refactor(llm): merge preset selection into base URL field

Use a single editable Base URL combobox for LLM providers so preset endpoints and manual input share one field, with preset types shown as subtitles.
This commit is contained in:
jxxghp
2026-05-03 11:30:19 +08:00
parent a40e52079f
commit aa49c6ccbc
6 changed files with 29 additions and 34 deletions

View File

@@ -21,6 +21,12 @@ export interface LlmProviderUrlPreset {
value: string
}
export interface LlmProviderUrlPresetItem {
title: string
value: string
subtitle?: string
}
export interface LlmProvider {
id: string
name: string
@@ -102,10 +108,11 @@ export function useLlmProviderDirectory(options: UseLlmProviderDirectoryOptions)
() => models.value.find(item => item.id === normalizeValue(options.model.value)) || null,
)
const providerItems = computed(() => providers.value.map(item => ({ title: item.name, value: item.id })))
const baseUrlPresetItems = computed(() =>
const baseUrlPresetItems = computed<LlmProviderUrlPresetItem[]>(() =>
(selectedProvider.value?.base_url_presets || []).map(item => ({
title: item.label,
title: item.value,
value: item.value,
subtitle: item.label,
})),
)
const providerConnected = computed(() => Boolean(selectedProvider.value?.auth_status?.connected))