Skip to content

Commit 6291579

Browse files
committed
Add warning prompt for missing API configurations and fix notice component styling
- `apps/editor/src/views/prompt/backend/message-handlers/handle-make-api-call.ts` should show modal 'missing configuration' - in `apps/editor/src/utils/show-no-configurations-warning.ts` use translation [Pasted text] placed in `apps/editor/src/i18n/translations/utils` - implement ellipsis truncation in notice ├── apps │ └── editor │ └── src │ ├── constants │ │ └── edit-format-instructions.ts │ ├── i18n │ │ └── translations │ │ ├── common.ts │ │ └── utils │ │ ├── git-repository-utils.ts │ │ ├── index.ts │ │ ├── show-no-configurations-warning.ts │ │ └── show-parent-folder-quick-pick.ts │ ├── utils │ │ └── show-no-configurations-warning.ts │ └── views │ ├── prompt │ │ ├── backend │ │ │ └── message-handlers │ │ │ └── handle-make-api-call.ts │ │ └── frontend │ │ └── i18n │ │ └── translations │ │ └── common.ts │ └── settings │ ├── frontend │ │ ├── Home │ │ │ └── sections │ │ │ ├── ApiSection.tsx │ │ │ └── WebSection.tsx │ │ └── i18n │ │ └── translations │ │ └── common.ts │ └── helpers │ └── open-settings.ts ├── docs │ └── chatbot-initialization.mdx └── packages └── ui └── src └── components └── editor └── settings └── Notice ├── Notice.module.scss ├── Notice.tsx └── index.ts
1 parent 178c900 commit 6291579

6 files changed

Lines changed: 31 additions & 3 deletions

File tree

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { translations as show_parent_folder_quick_pick } from './show-parent-folder-quick-pick'
22
import { translations as git_repository_utils } from './git-repository-utils'
3+
import { translations as show_no_configurations_warning } from './show-no-configurations-warning'
34

45
export const translations = {
56
...show_parent_folder_quick_pick,
6-
...git_repository_utils
7+
...git_repository_utils,
8+
...show_no_configurations_warning
79
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const translations = {
2+
'utils.show-no-configurations-warning.no-configurations-created-yet': {
3+
en: 'No configurations created yet.',
4+
pl: 'Nie utworzono jeszcze żadnych konfiguracji.',
5+
'zh-cn': '尚未创建配置。',
6+
ja: 'まだ設定は作成されていません。',
7+
'zh-tw': '尚未建立設定。',
8+
de: 'Noch keine Konfigurationen erstellt.',
9+
es: 'Aún no se han creado configuraciones.',
10+
fr: 'Aucune configuration créée pour le moment.',
11+
'pt-br': 'Nenhuma configuração criada ainda.',
12+
ru: 'Конфигурации еще не созданы.',
13+
ko: '아직 생성된 구성이 없습니다.',
14+
it: 'Nessuna configurazione ancora creata.',
15+
tr: 'Henüz yapılandırma oluşturulmadı.',
16+
cs: 'Zatím nebyly vytvořeny žádné konfigurace.',
17+
hu: 'Még nincsenek konfigurációk létrehozva.',
18+
bg: 'Все още няма създадени конфигурации.'
19+
}
20+
} as const

‎apps/editor/src/utils/show-no-configurations-warning.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const show_no_configurations_warning = async (
77
): Promise<void> => {
88
const open_settings_label = t('common.open-settings')
99
const result = await vscode.window.showWarningMessage(
10-
t('common.missing-configuration'),
10+
t('utils.show-no-configurations-warning.no-configurations-created-yet'),
1111
{ modal: true },
1212
open_settings_label
1313
)

‎apps/editor/src/views/prompt/backend/message-handlers/handle-make-api-call.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
show_configuration_quick_pick,
2222
map_api_configuration_to_item
2323
} from '@/utils/show-configuration-quick-pick'
24+
import { show_no_configurations_warning } from '@/utils/show-no-configurations-warning'
2425
import { PromptBuilder } from '@/utils/prompt-builder'
2526
import { ApiPromptType } from '@shared/types/prompt-types'
2627
import {
@@ -50,6 +51,7 @@ const get_api_configuration = async (params: {
5051
await params.model_providers_manager.get_api_configurations()
5152

5253
if (api_configurations.length == 0) {
54+
show_no_configurations_warning('api')
5355
return
5456
}
5557

‎apps/editor/src/views/settings/helpers/open-settings.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const open_settings = {
55
prompt_field: () =>
66
vscode.commands.executeCommand(
77
'codeWebChat.settings',
8-
'section:general:group:prompt-field'
8+
'section:general:group:prompt'
99
)
1010
},
1111
web: {

‎packages/ui/src/components/editor/settings/Notice/Notice.module.scss‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
display: flex;
3030
align-items: center;
3131
gap: 6px;
32+
min-width: 0;
3233

3334
&--warning {
3435
> span:first-child {
@@ -46,5 +47,8 @@
4647

4748
.content {
4849
flex: 1;
50+
overflow: hidden;
51+
text-overflow: ellipsis;
52+
white-space: nowrap;
4953
}
5054
}

0 commit comments

Comments
 (0)