Skip to content

Commit 141a30e

Browse files
committed
Add an 'API Providers' option to the tool configuration quick pick menu for direct navigation to provider settings
1 parent 11c475f commit 141a30e

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

packages/vscode/src/commands/open-settings-command/setup-api-tool-multi-config.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { PROVIDERS } from '@shared/constants/providers'
1414
import { Logger } from '@/utils/logger'
1515
import { DEFAULT_TEMPERATURE, SupportedTool } from '@shared/constants/api-tools'
1616
import { COMMIT_MESSAGES_CONFIRMATION_THRESHOLD_STATE_KEY } from '@/constants/state-keys'
17+
import { api_providers } from './api-providers'
1718

1819
const DEFAULT_COMMIT_MESSAGE_MAX_TOKENS_BEFORE_ASK = 20000
1920

@@ -37,6 +38,7 @@ export const setup_api_tool_multi_config = async (params: {
3738
const CONFIRMATION_THRESHOLD_LABEL = 'Show file picker threshold'
3839

3940
const BACK_LABEL = '$(arrow-left) Back'
41+
const API_PROVIDERS_LABEL = '$(key) API Providers'
4042
const ADD_CONFIGURATION_LABEL = '$(add) Add configuration...'
4143
const SET_AS_DEFAULT_LABEL = '$(pass) Set as default'
4244
const UNSET_DEFAULT_LABEL = '$(pass-filled) Unset default'
@@ -146,10 +148,15 @@ export const setup_api_tool_multi_config = async (params: {
146148
const items: (vscode.QuickPickItem & {
147149
config?: ToolConfig
148150
index?: number
149-
})[] = [
150-
...(params.show_back_button !== false ? [{ label: BACK_LABEL }] : []),
151-
{ label: ADD_CONFIGURATION_LABEL }
152-
]
151+
})[] = []
152+
153+
if (params.show_back_button === false) {
154+
items.push({ label: API_PROVIDERS_LABEL })
155+
} else {
156+
items.push({ label: BACK_LABEL })
157+
}
158+
159+
items.push({ label: ADD_CONFIGURATION_LABEL })
153160

154161
if (current_configs.length > 0) {
155162
items.push({
@@ -269,6 +276,13 @@ export const setup_api_tool_multi_config = async (params: {
269276
return
270277
}
271278

279+
if (selected.label === API_PROVIDERS_LABEL) {
280+
quick_pick.hide()
281+
await api_providers(params.context)
282+
resolve(await show_configs_quick_pick())
283+
return
284+
}
285+
272286
if (selected.label == ADD_CONFIGURATION_LABEL) {
273287
quick_pick.hide()
274288
await add_configuration()

0 commit comments

Comments
 (0)