From 079c8630d954764c89537a1213036ecdf5d4ca82 Mon Sep 17 00:00:00 2001 From: 3030332422 <3030332422@qq.com> Date: Wed, 25 Mar 2026 10:43:45 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=89=8D=E7=AB=AF=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/ChatHistoryDialog.vue | 62 ++++++++++++++++++- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/main/manager-web/src/components/ChatHistoryDialog.vue b/main/manager-web/src/components/ChatHistoryDialog.vue index 81a2dcd9..9e8b742f 100644 --- a/main/manager-web/src/components/ChatHistoryDialog.vue +++ b/main/manager-web/src/components/ChatHistoryDialog.vue @@ -30,7 +30,20 @@
{{ item.text }}
{{ item.text }}
-
{{ item.text }}
+
+
+
+ {{ getFirstLineText(item.text) }} +
+
+ {{ item.text }} +
+ + + +
+
{{ item.text }}
+
@@ -92,7 +105,8 @@ export default { scrollTimer: null, isFirstLoad: true, playingAudioId: null, - audioElement: null + audioElement: null, + expandedToolResults: {} // 跟踪工具结果的展开状态 }; }, watch: { @@ -182,6 +196,23 @@ export default { // 如果不是 JSON 格式或没有 content 字段,直接返回原内容 return content; }, + // 切换工具结果的展开/折叠状态 + toggleToolResult(messageIndex, itemIndex) { + const key = `${messageIndex}-${itemIndex}`; + this.$set(this.expandedToolResults, key, !this.expandedToolResults[key]); + }, + // 判断工具结果是否处于折叠状态 + isToolResultCollapsed(messageIndex, itemIndex) { + const key = `${messageIndex}-${itemIndex}`; + // 默认折叠(true表示折叠) + return !this.expandedToolResults[key]; + }, + // 获取截断的文本(只显示第一行) + getFirstLineText(text) { + if (!text) return ''; + const firstLine = text.split('\n')[0]; + return firstLine.length < text.length ? firstLine + '...' : text; + }, resetData() { this.sessions = []; this.messages = []; @@ -191,6 +222,7 @@ export default { this.loading = false; this.hasMore = true; this.isFirstLoad = true; + this.expandedToolResults = {}; }, handleClose() { this.dialogVisible = false; @@ -483,7 +515,31 @@ export default { } .tool-message .message-content { - background-color: #e6ebff; + background-color: #f0f0f0; +} + +.tool-result-wrapper { + position: relative; + padding-right: 20px; +} + +.tool-result-collapsed { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.tool-toggle-btn { + position: absolute; + right: 0; + top: 0; + cursor: pointer; + color: #1890ff; + font-size: 12px; +} + +.tool-toggle-btn:hover { + color: #40a9ff; } .loading,