Skip to content

Commit e4ea009

Browse files
committed
Remove disabled web configuration warnings and update prompt field dropdown and tooltips for better clarity
- allow sending to browser with an empty prompt - in 'web', we allow sending empty prompt, so place 'Send' action in dropdown. - the submit tooltip that shows model should be prefixed with 'Send with [conf name]'
1 parent a0b27d9 commit e4ea009

2 files changed

Lines changed: 19 additions & 35 deletions

File tree

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

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,6 @@ const show_web_configuration_quick_pick = async (params: {
354354

355355
const web_configuration = valid_web_configurations.find((p) => p.name == selected.web_configuration_name)!
356356
if (params.get_is_web_configuration_disabled(web_configuration)) {
357-
if (
358-
!params.is_in_code_completions_mode &&
359-
!params.current_instructions
360-
) {
361-
params.panel_provider.send_message({
362-
command: 'SHOW_AUTO_CLOSING_MODAL',
363-
title: 'Type something to use this web configuration',
364-
type: 'warning'
365-
})
366-
}
367357
do_resolve(null)
368358
} else {
369359
handle_update_last_used_web_configuration_or_group({
@@ -435,24 +425,13 @@ const resolve_web_configuration = async (params: {
435425
(!params.panel_provider.websocket_server_instance.is_connected_with_browser() ||
436426
(is_in_code_completions_mode &&
437427
(!params.panel_provider.currently_open_file_path ||
438-
!!params.panel_provider.current_selection)) ||
439-
(!is_in_code_completions_mode && !current_instructions))) ||
428+
!!params.panel_provider.current_selection)))) ||
440429
false
441430

442431
if (params.web_configuration_name !== undefined) {
443432
const web_configuration = all_web_configurations.find((p) => p.name == params.web_configuration_name)
444433
if (web_configuration) {
445434
if (get_is_web_configuration_disabled(web_configuration)) {
446-
if (
447-
!is_in_code_completions_mode &&
448-
!current_instructions
449-
) {
450-
params.panel_provider.send_message({
451-
command: 'SHOW_AUTO_CLOSING_MODAL',
452-
title: 'Type something to use this web configuration',
453-
type: 'warning'
454-
})
455-
}
456435
return { web_configuration_name: undefined }
457436
}
458437
return { web_configuration_name: params.web_configuration_name }
@@ -473,18 +452,7 @@ const resolve_web_configuration = async (params: {
473452
const item = all_web_configurations.find((p) => p.name === last_selected_name)
474453
if (item) {
475454
if (item.chatbot) {
476-
// It's a web_configuration
477455
if (get_is_web_configuration_disabled(item)) {
478-
if (
479-
!is_in_code_completions_mode &&
480-
!current_instructions
481-
) {
482-
params.panel_provider.send_message({
483-
command: 'SHOW_AUTO_CLOSING_MODAL',
484-
title: 'Type something to use this web configuration',
485-
type: 'warning'
486-
})
487-
}
488456
return { web_configuration_name: undefined }
489457
} else {
490458
return { web_configuration_name: last_selected_name }

‎packages/ui/src/components/editor/panel/prompts/PromptField/PromptField.tsx‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
400400
>
401401
{props.last_choice_button_title && show_submit_tooltip && (
402402
<Tooltip
403-
message={props.last_choice_button_title}
403+
message={`Send with ${props.last_choice_button_title}`}
404404
offset={28}
405405
align="right"
406406
/>
@@ -650,8 +650,24 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
650650
{is_dropdown_open && (
651651
<DropdownMenu
652652
items={[
653+
...(!props.value &&
654+
props.prompt_type != 'code-at-cursor' &&
655+
props.is_web_mode
656+
? [
657+
{
658+
label: 'Send',
659+
shortcut: is_mac ? '↩' : 'Enter',
660+
on_click: () => {
661+
handle_submit({
662+
stopPropagation: () => {}
663+
} as any)
664+
close_dropdown()
665+
}
666+
}
667+
]
668+
: []),
653669
{
654-
label: 'Select...',
670+
label: 'Send with...',
655671
shortcut: is_mac ? '⌘↩' : 'Ctrl+Enter',
656672
on_click: handle_select_click
657673
},

0 commit comments

Comments
 (0)