From 3a7ed2e04267393ea9cd71b3f232ce9c3dd65d2c Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Sun, 30 Nov 2025 00:54:55 +0800 Subject: [PATCH] fix: polish streaming state and ui controls --- static/src/app.ts | 7 ++++--- static/src/components/sidebar/ConversationSidebar.vue | 5 +---- static/src/composables/useLegacySocket.ts | 6 +++++- static/src/stores/chat.ts | 4 +++- static/src/styles/components/chat/_chat-area.scss | 5 +++++ .../src/styles/components/sidebar/_conversation.scss | 10 ++++------ static/src/utils/icons.ts | 1 + 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/static/src/app.ts b/static/src/app.ts index 9ee0580..9f228cb 100644 --- a/static/src/app.ts +++ b/static/src/app.ts @@ -940,9 +940,10 @@ const appOptions = { if (action.tool.awaiting_content) { return true; } - const status = typeof action.tool.status === 'string' - ? action.tool.status.toLowerCase() - : ''; + const status = + typeof action.tool.status === 'string' + ? action.tool.status.toLowerCase() + : ''; return !status || ['preparing', 'running', 'pending', 'queued'].includes(status); }); }); diff --git a/static/src/components/sidebar/ConversationSidebar.vue b/static/src/components/sidebar/ConversationSidebar.vue index 48173e9..bf34e9c 100644 --- a/static/src/components/sidebar/ConversationSidebar.vue +++ b/static/src/components/sidebar/ConversationSidebar.vue @@ -82,9 +82,7 @@ @click="$emit('toggle-workspace')" > {{ workspaceCollapsed ? '显示工作区' : '隐藏工作区' }} - + {{ workspaceCollapsed ? '显示工作区' : '隐藏工作区' }} @@ -227,5 +225,4 @@ const iconStyle = (key: string) => (props.iconStyle ? props.iconStyle(key) : {}) const resolvedShowCollapseButton = computed(() => props.showCollapseButton); const resolvedCollapseButtonVariant = computed(() => props.collapseButtonVariant); -const workspaceToggleIcon = new URL('../../../icons/layers.svg', import.meta.url).href; diff --git a/static/src/composables/useLegacySocket.ts b/static/src/composables/useLegacySocket.ts index 56e4000..608ed58 100644 --- a/static/src/composables/useLegacySocket.ts +++ b/static/src/composables/useLegacySocket.ts @@ -140,7 +140,11 @@ export async function initializeLegacySocket(ctx: any) { const action = ensureActiveTextAction(); if (action) { action.streaming = false; - action.content = fullContent; + const fallback = + (typeof fullContent === 'string' && fullContent.length + ? fullContent + : action.content) || ''; + action.content = fallback; } msg.streamingText = ''; msg.currentStreamingType = null; diff --git a/static/src/stores/chat.ts b/static/src/stores/chat.ts index 3462311..87731f5 100644 --- a/static/src/stores/chat.ts +++ b/static/src/stores/chat.ts @@ -264,7 +264,9 @@ export const useChatStore = defineStore('chat', { const action = msg.actions[i]; if (action.type === 'text' && action.streaming) { action.streaming = false; - action.content = fullContent; + if (typeof fullContent === 'string' && fullContent.length) { + action.content = fullContent; + } break; } } diff --git a/static/src/styles/components/chat/_chat-area.scss b/static/src/styles/components/chat/_chat-area.scss index c5e1e72..db85433 100644 --- a/static/src/styles/components/chat/_chat-area.scss +++ b/static/src/styles/components/chat/_chat-area.scss @@ -197,6 +197,11 @@ font-size: 13px; line-height: 1.6; color: var(--claude-text-secondary); + scrollbar-width: none; +} + +.thinking-content::-webkit-scrollbar { + display: none; } .collapsible-block { diff --git a/static/src/styles/components/sidebar/_conversation.scss b/static/src/styles/components/sidebar/_conversation.scss index c936f4b..a7e8bfc 100644 --- a/static/src/styles/components/sidebar/_conversation.scss +++ b/static/src/styles/components/sidebar/_conversation.scss @@ -86,7 +86,9 @@ padding: 10px 14px; cursor: pointer; font-size: 13px; - transition: color 0.2s ease, background-color 0.2s ease; + transition: + color 0.2s ease, + transform 0.2s ease; } .workspace-immersive-btn .workspace-immersive-icon { @@ -97,11 +99,6 @@ justify-content: center; } -.workspace-immersive-btn .workspace-immersive-icon img { - width: 100%; - height: 100%; -} - .workspace-immersive-btn .workspace-immersive-label { font-size: 13px; font-weight: 500; @@ -111,6 +108,7 @@ .workspace-immersive-btn:focus-visible { color: var(--claude-accent); outline: none; + transform: translateY(-1px); } .workspace-immersive-btn.active { diff --git a/static/src/utils/icons.ts b/static/src/utils/icons.ts index 2e87f02..c4f9d19 100644 --- a/static/src/utils/icons.ts +++ b/static/src/utils/icons.ts @@ -17,6 +17,7 @@ export const ICONS = Object.freeze({ hammer: '/static/icons/hammer.svg', info: '/static/icons/info.svg', laptop: '/static/icons/laptop.svg', + layers: '/static/icons/layers.svg', menu: '/static/icons/menu.svg', monitor: '/static/icons/monitor.svg', octagon: '/static/icons/octagon.svg',