fix(chat): improve thinking segment display and message bubble rendering

This commit is contained in:
matevip 2026-04-11 17:09:25 +08:00
parent aa09345403
commit e662cce91a
4 changed files with 10 additions and 3 deletions

View File

@ -132,7 +132,7 @@
<!-- 停止指示器 -->
<div v-if="status === 'stopped' || status === 'interrupted'" class="stopped-indicator">
<el-icon><CloseBold /></el-icon>
<span>{{ status === 'interrupted' ? ($t('chat.interrupted') || '已中断') : $t('chat.stopped') }}</span>
<span>{{ status === 'interrupted' ? $t('chat.interrupted') : $t('chat.stopped') }}</span>
</div>
<!-- 错误卡片 -->

View File

@ -1,9 +1,12 @@
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { Opportunity, ArrowDown } from '@element-plus/icons-vue'
import { useMarkdownRenderer } from '@/composables/useMarkdownRenderer'
import type { MessageSegment } from '@/types'
const { t } = useI18n()
const props = defineProps<{
segment: MessageSegment
}>()
@ -22,7 +25,7 @@ watch(() => props.segment.status, (val) => {
const lengthHint = computed(() => {
const len = props.segment.thinkingText?.length || 0
if (len < 100) return ''
return len < 1000 ? `${len} ` : `${(len / 1000).toFixed(1)}k `
return len < 1000 ? `${len} chars` : `${(len / 1000).toFixed(1)}k chars`
})
</script>
@ -32,7 +35,7 @@ const lengthHint = computed(() => {
<span class="seg-thinking__icon">
<el-icon :class="{ 'is-loading': isRunning }" :size="14"><Opportunity /></el-icon>
</span>
<span class="seg-thinking__label">{{ isRunning ? '思考中...' : '深度思考' }}</span>
<span class="seg-thinking__label">{{ isRunning ? t('chat.thinkingInProgress') : t('chat.thinking') }}</span>
<span v-if="lengthHint" class="seg-thinking__hint">{{ lengthHint }}</span>
<el-icon class="seg-thinking__arrow" :class="{ 'is-open': expanded }" :size="12"><ArrowDown /></el-icon>
</div>

View File

@ -40,7 +40,9 @@ export default {
error: 'Disconnected',
},
thinking: 'Thinking',
thinkingInProgress: 'Thinking...',
stopped: 'Generation stopped',
interrupted: 'Interrupted',
failed: 'Generation failed',
retry: 'Retry',
errorCode: 'Error code',

View File

@ -40,7 +40,9 @@ export default {
error: '连接断开',
},
thinking: '深度思考',
thinkingInProgress: '思考中...',
stopped: '已停止生成',
interrupted: '已中断',
failed: '生成失败',
retry: '重试',
errorCode: '错误码',