Skip to content

Commit 2620ca9

Browse files
committed
Improve web configuration descriptions in quick pick and refine the context selection modal behavior in the panel
- instead of 'go back' place 'Close', remove the unnecessary previous prompt type saving. The new behavior simply closes the modal on click, or when token count is >0 - the quick pick with web configurations should include reasoning effort
1 parent fa533bb commit 2620ca9

2 files changed

Lines changed: 37 additions & 39 deletions

File tree

‎apps/editor/src/views/panel/backend/message-handlers/handle-send-to-browser.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,26 @@ const show_web_configuration_quick_pick = async (params: {
260260
const model = web_configuration.model
261261
? chatbot_models?.[web_configuration.model]?.label || web_configuration.model
262262
: ''
263+
264+
const details: string[] = []
265+
if (!is_unnamed && web_configuration.chatbot) {
266+
details.push(web_configuration.chatbot)
267+
}
268+
if (model) {
269+
details.push(model)
270+
}
271+
if (web_configuration.reasoningEffort) {
272+
details.push(web_configuration.reasoningEffort)
273+
}
274+
263275
return {
264276
label: `${
265277
is_unnamed
266278
? web_configuration.chatbot!
267279
: web_configuration.name!.replace(/\s*\(\d+\)$/, '')
268280
}`,
269281
web_configuration_name: web_configuration.name,
270-
description: is_unnamed
271-
? model
272-
: `${web_configuration.chatbot}${model ? ` · ${model}` : ''}`
282+
description: details.join(' · ')
273283
}
274284
}
275285

‎apps/editor/src/views/panel/frontend/Panel.tsx‎

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { use_response_history } from './hooks/panel/use-response-history'
3232
import { use_preview_manager } from './hooks/panel/use-preview-manager'
3333
import { use_editor_sync } from './hooks/panel/use-editor-sync'
3434
import { use_web_configuration_editing } from './hooks/panel/use-web-configuration-editing'
35-
import { ApiPromptType, WebPromptType } from '@shared/types/prompt-types'
3635

3736
const vscode = acquireVsCodeApi()
3837

@@ -148,22 +147,14 @@ export const Panel = () => {
148147

149148
const active_prompt_type =
150149
mode == MODE.WEB ? web_prompt_type : api_prompt_type
151-
const [previous_web_prompt_type, set_previous_web_prompt_type] =
152-
useState<WebPromptType>('edit-context')
153-
const [previous_api_prompt_type, set_previous_api_prompt_type] =
154-
useState<ApiPromptType>('edit-context')
150+
const [is_context_modal_dismissed, set_is_context_modal_dismissed] =
151+
useState(false)
155152

156153
useEffect(() => {
157-
if (web_prompt_type && web_prompt_type !== 'find-relevant-files') {
158-
set_previous_web_prompt_type(web_prompt_type)
154+
if (active_prompt_type !== 'find-relevant-files') {
155+
set_is_context_modal_dismissed(false)
159156
}
160-
}, [web_prompt_type])
161-
162-
useEffect(() => {
163-
if (api_prompt_type && api_prompt_type !== 'find-relevant-files') {
164-
set_previous_api_prompt_type(api_prompt_type)
165-
}
166-
}, [api_prompt_type])
157+
}, [active_prompt_type])
167158

168159
if (
169160
ask_about_context_instructions === undefined ||
@@ -813,28 +804,25 @@ export const Panel = () => {
813804
</div>
814805
)}
815806

816-
{active_prompt_type == 'find-relevant-files' && token_count == 0 && (
817-
<div className={styles.slot}>
818-
<UiModal
819-
title="Make rough context selection"
820-
icon="info"
821-
footer_slot={
822-
<UiButton
823-
is_secondary
824-
on_click={() => {
825-
if (mode == MODE.WEB) {
826-
handle_web_prompt_type_change(previous_web_prompt_type)
827-
} else {
828-
handle_api_prompt_type_change(previous_api_prompt_type)
829-
}
830-
}}
831-
>
832-
Go back
833-
</UiButton>
834-
}
835-
/>
836-
</div>
837-
)}
807+
{active_prompt_type == 'find-relevant-files' &&
808+
token_count == 0 &&
809+
!is_context_modal_dismissed && (
810+
<div className={styles.slot}>
811+
<UiModal
812+
title="Make context selection"
813+
icon="info"
814+
on_background_click={() => set_is_context_modal_dismissed(true)}
815+
footer_slot={
816+
<UiButton
817+
is_secondary
818+
on_click={() => set_is_context_modal_dismissed(true)}
819+
>
820+
Close
821+
</UiButton>
822+
}
823+
/>
824+
</div>
825+
)}
838826

839827
{auto_closing_modal_data && (
840828
<div className={styles.slot}>

0 commit comments

Comments
 (0)