修复: DeepSeek 400 全量扫描 + 队列 per-conv 隔离
- openai_compat: 扫描所有 assistant 消息剥离 orphan tool_calls(原仅查末条) - queue 加 conversationId 字段,按会话精准 drain - regenerate/editMessage 只清本会话排队消息 - newConversation 保留旧会话排队消息 - AiError 只清出错会话的队列项
This commit is contained in:
@@ -730,13 +730,13 @@ defineExpose({
|
||||
</div>
|
||||
|
||||
|
||||
<!-- token 用量(仅最后一条 AI 消息 + 非流式;ai.ts handleEvent 已按 df-show-token-usage 开关过滤 lastTokenUsage) -->
|
||||
<!-- token 用量(显示在每条 assistant 消息底部,非流式且有数据时) -->
|
||||
<div
|
||||
v-if="isLastAi(item.msg) && !store.state.streaming && store.state.lastTokenUsage"
|
||||
v-if="item.msg.role === 'assistant' && !store.state.streaming && item.msg.tokenUsage"
|
||||
class="ai-token-usage"
|
||||
>
|
||||
<span class="ai-token-usage-icon">🔣</span>
|
||||
<span>{{ formatTokens(store.state.lastTokenUsage.prompt) }} in · {{ formatTokens(store.state.lastTokenUsage.completion) }} out</span>
|
||||
<span>{{ formatTokens(item.msg.tokenUsage.prompt) }} in · {{ formatTokens(item.msg.tokenUsage.completion) }} out</span>
|
||||
</div>
|
||||
|
||||
<!-- 工具调用卡片(渲染/折叠/审批全下沉到 ToolCardList+ToolCard 子组件,MessageList 仅转发审批) -->
|
||||
|
||||
@@ -225,7 +225,7 @@ import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useAiStore } from '../../stores/ai'
|
||||
import { aiApi } from '../../api/ai'
|
||||
import type { AiMessage, ModelConfig } from '../../api/types'
|
||||
import type { AiMessage, ModelConfig, GoalEntry } from '../../api/types'
|
||||
|
||||
defineProps<{
|
||||
/** 分离窗口模式(嵌入 vs 分离决定顶部按钮组) */
|
||||
@@ -326,6 +326,20 @@ watch(() => store.state.activeConversationId, () => {
|
||||
store.modelOverride.value = enabledModels.value[0]?.model_id || null
|
||||
})
|
||||
|
||||
// 切 provider 后模型 override 同步(BUG-2026-07-07:provider 切换后 header 模型名不刷新):
|
||||
// - modelOverride 是模块级 ref(useAiSend)不持久化,切 provider 后仍持旧 provider 的 model_id,
|
||||
// 该 id 不在新 provider 池里 → 下拉显示错位(UI 显示 X,实际后端用路由默认 Y)。
|
||||
// - 守卫:当前选择对新 provider 模型池无效(空/不在池)时,默认选权重最高模型。
|
||||
// enabledModels 已按 weight 降序排,model[0] 即权重最高。
|
||||
// - immediate:组件挂载时也校验(modelOverride 为 null → 默认权重最高,与下拉首项对齐)。
|
||||
watch(enabledModels, (models) => {
|
||||
const current = store.modelOverride.value
|
||||
const valid = current && models.some(m => m.model_id === current)
|
||||
if ((!valid || !current) && models.length) {
|
||||
store.modelOverride.value = models[0].model_id
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
// ── 当前对话标题 ──
|
||||
const currentConvTitle = computed(() => {
|
||||
const id = store.state.activeConversationId
|
||||
@@ -416,7 +430,7 @@ const summaryExpanded = ref(false)
|
||||
|
||||
// ── L3 完整上下文 ──
|
||||
interface ContextInfo {
|
||||
goals: string[]
|
||||
goals: GoalEntry[]
|
||||
summaryCount: number
|
||||
osInfo: string
|
||||
projectNames: string
|
||||
|
||||
Reference in New Issue
Block a user