From c332380080f9e94abd8a0025fc08bb564458b22c Mon Sep 17 00:00:00 2001 From: ViperEkura <3081035982@qq.com> Date: Mon, 4 May 2026 21:20:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dapi=20=E9=80=82?= =?UTF-8?q?=E9=85=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/src/components/Pagination.vue | 48 ++++++ dashboard/src/components/ProcessBlock.vue | 3 +- dashboard/src/utils/streamManager.js | 3 +- dashboard/src/utils/streamStore.js | 11 +- dashboard/src/views/ConversationView.vue | 18 +- dashboard/src/views/SettingsView.vue | 163 +++++++++++++++++-- luxx/routes/messages.py | 3 +- luxx/routes/tools.py | 26 ++- luxx/services/agentic_loop.py | 90 +++++++++- luxx/services/chat.py | 13 +- luxx/services/llm_adapters/openai_adapter.py | 29 +++- luxx/services/llm_client.py | 68 ++++++-- luxx/services/llm_response.py | 6 +- luxx/services/stream_context.py | 18 +- luxx/tools/core.py | 11 +- luxx/tools/executor.py | 27 ++- 16 files changed, 464 insertions(+), 73 deletions(-) create mode 100644 dashboard/src/components/Pagination.vue diff --git a/dashboard/src/components/Pagination.vue b/dashboard/src/components/Pagination.vue new file mode 100644 index 0000000..fe9877c --- /dev/null +++ b/dashboard/src/components/Pagination.vue @@ -0,0 +1,48 @@ + + + + + \ No newline at end of file diff --git a/dashboard/src/components/ProcessBlock.vue b/dashboard/src/components/ProcessBlock.vue index ab86c82..e9e7c2a 100644 --- a/dashboard/src/components/ProcessBlock.vue +++ b/dashboard/src/components/ProcessBlock.vue @@ -142,7 +142,8 @@ const allItems = computed(() => { displayContent = JSON.stringify(parsed, null, 2) } } catch (e) { - // 不是 JSON,保持原样 + // 不是 JSON,保持原样显示原始内容 + console.warn('Failed to parse tool result JSON:', e) } match.resultSummary = displayContent.slice(0, 200) diff --git a/dashboard/src/utils/streamManager.js b/dashboard/src/utils/streamManager.js index 6ea968b..90ae290 100644 --- a/dashboard/src/utils/streamManager.js +++ b/dashboard/src/utils/streamManager.js @@ -149,7 +149,8 @@ class StreamManager { const data = JSON.parse(line.slice(6)) this._handleEvent(conversationId, currentEvent, data, streamStore, null) } catch (e) { - // 忽略解析错误 + console.error('SSE parse error in _processLines:', e, 'line:', line) + streamStore.errorStream(conversationId, `Parse error: ${e.message}`) } } } diff --git a/dashboard/src/utils/streamStore.js b/dashboard/src/utils/streamStore.js index 639897c..910fe6b 100644 --- a/dashboard/src/utils/streamStore.js +++ b/dashboard/src/utils/streamStore.js @@ -48,7 +48,16 @@ export const useStreamStore = defineStore('stream', () => { const idx = state.process_steps.findIndex(s => s.id === step.id) if (idx >= 0) { - state.process_steps[idx] = step + // 对于 thinking/text 步骤,后端发送的是增量内容(基于 offset) + // 需要追加到已有内容上,而不是替换 + if (step.type === 'thinking' || step.type === 'text') { + const existing = state.process_steps[idx] + existing.content = (existing.content || '') + (step.content || '') + // 触发响应式更新 + state.process_steps[idx] = { ...existing } + } else { + state.process_steps[idx] = step + } } else { state.process_steps.push(step) } diff --git a/dashboard/src/views/ConversationView.vue b/dashboard/src/views/ConversationView.vue index b1e76cd..c67a964 100644 --- a/dashboard/src/views/ConversationView.vue +++ b/dashboard/src/views/ConversationView.vue @@ -48,11 +48,12 @@ - + @@ -170,6 +171,7 @@ import { formatDate } from '../utils/useFormatters.js' import ProcessBlock from '../components/ProcessBlock.vue' import MessageNav from '../components/MessageNav.vue' import MessageBubble from '../components/MessageBubble.vue' +import Pagination from '../components/Pagination.vue' const { list, @@ -277,6 +279,12 @@ const handleRegenerateMessage = async (msgId) => { } +// 处理分页切换 +const handlePageChange = (newPage) => { + page.value = newPage + fetchData() +} + const onProviderChange = () => { const p = providers.value.find(p => p.id === form.value.provider_id) if (p) form.value.model = p.default_model || '' diff --git a/dashboard/src/views/SettingsView.vue b/dashboard/src/views/SettingsView.vue index 4db1338..bf9c80f 100644 --- a/dashboard/src/views/SettingsView.vue +++ b/dashboard/src/views/SettingsView.vue @@ -155,6 +155,7 @@
🔌 LLM Provider + {{ providers.length }}
加载中...
@@ -163,16 +164,17 @@ - + - + - + @@ -257,6 +267,19 @@ + + + + +
名称名称 / 类型 API / 模型 启用 操作
{{ p.name }}
+
{{ p.provider_type }}
默认 启用 @@ -180,9 +182,9 @@
-
{{ p.base_url }}
-
模型: {{ p.default_model }}
-
最大Tokens: {{ p.max_tokens || 8192 }}
+
{{ p.base_url }}
+
模型: {{ p.default_model }}
+
最大 Tokens: {{ p.max_tokens || 8192 }}
{{ u.username }} {{ u.email || '-' }} {{ u.role }}
暂无用户
@@ -308,23 +331,55 @@