fix(ai): 修复AI服务提供商配置逻辑

- 修复baseURL初始化逻辑,确保Ollama原生API正确设置
- 恢复被注释的服务提供商选择下拉框组件
- 恢复被注释的BaseURL输入框组件
- 保持OpenAI API密钥输入框仅在OpenAI模式下显示
This commit is contained in:
2026-02-27 23:36:17 +08:00
parent b272ad09ce
commit fb5e218b43

View File

@@ -22,9 +22,7 @@
const provider = ref<Provider>('ollama'); const provider = ref<Provider>('ollama');
// Default to Ollama native API when provider is ollama. // Default to Ollama native API when provider is ollama.
const baseURL = ref( const baseURL = ref(provider.value === OLLAMA_API_URL);
provider.value === 'openai' ? AI_API_URL : OLLAMA_API_URL
);
const apiKey = ref<string>(''); const apiKey = ref<string>('');
const modelLoading = ref(false); const modelLoading = ref(false);
@@ -255,23 +253,23 @@
/> />
<a-row :gutter="12"> <a-row :gutter="12">
<!-- <a-col :xs="24" :md="6">--> <a-col :xs="24" :md="6">
<!-- <a-select--> <a-select
<!-- v-model:value="provider"--> v-model:value="provider"
<!-- :options="[--> :options="[
<!-- { label: 'OpenAI兼容(/v1)', value: 'openai' },--> { label: 'OpenAI兼容(/v1)', value: 'openai' },
<!-- { label: 'Ollama原生(/api)', value: 'ollama' }--> { label: 'Ollama原生(/api)', value: 'ollama' }
<!-- ]"--> ]"
<!-- style="width: 100%"--> style="width: 100%"
<!-- />--> />
<!-- </a-col>--> </a-col>
<!-- <a-col :xs="24" :md="12">--> <a-col :xs="24" :md="12">
<!-- <a-input--> <a-input
<!-- v-model:value="baseURL"--> v-model:value="baseURL"
<!-- addon-before="BaseURL"--> addon-before="BaseURL"
<!-- placeholder="https://ai-api.websoft.top/api/v1"--> placeholder="https://ai-api.websoft.top/api/v1"
<!-- />--> />
<!-- </a-col>--> </a-col>
<a-col :xs="24" :md="12" v-if="provider === 'openai'"> <a-col :xs="24" :md="12" v-if="provider === 'openai'">
<a-input-password <a-input-password
v-model:value="apiKey" v-model:value="apiKey"