myagent-ai 1.23.13 → 1.23.14
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/agents/main_agent.py
CHANGED
|
@@ -1592,6 +1592,22 @@ class MainAgent(BaseAgent):
|
|
|
1592
1592
|
content=_fallback_text,
|
|
1593
1593
|
)
|
|
1594
1594
|
|
|
1595
|
+
# [v1.23.13] 持久化已发送文件到会话记忆,刷新后可恢复文件卡片
|
|
1596
|
+
if _sent_files and self.memory:
|
|
1597
|
+
import json as _json_files
|
|
1598
|
+
try:
|
|
1599
|
+
self.memory.add_session(
|
|
1600
|
+
session_id=context.session_id,
|
|
1601
|
+
role="assistant",
|
|
1602
|
+
content="", # 空内容,仅用于承载文件元数据
|
|
1603
|
+
key="file_send",
|
|
1604
|
+
importance=0.2,
|
|
1605
|
+
metadata={"files": _sent_files},
|
|
1606
|
+
)
|
|
1607
|
+
logger.info(f"[{task_id}] 已持久化 {len(_sent_files)} 个文件到会话记忆")
|
|
1608
|
+
except Exception as _fe:
|
|
1609
|
+
logger.warning(f"[{task_id}] 持久化文件信息失败: {_fe}")
|
|
1610
|
+
|
|
1595
1611
|
context.working_memory["iterations"] = self._iteration_count
|
|
1596
1612
|
if current_task_plan:
|
|
1597
1613
|
context.working_memory["task_plan"] = current_task_plan
|
package/package.json
CHANGED
package/web/ui/chat/chat_main.js
CHANGED
|
@@ -2248,6 +2248,8 @@ async function selectSession(id) {
|
|
|
2248
2248
|
}
|
|
2249
2249
|
if (m.files && m.files.length > 0) {
|
|
2250
2250
|
mapped.files = m.files;
|
|
2251
|
+
// [v1.23.13] 同时映射到 _files,使历史消息中的文件卡片可渲染
|
|
2252
|
+
mapped._files = m.files;
|
|
2251
2253
|
}
|
|
2252
2254
|
return mapped;
|
|
2253
2255
|
});
|
|
@@ -2944,7 +2946,7 @@ function _renderMessagesInner() {
|
|
|
2944
2946
|
(sizeStr ? '<span class="msg-file-size">' + sizeStr + '</span>' : '') +
|
|
2945
2947
|
'</span>' +
|
|
2946
2948
|
'<span class="msg-file-actions">' +
|
|
2947
|
-
'<a class="msg-file-download" href="/api/file/' + (fileId || '') + '
|
|
2949
|
+
'<a class="msg-file-download" href="/api/file/' + (fileId || '') + '?name=' + encodeURIComponent(f.name || 'file') + '" download="' + escapeHtml(f.name) + '" title="下载" onclick="event.stopPropagation()">⬇</a>' +
|
|
2948
2950
|
'</span>' +
|
|
2949
2951
|
'</div>');
|
|
2950
2952
|
}
|
|
@@ -2966,7 +2968,7 @@ function _renderMessagesInner() {
|
|
|
2966
2968
|
(sizeStr ? '<span class="msg-file-size">' + sizeStr + '</span>' : '') +
|
|
2967
2969
|
'</span>' +
|
|
2968
2970
|
'<span class="msg-file-actions">' +
|
|
2969
|
-
'<a class="msg-file-download" href="/api/file/' + (fileId || '') + '
|
|
2971
|
+
'<a class="msg-file-download" href="/api/file/' + (fileId || '') + '?name=' + encodeURIComponent(f.name || 'file') + '" download="' + escapeHtml(f.name) + '" title="下载" onclick="event.stopPropagation()">⬇</a>' +
|
|
2970
2972
|
'</span>' +
|
|
2971
2973
|
'</div>');
|
|
2972
2974
|
}
|
|
@@ -1752,7 +1752,7 @@ async function sendMessage(opts) {
|
|
|
1752
1752
|
data: {
|
|
1753
1753
|
id: 'v2tool_' + Date.now() + '_' + allExecEvents.length,
|
|
1754
1754
|
type: 'tool_start',
|
|
1755
|
-
title:
|
|
1755
|
+
title: '调用工具: ' + (evt.tool.toolname || ''),
|
|
1756
1756
|
tool_name: evt.tool.toolname,
|
|
1757
1757
|
params: evt.tool.parms,
|
|
1758
1758
|
timeout: evt.tool.timeout,
|