优化: 清理无意义注释(走查编号前缀/过时历史标注/死代码注释)
This commit is contained in:
@@ -53,7 +53,7 @@ async function detachPanel(convId?: string) {
|
||||
return
|
||||
}
|
||||
// 快照当前生成态,供分离窗口接管(保持正在进行的对话)
|
||||
// F-09:用 per-conv key 写入(多会话各自快照互不覆盖)
|
||||
// 用 per-conv key 写入(多会话各自快照互不覆盖)
|
||||
// 批4 双轨收口:读 getConvState(enum 真相源)派生,替代旧 generatingConvs.has。
|
||||
// 桥接语义:has(convId)=true 等价于 conv_state∈{generating,stopping,compressed}(非终止三态)。
|
||||
if (state.streaming && targetConv) {
|
||||
@@ -67,7 +67,7 @@ async function detachPanel(convId?: string) {
|
||||
// 主窗口 state 与分离窗口 state 独立(各自 webview 独立 JS context,
|
||||
// stores/ai.ts 模块级单例仅在同 webview 内共享),清主窗口 state 不影响分离窗口生成态。
|
||||
// 分离窗口接管生成后,主窗口不应再持该会话生成态残留(防重开面板时 UI 显生成中幽灵/进度条)。
|
||||
// F-09:仅从 convStates 移除该 conv(其他会话可能仍在生成),不全局清空。
|
||||
// 仅从 convStates 移除该 conv(其他会话可能仍在生成),不全局清空。
|
||||
// watchdog 在主窗口 AiChat 卸载(App.vue v-if detached)→ stopListener → clearStreamWatchdog 时已清,
|
||||
// 此处仅清内存 state 视觉残留;localStorage 快照保留供 resumeInDetached 恢复。
|
||||
setStreaming(false, { convId: targetConv || null, reason: 'detachPanel-clear-main' })
|
||||
@@ -77,7 +77,7 @@ async function detachPanel(convId?: string) {
|
||||
const win = new WebviewWindow(label, {
|
||||
url,
|
||||
title: 'DevFlow AI',
|
||||
width: 600, // U-260618: 加宽(原 520 偏窄),与吸附态 AI_DOCK_WIDTH 一致
|
||||
width: 600, // 加宽(原 520 偏窄),与吸附态 AI_DOCK_WIDTH 一致
|
||||
height: 700,
|
||||
minWidth: 360,
|
||||
minHeight: 400,
|
||||
@@ -109,7 +109,7 @@ async function detachPanel(convId?: string) {
|
||||
}
|
||||
|
||||
/** 关闭分离窗口并回到内嵌面板(主窗口侧调用)。
|
||||
* F-09:多会话并发下可能存在多个 detached 窗口,全部关闭并清各自 per-conv 快照。 */
|
||||
* 多会话并发下可能存在多个 detached 窗口,全部关闭并清各自 per-conv 快照。 */
|
||||
async function reattachPanel() {
|
||||
stopFollowMain()
|
||||
const { WebviewWindow } = await import('@tauri-apps/api/webviewWindow')
|
||||
@@ -128,7 +128,7 @@ async function reattachPanel() {
|
||||
// 时序加固:reattach 关闭分离窗口后,显式停分离窗口残留 listener(分离窗口 close 异步,
|
||||
// onBeforeUnmount stopListener 可能延迟),防主面板重新挂载 startListener 时与旧 listener 重叠竞态。
|
||||
stopListener()
|
||||
// F-09:清所有 per-conv 快照(分离窗口已全关,快照无消费方)
|
||||
// 清所有 per-conv 快照(分离窗口已全关,快照无消费方)
|
||||
cleanupAllDetachedSnapshots()
|
||||
}
|
||||
|
||||
@@ -230,12 +230,12 @@ export async function restoreGeneratingState(opts?: { fromMainPanel?: boolean; c
|
||||
async function resumeInDetached(convId: string | null) {
|
||||
// R5: 不自动 switchConversation —— 分离窗口可看历史列表,但不主动覆盖主窗口 activeConversationId
|
||||
// (避免主窗口期间发消息落错会话)。若需切换会话,由用户在分离窗口显式操作触发。
|
||||
// F-09: 透传 convId 给 restoreGeneratingState,定位正确的 per-conv 快照 key。
|
||||
// 透传 convId 给 restoreGeneratingState,定位正确的 per-conv 快照 key。
|
||||
await restoreGeneratingState({ convId: convId || undefined })
|
||||
}
|
||||
|
||||
/** 关闭分离窗口自身(分离窗口侧调用)。
|
||||
* F-09:从当前 webview 的 label 反推 convId,清自己的 per-conv 快照。 */
|
||||
* 从当前 webview 的 label 反推 convId,清自己的 per-conv 快照。 */
|
||||
async function closeDetachedWindow() {
|
||||
state.docked = false
|
||||
stopFollowMain()
|
||||
@@ -275,7 +275,7 @@ async function dockDetached() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 吸附态 AI 窗口宽度/间隙常量(U-260618) */
|
||||
/** 吸附态 AI 窗口宽度/间隙常量*/
|
||||
const AI_DOCK_WIDTH = 600
|
||||
const AI_DOCK_GAP = 4
|
||||
// 防 syncToMain 改主窗口 size 触发 onResized 递归回调
|
||||
|
||||
Reference in New Issue
Block a user