From 5cb67e00a6a37c4e44a7748818a2e093f66dfa46 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Tue, 3 Sep 2024 20:03:09 +0800 Subject: [PATCH] feat: change default provider --- src/renderer/src/config/models.ts | 64 +++++++++---------- .../src/pages/home/Messages/Message.tsx | 4 +- src/renderer/src/store/llm.ts | 56 ++++++++-------- 3 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/renderer/src/config/models.ts b/src/renderer/src/config/models.ts index f96808a2..e63f131d 100644 --- a/src/renderer/src/config/models.ts +++ b/src/renderer/src/config/models.ts @@ -5,6 +5,38 @@ const EMBEDDING_REGEX = /embedding/i export const SYSTEM_MODELS: Record = { ollama: [], + silicon: [ + { + id: 'Qwen/Qwen2-7B-Instruct', + provider: 'silicon', + name: 'Qwen2-7B-Instruct', + group: 'Qwen2' + }, + { + id: 'Qwen/Qwen2-72B-Instruct', + provider: 'silicon', + name: 'Qwen2-72B-Instruct', + group: 'Qwen2' + }, + { + id: 'THUDM/glm-4-9b-chat', + provider: 'silicon', + name: 'GLM-4-9B-Chat', + group: 'GLM' + }, + { + id: 'deepseek-ai/DeepSeek-V2-Chat', + provider: 'silicon', + name: 'DeepSeek-V2-Chat', + group: 'DeepSeek' + }, + { + id: 'deepseek-ai/DeepSeek-Coder-V2-Instruct', + provider: 'silicon', + name: 'DeepSeek-Coder-V2-Instruct', + group: 'DeepSeek' + } + ], openai: [ { id: 'gpt-4o', @@ -71,38 +103,6 @@ export const SYSTEM_MODELS: Record = { group: 'Claude 3' } ], - silicon: [ - { - id: 'Qwen/Qwen2-7B-Instruct', - provider: 'silicon', - name: 'Qwen2-7B-Instruct', - group: 'Qwen2' - }, - { - id: 'Qwen/Qwen2-72B-Instruct', - provider: 'silicon', - name: 'Qwen2-72B-Instruct', - group: 'Qwen2' - }, - { - id: 'THUDM/glm-4-9b-chat', - provider: 'silicon', - name: 'GLM-4-9B-Chat', - group: 'GLM' - }, - { - id: 'deepseek-ai/DeepSeek-V2-Chat', - provider: 'silicon', - name: 'DeepSeek-V2-Chat', - group: 'DeepSeek' - }, - { - id: 'deepseek-ai/DeepSeek-Coder-V2-Instruct', - provider: 'silicon', - name: 'DeepSeek-Coder-V2-Instruct', - group: 'DeepSeek' - } - ], deepseek: [ { id: 'deepseek-chat', diff --git a/src/renderer/src/pages/home/Messages/Message.tsx b/src/renderer/src/pages/home/Messages/Message.tsx index 915855cc..6f467c85 100644 --- a/src/renderer/src/pages/home/Messages/Message.tsx +++ b/src/renderer/src/pages/home/Messages/Message.tsx @@ -110,10 +110,10 @@ const MessageItem: FC = ({ message, index, showMenu, onDeleteMessage }) = if (message.status === 'error') { return ( {t('error.chat.response')}} description={} type="error" - style={{ marginBottom: 15 }} + style={{ marginBottom: 15, padding: 10, fontSize: 12 }} /> ) } diff --git a/src/renderer/src/store/llm.ts b/src/renderer/src/store/llm.ts index dc25672f..81fe0d41 100644 --- a/src/renderer/src/store/llm.ts +++ b/src/renderer/src/store/llm.ts @@ -19,25 +19,25 @@ export interface LlmState { } const initialState: LlmState = { - defaultModel: SYSTEM_MODELS.openai[0], - topicNamingModel: SYSTEM_MODELS.openai[0], - translateModel: SYSTEM_MODELS.openai[0], + defaultModel: SYSTEM_MODELS.silicon[0], + topicNamingModel: SYSTEM_MODELS.silicon[0], + translateModel: SYSTEM_MODELS.silicon[0], providers: [ { - id: 'openai', - name: 'OpenAI', + id: 'silicon', + name: 'Silicon', apiKey: '', - apiHost: 'https://api.openai.com', - models: SYSTEM_MODELS.openai, + apiHost: 'https://api.siliconflow.cn', + models: SYSTEM_MODELS.silicon, isSystem: true, enabled: true }, { - id: 'gemini', - name: 'Gemini', + id: 'ollama', + name: 'Ollama', apiKey: '', - apiHost: 'https://generativelanguage.googleapis.com', - models: SYSTEM_MODELS.gemini, + apiHost: 'http://localhost:11434/v1/', + models: SYSTEM_MODELS.ollama, isSystem: true, enabled: false }, @@ -51,20 +51,20 @@ const initialState: LlmState = { enabled: false }, { - id: 'ollama', - name: 'Ollama', + id: 'openai', + name: 'OpenAI', apiKey: '', - apiHost: 'http://localhost:11434/v1/', - models: SYSTEM_MODELS.ollama, + apiHost: 'https://api.openai.com', + models: SYSTEM_MODELS.openai, isSystem: true, enabled: false }, { - id: 'silicon', - name: 'Silicon', + id: 'gemini', + name: 'Gemini', apiKey: '', - apiHost: 'https://api.siliconflow.cn', - models: SYSTEM_MODELS.silicon, + apiHost: 'https://generativelanguage.googleapis.com', + models: SYSTEM_MODELS.gemini, isSystem: true, enabled: false }, @@ -149,15 +149,6 @@ const initialState: LlmState = { isSystem: true, enabled: false }, - { - id: 'aihubmix', - name: 'AiHubMix', - apiKey: '', - apiHost: 'https://aihubmix.com', - models: SYSTEM_MODELS.aihubmix, - isSystem: true, - enabled: false - }, { id: 'graphrag-kylin-mountain', name: 'GraphRAG', @@ -184,6 +175,15 @@ const initialState: LlmState = { models: SYSTEM_MODELS.groq, isSystem: true, enabled: false + }, + { + id: 'aihubmix', + name: 'AiHubMix', + apiKey: '', + apiHost: 'https://aihubmix.com', + models: SYSTEM_MODELS.aihubmix, + isSystem: true, + enabled: false } ], settings: {