优化: AI模块(provider重试兼容+aichat交互+工具卡片可读化+diff高亮)

This commit is contained in:
2026-06-16 02:33:16 +08:00
parent d2cb38cdac
commit 10e4945e5a
26 changed files with 2337 additions and 332 deletions

View File

@@ -373,12 +373,14 @@ import { reactive, ref, computed, watch, onMounted, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { aiApi, knowledgeApi } from '@/api'
import { useAppSettingsStore } from '@/stores/appSettings'
import { useAiStore } from '@/stores/ai'
import { useConfirm } from '@/composables/useConfirm'
import type { AiProviderConfig } from '@/api/types'
import i18n from '@/i18n'
const { t } = useI18n()
const appSettings = useAppSettingsStore()
const aiStore = useAiStore()
// ============================================================
// AI 提供商 — 真实后端 CRUD
@@ -418,6 +420,8 @@ const providerForm = reactive({
async function loadProviders() {
try {
aiProviders.value = await aiApi.listProviders()
// 同步刷新全局 store(AiChat 等 AI 面板消费方共享同一 state,避免改完仍提示「未配置」)
await aiStore.loadProviders()
} catch (e) {
console.error(t('settings.toastLoadProviderFail'), e)
showToast(t('settings.toastLoadProviderFail'), 'error')