From 88d462d6294e30e6c9fdca08c07c84ef48a216fc Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 9 May 2025 12:07:51 +0800 Subject: [PATCH 1/4] perf: implement the expand/collapse function for reasoning process --- src/locales/en-US.ts | 4 + src/locales/ko-KR.ts | 4 + src/locales/zh-CN.ts | 4 + src/locales/zh-TW.ts | 4 + src/typings/chat.d.ts | 1 + .../chat/components/Message/Reasoning.vue | 162 ++++++++++++++++-- src/views/chat/components/Message/index.vue | 3 +- src/views/chat/index.vue | 2 + 8 files changed, 172 insertions(+), 12 deletions(-) diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index 842a1049..d33c1c72 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -78,6 +78,10 @@ export default { deleteKeyConfirm: 'Are you sure to delete this key?', disable2FA: 'Disable 2FA', disable2FAConfirm: 'Are you sure to disable 2FA for this user?', + thinking: 'Thinking', + reasoningProcess: 'Reasoning Process', + noReasoningProcess: 'No Reasoning Process', + expandCollapseReasoningProcess: 'Expand/Collapse Reasoning Process', }, setting: { overRide: 'Enable Override', diff --git a/src/locales/ko-KR.ts b/src/locales/ko-KR.ts index 25b5af75..790ee51d 100644 --- a/src/locales/ko-KR.ts +++ b/src/locales/ko-KR.ts @@ -78,6 +78,10 @@ export default { deleteKeyConfirm: 'Are you sure to delete this key?', disable2FA: 'Disable 2FA', disable2FAConfirm: 'Are you sure to disable 2FA for this user?', + thinking: '생각 중', + reasoningProcess: '추론 과정', + noReasoningProcess: '추론 과정 없음', + expandCollapseReasoningProcess: '추론 과정 펼치기/접기', }, setting: { overRide: '덮어쓰기 활성화', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 41894ba0..6d037b6f 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -78,6 +78,10 @@ export default { deleteKeyConfirm: '你确定要删除这个 key 吗?', disable2FA: '禁用 2FA', disable2FAConfirm: '您确定要为此用户禁用两步验证吗??', + thinking: '思考中', + reasoningProcess: '推理过程', + noReasoningProcess: '无推理过程', + expandCollapseReasoningProcess: '展开/折叠推理过程', }, setting: { overRide: '开启覆写', diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts index 5d48ca76..e09eea78 100644 --- a/src/locales/zh-TW.ts +++ b/src/locales/zh-TW.ts @@ -78,6 +78,10 @@ export default { deleteKeyConfirm: '你確定要刪除這個 key 嗎?', disable2FA: '禁用 2FA', disable2FAConfirm: '您确定要为此用户禁用两步验证吗??', + thinking: '思考中', + reasoningProcess: '推理過程', + noReasoningProcess: '無推理過程', + expandCollapseReasoningProcess: '展開/收合推理過程', }, setting: { overRide: '開啟覆寫', diff --git a/src/typings/chat.d.ts b/src/typings/chat.d.ts index 7fa5f846..b8edebf5 100644 --- a/src/typings/chat.d.ts +++ b/src/typings/chat.d.ts @@ -3,6 +3,7 @@ declare namespace Chat { uuid?: number dateTime: string reasoning?: string + finish_reason?: null | 'stop' text: string images?: string[] inversion?: boolean diff --git a/src/views/chat/components/Message/Reasoning.vue b/src/views/chat/components/Message/Reasoning.vue index 24ea88b4..cb76a114 100644 --- a/src/views/chat/components/Message/Reasoning.vue +++ b/src/views/chat/components/Message/Reasoning.vue @@ -1,33 +1,133 @@

- +
{ :current-nav-index="currentNavIndexRef" :date-time="item.dateTime" :reasoning="item?.reasoning" + :finish_reason="item?.finish_reason" :text="item.text" :images="item.images" :inversion="item.inversion" From 93a6af54a0c247c3056ccfd805175d2a89e8f0d4 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 9 May 2025 12:07:51 +0800 Subject: [PATCH 2/4] perf: correct the erroneous text --- src/views/chat/components/Message/Reasoning.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/chat/components/Message/Reasoning.vue b/src/views/chat/components/Message/Reasoning.vue index cb76a114..a9d5a579 100644 --- a/src/views/chat/components/Message/Reasoning.vue +++ b/src/views/chat/components/Message/Reasoning.vue @@ -94,7 +94,7 @@ function toggleCollapse() { {{ $t('chat.thinking') }} | - {{ $t('chat.thinking') }} + {{ $t('chat.reasoningProcess') }} ({{ $t('chat.noReasoningProcess') }})