File tree Expand file tree Collapse file tree
apps/editor/src/views/panel
packages/ui/src/components/editor/panel/ResponsePreview Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export const handle_intelligent_update_file_in_preview = async (
2424 panel_provider : PanelProvider ,
2525 message : IntelligentUpdateFileInPreviewMessage
2626) : Promise < void > => {
27- const { file_path, workspace_name } = message
27+ const { file_path, workspace_name, force_model_selection } = message
2828 const file_name = path . basename ( file_path )
2929
3030 const original_states = panel_provider . context . workspaceState . get <
@@ -95,7 +95,7 @@ export const handle_intelligent_update_file_in_preview = async (
9595 )
9696 const config_result = await get_intelligent_update_config (
9797 api_providers_manager ,
98- false ,
98+ force_model_selection ?? false ,
9999 panel_provider . context
100100 )
101101 if ( ! config_result ) return
Original file line number Diff line number Diff line change @@ -587,7 +587,8 @@ export const Panel = () => {
587587 post_message ( vscode , {
588588 command : 'INTELLIGENT_UPDATE_FILE_IN_PREVIEW' ,
589589 file_path : file . file_path ,
590- workspace_name : file . workspace_name
590+ workspace_name : file . workspace_name ,
591+ force_model_selection : file . force_model_selection
591592 } )
592593 } }
593594 on_cancel_intelligent_update = { ( file ) => {
Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ export interface IntelligentUpdateFileInPreviewMessage extends BaseMessage {
347347 command : 'INTELLIGENT_UPDATE_FILE_IN_PREVIEW'
348348 file_path : string
349349 workspace_name ?: string
350+ force_model_selection ?: boolean
350351}
351352
352353export interface CancelIntelligentUpdateFileInPreviewMessage extends BaseMessage {
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ type Props = {
1313 on_intelligent_update : ( file : {
1414 file_path : string
1515 workspace_name ?: string
16+ force_model_selection ?: boolean
1617 } ) => void
1718 on_cancel_intelligent_update : ( file : {
1819 file_path : string
@@ -299,10 +300,11 @@ export const ResponsePreview: FC<Props> = (props) => {
299300 content : file . ai_content !
300301 } )
301302 }
302- on_intelligent_update = { ( ) =>
303+ on_intelligent_update = { ( force_model_selection ) =>
303304 props . on_intelligent_update ( {
304305 file_path : file . file_path ,
305- workspace_name : file . workspace_name
306+ workspace_name : file . workspace_name ,
307+ force_model_selection
306308 } )
307309 }
308310 on_cancel_intelligent_update = { ( ) =>
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ type Props = {
1414 on_toggle : ( checked : boolean ) => void
1515 on_discard_user_changes : ( ) => void
1616 on_preview_generated_code : ( ) => void
17- on_intelligent_update : ( ) => void
17+ on_intelligent_update : ( force_model_selection ?: boolean ) => void
1818 on_cancel_intelligent_update : ( ) => void
1919 on_go_to_file : ( ) => void
2020}
@@ -163,7 +163,9 @@ export const FileItem: FC<Props> = (props) => {
163163 title = "Fix with Intelligent Update API tool"
164164 on_click = { ( e ) => {
165165 e . stopPropagation ( )
166- props . on_intelligent_update ( )
166+ props . on_intelligent_update (
167+ ! ! props . file . fixed_with_intelligent_update
168+ )
167169 } }
168170 />
169171 ) }
@@ -227,7 +229,11 @@ export const FileItem: FC<Props> = (props) => {
227229 { ! props . file . is_applying && (
228230 < div
229231 className = { styles [ 'message__actions__item' ] }
230- onClick = { props . on_intelligent_update }
232+ onClick = { ( ) =>
233+ props . on_intelligent_update (
234+ ! ! props . file . fixed_with_intelligent_update
235+ )
236+ }
231237 title = { 'Fix with Intelligent Update API tool' }
232238 >
233239 < span className = "codicon codicon-sparkle" />
You can’t perform that action at this time.
0 commit comments