优化: 清理无意义注释(走查编号前缀/过时历史标注/死代码注释)
This commit is contained in:
+8
-8
@@ -36,9 +36,9 @@ import type { AiChatEvent, AiConversationSummary, AiMessage, AiProviderConfig, A
|
||||
const MESSAGE_CAP = 200
|
||||
|
||||
/**
|
||||
* 单对话 messages 的 parts 体积软上限(UX-260617-20)。
|
||||
* 单对话 messages 的 parts 体积软上限。
|
||||
*
|
||||
* 背景:MESSAGE_CAP 仅按"条数"裁剪,不感知单条体积。多模态 base64 图片(F-260614-05)
|
||||
* 背景:MESSAGE_CAP 仅按"条数"裁剪,不感知单条体积。多模态 base64 图片
|
||||
* 单条可达数 MB,极端 200 条 × 5MB ≈ 1GB 会撑爆渲染内存。
|
||||
*
|
||||
* 设计:
|
||||
@@ -51,7 +51,7 @@ const PARTS_SIZE_BUDGET = 50 * 1024 * 1024 // 50MB(base64 char 计)
|
||||
import { useAiEvents } from '@/composables/ai/useAiEvents'
|
||||
import { useAiStream } from '@/composables/ai/useAiStream'
|
||||
// 批4 双轨收口:getConvState 从 aiShared 取(下沉破环,避免 stores/ai↔useAiEvents 反向环)。
|
||||
// F-09 per-conv streaming/currentText(DEC-07a 父④):convStreamStates Map + 辅助函数亦从 aiShared 取。
|
||||
// F-09 per-conv streaming/currentText(a 父④):convStreamStates Map + 辅助函数亦从 aiShared 取。
|
||||
import { getConvState, getConvStreamState, setConvStreaming, setConvCurrentText, __bindMessages, __bindState } from '@/composables/ai/aiShared'
|
||||
import { useAiSend, initDrainQueueListener } from '@/composables/ai/useAiSend'
|
||||
import { useAiApproval } from '@/composables/ai/useAiApproval'
|
||||
@@ -62,7 +62,7 @@ import { useAiContext } from '@/composables/ai/useAiContext'
|
||||
|
||||
/// 模块级单例 state — 全应用共享(composables 通过 `import { state } from '@/stores/ai'` 取用)
|
||||
//
|
||||
// F-09 B 路线 per-conv streaming/currentText(DEC-07a 父④):
|
||||
// F-09 B 路线 per-conv streaming/currentText(a 父④):
|
||||
// `streaming`/`currentText` 不再是全局单例字段,改为 accessor 委派 aiShared.convStreamStates
|
||||
// (per-conv Map,定义于 composables/ai/aiShared.ts)按 activeConversationId 索引读写。
|
||||
//
|
||||
@@ -137,7 +137,7 @@ const _stateBase: {
|
||||
// F-260614-05 Phase 2b: parts 挂多模态图片片(供 drainQueue/force 续发时本地 user 消息渲染图)
|
||||
queue: [],
|
||||
// Agentic 循环当前轮次(0=非agentic/未开始;>0=收到后端 AiAgentRound 事件的 round)
|
||||
// AE-2025-07:进度条用; AiCompleted/AiError 复位为 0
|
||||
// 进度条用; AiCompleted/AiError 复位为 0
|
||||
agentRound: 0,
|
||||
completedTools: 0,
|
||||
// 归档分组折叠态(默认折叠)
|
||||
@@ -252,7 +252,7 @@ function estimatePartsSize(parts: ContentPart[] | undefined): number {
|
||||
}
|
||||
|
||||
/**
|
||||
* parts 体积软上限守卫(UX-260617-20):push 式增长使总 parts 体积超 PARTS_SIZE_BUDGET 时,
|
||||
* parts 体积软上限守卫push 式增长使总 parts 体积超 PARTS_SIZE_BUDGET 时,
|
||||
* 从最旧消息起逐条置空其 parts(丢历史多模态图,保文本/条数)。
|
||||
*
|
||||
* 仅拦截 push(同上 length watch 的判定),避免切换对话整体替换时误裁后端历史图。
|
||||
@@ -319,12 +319,12 @@ function isGenerating(convId: string | null | undefined): boolean {
|
||||
* (composable 内部全部是模块级单例实现,展开的只是引用,无重复实例化开销)。
|
||||
*/
|
||||
export function useAiStore() {
|
||||
// ARC-06: 启动 drain-queue 事件监听(由 useAiEvents AiCompleted 经事件总线触发)
|
||||
// 启动 drain-queue 事件监听(由 useAiEvents AiCompleted 经事件总线触发)
|
||||
void initDrainQueueListener()
|
||||
return {
|
||||
state,
|
||||
filteredConversations,
|
||||
// F-09: 生成态 helper(批4 双轨收口:仅读 isGenerating 派生自 getConvState;
|
||||
// 生成态 helper(批4 双轨收口:仅读 isGenerating 派生自 getConvState;
|
||||
// addGenerating/removeGenerating 写 helper 已删,写收敛到 useAiEvents setConvState)
|
||||
isGenerating,
|
||||
...useAiEvents(),
|
||||
|
||||
Reference in New Issue
Block a user