Skip to content

Commit 7334150

Browse files
committed
Streamline prompt attachments and context controls by removing empty context warning and adding clear context shortcuts
- make 'X completed tasks' in the prompt field have 'clear all' button on the right side, identical to status bar we show below. Move translation to `apps/editor/src/views/prompt/frontend/i18n/translations/prompt-field.ts` and remove this status bar completely. - when context is empty, should not turn prompt field and bar underneath into warning color - under prompt field, 'clear context' should have shortcut alt+x - remove 'agentic search' from prompt field's 'more' dropdown menu - when showing 'clear context', show 'agentic search' but only icon (without label) - when showing 'clear context' and 'agentic search' together, 'agentic search' should turn into 'search' - don't use short form 'search' but always 'agentic search' - 'clear context' should not have label, just icon - show 'clear context' in the prompt attachments at all times - instead of 'context is empty' show 'attaching 0 files' - move [Pasted text] to main ├── apps │ └── editor │ ├── package.json │ └── src │ ├── context │ │ └── context-initialization.ts │ └── views │ └── prompt │ ├── backend │ │ └── message-handlers │ │ └── handle-agentic-search.ts │ └── frontend │ ├── Main │ │ ├── Main.tsx │ │ └── MainView │ │ ├── MainView.tsx │ │ └── components │ │ └── PromptAttachments │ │ ├── PromptAttachments.tsx │ │ └── index.ts │ └── i18n │ └── translations │ ├── common.ts │ ├── index.ts │ ├── main.ts │ ├── prompt-field.ts │ └── selected-files.ts └── packages └── ui └── src └── components └── editor ├── common │ └── prompts │ ├── PromptField │ │ ├── PromptField.module.scss │ │ ├── PromptField.stories.tsx │ │ ├── PromptField.tsx │ │ ├── components │ │ │ ├── Footer │ │ │ │ ├── Footer.tsx │ │ │ │ └── index.ts │ │ │ └── Tabs │ │ │ └── index.ts │ │ ├── hooks │ │ │ ├── use-ghost-text.ts │ │ │ ├── use-handlers │ │ │ │ ├── handle-copy.ts │ │ │ │ ├── handle-cut.ts │ │ │ │ ├── handle-input-change.ts │ │ │ │ ├── handle-key-down.ts │ │ │ │ ├── handle-paste.ts │ │ │ │ ├── handle-submit.ts │ │ │ │ ├── index.ts │ │ │ │ └── utils.ts │ │ │ └── use-keyboard-shortcuts.ts │ │ └── index.ts │ ├── Template │ │ └── index.ts │ └── shared │ └── symbols │ ├── caret.ts │ ├── get-highlighted-text.tsx │ ├── index.ts │ ├── position-mapping.ts │ ├── prompt-symbols.module.scss │ ├── reconstruct-raw-value.ts │ └── use-symbol-deletion.ts └── prompt-view └── StatusBar └── index.ts
1 parent 5a666b1 commit 7334150

10 files changed

Lines changed: 75 additions & 164 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx‎

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ export const MainView: React.FC<Props> = (props) => {
194194
(props.target == 'WEB' && props.web_prompt_type == 'edit') ||
195195
(props.target == 'API' && props.api_prompt_type == 'edit')
196196

197-
const is_required_context_empty =
198-
is_edit_prompt_type && props.selected_files.length == 0
199-
200197
const handle_input_change = (value: string) => {
201198
props.set_instructions(value)
202199
}
@@ -441,7 +438,7 @@ export const MainView: React.FC<Props> = (props) => {
441438
props.on_response_history_item_remove
442439
}
443440
translations={{
444-
applied_manually: t('common.applied-manually'),
441+
applied_manually: t('main.applied-manually'),
445442
reject: t('action.reject')
446443
}}
447444
/>
@@ -488,27 +485,25 @@ export const MainView: React.FC<Props> = (props) => {
488485
target={props.target}
489486
on_target_change={(target) => props.on_target_change(target)}
490487
active_border_color={
491-
is_required_context_empty
492-
? 'yellow'
493-
: props.target == 'WEB'
494-
? props.web_prompt_type == 'edit'
488+
props.target == 'WEB'
489+
? props.web_prompt_type == 'edit'
490+
? 'blue'
491+
: 'purple'
492+
: props.target == 'API'
493+
? props.api_prompt_type == 'edit'
494+
? 'blue'
495+
: 'purple'
496+
: props.cli_prompt_type == 'edit'
495497
? 'blue'
496498
: 'purple'
497-
: props.target == 'API'
498-
? props.api_prompt_type == 'edit'
499-
? 'blue'
500-
: 'purple'
501-
: props.cli_prompt_type == 'edit'
502-
? 'blue'
503-
: 'purple'
504499
}
505500
on_paste_image={props.on_paste_image}
506501
on_open_image={props.on_open_image}
507502
on_paste_long_text={props.on_paste_long_text}
508503
on_open_pasted_text={props.on_open_pasted_text}
509504
on_paste_url={props.on_paste_url}
510505
on_changes_click={props.on_changes_click}
511-
on_agentic_search={props.on_agentic_search}
506+
on_clear_context={props.on_clear_context}
512507
on_commit_click={props.on_commit_click}
513508
on_skill_click={props.on_skill_click}
514509
on_preview_prompt={props.on_preview_prompt}
@@ -564,31 +559,12 @@ export const MainView: React.FC<Props> = (props) => {
564559
mark_as_complete: t('prompt-field.mark-as-complete'),
565560
new_tab: t('prompt-field.new-tab'),
566561
clear_tab: t('prompt-field.clear-tab'),
567-
close_tab: t('prompt-field.close-tab'),
568-
agentic_search: t('prompt-field.agentic-search')
562+
close_tab: t('prompt-field.close-tab')
569563
}}
570564
/>
571565
</div>
572566

573-
{is_required_context_empty ? (
574-
<UiStatusBar
575-
placement="bottom"
576-
theme="warning"
577-
icon="codicon-warning"
578-
label={t('common.context-is-empty')}
579-
actions={[
580-
{
581-
id: 'agentic-search',
582-
icon: 'codicon-search-sparkle',
583-
label: t('selected-files.agentic-search'),
584-
keycap: is_alt_pressed ? 'F' : undefined,
585-
on_click: props.on_agentic_search
586-
}
587-
]}
588-
/>
589-
) : (
590-
prompt_attachments
591-
)}
567+
{prompt_attachments}
592568

593569
{is_landscape && <UiSpacer height={6} />}
594570
</>

‎apps/editor/src/views/prompt/frontend/Main/MainView/components/PromptAttachments/PromptAttachments.tsx‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { display_token_count } from '@shared/utils/display-token-count'
55
type Props = {
66
token_count?: number
77
files_count?: number
8-
theme?: 'default' | 'warning' | 'success' | 'error' | 'blue' | 'purple'
8+
theme: 'blue' | 'purple'
99
translations: {
1010
attaching_file: string
1111
attaching_files: string
@@ -27,7 +27,7 @@ export const PromptAttachments: React.FC<Props> = (props) => {
2727
return (
2828
<StatusBar
2929
placement="bottom"
30-
theme={props.theme ?? 'default'}
30+
theme={props.theme}
3131
icon="codicon-attach"
3232
label={attaching_files_label}
3333
description={
@@ -36,20 +36,20 @@ export const PromptAttachments: React.FC<Props> = (props) => {
3636
: undefined
3737
}
3838
actions={[
39-
(props.files_count || 0) === 0
40-
? {
41-
id: 'agentic-search',
42-
icon: 'codicon-search-sparkle',
43-
label: props.translations.agentic_search,
44-
keycap: props.is_alt_pressed ? 'F' : undefined,
45-
on_click: props.on_agentic_search
46-
}
47-
: {
48-
id: 'clear-context',
49-
icon: 'codicon-clear-all',
50-
label: props.translations.clear_context,
51-
on_click: props.on_clear_context
52-
}
39+
{
40+
id: 'agentic-search',
41+
icon: 'codicon-search-sparkle',
42+
label: props.translations.agentic_search,
43+
keycap: props.is_alt_pressed ? 'F' : undefined,
44+
on_click: props.on_agentic_search
45+
},
46+
{
47+
id: 'clear-context',
48+
icon: 'codicon-clear-all',
49+
title: props.translations.clear_context,
50+
keycap: props.is_alt_pressed ? 'X' : undefined,
51+
on_click: props.on_clear_context
52+
}
5353
]}
5454
/>
5555
)
Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +0,0 @@
1-
export const common = {
2-
'common.context-is-empty': {
3-
en: 'Context is empty',
4-
pl: 'Kontekst jest pusty',
5-
'zh-cn': '上下文为空',
6-
ja: 'コンテキストが空です',
7-
'zh-tw': '上下文為空',
8-
de: 'Kontext ist leer',
9-
es: 'El contexto está vacío',
10-
fr: 'Le contexte est vide',
11-
'pt-br': 'O contexto está vazio',
12-
ru: 'Контекст пуст',
13-
ko: '컨텍스트가 비어 있습니다',
14-
it: 'Il contesto è vuoto',
15-
tr: 'Bağlam boş',
16-
cs: 'Kontext je prázdný',
17-
hu: 'A kontextus üres',
18-
bg: 'Контекстът е празен'
19-
},
20-
'common.applied-manually': {
21-
en: 'Applied manually',
22-
pl: 'Zastosowano ręcznie',
23-
'zh-cn': '手动应用',
24-
ja: '手動で適用',
25-
'zh-tw': '手動應用',
26-
de: 'Manuell angewendet',
27-
es: 'Aplicado manualmente',
28-
fr: 'Appliqué manuellement',
29-
'pt-br': 'Aplicado manualmente',
30-
ru: 'Применено вручную',
31-
ko: '수동으로 적용됨',
32-
it: 'Applicato manualmente',
33-
tr: 'Manuel olarak uygulandı',
34-
cs: 'Ručně aplikováno',
35-
hu: 'Manuálisan alkalmazva',
36-
bg: 'Приложено ръчно'
37-
}
38-
} as const

‎apps/editor/src/views/prompt/frontend/i18n/translations/index.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { selected_files } from './selected-files'
99

1010
import { footer } from './footer'
1111
import { modals } from './modals'
12-
import { common } from './common'
1312

1413
export const translations = {
1514
...header,
@@ -21,6 +20,5 @@ export const translations = {
2120
...footer,
2221
...modals,
2322
...main,
24-
...selected_files,
25-
...common
23+
...selected_files
2624
}

‎apps/editor/src/views/prompt/frontend/i18n/translations/main.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,23 @@ export const main = {
160160
cs: 'Skrýt',
161161
hu: 'Elrejtés',
162162
bg: 'Скриване'
163+
},
164+
'main.applied-manually': {
165+
en: 'Applied manually',
166+
pl: 'Zastosowano ręcznie',
167+
'zh-cn': '手动应用',
168+
ja: '手動で適用',
169+
'zh-tw': '手動應用',
170+
de: 'Manuell angewendet',
171+
es: 'Aplicado manualmente',
172+
fr: 'Appliqué manuellement',
173+
'pt-br': 'Aplicado manualmente',
174+
ru: 'Применено вручную',
175+
ko: '수동으로 적용됨',
176+
it: 'Applicato manualmente',
177+
tr: 'Manuel olarak uygulandı',
178+
cs: 'Ručně aplikováno',
179+
hu: 'Manuálisan alkalmazva',
180+
bg: 'Приложено ръчно'
163181
}
164182
} as const

‎apps/editor/src/views/prompt/frontend/i18n/translations/prompt-field.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -484,23 +484,5 @@ export const prompt_field = {
484484
cs: 'Zavřít kartu',
485485
hu: 'Lap bezárása',
486486
bg: 'Затваряне на раздела'
487-
},
488-
'prompt-field.agentic-search': {
489-
en: 'Agentic Search',
490-
pl: 'Szukaj agentem',
491-
'zh-cn': '智能体搜索',
492-
ja: 'エージェント検索',
493-
'zh-tw': '智能體搜尋',
494-
de: 'Agentenbasierte Suche',
495-
es: 'Búsqueda agéntica',
496-
fr: 'Recherche agentique',
497-
'pt-br': 'Pesquisa agêntica',
498-
ru: 'Агентный поиск',
499-
ko: '에이전트 검색',
500-
it: 'Ricerca agentica',
501-
tr: 'Ajan Araması',
502-
cs: 'Agentní vyhledávání',
503-
hu: 'Ügynök alapú keresés',
504-
bg: 'Агентно търсене'
505487
}
506488
} as const

‎packages/ui/src/components/editor/common/prompts/PromptField/PromptField.stories.tsx‎

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ export const Empty = () => (
7171
mark_as_complete: 'Mark as complete',
7272
new_tab: 'New tab',
7373
clear_tab: 'Clear tab',
74-
close_tab: 'Close tab',
75-
agentic_search: 'Agentic search'
74+
close_tab: 'Close tab'
7675
}}
7776
/>
7877
)
@@ -143,8 +142,7 @@ export const WithText = () => (
143142
mark_as_complete: 'Mark as complete',
144143
new_tab: 'New tab',
145144
clear_tab: 'Clear tab',
146-
close_tab: 'Close tab',
147-
agentic_search: 'Agentic search'
145+
close_tab: 'Close tab'
148146
}}
149147
/>
150148
)
@@ -215,8 +213,7 @@ export const LongText = () => (
215213
mark_as_complete: 'Mark as complete',
216214
new_tab: 'New tab',
217215
clear_tab: 'Clear tab',
218-
close_tab: 'Close tab',
219-
agentic_search: 'Agentic search'
216+
close_tab: 'Close tab'
220217
}}
221218
/>
222219
)
@@ -287,8 +284,7 @@ export const WithPlaceholderSavedContext = () => (
287284
mark_as_complete: 'Mark as complete',
288285
new_tab: 'New tab',
289286
clear_tab: 'Clear tab',
290-
close_tab: 'Close tab',
291-
agentic_search: 'Agentic search'
287+
close_tab: 'Close tab'
292288
}}
293289
/>
294290
)
@@ -359,8 +355,7 @@ export const WithCommit = () => (
359355
mark_as_complete: 'Mark as complete',
360356
new_tab: 'New tab',
361357
clear_tab: 'Clear tab',
362-
close_tab: 'Close tab',
363-
agentic_search: 'Agentic search'
358+
close_tab: 'Close tab'
364359
}}
365360
/>
366361
)
@@ -430,8 +425,7 @@ export const WithCommitWithQuotes = () => (
430425
mark_as_complete: 'Mark as complete',
431426
new_tab: 'New tab',
432427
clear_tab: 'Clear tab',
433-
close_tab: 'Close tab',
434-
agentic_search: 'Agentic search'
428+
close_tab: 'Close tab'
435429
}}
436430
/>
437431
)
@@ -509,8 +503,7 @@ export const WithEditFormatSelector = () => {
509503
mark_as_complete: 'Mark as complete',
510504
new_tab: 'New tab',
511505
clear_tab: 'Clear tab',
512-
close_tab: 'Close tab',
513-
agentic_search: 'Agentic search'
506+
close_tab: 'Close tab'
514507
}}
515508
/>
516509
)
@@ -580,8 +573,7 @@ export const WithWarning = () => (
580573
mark_as_complete: 'Mark as complete',
581574
new_tab: 'New tab',
582575
clear_tab: 'Clear tab',
583-
close_tab: 'Close tab',
584-
agentic_search: 'Agentic search'
576+
close_tab: 'Close tab'
585577
}}
586578
/>
587579
)
@@ -652,8 +644,7 @@ export const WithFilePaths = () => (
652644
mark_as_complete: 'Mark as complete',
653645
new_tab: 'New tab',
654646
clear_tab: 'Clear tab',
655-
close_tab: 'Close tab',
656-
agentic_search: 'Agentic search'
647+
close_tab: 'Close tab'
657648
}}
658649
/>
659650
)
@@ -752,8 +743,7 @@ export const WithTabs = () => {
752743
mark_as_complete: 'Mark as complete',
753744
new_tab: 'New tab',
754745
clear_tab: 'Clear tab',
755-
close_tab: 'Close tab',
756-
agentic_search: 'Agentic search'
746+
close_tab: 'Close tab'
757747
}}
758748
/>
759749
)

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export namespace PromptField {
9595
completed_tasks: string[]
9696
on_task_completed?: () => void
9797
on_clear_completed_tasks?: () => void
98-
on_agentic_search?: () => void
98+
on_clear_context?: () => void
9999
translations: {
100100
voice_input: string
101101
stop_recording: string
@@ -124,7 +124,6 @@ export namespace PromptField {
124124
new_tab: string
125125
clear_tab: string
126126
close_tab: string
127-
agentic_search: string
128127
}
129128
}
130129
}

0 commit comments

Comments
 (0)