Skip to content

Commit 96587e2

Browse files
committed
Rename configuration references to api-configuration throughout the codebase for consistency
1 parent 17f156c commit 96587e2

35 files changed

Lines changed: 269 additions & 263 deletions

‎apps/editor/src/views/panel/backend/message-handlers/handle-code-at-cursor.ts‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const get_code_at_cursor_config = async (
2323
show_quick_pick: boolean = false,
2424
context: vscode.ExtensionContext,
2525
panel_provider: PanelProvider,
26-
config_id?: string
26+
api_configuration_id?: string
2727
): Promise<{ provider: Provider; config: ToolConfig } | undefined> => {
2828
const code_completions_configs =
2929
await api_providers_manager.get_tool_configs()
@@ -38,16 +38,16 @@ const get_code_at_cursor_config = async (
3838

3939
let selected_config: ToolConfig | null = null
4040

41-
if (config_id !== undefined) {
41+
if (api_configuration_id !== undefined) {
4242
selected_config =
4343
code_completions_configs.find(
44-
(c) => get_tool_config_id(c) == config_id
44+
(c) => get_tool_config_id(c) == api_configuration_id
4545
) || null
4646
if (selected_config && panel_provider) {
4747
panel_provider.send_message({
48-
command: 'SELECTED_CONFIGURATION_CHANGED',
48+
command: 'SELECTED_API_CONFIGURATION_CHANGED',
4949
prompt_type: 'code-at-cursor',
50-
id: config_id
50+
id: api_configuration_id
5151
})
5252
}
5353
} else if (!show_quick_pick) {
@@ -131,7 +131,7 @@ const get_code_at_cursor_config = async (
131131
if (other_configs.length > 0) {
132132
if (recent_configs.length > 0) {
133133
items.push({
134-
label: 'other configurations',
134+
label: 'other API configurations',
135135
kind: vscode.QuickPickItemKind.Separator
136136
})
137137
}
@@ -143,7 +143,7 @@ const get_code_at_cursor_config = async (
143143

144144
const quick_pick = vscode.window.createQuickPick()
145145
quick_pick.items = create_items()
146-
quick_pick.placeholder = 'Select code completions configuration'
146+
quick_pick.placeholder = 'Select code completions API configuration'
147147
quick_pick.matchOnDescription = true
148148

149149
const items = quick_pick.items as (vscode.QuickPickItem & { id: string })[]
@@ -179,7 +179,7 @@ const get_code_at_cursor_config = async (
179179

180180
if (panel_provider) {
181181
panel_provider.send_message({
182-
command: 'SELECTED_CONFIGURATION_CHANGED',
182+
command: 'SELECTED_API_CONFIGURATION_CHANGED',
183183
prompt_type: 'code-at-cursor',
184184
id: selected.id
185185
})
@@ -251,7 +251,7 @@ export const handle_code_at_cursor = async (
251251
message.use_quick_pick,
252252
panel_provider.context,
253253
panel_provider,
254-
message.config_id
254+
message.api_configuration_id
255255
)
256256

257257
if (!config_result) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { PanelProvider } from '../panel-provider'
2+
import { delete_api_configuration } from '@/views/utils/delete-api-configuration'
3+
4+
export const handle_delete_api_configuration = async (
5+
provider: PanelProvider,
6+
message: any
7+
): Promise<void> => {
8+
await delete_api_configuration({
9+
context: provider.context,
10+
api_configuration_id: message.api_configuration_id
11+
})
12+
}
13+

‎apps/editor/src/views/panel/backend/message-handlers/handle-delete-configuration.ts‎

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

‎apps/editor/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const get_edit_context_config = async (params: {
3232
show_quick_pick?: boolean
3333
context: vscode.ExtensionContext
3434
panel_provider: PanelProvider
35-
config_id?: string
35+
api_configuration_id?: string
3636
}): Promise<{ provider: Provider; config: ToolConfig } | undefined> => {
3737
const edit_context_configs =
3838
await params.api_providers_manager.get_tool_configs()
@@ -47,19 +47,19 @@ const get_edit_context_config = async (params: {
4747

4848
let selected_config: ToolConfig | null = null
4949

50-
if (params.config_id !== undefined) {
50+
if (params.api_configuration_id !== undefined) {
5151
selected_config =
5252
edit_context_configs.find(
53-
(c) => get_tool_config_id(c) == params.config_id
53+
(c) => get_tool_config_id(c) == params.api_configuration_id
5454
) || null
5555
if (selected_config) {
5656
let recents =
5757
params.context.workspaceState.get<string[]>(
5858
RECENTLY_USED_EDIT_CONTEXT_CONFIG_IDS_STATE_KEY
5959
) || []
6060
recents = [
61-
params.config_id,
62-
...recents.filter((id) => id != params.config_id)
61+
params.api_configuration_id,
62+
...recents.filter((id) => id != params.api_configuration_id)
6363
]
6464
params.context.workspaceState.update(
6565
RECENTLY_USED_EDIT_CONTEXT_CONFIG_IDS_STATE_KEY,
@@ -68,9 +68,9 @@ const get_edit_context_config = async (params: {
6868

6969
if (params.panel_provider) {
7070
params.panel_provider.send_message({
71-
command: 'SELECTED_CONFIGURATION_CHANGED',
71+
command: 'SELECTED_API_CONFIGURATION_CHANGED',
7272
prompt_type: 'edit-context',
73-
id: params.config_id
73+
id: params.api_configuration_id
7474
})
7575
}
7676
}
@@ -153,7 +153,7 @@ const get_edit_context_config = async (params: {
153153
if (other_configs.length > 0) {
154154
if (recent_configs.length > 0) {
155155
items.push({
156-
label: 'other configurations',
156+
label: 'other API configurations',
157157
kind: vscode.QuickPickItemKind.Separator
158158
})
159159
}
@@ -165,8 +165,8 @@ const get_edit_context_config = async (params: {
165165

166166
const quick_pick = vscode.window.createQuickPick<Item>()
167167
quick_pick.items = await create_items()
168-
quick_pick.title = 'Configurations'
169-
quick_pick.placeholder = 'Select configuration'
168+
quick_pick.title = 'API Configurations'
169+
quick_pick.placeholder = 'Select an API configuration'
170170
quick_pick.matchOnDescription = true
171171
quick_pick.buttons = [
172172
{
@@ -229,7 +229,7 @@ const get_edit_context_config = async (params: {
229229

230230
if (params.panel_provider) {
231231
params.panel_provider.send_message({
232-
command: 'SELECTED_CONFIGURATION_CHANGED',
232+
command: 'SELECTED_API_CONFIGURATION_CHANGED',
233233
prompt_type: 'edit-context',
234234
id: selected.id!
235235
})
@@ -336,7 +336,7 @@ export const handle_edit_context = async (
336336
return
337337
}
338338

339-
let current_config_id = message.config_id
339+
let current_api_configuration_id = message.api_configuration_id
340340
let should_show_quick_pick = message.use_quick_pick
341341

342342
while (true) {
@@ -345,7 +345,7 @@ export const handle_edit_context = async (
345345
show_quick_pick: should_show_quick_pick,
346346
context: panel_provider.context,
347347
panel_provider,
348-
config_id: current_config_id
348+
api_configuration_id: current_api_configuration_id
349349
})
350350

351351
if (!config_result) {
@@ -488,7 +488,7 @@ export const handle_edit_context = async (
488488
return
489489
} else {
490490
should_show_quick_pick = true
491-
current_config_id = undefined
491+
current_api_configuration_id = undefined
492492
}
493493
}
494494
}

‎apps/editor/src/views/panel/backend/message-handlers/handle-find-relevant-files.ts‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const get_find_relevant_files_config = async (params: {
2828
show_quick_pick?: boolean
2929
context: vscode.ExtensionContext
3030
panel_provider: PanelProvider
31-
config_id?: string
31+
api_configuration_id?: string
3232
}): Promise<{ provider: Provider; config: ToolConfig } | undefined> => {
3333
const find_relevant_files_configs =
3434
await params.api_providers_manager.get_tool_configs()
@@ -43,19 +43,19 @@ const get_find_relevant_files_config = async (params: {
4343

4444
let selected_config: ToolConfig | null = null
4545

46-
if (params.config_id !== undefined) {
46+
if (params.api_configuration_id !== undefined) {
4747
selected_config =
4848
find_relevant_files_configs.find(
49-
(c) => get_tool_config_id(c) == params.config_id
49+
(c) => get_tool_config_id(c) == params.api_configuration_id
5050
) || null
5151
if (selected_config) {
5252
let recents =
5353
params.context.workspaceState.get<string[]>(
5454
RECENTLY_USED_FIND_RELEVANT_FILES_CONFIG_IDS_STATE_KEY
5555
) || []
5656
recents = [
57-
params.config_id,
58-
...recents.filter((id) => id != params.config_id)
57+
params.api_configuration_id,
58+
...recents.filter((id) => id != params.api_configuration_id)
5959
]
6060
params.context.workspaceState.update(
6161
RECENTLY_USED_FIND_RELEVANT_FILES_CONFIG_IDS_STATE_KEY,
@@ -64,9 +64,9 @@ const get_find_relevant_files_config = async (params: {
6464

6565
if (params.panel_provider) {
6666
params.panel_provider.send_message({
67-
command: 'SELECTED_CONFIGURATION_CHANGED',
67+
command: 'SELECTED_API_CONFIGURATION_CHANGED',
6868
prompt_type: 'find-relevant-files',
69-
id: params.config_id
69+
id: params.api_configuration_id
7070
})
7171
}
7272
}
@@ -149,7 +149,7 @@ const get_find_relevant_files_config = async (params: {
149149
if (other_configs.length > 0) {
150150
if (recent_configs.length > 0) {
151151
items.push({
152-
label: 'other configurations',
152+
label: 'other API configurations',
153153
kind: vscode.QuickPickItemKind.Separator
154154
})
155155
}
@@ -161,8 +161,8 @@ const get_find_relevant_files_config = async (params: {
161161

162162
const quick_pick = vscode.window.createQuickPick<Item>()
163163
quick_pick.items = await create_items()
164-
quick_pick.title = 'Configurations'
165-
quick_pick.placeholder = 'Select configuration'
164+
quick_pick.title = 'API Configurations'
165+
quick_pick.placeholder = 'Select an API configuration'
166166
quick_pick.matchOnDescription = true
167167
quick_pick.buttons = [
168168
{
@@ -225,7 +225,7 @@ const get_find_relevant_files_config = async (params: {
225225

226226
if (params.panel_provider) {
227227
params.panel_provider.send_message({
228-
command: 'SELECTED_CONFIGURATION_CHANGED',
228+
command: 'SELECTED_API_CONFIGURATION_CHANGED',
229229
prompt_type: 'find-relevant-files',
230230
id: selected.id!
231231
})
@@ -333,7 +333,7 @@ export const handle_find_relevant_files = async (
333333
return
334334
}
335335

336-
let current_config_id = message.config_id
336+
let current_api_configuration_id = message.api_configuration_id
337337
let should_show_quick_pick = message.use_quick_pick
338338

339339
while (true) {
@@ -342,7 +342,7 @@ export const handle_find_relevant_files = async (
342342
show_quick_pick: should_show_quick_pick,
343343
context: panel_provider.context,
344344
panel_provider,
345-
config_id: current_config_id
345+
api_configuration_id: current_api_configuration_id
346346
})
347347

348348
if (!config_result) {
@@ -424,6 +424,7 @@ export const handle_find_relevant_files = async (
424424
}
425425

426426
should_show_quick_pick = true
427-
current_config_id = undefined
427+
current_api_configuration_id = undefined
428428
}
429429
}
430+

‎apps/editor/src/views/panel/backend/message-handlers/handle-get-collapsed-states.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const handle_get_collapsed_states = (panel_provider: PanelProvider) => {
1313
PRESETS_COLLAPSED_STATE_KEY,
1414
false
1515
),
16-
configurations_collapsed: panel_provider.context.globalState.get<boolean>(
16+
api_configurations_collapsed: panel_provider.context.globalState.get<boolean>(
1717
CONFIGURATIONS_COLLAPSED_STATE_KEY,
1818
false
1919
),

apps/editor/src/views/panel/backend/message-handlers/handle-manage-configurations.ts renamed to apps/editor/src/views/panel/backend/message-handlers/handle-manage-api-configurations.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as vscode from 'vscode'
22

3-
export const handle_manage_configurations = async (): Promise<void> => {
4-
await vscode.commands.executeCommand('codeWebChat.settings', 'configurations')
3+
export const handle_manage_api_configurations = async (): Promise<void> => {
4+
await vscode.commands.executeCommand('codeWebChat.settings', 'api-configurations')
55
}
6+

‎apps/editor/src/views/panel/backend/message-handlers/handle-save-component-collapsed-state.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const handle_save_component_collapsed_state = async (
1616
PRESETS_COLLAPSED_STATE_KEY,
1717
message.is_collapsed
1818
)
19-
} else if (message.component == 'configurations') {
19+
} else if (message.component == 'api-configurations') {
2020
await panel_provider.context.globalState.update(
2121
CONFIGURATIONS_COLLAPSED_STATE_KEY,
2222
message.is_collapsed

‎apps/editor/src/views/panel/backend/message-handlers/handle-toggle-pinned-api-configuration.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export const handle_toggle_pinned_api_configuration = async (
1010
panel_provider: PanelProvider,
1111
message: TogglePinnedApiConfigurationMessage
1212
): Promise<void> => {
13-
const { configuration_id } = message
13+
const { api_configuration_id } = message
1414
const providers_manager = new ModelProvidersManager(panel_provider.context)
1515
const configs = await providers_manager.get_tool_configs()
1616

17-
const config = configs.find((c) => get_tool_config_id(c) == configuration_id)
17+
const config = configs.find((c) => get_tool_config_id(c) == api_configuration_id)
1818
if (!config) return
1919

2020
config.is_pinned = !config.is_pinned

apps/editor/src/views/panel/backend/message-handlers/handle-upsert-configuration.ts renamed to apps/editor/src/views/panel/backend/message-handlers/handle-upsert-api-configuration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { PanelProvider } from '../panel-provider'
2-
import { upsert_configuration } from '@/views/utils/upsert-configuration/upsert-configuration'
2+
import { upsert_api_configuration } from '@/views/utils/upsert-api-configuration/upsert-api-configuration'
33

4-
export const handle_upsert_configuration = async (
4+
export const handle_upsert_api_configuration = async (
55
provider: PanelProvider,
66
message: any
77
): Promise<void> => {
8-
await upsert_configuration({
8+
await upsert_api_configuration({
99
context: provider.context,
1010
tool_type: message.tool_type,
11-
configuration_id: message.configuration_id,
11+
api_configuration_id: message.api_configuration_id,
1212
duplicate_from_id: message.duplicate_from_id,
1313
create_on_top: message.create_on_top,
1414
insertion_index: message.insertion_index

0 commit comments

Comments
 (0)