myagent-ai 1.10.9 → 1.11.0
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/web/ui/chat/chat.css +5 -0
- package/web/ui/chat/chat_main.js +18 -2
- package/web/ui/chat/flow_engine.js +17 -13
package/package.json
CHANGED
package/web/ui/chat/chat.css
CHANGED
|
@@ -482,6 +482,11 @@ input,textarea,select{font:inherit}
|
|
|
482
482
|
@keyframes badgePulse{0%,100%{opacity:1}50%{opacity:.6}}
|
|
483
483
|
.thought-block:not(.streaming) summary .thought-badge{background:var(--bg4);color:var(--text3);animation:none}
|
|
484
484
|
.thought-content{width:100%;padding:10px 14px 14px;font-size:13px;line-height:1.7;color:var(--text2);border-top:1px solid var(--border-light);max-height:300px;overflow-y:auto;overflow-x:hidden;word-break:break-word;overflow-wrap:break-word}
|
|
485
|
+
/* Reasoning (模型推理过程): limit to ~5 lines, scrollable */
|
|
486
|
+
.thought-block .thought-content.reasoning-content{max-height:calc(1.7em * 5 + 28px);min-height:0}
|
|
487
|
+
.thought-block .thought-content.reasoning-content::-webkit-scrollbar{width:4px}
|
|
488
|
+
.thought-block .thought-content.reasoning-content::-webkit-scrollbar-thumb{background:var(--bg4);border-radius:2px}
|
|
489
|
+
.thought-block .thought-content.reasoning-content::-webkit-scrollbar-track{background:transparent}
|
|
485
490
|
.thought-content p{margin:4px 0}
|
|
486
491
|
.thought-content p:first-child{margin-top:0}
|
|
487
492
|
.thought-content p:last-child{margin-bottom:0}
|
package/web/ui/chat/chat_main.js
CHANGED
|
@@ -1600,6 +1600,7 @@ async function clearSessionFromMenu(id) {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
|
|
1602
1602
|
function formatSessionName(id) {
|
|
1603
|
+
if (!id) return '新会话';
|
|
1603
1604
|
if (id.startsWith('web_')) return id.replace('web_', '').replace(/_/g, ' ');
|
|
1604
1605
|
if (id.startsWith('cli_')) return 'CLI: ' + id.replace('cli_', '');
|
|
1605
1606
|
// Strip agent prefix if present (e.g., "default_web_2024..." -> "web_2024...")
|
|
@@ -2261,7 +2262,7 @@ function _renderMessagesInner() {
|
|
|
2261
2262
|
<span class="thought-label">模型推理过程</span>
|
|
2262
2263
|
${isStreaming ? '<span class="thought-badge">推理中...</span>' : '<span class="thought-badge">已完成</span>'}
|
|
2263
2264
|
</summary>
|
|
2264
|
-
<div class="thought-content">${renderMarkdown(msg.reasoning)}</div>
|
|
2265
|
+
<div class="thought-content reasoning-content">${renderMarkdown(msg.reasoning)}</div>
|
|
2265
2266
|
</details>`;
|
|
2266
2267
|
})() : '';
|
|
2267
2268
|
const actionBtns = (!isUser && msg.content) ? `
|
|
@@ -2323,7 +2324,7 @@ function _renderMessagesInner() {
|
|
|
2323
2324
|
const execEventsHtml = (!isUser && !hasParts && msg.exec_events && msg.exec_events.length > 0)
|
|
2324
2325
|
? renderExecEvents(msg.exec_events, i) : '';
|
|
2325
2326
|
html += `
|
|
2326
|
-
<div class="message-row ${msg.role}">
|
|
2327
|
+
<div class="message-row ${msg.role}${msg.streaming ? ' streaming' : ''}">
|
|
2327
2328
|
<div class="message-avatar">${avatar}</div>
|
|
2328
2329
|
<div class="message-content" style="flex:1;min-width:0">
|
|
2329
2330
|
${reasoningHtml}
|
|
@@ -2441,6 +2442,21 @@ function formatTime(timeStr) {
|
|
|
2441
2442
|
function scrollToBottom(force) {
|
|
2442
2443
|
const c = document.getElementById('messagesContainer');
|
|
2443
2444
|
if (!c) return;
|
|
2445
|
+
// During streaming: pin the active assistant message to the top of the chat window
|
|
2446
|
+
// so the user can see the full response content below
|
|
2447
|
+
const isStreaming = state.isGenerating;
|
|
2448
|
+
if (isStreaming && !force) {
|
|
2449
|
+
const activeRow = c.querySelector('.message-row.assistant.streaming, .message-row.assistant:last-of-type');
|
|
2450
|
+
if (activeRow) {
|
|
2451
|
+
requestAnimationFrame(() => {
|
|
2452
|
+
const rowTop = activeRow.offsetTop;
|
|
2453
|
+
// Scroll so the assistant row sits at the very top of the visible area
|
|
2454
|
+
c.scrollTop = rowTop;
|
|
2455
|
+
updateScrollToBottomBtn(c.scrollHeight - c.scrollTop - c.clientHeight);
|
|
2456
|
+
});
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2444
2460
|
requestAnimationFrame(() => {
|
|
2445
2461
|
// Smart scroll: only auto-scroll if user is near bottom (within 120px)
|
|
2446
2462
|
// or if force is true
|
|
@@ -377,7 +377,7 @@ function updateStreamingMessage(msgIdx) {
|
|
|
377
377
|
<span class="thought-label">模型推理过程${reasoningWordCount}</span>
|
|
378
378
|
${msg.streaming ? '<span class="thought-badge">推理中...</span>' : '<span class="thought-badge">已完成</span>'}
|
|
379
379
|
</summary>
|
|
380
|
-
<div class="thought-content">${renderMarkdown(msg.reasoning)}</div>
|
|
380
|
+
<div class="thought-content reasoning-content">${renderMarkdown(msg.reasoning)}</div>
|
|
381
381
|
</details>`;
|
|
382
382
|
contentArea.insertAdjacentHTML('afterbegin', reasoningHtml);
|
|
383
383
|
// Set initial length tracking
|
|
@@ -1438,25 +1438,29 @@ async function sendMessage() {
|
|
|
1438
1438
|
// evt.result contains: {success, output, error, ...}
|
|
1439
1439
|
// 记录到调试控制台
|
|
1440
1440
|
if (window.addDebugLog) {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1441
|
+
var _toolResult = evt.result || {};
|
|
1442
|
+
var _toolInfo = evt.tool || {};
|
|
1443
|
+
window.addDebugLog(_toolResult.success ? 'tool' : 'error',
|
|
1444
|
+
(_toolInfo.toolname || '工具') + ' 执行' + (_toolResult.success ? '成功' : '失败'), {
|
|
1445
|
+
tool: _toolInfo.toolname,
|
|
1446
|
+
success: _toolResult.success,
|
|
1447
|
+
error: _toolResult.error,
|
|
1448
|
+
result: _toolResult.output || _toolResult.error
|
|
1447
1449
|
});
|
|
1448
1450
|
}
|
|
1451
|
+
var _r = evt.result || {};
|
|
1452
|
+
var _t = evt.tool || {};
|
|
1449
1453
|
var resultEvent = {
|
|
1450
1454
|
type: 'v2_tool',
|
|
1451
1455
|
data: {
|
|
1452
1456
|
id: 'v2tool_' + Date.now() + '_' + allExecEvents.length,
|
|
1453
1457
|
type: 'tool_result',
|
|
1454
|
-
title: (
|
|
1455
|
-
tool_name:
|
|
1456
|
-
success:
|
|
1457
|
-
summary: (
|
|
1458
|
-
result:
|
|
1459
|
-
callback:
|
|
1458
|
+
title: (_t.toolname || '工具') + ' 执行完成',
|
|
1459
|
+
tool_name: _t.toolname,
|
|
1460
|
+
success: !!_r.success,
|
|
1461
|
+
summary: (_r.output || _r.error || '').substring(0, 500),
|
|
1462
|
+
result: _r,
|
|
1463
|
+
callback: _t.callback
|
|
1460
1464
|
}
|
|
1461
1465
|
};
|
|
1462
1466
|
msgParts.push(resultEvent);
|