优化: aichat 打磨收尾(切换信任保留 + save并发串行 + 后台授权守卫 + 分离窗口失效 + 气泡截图复制)

This commit is contained in:
lxy
2026-08-08 21:08:25 +08:00
parent 65c0f6b2b6
commit 6ba6daf188
14 changed files with 196 additions and 27 deletions
+8 -8
View File
@@ -21,7 +21,7 @@
//! streaming 是 boolean 无真正非法跃迁,guard 价值在集中入口与日志而非拦截。
import { state } from '@/stores/ai'
import { convStates } from './aiShared'
import { convStates, getConvStreamState, setConvStreaming } from './aiShared'
import { useAppSettingsStore } from '@/stores/appSettings'
/// feature flag key(appSettings KV)。关=回退散布语义(灰度/回退用)。
@@ -56,14 +56,14 @@ export function setStreaming(
// flag 关:回退散布语义,直接赋值不动其他。
if (!isGuardEnabled()) {
state.streaming = value
if (convId) setConvStreaming(convId, value)
else state.streaming = value
return
}
const prev = state.streaming
const prev = convId ? (getConvStreamState(convId)?.streaming ?? false) : state.streaming
// 幂等观测:同值重复写不拒绝(resetStreamWatchdog 等副作用场景需合法重入),
// 仅记 debug 日志供排查「为何重复置位」的卡死场景。
// 幂等观测:同值重复写不拒绝,仅记 debug 日志供排查卡死场景。
if (prev === value) {
console.debug(
`[AI-Guard] setStreaming 幂等(prev=${prev}, convId=${convId ?? 'none'}, reason=${reason ?? 'unknown'})`,
@@ -74,9 +74,9 @@ export function setStreaming(
)
}
// 批4 双轨收口:generating 态真相归 convStates(enum),本 guard 不再联动 generatingConvs
// (bool 轨已退役)。streaming 单值是另一条过渡态(F-09 per-conv streaming 收口前保留)。
state.streaming = value
// 显式 convId 写目标会话 per-conv 流式态;缺省写当前活跃会话(单会话语义不变)。
if (convId) setConvStreaming(convId, value)
else state.streaming = value
}
/**