myagent-ai 1.23.14 → 1.23.16
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/web/ui/chat/flow_engine.js +45 -0
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);
|
|
@@ -606,6 +606,47 @@ function updateStreamingMessage(msgIdx) {
|
|
|
606
606
|
msg._lastStreamRenderedLen = 0;
|
|
607
607
|
}
|
|
608
608
|
|
|
609
|
+
// ── [v1.23.15] 增量渲染文件卡片(v2_file 事件到达时立即显示) ──
|
|
610
|
+
if (msg._files && msg._files.length > 0) {
|
|
611
|
+
var existingFiles = bubbleWrapper ? bubbleWrapper.querySelectorAll(':scope > .msg-attachments') : contentArea.querySelectorAll(':scope > .msg-attachments');
|
|
612
|
+
var fileContainer = existingFiles.length > 0 ? existingFiles[0] : null;
|
|
613
|
+
if (!fileContainer) {
|
|
614
|
+
fileContainer = document.createElement('div');
|
|
615
|
+
fileContainer.className = 'msg-attachments msg-attachments-files';
|
|
616
|
+
if (bubbleWrapper) {
|
|
617
|
+
bubbleWrapper.appendChild(fileContainer);
|
|
618
|
+
} else {
|
|
619
|
+
contentArea.appendChild(fileContainer);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
// 只添加未渲染的新文件
|
|
623
|
+
var renderedIds = fileContainer._renderedFileIds || [];
|
|
624
|
+
for (var _fIdx = 0; _fIdx < msg._files.length; _fIdx++) {
|
|
625
|
+
var _f = msg._files[_fIdx];
|
|
626
|
+
var _fId = _f.id || _f.file_id || '';
|
|
627
|
+
if (renderedIds.indexOf(_fId) >= 0) continue;
|
|
628
|
+
var _isImg = _f.type && _f.type.indexOf('image/') === 0;
|
|
629
|
+
var _isAud = _f.type && _f.type.indexOf('audio/') === 0;
|
|
630
|
+
var _isVid = _f.type && _f.type.indexOf('video/') === 0;
|
|
631
|
+
if (_isImg || _isAud || _isVid) { renderedIds.push(_fId); continue; }
|
|
632
|
+
var _icon = _getFileIcon(_f.name || _f.type || '');
|
|
633
|
+
var _sizeStr = _f.size ? formatFileSize(_f.size) : '';
|
|
634
|
+
var _fDiv = document.createElement('div');
|
|
635
|
+
_fDiv.className = 'msg-file-item agent-file';
|
|
636
|
+
_fDiv.title = '点击预览';
|
|
637
|
+
_fDiv.innerHTML = '<span class="msg-file-icon">' + _icon + '</span>' +
|
|
638
|
+
'<span class="msg-file-info"><span class="msg-file-name">' + escapeHtml(_f.name) + '</span>' +
|
|
639
|
+
(_sizeStr ? '<span class="msg-file-size">' + _sizeStr + '</span>' : '') +
|
|
640
|
+
'</span>' +
|
|
641
|
+
'<span class="msg-file-actions">' +
|
|
642
|
+
'<a class="msg-file-download" href="/api/file/' + (_fId || '') + '?name=' + encodeURIComponent(_f.name || 'file') + '" download="' + escapeHtml(_f.name) + '" title="下载" onclick="event.stopPropagation()">⬇</a>' +
|
|
643
|
+
'</span>';
|
|
644
|
+
fileContainer.appendChild(_fDiv);
|
|
645
|
+
renderedIds.push(_fId);
|
|
646
|
+
}
|
|
647
|
+
fileContainer._renderedFileIds = renderedIds;
|
|
648
|
+
}
|
|
649
|
+
|
|
609
650
|
// Remove exec events panel if present (events are now inline in timeline)
|
|
610
651
|
const execPanel = contentArea.querySelector('.exec-events-panel');
|
|
611
652
|
if (execPanel) execPanel.remove();
|
|
@@ -1747,6 +1788,10 @@ async function sendMessage(opts) {
|
|
|
1747
1788
|
// Flush reasoning text BEFORE tool call to create speak→tool pattern
|
|
1748
1789
|
flushV2Reasoning();
|
|
1749
1790
|
flushCurrentText();
|
|
1791
|
+
// [v1.23.15] 清除 _streamingText,防止推理文本在 msgParts(文本段) 和
|
|
1792
|
+
// streaming-segment 中同时渲染导致重复显示
|
|
1793
|
+
state.messages[msgIdx]._streamingText = '';
|
|
1794
|
+
state.messages[msgIdx]._v2Reasoning = '';
|
|
1750
1795
|
var toolEvent = {
|
|
1751
1796
|
type: 'v2_tool',
|
|
1752
1797
|
data: {
|