File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,33 @@ async function setLangDefaultValue() {
217217 }
218218}
219219
220+ async function updateInvalidSettings ( ) {
221+ const oldModels = [
222+ "Model.gpt-3-5" ,
223+ "Model.gpt-3-5-16k" ,
224+ "Model.gpt-4" ,
225+ "Model.claude-2"
226+ ] ;
227+
228+ for ( const model of oldModels ) {
229+ const modelConfig : any = UiUtilWrapper . getConfiguration ( "devchat" , model ) ;
230+ if ( Object . keys ( modelConfig ) . length !== 0 ) {
231+ let modelProperties : any = { } ;
232+ for ( const key of Object . keys ( modelConfig || { } ) ) {
233+ const property = modelConfig ! [ key ] ;
234+ modelProperties [ key ] = property ;
235+ }
236+
237+ if ( modelConfig [ "api_key" ] ) {
238+ delete modelProperties [ "api_key" ] ;
239+ delete modelProperties [ "api_base" ] ;
240+ modelProperties [ "provider" ] = "devchat" ;
241+ await vscode . workspace . getConfiguration ( "devchat" ) . update ( model , modelProperties , vscode . ConfigurationTarget . Global ) ;
242+ }
243+ }
244+ }
245+ }
246+
220247async function activate ( context : vscode . ExtensionContext ) {
221248 ExtensionContextHolder . context = context ;
222249
@@ -227,6 +254,7 @@ async function activate(context: vscode.ExtensionContext) {
227254 await configUpdate0912To0924 ( ) ;
228255 await configUpdateTo1115 ( ) ;
229256 await setLangDefaultValue ( ) ;
257+ await updateInvalidSettings ( ) ;
230258
231259 regLanguageContext ( ) ;
232260 registerCodeLensProvider ( context ) ;
You can’t perform that action at this time.
0 commit comments