Skip to content

Commit 21285f3

Browse files
committed
Rename configuration sections to chatbots and models and add direct settings links to warning banners
- 'missing model' should not be in 'common' as it's not reused - in api target, when there are no models, show (above the prompt field) a status bar (warning) 'Missing model', '+ add new' - rename 'add new' to 'Settings' - handle [Fragment] by running `apps/editor/src/views/settings/helpers/open-settings.ts` through backed - rename 'manage api configurations' to 'manage models' - when connected and there are no chatbots, show warning 'Missing chatbot' - handle manage chatbots/handle manage models should not be separate files, just use `apps/editor/src/views/settings/helpers/open-settings.ts` in `apps/editor/src/views/prompt/backend/prompt-view-provider.ts` - implement approach 2 [Pasted text] - in `apps/editor/src/views/settings/frontend/Home/Home.tsx`, move the scrolling related logic to a hook in `apps/editor/src/views/settings/frontend/Home/hooks` - Type 'string | undefined' is not assignable to type 'NavItem | undefined'. Type 'string' is not assignable to type 'NavItem | undefined' - `apps/editor/src/views/settings/frontend/Home/hooks/use-settings-navigation.ts` should be named use-scroll-to └── apps └── editor └── src └── views ├── prompt │ ├── backend │ │ ├── message-handlers │ │ │ └── index.ts │ │ └── prompt-view-provider.ts │ ├── frontend │ │ ├── Main │ │ │ ├── Main.tsx │ │ │ └── MainView │ │ │ ├── MainView.tsx │ │ │ └── components │ │ │ └── BrowserConnectionStatus │ │ │ └── BrowserConnectionStatus.tsx │ │ ├── Prompt.tsx │ │ ├── hooks │ │ │ └── use-prompt │ │ │ ├── hooks │ │ │ │ └── use-instructions.ts │ │ │ ├── index.ts │ │ │ └── use-prompt.ts │ │ └── i18n │ │ ├── translations │ │ │ ├── actions.ts │ │ │ ├── common.ts │ │ │ ├── configurations.ts │ │ │ ├── footer.ts │ │ │ ├── header.ts │ │ │ ├── home.ts │ │ │ ├── index.ts │ │ │ ├── main.ts │ │ │ ├── modals.ts │ │ │ ├── prompt-field.ts │ │ │ ├── recent-donations.ts │ │ │ └── selected-files.ts │ │ └── use-translation.tsx │ └── types │ └── messages.ts └── settings ├── frontend │ ├── Home │ │ ├── Home.tsx │ │ ├── hooks │ │ │ └── use-scroll-to.ts │ │ └── sections │ │ └── ApiSection.tsx │ ├── Settings.tsx │ ├── hooks │ │ ├── use-api-configuration-editing.ts │ │ ├── use-provider-editing.ts │ │ ├── use-settings.ts │ │ └── use-web-configuration-editing.ts │ └── i18n │ └── translations │ ├── actions.ts │ ├── api.ts │ ├── common.ts │ ├── edit-provider-form.ts │ ├── edit-template-form.ts │ ├── general.ts │ ├── index.ts │ ├── sections.ts │ └── web.ts └── helpers └── open-settings.ts
1 parent 08d9dd1 commit 21285f3

18 files changed

Lines changed: 405 additions & 271 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
"command": "codeWebChat.settings",
311311
"title": "%codeWebChat.settings.title%",
312312
"category": "Code Web Chat",
313-
"icon": "$(settings-gear)"
313+
"icon": "$(gear)"
314314
},
315315
{
316316
"command": "codeWebChat.generateCommitMessage",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export const show_no_configurations_warning = async (
1414

1515
if (result === open_settings_label) {
1616
if (type == 'api') {
17-
open_settings.api.api_configurations()
17+
open_settings.api.models()
1818
} else {
19-
open_settings.web.web_configurations()
19+
open_settings.web.chatbots()
2020
}
2121
}
2222
}

‎apps/editor/src/views/prompt/backend/message-handlers/handle-manage-api-configurations.ts‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎apps/editor/src/views/prompt/backend/message-handlers/handle-voice-input.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export const handle_voice_input = async (
264264
const api_configurations = await providers_manager.get_api_configurations()
265265

266266
if (api_configurations.length == 0) {
267-
open_settings.api.api_configurations()
267+
open_settings.api.models()
268268
prompt_view_provider.send_message({
269269
command: 'RECORDING_STATE',
270270
is_recording: false

‎apps/editor/src/views/prompt/backend/message-handlers/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export * from './handle-focus-on-file-in-preview'
4141
export * from './handle-go-to-file'
4242
export * from './handle-toggle-file-in-preview'
4343
export * from './handle-patch-repair'
44-
export * from './handle-manage-api-configurations'
4544
export * from './handle-undo'
4645
export * from './handle-show-diff'
4746
export * from './handle-discard-user-changes-in-preview'

‎apps/editor/src/views/prompt/backend/prompt-view-provider.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import {
5656
handle_discard_user_changes_in_preview,
5757
handle_patch_repair,
5858
handle_response_preview,
59-
handle_manage_api_configurations,
6059
handle_undo,
6160
handle_request_can_undo,
6261
handle_preview_generated_code,
@@ -117,6 +116,7 @@ import { SharedContextState } from '@/context/shared-context-state'
117116
import { webview_html } from '@/views/shared/utils/webview-html'
118117
import { get_selected_files } from '@/context/helpers/get-selected-files'
119118
import { normalize_path } from '@/utils/normalize-path'
119+
import { open_settings } from '@/views/settings/helpers/open-settings'
120120
import { replace_symbols } from './utils/symbols/replace-symbols'
121121
import { SymbolCacheManager } from './utils/symbols/symbol-cache'
122122

@@ -768,8 +768,10 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
768768
prompt_view_provider: this,
769769
web_configuration_name: message.web_configuration_name
770770
})
771-
} else if (message.command == 'MANAGE_API_CONFIGURATIONS') {
772-
await handle_manage_api_configurations()
771+
} else if (message.command == 'MANAGE_MODELS') {
772+
open_settings.api.models()
773+
} else if (message.command == 'MANAGE_CHATBOTS') {
774+
open_settings.web.chatbots()
773775
} else if (message.command == 'PREVIEW_SWITCH_CHOICE') {
774776
if (this.preview_switch_choice_resolver) {
775777
this.preview_switch_choice_resolver(message.choice)

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,18 @@ export const Main: React.FC<Props> = (props) => {
311311
})
312312
}
313313

314+
const handle_manage_models = () => {
315+
post_message(props.vscode, {
316+
command: 'MANAGE_MODELS'
317+
})
318+
}
319+
320+
const handle_manage_chatbots = () => {
321+
post_message(props.vscode, {
322+
command: 'MANAGE_CHATBOTS'
323+
})
324+
}
325+
314326
const handle_toggle_pinned_api_configuration = (id: string) => {
315327
post_message(props.vscode, {
316328
command: 'TOGGLE_PINNED_API_CONFIGURATION',
@@ -484,6 +496,8 @@ export const Main: React.FC<Props> = (props) => {
484496
on_edit_api_configuration={handle_edit_api_configuration}
485497
on_delete_api_configuration={handle_delete_api_configuration}
486498
on_create_api_configuration={handle_create_api_configuration}
499+
on_manage_models={handle_manage_models}
500+
on_manage_chatbots={handle_manage_chatbots}
487501
on_at_sign_click={handle_at_sign_click}
488502
on_hash_sign_click={handle_hash_sign_click}
489503
on_slash_click={handle_slash_click}

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ type Props = {
5151
insertion_index?: number
5252
exact_insertion?: boolean
5353
}) => void
54+
on_manage_models: () => void
55+
on_manage_chatbots: () => void
5456
currently_open_file_path?: string
5557
current_selection?: SelectionState | null
5658
chat_history: string[]
@@ -280,6 +282,48 @@ export const MainView: React.FC<Props> = (props) => {
280282
}}
281283
/>
282284

285+
{props.target == TARGET.WEB &&
286+
props.is_connected &&
287+
props.web_configurations.length == 0 && (
288+
<>
289+
<UiStatusBar
290+
theme="warning"
291+
icon="codicon-warning"
292+
label={t('chatbots.missing-chatbot')}
293+
actions={[
294+
{
295+
id: 'settings',
296+
icon: 'codicon-gear',
297+
label: t('action.settings'),
298+
title: t('action.settings'),
299+
on_click: props.on_manage_chatbots
300+
}
301+
]}
302+
/>
303+
<UiSeparator height={4} />
304+
</>
305+
)}
306+
307+
{props.target == TARGET.API && props.api_configurations.length == 0 && (
308+
<>
309+
<UiStatusBar
310+
theme="warning"
311+
icon="codicon-warning"
312+
label={t('configurations.missing-model')}
313+
actions={[
314+
{
315+
id: 'settings',
316+
icon: 'codicon-gear',
317+
label: t('action.settings'),
318+
title: t('action.settings'),
319+
on_click: props.on_manage_models
320+
}
321+
]}
322+
/>
323+
<UiSeparator height={4} />
324+
</>
325+
)}
326+
283327
<UiSeparator height={2} />
284328

285329
{props.response_history.length > 0 &&

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
export const actions = {
2+
'action.settings': {
3+
en: 'Settings',
4+
pl: 'Ustawienia',
5+
'zh-cn': '设置',
6+
ja: '設定',
7+
'zh-tw': '設定',
8+
de: 'Einstellungen',
9+
es: 'Configuración',
10+
fr: 'Paramètres',
11+
'pt-br': 'Configurações',
12+
ru: 'Настройки',
13+
ko: '설정',
14+
it: 'Impostazioni',
15+
tr: 'Ayarlar',
16+
cs: 'Nastavení',
17+
hu: 'Beállítások',
18+
bg: 'Настройки'
19+
},
220
'action.add-new': {
321
en: 'Add New',
422
pl: 'Dodaj...',

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
export const configurations = {
2+
'configurations.missing-model': {
3+
en: 'Missing model',
4+
pl: 'Brak modelu',
5+
'zh-cn': '缺少模型',
6+
ja: 'モデルが不足しています',
7+
'zh-tw': '缺少模型',
8+
de: 'Fehlendes Modell',
9+
es: 'Falta modelo',
10+
fr: 'Modèle manquant',
11+
'pt-br': 'Modelo ausente',
12+
ru: 'Отсутствует модель',
13+
ko: '모델이 누락되었습니다',
14+
it: 'Modello mancante',
15+
tr: 'Eksik model',
16+
cs: 'Chybějící model',
17+
hu: 'Hiányzó modell',
18+
bg: 'Липсващ модел'
19+
},
220
'configurations.empty': {
321
en: 'No models created yet.',
422
pl: 'Nie utworzono jeszcze żadnych modeli.',
@@ -17,6 +35,24 @@ export const configurations = {
1735
hu: 'Még nincsenek modellek létrehozva.',
1836
bg: 'Все още няма създадени модели.'
1937
},
38+
'chatbots.missing-chatbot': {
39+
en: 'Missing chatbot',
40+
pl: 'Brak chatbota',
41+
'zh-cn': '缺少聊天机器人',
42+
ja: 'チャットボットが不足しています',
43+
'zh-tw': '缺少聊天機器人',
44+
de: 'Fehlender Chatbot',
45+
es: 'Falta chatbot',
46+
fr: 'Chatbot manquant',
47+
'pt-br': 'Chatbot ausente',
48+
ru: 'Отсутствует чат-бот',
49+
ko: '챗봇이 누락되었습니다',
50+
it: 'Chatbot mancante',
51+
tr: 'Eksik sohbet robotu',
52+
cs: 'Chybějící chatbot',
53+
hu: 'Hiányzó chatbot',
54+
bg: 'Липсващ чатбот'
55+
},
2056
'chatbots.empty': {
2157
en: 'No chatbots configured yet.',
2258
pl: 'Nie ustawiono jeszcze żadnych chatbotów.',

0 commit comments

Comments
 (0)