Skip to content

Commit ec47ec9

Browse files
committed
Update delete icon from "remove" to "trash" and consolidate configuration handlers into a unified get_configurations handler
1 parent 3b296cf commit ec47ec9

10 files changed

Lines changed: 99 additions & 248 deletions

‎packages/ui/src/components/editor/settings/ConfigurationsList/ConfigurationsList.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const ConfigurationsList: React.FC<ConfigurationsList.Props> = (
6060
<div className={styles['col-actions']}>
6161
{props.on_delete && (
6262
<IconButton
63-
codicon_icon="remove"
63+
codicon_icon="trash"
6464
title="Delete configuration"
6565
on_click={(e) => {
6666
e.stopPropagation()

‎packages/ui/src/components/editor/settings/ModelProviders/ModelProviders.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const ModelProviders: React.FC<ModelProviders.Props> = (props) => {
5858
/>
5959
)}
6060
<IconButton
61-
codicon_icon="remove"
61+
codicon_icon="trash"
6262
on_click={() => props.on_delete_provider(provider.name)}
6363
title="Delete provider"
6464
/>

‎packages/vscode/src/views/settings/backend/message-handlers/handle-get-code-completions-configurations.ts‎

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

‎packages/vscode/src/views/settings/backend/message-handlers/handle-get-commit-messages-configurations.ts‎

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { SettingsProvider } from '@/views/settings/backend/settings-provider'
2+
import {
3+
ModelProvidersManager,
4+
ToolConfig,
5+
get_tool_config_id
6+
} from '@/services/model-providers-manager'
7+
import { ConfigurationForClient } from '@/views/settings/types/messages'
8+
9+
const create_description = (config: ToolConfig): string => {
10+
const description_parts = [config.provider_name]
11+
if (config.temperature != null) {
12+
description_parts.push(`${config.temperature}`)
13+
}
14+
if (config.reasoning_effort) {
15+
description_parts.push(`${config.reasoning_effort}`)
16+
}
17+
return description_parts.join(' · ')
18+
}
19+
20+
export const handle_get_configurations = async (
21+
provider: SettingsProvider,
22+
type:
23+
| 'code-completions'
24+
| 'edit-context'
25+
| 'intelligent-update'
26+
| 'commit-messages'
27+
| 'prune-context'
28+
): Promise<void> => {
29+
const providers_manager = new ModelProvidersManager(provider.context)
30+
31+
let saved_configs: ToolConfig[] = []
32+
let default_config: ToolConfig | undefined
33+
let command: string
34+
35+
switch (type) {
36+
case 'code-completions':
37+
saved_configs =
38+
await providers_manager.get_code_completions_tool_configs()
39+
default_config =
40+
await providers_manager.get_default_code_completions_config()
41+
command = 'CODE_COMPLETIONS_CONFIGURATIONS'
42+
break
43+
case 'edit-context':
44+
saved_configs = await providers_manager.get_edit_context_tool_configs()
45+
command = 'EDIT_CONTEXT_CONFIGURATIONS'
46+
break
47+
case 'intelligent-update':
48+
saved_configs =
49+
await providers_manager.get_intelligent_update_tool_configs()
50+
default_config =
51+
await providers_manager.get_default_intelligent_update_config()
52+
command = 'INTELLIGENT_UPDATE_CONFIGURATIONS'
53+
break
54+
case 'commit-messages':
55+
saved_configs = await providers_manager.get_commit_messages_tool_configs()
56+
default_config =
57+
await providers_manager.get_default_commit_messages_config()
58+
command = 'COMMIT_MESSAGES_CONFIGURATIONS'
59+
break
60+
case 'prune-context':
61+
saved_configs = await providers_manager.get_prune_context_tool_configs()
62+
command = 'PRUNE_CONTEXT_CONFIGURATIONS'
63+
break
64+
}
65+
66+
const default_config_id = default_config
67+
? get_tool_config_id(default_config)
68+
: null
69+
70+
const configs_for_client: ConfigurationForClient[] = saved_configs.map(
71+
(config) => {
72+
return {
73+
id: get_tool_config_id(config),
74+
model: config.model,
75+
description: create_description(config),
76+
is_default: get_tool_config_id(config) === default_config_id
77+
}
78+
}
79+
)
80+
81+
provider.postMessage({
82+
command,
83+
configurations: configs_for_client
84+
} as any)
85+
}

‎packages/vscode/src/views/settings/backend/message-handlers/handle-get-edit-context-configurations.ts‎

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

‎packages/vscode/src/views/settings/backend/message-handlers/handle-get-intelligent-update-configurations.ts‎

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

‎packages/vscode/src/views/settings/backend/message-handlers/handle-get-prune-context-configurations.ts‎

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

‎packages/vscode/src/views/settings/backend/message-handlers/index.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,17 @@ export * from './handle-add-model-provider'
44
export * from './handle-delete-model-provider'
55
export * from './handle-edit-custom-model-provider'
66
export * from './handle-edit-model-provider-key'
7-
export * from './handle-get-code-completions-configurations'
87
export * from './handle-reorder-code-completions-configurations'
98
export * from './handle-set-default-code-completions-configuration'
10-
export * from './handle-get-commit-messages-configurations'
119
export * from './handle-reorder-commit-messages-configurations'
1210
export * from './handle-set-default-commit-messages-configuration'
13-
export * from './handle-get-edit-context-configurations'
1411
export * from './handle-reorder-edit-context-configurations'
1512
export * from './handle-get-edit-context-system-instructions'
1613
export * from './handle-update-edit-context-system-instructions'
1714
export * from './handle-get-edit-format-instructions'
1815
export * from './handle-update-edit-format-instructions'
19-
export * from './handle-get-intelligent-update-configurations'
2016
export * from './handle-reorder-intelligent-update-configurations'
2117
export * from './handle-set-default-intelligent-update-configuration'
22-
export * from './handle-get-prune-context-configurations'
2318
export * from './handle-reorder-prune-context-configurations'
2419
export * from './handle-get-commit-message-instructions'
2520
export * from './handle-update-commit-message-instructions'
@@ -44,3 +39,4 @@ export * from './handle-update-send-with-shift-enter'
4439
export * from './handle-get-check-new-files'
4540
export * from './handle-update-check-new-files'
4641
export * from './handle-delete-configuration'
42+
export * from './handle-get-configurations'

0 commit comments

Comments
 (0)