diff --git a/electron/preload/index.ts b/electron/preload/index.ts index 69e33f685..4647ab66a 100644 --- a/electron/preload/index.ts +++ b/electron/preload/index.ts @@ -100,7 +100,6 @@ const electronAPI = { 'channel:listConfigured', 'channel:setEnabled', 'channel:validate', - 'channel:validate', 'channel:validateCredentials', // WhatsApp 'channel:requestWhatsAppQr', diff --git a/src/pages/Skills/index.tsx b/src/pages/Skills/index.tsx index e7b903cc0..5c14dbe87 100644 --- a/src/pages/Skills/index.tsx +++ b/src/pages/Skills/index.tsx @@ -36,6 +36,9 @@ import type { Skill } from '@/types/skill'; import { useTranslation } from 'react-i18next'; import type { TFunction } from 'i18next'; +const INSTALL_ERROR_CODES = new Set(['installTimeoutError', 'installRateLimitError']); +const FETCH_ERROR_CODES = new Set(['fetchTimeoutError', 'fetchRateLimitError', 'timeoutError', 'rateLimitError']); +const SEARCH_ERROR_CODES = new Set(['searchTimeoutError', 'searchRateLimitError', 'timeoutError', 'rateLimitError']); @@ -585,7 +588,7 @@ export function Skills() { toast.success(t('toast.installed')); } catch (err) { const errorMessage = err instanceof Error ? err.message : String(err); - if (['installTimeoutError', 'installRateLimitError'].includes(errorMessage)) { + if (INSTALL_ERROR_CODES.has(errorMessage)) { toast.error(t(`toast.${errorMessage}`, { path: skillsDirPath }), { duration: 10000 }); } else { toast.error(t('toast.failedInstall') + ': ' + errorMessage); @@ -739,7 +742,7 @@ export function Skills() {