myagent-ai 1.23.14 → 1.23.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/docx_skill.py +7 -1
- package/skills/pdf_skill.py +7 -1
- package/skills/ppt_skill.py +7 -1
- package/skills/xlsx_skill.py +5 -9
- package/start.js +6 -1
package/package.json
CHANGED
package/skills/docx_skill.py
CHANGED
|
@@ -8,6 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
import json
|
|
10
10
|
import os
|
|
11
|
+
import time
|
|
11
12
|
from pathlib import Path
|
|
12
13
|
from typing import Any, Dict, List, Optional
|
|
13
14
|
|
|
@@ -61,7 +62,12 @@ class DOCXCreateSkill(Skill):
|
|
|
61
62
|
return SkillResult(success=False, error=f"content JSON 解析失败: {e}")
|
|
62
63
|
|
|
63
64
|
try:
|
|
64
|
-
|
|
65
|
+
if not output_path.strip():
|
|
66
|
+
default_dir = Path.home() / ".myagent" / "data" / "workspace" / "userfiles"
|
|
67
|
+
default_dir.mkdir(parents=True, exist_ok=True)
|
|
68
|
+
out = default_dir / f"doc_{int(time.time())}.docx"
|
|
69
|
+
else:
|
|
70
|
+
out = Path(output_path).expanduser().resolve()
|
|
65
71
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
66
72
|
|
|
67
73
|
doc = Document()
|
package/skills/pdf_skill.py
CHANGED
|
@@ -9,6 +9,7 @@ from __future__ import annotations
|
|
|
9
9
|
import json
|
|
10
10
|
import os
|
|
11
11
|
import textwrap
|
|
12
|
+
import time
|
|
12
13
|
from pathlib import Path
|
|
13
14
|
from typing import Any, Dict, List, Optional
|
|
14
15
|
|
|
@@ -115,7 +116,12 @@ class PDFCreateSkill(Skill):
|
|
|
115
116
|
|
|
116
117
|
try:
|
|
117
118
|
# 输出路径
|
|
118
|
-
|
|
119
|
+
if not output_path.strip():
|
|
120
|
+
default_dir = Path.home() / ".myagent" / "data" / "workspace" / "userfiles"
|
|
121
|
+
default_dir.mkdir(parents=True, exist_ok=True)
|
|
122
|
+
out = default_dir / f"doc_{int(time.time())}.pdf"
|
|
123
|
+
else:
|
|
124
|
+
out = Path(output_path).expanduser().resolve()
|
|
119
125
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
120
126
|
|
|
121
127
|
# 配色
|
package/skills/ppt_skill.py
CHANGED
|
@@ -8,6 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
import json
|
|
10
10
|
import os
|
|
11
|
+
import time
|
|
11
12
|
from pathlib import Path
|
|
12
13
|
from typing import Any, Dict, List, Optional
|
|
13
14
|
|
|
@@ -87,7 +88,12 @@ class PPTCreateSkill(Skill):
|
|
|
87
88
|
return SkillResult(success=False, error=f"slides JSON 解析失败: {e}")
|
|
88
89
|
|
|
89
90
|
try:
|
|
90
|
-
|
|
91
|
+
if not output_path.strip():
|
|
92
|
+
default_dir = Path.home() / ".myagent" / "data" / "workspace" / "userfiles"
|
|
93
|
+
default_dir.mkdir(parents=True, exist_ok=True)
|
|
94
|
+
out = default_dir / f"ppt_{int(time.time())}.pptx"
|
|
95
|
+
else:
|
|
96
|
+
out = Path(output_path).expanduser().resolve()
|
|
91
97
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
92
98
|
|
|
93
99
|
t = THEMES.get(theme, THEMES["professional"])
|
package/skills/xlsx_skill.py
CHANGED
|
@@ -99,16 +99,12 @@ class XLSXCreateSkill(Skill):
|
|
|
99
99
|
return SkillResult(success=False, error=f"sheets JSON 解析失败: {e}")
|
|
100
100
|
|
|
101
101
|
try:
|
|
102
|
-
out = Path(output_path).expanduser().resolve()
|
|
103
102
|
if not output_path.strip():
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
except Exception:
|
|
110
|
-
work_dir = Path.cwd()
|
|
111
|
-
out = work_dir / f"report_{int(time.time())}.xlsx"
|
|
103
|
+
default_dir = Path.home() / ".myagent" / "data" / "workspace" / "userfiles"
|
|
104
|
+
default_dir.mkdir(parents=True, exist_ok=True)
|
|
105
|
+
out = default_dir / f"report_{int(time.time())}.xlsx"
|
|
106
|
+
else:
|
|
107
|
+
out = Path(output_path).expanduser().resolve()
|
|
112
108
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
113
109
|
|
|
114
110
|
wb = openpyxl.Workbook()
|
package/start.js
CHANGED
|
@@ -821,9 +821,14 @@ function main() {
|
|
|
821
821
|
}
|
|
822
822
|
env = process.env;
|
|
823
823
|
}
|
|
824
|
+
// [v1.23.14] CLI cwd 使用 workspace 目录而非 pkgDir,
|
|
825
|
+
// 避免 Path("").resolve() 指向 npm 安装目录导致 "Is a directory" 错误。
|
|
826
|
+
// cli.py 已通过 sys.path 处理模块导入,不依赖 cwd。
|
|
827
|
+
const cliWorkDir = path.join(getDataDir(), "data", "workspace");
|
|
828
|
+
try { fs.mkdirSync(cliWorkDir, { recursive: true }); } catch (_) {}
|
|
824
829
|
try {
|
|
825
830
|
execFileSync(pyExe, [cliScript, ...args], {
|
|
826
|
-
stdio: "inherit", cwd:
|
|
831
|
+
stdio: "inherit", cwd: cliWorkDir, env, timeout: 300000,
|
|
827
832
|
});
|
|
828
833
|
} catch (e) {
|
|
829
834
|
process.exit(e.status || 1);
|