✨ feat(vscode): 问 AI 收起再展开、重启后接着这块最近的会话问;代码改了对不上的问答不再显示

This commit is contained in:
cruldra committed 2026-09-26 21:25:22 +08:00
1 parent cbe447ade8
commit f0a3ad80e1
16 files changed
+82 -211

No files matched your search

+5 -7
View File
@@ -4,7 +4,6 @@
import type { FileAttribute } from '../attributes'
import type { BlockView } from '../blockView'
import type { AnchorStep } from '../qa/anchor'
import type { RunningAsk } from '../qa/asks'
import type { Excluded } from './blockFilter'
@@ -54,10 +53,9 @@ export interface QaEntryView {
createdAt: string
}
/** 挂在一块上的问答。where 是记号拆回的各层(种类和名字),块找不到了时写它原来在哪。 */
/** 挂在一块上的问答;记号对不上这份文件里任何一块的不显示。 */
export interface QaThreadView {
anchor: string
where: AnchorStep[]
entries: QaEntryView[]
}
@@ -79,7 +77,7 @@ export interface QaMessage {
* filter:整个工作区共用的块筛选;ready 后先于第一份文档发一次,之后任何一个预览改了都发给所有预览
* qa:这份文件的问答;ready 后发一次,问答、正在答的问题变了再发
* answer:askId 那个问题的回答长了(text 是到现在为止的全文)、或换了在做的事
* answerEnd:askId 那个问题答完了:done 带最终的回答、存下的那条的 id 和会话 id(追问接着这个会话),failed 带给人看的原因,stopped 是被叫停
* answerEnd:askId 那个问题答完了:done 带最终的回答和存下的那条的 id,failed 带给人看的原因,stopped 是被叫停
*/
export type ExtensionToWebview
= | DocumentMessage
@@ -89,7 +87,7 @@ export type ExtensionToWebview
| { type: 'filter', excluded: Excluded }
| QaMessage
| { type: 'answer', askId: string, text: string, activity?: string }
| { type: 'answerEnd', askId: string, status: 'done' | 'failed' | 'stopped', text?: string, error?: string, entryId?: string, sessionId?: string }
| { type: 'answerEnd', askId: string, status: 'done' | 'failed' | 'stopped', text?: string, error?: string, entryId?: string }
/**
* edit:把 startLine..endLine 这几行整行替换成 text(扩展端给每行补回原来的缩进)
@@ -99,7 +97,7 @@ export type ExtensionToWebview
* goToDefinition:⌘ / Ctrl + 点击,跳到 offset 处名字的定义
* findOccurrences:单击带下标的名字,问它在这份文档里出现在哪几处;id、version 同 probeDefinition
* setFilter:改块筛选(整份替换),扩展端记下后发 filter 给所有预览
* ask:问 anchor 那块代码;askId 由 webview 起,回答的消息带回去;resume 是追问时上一次的会话 id
* ask:问 anchor 那块代码;askId 由 webview 起,回答的消息带回去;扩展端接着这块最近一次问答的会话问
* stopAsk:叫停 askId 那个问题,这次不存
* deleteQa:删掉 anchor 那块下面的一次问答(已经理解了)
*/
@@ -112,6 +110,6 @@ export type WebviewToExtension
| { type: 'probeDefinition', id: number, version: number, offset: number }
| { type: 'goToDefinition', version: number, offset: number }
| { type: 'findOccurrences', id: number, version: number, offset: number }
| { type: 'ask', askId: string, anchor: string, question: string, resume?: string }
| { type: 'ask', askId: string, anchor: string, question: string }
| { type: 'stopAsk', askId: string }
| { type: 'deleteQa', anchor: string, entryId: string }