diff --git a/frontend/src/components/article/AISearchBar.vue b/frontend/src/components/article/AISearchBar.vue index 517f1f24c..97019445e 100644 --- a/frontend/src/components/article/AISearchBar.vue +++ b/frontend/src/components/article/AISearchBar.vue @@ -3,6 +3,7 @@ import { ref, computed } from 'vue'; import { useI18n } from 'vue-i18n'; import { PhMagnifyingGlass, PhX, PhSparkle, PhSpinner } from '@phosphor-icons/vue'; import type { Article } from '@/types/models'; +import { getAIErrorMessage } from '@/utils/aiError'; const { t } = useI18n(); @@ -37,7 +38,7 @@ async function performAISearch() { const data = await response.json(); if (!data.success) { - errorMessage.value = data.error || t('aiSearch.searchFailed'); + errorMessage.value = getAIErrorMessage(data, response.status); window.showToast(errorMessage.value, 'error'); return; } diff --git a/frontend/src/components/modals/settings/ai/AIProfileList.vue b/frontend/src/components/modals/settings/ai/AIProfileList.vue index ac0c3817b..f0a02e0c7 100644 --- a/frontend/src/components/modals/settings/ai/AIProfileList.vue +++ b/frontend/src/components/modals/settings/ai/AIProfileList.vue @@ -15,6 +15,7 @@ import type { AIProfile, AIProfileTestResult, AIProfileFormData } from '@/types/ import { useAIProfiles } from '@/composables/ai/useAIProfiles'; import { getProviderIconUrl } from '@/composables/ai/useAIProvider'; import AIProfileModal from './AIProfileModal.vue'; +import { getAIErrorMessage } from '@/utils/aiError'; const { t } = useI18n(); const { @@ -130,6 +131,11 @@ function getTestStatus(profileId: number): 'success' | 'error' | 'unknown' { if (!result) return 'unknown'; return result.config_valid && result.connection_success ? 'success' : 'error'; } + +function getTestError(profileId: number): string { + const result = testResults.value.get(profileId); + return result ? getAIErrorMessage(result) : ''; +}