部分优化

This commit is contained in:
2026-07-07 18:02:55 +08:00
parent b8af01cc69
commit bf5203b081
48 changed files with 3228 additions and 1755 deletions

View File

@@ -29,6 +29,8 @@ export const useSocketStore = defineStore('socket', () => {
const logs = ref([])
const maxLogCount = ref(20)
const authFailReason = ref('')
// ==================== 计算属性 ====================
const isConnected = computed(() => connectionStatus.value === 'connected')
const isConnecting = computed(() => connectionStatus.value === 'connecting')
@@ -164,6 +166,12 @@ export const useSocketStore = defineStore('socket', () => {
addLog('success', '连接成功')
break
case 'auth_fail':
isThinking.value = false
authFailReason.value = data?.reason || messageData?.reason || 'unknown'
addLog('error', `认证失败: ${authFailReason.value}`)
break
case 'chat_ack':
addLog('warn', 'AI成功收到用户发送的消息')
break
@@ -216,8 +224,14 @@ export const useSocketStore = defineStore('socket', () => {
// 处理 data 为对象的情况
if (!data || typeof data !== 'object') return
// 中断确认:后端返回 cmd=event_callback 表示中断成功
if (data.cmd === 'event_callback' && data.info === '中断成功') {
console.log("后端确认中断成功");
addLog('warn', `中断确认: ${data.info}`)
isThinking.value = false
return
}
const {
role,
@@ -264,6 +278,7 @@ export const useSocketStore = defineStore('socket', () => {
isThinking,
logs,
config,
authFailReason,
// 计算属性
isConnected,