重构: aichat 双轨状态机收口 + AiCompressed 事件拆分
- generating bool + CONV_STATE_ENABLED 开关双轨退役,ConvState enum 单一真相源 - can_accept_request 接入 chat 域入口(覆盖 Stopping 竞态,严谨于 is_active) - AiCompressed 拆 AiManualCompressed/AiAutoCompressed(治自动压缩误触桌面toast+刷新) - convStates/getConvState 下沉 aiShared.ts 破循环依赖
This commit is contained in:
@@ -615,7 +615,10 @@ export function handleEvent(event: AiChatEvent): void {
|
||||
// 上下文分段/压缩中,miniapp 无需特殊处理(状态在桌面端)
|
||||
break
|
||||
|
||||
case 'AiCompressed':
|
||||
// 治 Task#1:手动/自动两变体都插摘要气泡(miniapp 无独立压缩按钮,
|
||||
// 两路径都代表"对端发生压缩",插摘要气泡告知用户合理)。
|
||||
case 'AiManualCompressed':
|
||||
case 'AiAutoCompressed':
|
||||
// 压缩完成:在消息首位插入摘要提示
|
||||
messages.unshift({
|
||||
id: genId('compressed'),
|
||||
|
||||
@@ -68,7 +68,10 @@ export type AiChatEvent =
|
||||
}
|
||||
| { type: 'AiContextCleared'; conversation_id?: string | null }
|
||||
| { type: 'AiCompressing'; conversation_id?: string | null }
|
||||
| { type: 'AiCompressed'; conversation_id?: string | null; summary: string }
|
||||
// 治 Task#1:拆分手动/自动两变体(字段相同仅 type 字面量不同),桌面按 type 分流,
|
||||
// miniapp 两变体都插摘要气泡(历史可见性,见 useAiChat.ts:618 case fallthrough)。
|
||||
| { type: 'AiManualCompressed'; conversation_id?: string | null; summary: string }
|
||||
| { type: 'AiAutoCompressed'; conversation_id?: string | null; summary: string }
|
||||
| {
|
||||
type: 'AiHelpRequired'
|
||||
reason: string
|
||||
|
||||
Reference in New Issue
Block a user