@@ -97,10 +97,6 @@ export class ExtensionState extends EventTarget {
9797 private _project : Project = undefined
9898 private _aiRequest : AIRequest = undefined
9999 private _diagColl : vscode . DiagnosticCollection
100- private _aiRequestCache : WorkspaceFileCache <
101- AIRequestSnapshotKey ,
102- AIRequestSnapshot
103- > = undefined
104100 readonly output : vscode . LogOutputChannel
105101 readonly sessionApiKey : string
106102 private panel : vscode . WebviewPanel
@@ -122,11 +118,6 @@ export class ExtensionState extends EventTarget {
122118 this . _diagColl = vscode . languages . createDiagnosticCollection ( TOOL_NAME )
123119 subscriptions . push ( this . _diagColl )
124120
125- this . _aiRequestCache = createCache <
126- AIRequestSnapshotKey ,
127- AIRequestSnapshot
128- > ( AI_REQUESTS_CACHE )
129-
130121 // clear errors when file edited (remove me?)
131122 subscriptions . push (
132123 vscode . workspace . onDidChangeTextDocument (
@@ -169,10 +160,6 @@ export class ExtensionState extends EventTarget {
169160 return res
170161 }
171162
172- aiRequestCache ( ) {
173- return this . _aiRequestCache
174- }
175-
176163 async applyEdits ( ) {
177164 const req = this . aiRequest
178165 if ( ! req ) return
@@ -193,7 +180,7 @@ export class ExtensionState extends EventTarget {
193180
194181 async requestAI (
195182 options : AIRequestOptions
196- ) : Promise < Partial < GenerationResult > & { requestSha : string } > {
183+ ) : Promise < Partial < GenerationResult > > {
197184 try {
198185 const req = await this . startAIRequest ( options )
199186 if ( ! req ) {
@@ -208,42 +195,17 @@ export class ExtensionState extends EventTarget {
208195 else if ( text ) this . showWebview ( { reveal : false } )
209196 }
210197
211- const { key, sha } = await this . snapshotAIRequestKey ( req )
212- const snapshot = snapshotAIRequest ( req )
213- await this . _aiRequestCache . set ( key , snapshot )
214198 this . setDiagnostics ( )
215199 this . dispatchChange ( )
216200
217201 if ( edits ?. length && options . mode != "notebook" ) this . applyEdits ( )
218- return { ... res , requestSha : sha }
202+ return res
219203 } catch ( e ) {
220204 if ( isCancelError ( e ) ) return undefined
221205 throw e
222206 }
223207 }
224208
225- private async snapshotAIRequestKey ( r : AIRequest ) {
226- const { options } = r
227- const key : AIRequestSnapshotKey = {
228- template : {
229- id : options . template . id ,
230- title : options . template . title ,
231- hash : await hash (
232- {
233- template : options . template ,
234- parameters : options . parameters ,
235- mode : options . mode ,
236- runOptions : options . runOptions ,
237- } ,
238- { version : true }
239- ) ,
240- } ,
241- fragment : options . fragment ,
242- version : CORE_VERSION ,
243- }
244- return { key, sha : await this . _aiRequestCache . getSha ( key ) }
245- }
246-
247209 dispatchAIRequestChange ( ) {
248210 this . dispatchEvent ( new Event ( AI_REQUEST_CHANGE ) )
249211 }
0 commit comments