fix(frontend): test selected model provider only

This commit is contained in:
2026-07-09 23:29:44 +08:00
parent 2ff022c48a
commit 28de48b8a5
+8 -5
View File
@@ -571,11 +571,10 @@ const filteredProviders = computed(() => {
const activeProvider = computed<ProviderView>( const activeProvider = computed<ProviderView>(
() => providers.value.find((item) => item.providerCode === selectedProviderCode.value) ?? providers.value[0] ?? seedProviders[0] () => providers.value.find((item) => item.providerCode === selectedProviderCode.value) ?? providers.value[0] ?? seedProviders[0]
); );
const activeChatModel = computed( const activeChatModel = computed(() =>
() => modelRows.value.find(
modelRows.value.find((item) => item.category === 'chat' && item.enabled && item.configured) ?? (item) => item.id > 0 && item.providerCode === selectedProviderCode.value && item.category === 'chat' && item.enabled && item.configured
modelRows.value.find((item) => item.category === 'chat' && item.enabled) ?? )
modelRows.value[0]
); );
const keyText = computed(() => { const keyText = computed(() => {
if (!activeProvider.value.configured) return '未配置'; if (!activeProvider.value.configured) return '未配置';
@@ -681,6 +680,10 @@ const runVectorRebuild = async () => {
}; };
const runConnectionTest = async () => { const runConnectionTest = async () => {
if (!activeChatModel.value) {
ElMessage.warning('请先为当前供应商配置并启用 chat 模型');
return;
}
testing.value = true; testing.value = true;
try { try {
const result = await testModelChat({ const result = await testModelChat({