Skip to content

Commit 613f07a

Browse files
committed
perf: optimize the display logic in thinking, after reasoning, hide the thoughts in the thinking
1 parent 93a6af5 commit 613f07a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/typings/chat.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare namespace Chat {
33
uuid?: number
44
dateTime: string
55
reasoning?: string
6-
finish_reason?: null | 'stop'
6+
finish_reason?: string
77
text: string
88
images?: string[]
99
inversion?: boolean

src/views/chat/components/Message/Reasoning.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { t } from '@/locales'
55
66
interface Props {
77
reasoning?: string
8-
finishReason?: string
8+
reasonEnd?: boolean
99
loading?: boolean
1010
}
1111
@@ -23,7 +23,7 @@ const reasoningBtnTitle = computed(() => {
2323
})
2424
2525
const shouldShowThinkingIndicator = computed(() => {
26-
return props.loading && props.finishReason !== 'stop'
26+
return props.loading && !props.reasonEnd
2727
})
2828
2929
const hasReasoningText = computed(() => {

src/views/chat/components/Message/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ function isEventTargetValid(event: any) {
226226
</template>
227227
</NSpace>
228228
</p>
229-
<Reasoning v-if="reasoning" :reasoning="reasoning" :finish-reason="finishReason" :loading="loading" />
229+
<Reasoning v-if="reasoning" :reasoning="reasoning" :reason-end="text ? text.length > 0 : false" :loading="loading" />
230230
<div
231231
class="flex items-end gap-1 mt-2"
232232
:class="[inversion ? 'flex-row-reverse' : 'flex-row']"

src/views/chat/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ onUnmounted(() => {
688688
:current-nav-index="currentNavIndexRef"
689689
:date-time="item.dateTime"
690690
:reasoning="item?.reasoning"
691-
:finish_reason="item?.finish_reason"
691+
:finish-reason="item?.finish_reason"
692692
:text="item.text"
693693
:images="item.images"
694694
:inversion="item.inversion"

0 commit comments

Comments
 (0)