diff --git a/src/config/__tests__/app.test.ts b/src/config/__tests__/app.test.ts index dc1d23475eb40..68e7cc33677e9 100644 --- a/src/config/__tests__/app.test.ts +++ b/src/config/__tests__/app.test.ts @@ -24,7 +24,7 @@ describe('getServerConfig', () => { describe('index url', () => { it('should return default URLs when no environment variables are set', () => { const config = getAppConfig(); - expect(config.AGENTS_INDEX_URL).toBe('https://chat-agents.lobehub.com'); + expect(config.AGENTS_INDEX_URL).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); expect(config.PLUGINS_INDEX_URL).toBe('https://chat-plugins.lobehub.com'); }); @@ -41,7 +41,7 @@ describe('getServerConfig', () => { process.env.PLUGINS_INDEX_URL = ''; const config = getAppConfig(); - expect(config.AGENTS_INDEX_URL).toBe('https://chat-agents.lobehub.com'); + expect(config.AGENTS_INDEX_URL).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); expect(config.PLUGINS_INDEX_URL).toBe('https://chat-plugins.lobehub.com'); }); }); diff --git a/src/config/app.ts b/src/config/app.ts index 33ad1f0afab82..dd9ee235bf61d 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -23,6 +23,11 @@ if (typeof window === 'undefined' && isServerMode && !APP_URL) { throw new Error('`APP_URL` is required in server mode'); } +const ASSISTANT_INDEX_URL = + 'https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'; + +const PLUGINS_INDEX_URL = 'https://chat-plugins.lobehub.com'; + export const getAppConfig = () => { const ACCESS_CODES = process.env.ACCESS_CODE?.split(',').filter(Boolean) || []; @@ -60,14 +65,14 @@ export const getAppConfig = () => { AGENTS_INDEX_URL: !!process.env.AGENTS_INDEX_URL ? process.env.AGENTS_INDEX_URL - : 'https://chat-agents.lobehub.com', + : ASSISTANT_INDEX_URL, DEFAULT_AGENT_CONFIG: process.env.DEFAULT_AGENT_CONFIG || '', SYSTEM_AGENT: process.env.SYSTEM_AGENT, PLUGINS_INDEX_URL: !!process.env.PLUGINS_INDEX_URL ? process.env.PLUGINS_INDEX_URL - : 'https://chat-plugins.lobehub.com', + : PLUGINS_INDEX_URL, PLUGIN_SETTINGS: process.env.PLUGIN_SETTINGS, diff --git a/src/server/modules/AssistantStore/index.test.ts b/src/server/modules/AssistantStore/index.test.ts index 975bb67190f8f..fcde5c052d5c3 100644 --- a/src/server/modules/AssistantStore/index.test.ts +++ b/src/server/modules/AssistantStore/index.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'; import { AssistantStore } from './index'; -const baseURL = 'https://chat-agents.lobehub.com'; +const baseURL = 'https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'; describe('AssistantStore', () => { it('should return the default index URL when no language is provided', () => { const agentMarket = new AssistantStore(); @@ -14,19 +14,19 @@ describe('AssistantStore', () => { it('should return the index URL for a not supported language', () => { const agentMarket = new AssistantStore(); const url = agentMarket.getAgentIndexUrl('xxx' as any); - expect(url).toBe('https://chat-agents.lobehub.com'); + expect(url).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); }); it('should return the zh-CN URL for zh locale', () => { const agentMarket = new AssistantStore(); const url = agentMarket.getAgentIndexUrl('zh' as any); - expect(url).toBe('https://chat-agents.lobehub.com/index.zh-CN.json'); + expect(url).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public/index.zh-CN.json'); }); it('should return the default URL for en locale', () => { const agentMarket = new AssistantStore(); const url = agentMarket.getAgentIndexUrl('en' as any); - expect(url).toBe('https://chat-agents.lobehub.com'); + expect(url).toBe('https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public'); }); it('should return the base URL if the provided language is not supported', () => {