Skip to content

Commit 4fd05ca

Browse files
committed
Add default web configuration selection for Patch Repair
- add the ability to set default chatbot for 'patch repair' ├── apps │ └── editor │ ├── package.json │ └── src │ ├── commands │ │ ├── apply-response-command │ │ │ ├── apply-response-command.ts │ │ │ ├── response-processor │ │ │ │ └── handlers │ │ │ │ └── patch-repair-handler.ts │ │ │ ├── types │ │ │ │ └── original-file-state.ts │ │ │ └── utils │ │ │ ├── preview │ │ │ │ ├── build-history-files.ts │ │ │ │ ├── file-preparer.ts │ │ │ │ ├── preview.ts │ │ │ │ └── workspace-listener.ts │ │ │ └── response-parser │ │ │ ├── parsers │ │ │ │ └── patch-repair-parser │ │ │ │ └── patch-repair-parser.ts │ │ │ └── response-parser.ts │ │ └── code-at-cursor-command │ │ ├── code-at-cursor-commands.ts │ │ ├── index.ts │ │ └── utils │ │ ├── get-code-at-cursor-config.ts │ │ ├── perform-code-at-cursor.ts │ │ └── show-ghost-text.ts │ ├── constants │ │ ├── instructions.ts │ │ └── state-keys.ts │ ├── features │ │ └── search-files │ │ ├── index.ts │ │ ├── search-files.ts │ │ ├── search-modes │ │ │ ├── perform-intelligent-search-mode.ts │ │ │ ├── perform-keywords-search-mode.ts │ │ │ └── perform-phrase-search-mode.ts │ │ └── utils │ │ ├── analyze-files.ts │ │ ├── check-matches-condition.ts │ │ ├── create-search-regex.ts │ │ ├── prompt-for-config.ts │ │ ├── prompt-for-intelligent-search-results.ts │ │ ├── prompt-for-keywords-match-mode.ts │ │ ├── prompt-for-keywords-target.ts │ │ ├── prompt-for-search-mode.ts │ │ ├── prompt-for-search-results.ts │ │ ├── prompt-for-search-term.ts │ │ ├── prompt-for-shrink-mode.ts │ │ ├── search-files-by-intelligent.ts │ │ ├── search-files-by-keywords.ts │ │ ├── search-files-by-phrase.ts │ │ └── show-search-results-quick-pick.ts │ ├── i18n │ │ └── translations │ │ └── common.ts │ ├── services │ │ └── providers-manager.ts │ ├── utils │ │ ├── cli-configuration-format-converters.ts │ │ └── web-configuration-format-converters.ts │ └── views │ ├── prompt │ │ ├── backend │ │ │ ├── message-handlers │ │ │ │ ├── handle-cancel-intelligent-update-file-in-preview.ts │ │ │ │ ├── handle-patch-repair.ts │ │ │ │ └── utils │ │ │ │ └── patch-repair-utils.ts │ │ │ └── prompt-view-provider.ts │ │ ├── frontend │ │ │ ├── Prompt.tsx │ │ │ └── hooks │ │ │ └── use-preview-manager.ts │ │ └── types │ │ └── messages.ts │ ├── settings │ │ ├── backend │ │ │ ├── message-handlers │ │ │ │ ├── handle-get-api-configurations.ts │ │ │ │ ├── handle-get-cli-configurations.ts │ │ │ │ ├── handle-get-web-configurations.ts │ │ │ │ ├── handle-select-default-api-configuration.ts │ │ │ │ ├── handle-select-default-cli-configuration.ts │ │ │ │ ├── handle-select-default-web-configuration.ts │ │ │ │ ├── handle-set-default-api-configuration.ts │ │ │ │ ├── handle-set-default-cli-configuration.ts │ │ │ │ ├── handle-set-default-web-configuration.ts │ │ │ │ └── index.ts │ │ │ └── settings-view-provider.ts │ │ ├── frontend │ │ │ ├── Home │ │ │ │ ├── Home.tsx │ │ │ │ └── sections │ │ │ │ ├── ApiSection.tsx │ │ │ │ ├── CliSection.tsx │ │ │ │ └── WebSection.tsx │ │ │ ├── Settings.tsx │ │ │ ├── hooks │ │ │ │ ├── use-settings.ts │ │ │ │ └── use-web-configuration-editing.ts │ │ │ └── i18n │ │ │ └── translations │ │ │ ├── api.ts │ │ │ ├── cli.ts │ │ │ └── web.ts │ │ └── types │ │ └── messages.ts │ └── shared │ └── actions │ └── api │ └── update │ └── update.ts └── packages ├── shared │ └── src │ └── types │ └── file-in-preview.ts └── ui └── src └── components └── editor └── prompt └── ResponsePreview ├── ResponsePreview.tsx └── components └── FileItem └── FileItem.tsx
1 parent 58f184f commit 4fd05ca

8 files changed

Lines changed: 59 additions & 1 deletion

File tree

‎apps/editor/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,9 @@
11211121
},
11221122
"isDefaultForIntelligentSearch": {
11231123
"type": "boolean"
1124+
},
1125+
"isDefaultForPatchRepair": {
1126+
"type": "boolean"
11241127
}
11251128
}
11261129
}

‎apps/editor/src/utils/web-configuration-format-converters.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type ConfigWebConfigurationFormat = {
1313
isPinned?: boolean
1414
isDefaultForCodeAtCursor?: boolean
1515
isDefaultForIntelligentSearch?: boolean
16+
isDefaultForPatchRepair?: boolean
1617
}
1718

1819
export const config_web_configuration_to_ui_format = (

‎apps/editor/src/views/prompt/backend/message-handlers/handle-patch-repair.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,13 @@ export const handle_patch_repair = async (params: {
273273

274274
let selected_web_configuration_name: string | undefined
275275

276-
if (valid_web_configurations.length == 1) {
276+
const default_web_config = valid_web_configurations.find(
277+
(c) => c.isDefaultForPatchRepair
278+
)
279+
280+
if (default_web_config) {
281+
selected_web_configuration_name = default_web_config.name
282+
} else if (valid_web_configurations.length == 1) {
277283
selected_web_configuration_name = valid_web_configurations[0].name
278284
} else {
279285
const recents_key = get_last_used_web_configuration_key('patch-repair')

‎apps/editor/src/views/settings/backend/message-handlers/handle-get-web-configurations.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export const handle_get_web_configurations = async (
3737
'code-at-cursor':
3838
web_configurations_config.find((c: any) => c.isDefaultForCodeAtCursor)
3939
?.name || null,
40+
'patch-repair':
41+
web_configurations_config.find((c: any) => c.isDefaultForPatchRepair)
42+
?.name || null,
4043
'intelligent-search':
4144
web_configurations_config.find(
4245
(c: any) => c.isDefaultForIntelligentSearch

‎apps/editor/src/views/settings/backend/message-handlers/handle-select-default-web-configuration.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ export const handle_select_default_web_configuration = async (
8585
} else {
8686
delete new_c.isDefaultForCodeAtCursor
8787
}
88+
} else if (message.web_feature == 'patch-repair') {
89+
if (c.name == selected.web_configuration_name) {
90+
new_c.isDefaultForPatchRepair = true
91+
} else {
92+
delete new_c.isDefaultForPatchRepair
93+
}
8894
} else if (message.web_feature == 'intelligent-search') {
8995
if (c.name == selected.web_configuration_name) {
9096
new_c.isDefaultForIntelligentSearch = true

‎apps/editor/src/views/settings/backend/message-handlers/handle-set-default-web-configuration.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export const handle_set_default_web_configuration = async (
1414
} else {
1515
delete new_c.isDefaultForCodeAtCursor
1616
}
17+
} else if (message.web_feature == 'patch-repair') {
18+
if (c.name == message.web_configuration_name) {
19+
new_c.isDefaultForPatchRepair = true
20+
} else {
21+
delete new_c.isDefaultForPatchRepair
22+
}
1723
} else if (message.web_feature == 'intelligent-search') {
1824
if (c.name == message.web_configuration_name) {
1925
new_c.isDefaultForIntelligentSearch = true

‎apps/editor/src/views/settings/frontend/Home/sections/WebSection.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,21 @@ export const WebSection = forwardRef<HTMLDivElement, Props>((props, ref) => {
361361
unset: t('chatbots.configurations.action.unset-default')
362362
}}
363363
/>
364+
<DefaultConfigurationSelector
365+
title={t('web.default-configurations.tool.patch-repair')}
366+
value={props.web_defaults['patch-repair'] || null}
367+
configurations={selector_configurations}
368+
on_unset={() =>
369+
props.on_set_default_web_configuration('patch-repair', null)
370+
}
371+
on_select={() =>
372+
props.on_select_default_web_configuration('patch-repair')
373+
}
374+
translations={{
375+
select: t('chatbots.configurations.action.select-default'),
376+
unset: t('chatbots.configurations.action.unset-default')
377+
}}
378+
/>
364379
<DefaultConfigurationSelector
365380
title={t('web.default-configurations.tool.intelligent-search')}
366381
value={props.web_defaults['intelligent-search'] || null}

‎apps/editor/src/views/settings/frontend/i18n/translations/web.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,24 @@ export const translations = {
315315
hu: 'Kód a kurzornál',
316316
bg: 'Код при курсора'
317317
},
318+
'web.default-configurations.tool.patch-repair': {
319+
en: 'Patch Repair',
320+
pl: 'Naprawa patchy',
321+
'zh-cn': '智能更新',
322+
ja: 'インテリジェントアップデート',
323+
'zh-tw': '智慧更新',
324+
de: 'Intelligentes Update',
325+
es: 'Actualización inteligente',
326+
fr: 'Mise à jour intelligente',
327+
'pt-br': 'Atualização Inteligente',
328+
ru: 'Умное обновление',
329+
ko: '지능형 업데이트',
330+
it: 'Aggiornamento intelligente',
331+
tr: 'Akıllı Güncelleme',
332+
cs: 'Inteligentní aktualizace',
333+
hu: 'Intelligens Frissítés',
334+
bg: 'Интелигентно актуализиране'
335+
},
318336
'web.default-configurations.tool.intelligent-search': {
319337
en: 'Intelligent Search',
320338
pl: 'Wyszukiwanie inteligentne',

0 commit comments

Comments
 (0)