@@ -118,6 +118,7 @@ import { dictionary } from '@shared/constants/dictionary'
118118import { DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD } from '@/constants/values'
119119import { upsert_configuration } from '../../utils/upsert-configuration'
120120import { delete_configuration } from '../../utils/delete-configuration'
121+ import { ModelProvidersManager } from '@/services/model-providers-manager'
121122
122123export class PanelProvider implements vscode . WebviewViewProvider {
123124 private _webview_view : vscode . WebviewView | undefined
@@ -190,6 +191,40 @@ export class PanelProvider implements vscode.WebviewViewProvider {
190191 } )
191192 }
192193
194+ public async send_setup_progress ( ) {
195+ const providers_manager = new ModelProvidersManager ( this . context )
196+ const [
197+ providers ,
198+ edit_context ,
199+ intelligent_update ,
200+ prune_context ,
201+ code_at_cursor ,
202+ voice_input ,
203+ commit_messages
204+ ] = await Promise . all ( [
205+ providers_manager . get_providers ( ) ,
206+ providers_manager . get_edit_context_tool_configs ( ) ,
207+ providers_manager . get_intelligent_update_tool_configs ( ) ,
208+ providers_manager . get_prune_context_tool_configs ( ) ,
209+ providers_manager . get_code_completions_tool_configs ( ) ,
210+ providers_manager . get_voice_input_tool_configs ( ) ,
211+ providers_manager . get_commit_messages_tool_configs ( )
212+ ] )
213+
214+ this . send_message ( {
215+ command : 'SETUP_PROGRESS' ,
216+ setup_progress : {
217+ has_model_provider : providers . length > 0 ,
218+ has_configuration_for_edit_context : edit_context . length > 0 ,
219+ has_configuration_for_intelligent_update : intelligent_update . length > 0 ,
220+ has_configuration_for_prune_context : prune_context . length > 0 ,
221+ has_configuration_for_code_at_cursor : code_at_cursor . length > 0 ,
222+ has_configuration_for_voice_input : voice_input . length > 0 ,
223+ has_configuration_for_commit_messages : commit_messages . length > 0
224+ }
225+ } )
226+ }
227+
193228 public send_currently_open_file_text ( ) {
194229 const active_editor = vscode . window . activeTextEditor
195230 this . send_message ( {
@@ -317,6 +352,22 @@ export class PanelProvider implements vscode.WebviewViewProvider {
317352 handle_get_api_tool_configurations ( this )
318353 }
319354
355+ const setup_progress_keys = [
356+ 'codeWebChat.modelProviders' ,
357+ 'codeWebChat.configurationsForEditContext' ,
358+ 'codeWebChat.configurationsForCodeAtCursor' ,
359+ 'codeWebChat.configurationsForPruneContext' ,
360+ 'codeWebChat.configurationsForIntelligentUpdate' ,
361+ 'codeWebChat.configurationsForCommitMessages' ,
362+ 'codeWebChat.configurationsForVoiceInput'
363+ ]
364+
365+ if (
366+ setup_progress_keys . some ( ( key ) => event . affectsConfiguration ( key ) )
367+ ) {
368+ this . send_setup_progress ( )
369+ }
370+
320371 if ( event . affectsConfiguration ( 'codeWebChat.isTimelineCollapsed' ) ) {
321372 handle_get_collapsed_states ( this )
322373 }
@@ -796,6 +847,8 @@ export class PanelProvider implements vscode.WebviewViewProvider {
796847 await handle_paste_url ( this , message )
797848 } else if ( message . command == 'SET_RECORDING_STATE' ) {
798849 await handle_voice_input ( this , message )
850+ } else if ( message . command == 'GET_SETUP_PROGRESS' ) {
851+ await this . send_setup_progress ( )
799852 }
800853 } catch ( error : any ) {
801854 Logger . error ( {
0 commit comments