diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36c71f6cc6e1..23b1af90e939 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,89 @@
# Changelog
+## [Version 1.17.0](https://github.com/lobehub/lobe-chat/compare/v1.16.14...v1.17.0)
+
+Released on **2024-09-13**
+
+#### ✨ Features
+
+- **misc**: Support openai new OpenAI o1-preview/o1-mini models.
+
+#### 💄 Styles
+
+- **misc**: Support Google Model List.
+
+
+
+
+Improvements and Fixes
+
+#### What's improved
+
+- **misc**: Support openai new OpenAI o1-preview/o1-mini models, closes [#3943](https://github.com/lobehub/lobe-chat/issues/3943) ([61bfeb2](https://github.com/lobehub/lobe-chat/commit/61bfeb2))
+
+#### Styles
+
+- **misc**: Support Google Model List, closes [#3938](https://github.com/lobehub/lobe-chat/issues/3938) ([be4efc7](https://github.com/lobehub/lobe-chat/commit/be4efc7))
+
+
+
+
+
+[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
+
+
+
+### [Version 1.16.14](https://github.com/lobehub/lobe-chat/compare/v1.16.13...v1.16.14)
+
+Released on **2024-09-13**
+
+#### 💄 Styles
+
+- **model**: Remove `OpenAI` deprecated model.
+
+
+
+
+Improvements and Fixes
+
+#### Styles
+
+- **model**: Remove `OpenAI` deprecated model, closes [#3465](https://github.com/lobehub/lobe-chat/issues/3465) ([68a4fb2](https://github.com/lobehub/lobe-chat/commit/68a4fb2))
+
+
+
+
+
+[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
+
+
+
+### [Version 1.16.13](https://github.com/lobehub/lobe-chat/compare/v1.16.12...v1.16.13)
+
+Released on **2024-09-13**
+
+#### 💄 Styles
+
+- **misc**: Update siliconcloud model.
+
+
+
+
+Improvements and Fixes
+
+#### Styles
+
+- **misc**: Update siliconcloud model, closes [#3935](https://github.com/lobehub/lobe-chat/issues/3935) ([882e981](https://github.com/lobehub/lobe-chat/commit/882e981))
+
+
+
+
+
+[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
+
+
+
### [Version 1.16.12](https://github.com/lobehub/lobe-chat/compare/v1.16.11...v1.16.12)
Released on **2024-09-12**
diff --git a/docs/usage/agents/model.mdx b/docs/usage/agents/model.mdx
index 92c1dd37f18d..57f3504114c7 100644
--- a/docs/usage/agents/model.mdx
+++ b/docs/usage/agents/model.mdx
@@ -17,7 +17,6 @@ tags:
## ChatGPT
- **gpt-3.5-turbo**: Currently the fastest generating ChatGPT model, it is faster but may sacrifice some text quality, with a context length of 4k.
-- **gpt-3.5-turbo-16k**: Similar to gpt-4, the context limit is increased to 16k tokens, with a higher cost.
- **gpt-4**: ChatGPT 4.0 has improved language understanding and generation capabilities compared to 3.5. It can better understand context and context, and generate more accurate and natural responses. This is thanks to improvements in the GPT-4 model, including better language modeling and deeper semantic understanding, but it may be slower than other models, with a context length of 8k.
- **gpt-4-32k**: Similar to gpt-4, the context limit is increased to 32k tokens, with a higher cost.
diff --git a/docs/usage/agents/model.zh-CN.mdx b/docs/usage/agents/model.zh-CN.mdx
index e50608568283..95264e4f4e91 100644
--- a/docs/usage/agents/model.zh-CN.mdx
+++ b/docs/usage/agents/model.zh-CN.mdx
@@ -16,7 +16,6 @@ tags:
## ChatGPT
- **gpt-3.5-turbo**:目前最生成速度最快的 chatgpt 模型更快,但可能会牺牲一些生成文本的质量,上下文长度为 4k。
-- **gpt-3.5-turbo-16k**:同 gpt-4,上下文限制增加到 16k token,同时费率更高。
- **gpt-4**:ChatGPT 4.0 在语言理解和生成能力方面相对于 3.5 有所提升。它可以更好地理解上下文和语境,并生成更准确、自然的回答。这得益于 GPT-4 模型的改进,包括更好的语言建模和更深入的语义理解,但它的速度可能比其他模型慢,上下文长度为 8k。
- **gpt-4-32k**:同 gpt-4,上下文限制增加到 32k token,同时费率更高。
diff --git a/package.json b/package.json
index 23537154b079..a82658854fd0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@lobehub/chat",
- "version": "1.16.12",
+ "version": "1.17.0",
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
"keywords": [
"framework",
diff --git a/src/config/llm.ts b/src/config/llm.ts
index 56981d585d66..91ac88e70d50 100644
--- a/src/config/llm.ts
+++ b/src/config/llm.ts
@@ -28,6 +28,7 @@ export const getLLMConfig = () => {
ENABLED_GOOGLE: z.boolean(),
GOOGLE_API_KEY: z.string().optional(),
GOOGLE_PROXY_URL: z.string().optional(),
+ GOOGLE_MODEL_LIST: z.string().optional(),
ENABLED_MOONSHOT: z.boolean(),
MOONSHOT_API_KEY: z.string().optional(),
@@ -134,6 +135,7 @@ export const getLLMConfig = () => {
ENABLED_GOOGLE: !!process.env.GOOGLE_API_KEY,
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY,
GOOGLE_PROXY_URL: process.env.GOOGLE_PROXY_URL,
+ GOOGLE_MODEL_LIST: process.env.GOOGLE_MODEL_LIST,
ENABLED_PERPLEXITY: !!process.env.PERPLEXITY_API_KEY,
PERPLEXITY_API_KEY: process.env.PERPLEXITY_API_KEY,
diff --git a/src/config/modelProviders/openai.ts b/src/config/modelProviders/openai.ts
index f3bc737c86d3..7784b1290424 100644
--- a/src/config/modelProviders/openai.ts
+++ b/src/config/modelProviders/openai.ts
@@ -3,6 +3,34 @@ import { ModelProviderCard } from '@/types/llm';
// ref: https://platform.openai.com/docs/deprecations
const OpenAI: ModelProviderCard = {
chatModels: [
+ {
+ description:
+ 'o1-mini是一款针对编程、数学和科学应用场景而设计的快速、经济高效的推理模型。该模型具有128K上下文和2023年10月的知识截止日期。',
+ displayName: 'OpenAI o1-mini',
+ enabled: true,
+ id: 'o1-mini',
+ maxOutput: 65_536,
+ pricing: {
+ input: 3,
+ output: 12,
+ },
+ releasedAt: '2024-09-12',
+ tokens: 128_000,
+ },
+ {
+ description:
+ 'o1是OpenAI新的推理模型,适用于需要广泛通用知识的复杂任务。该模型具有128K上下文和2023年10月的知识截止日期。',
+ displayName: 'OpenAI o1-preview',
+ enabled: true,
+ id: 'o1-preview',
+ maxOutput: 32_768,
+ pricing: {
+ input: 15,
+ output: 60,
+ },
+ releasedAt: '2024-09-12',
+ tokens: 128_000,
+ },
{
description:
'GPT-4o mini是OpenAI在GPT-4 Omni之后推出的最新模型,支持图文输入并输出文本。作为他们最先进的小型模型,它比其他近期的前沿模型便宜很多,并且比GPT-3.5 Turbo便宜超过60%。它保持了最先进的智能,同时具有显著的性价比。GPT-4o mini在MMLU测试中获得了 82% 的得分,目前在聊天偏好上排名高于 GPT-4。',
@@ -253,43 +281,6 @@ const OpenAI: ModelProviderCard = {
},
tokens: 4096,
},
- {
- description:
- 'GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125', // Will be discontinued on September 13, 2024
-
- displayName: 'GPT-3.5 Turbo 16K',
- id: 'gpt-3.5-turbo-16k',
- legacy: true,
- pricing: {
- input: 3,
- output: 4,
- },
- tokens: 16_385,
- },
- {
- description:
- 'GPT-3.5 Turbo 是 OpenAI 的一款基础模型,结合了高效性和经济性,广泛用于文本生成、理解和分析,专为指导性提示进行调整,去除了与聊天相关的优化。',
- displayName: 'GPT-3.5 Turbo 0613',
- // Will be discontinued on September 13, 2024
- id: 'gpt-3.5-turbo-0613',
- legacy: true,
- pricing: {
- input: 1.5,
- output: 2,
- },
- tokens: 4096,
- },
- {
- description:
- 'GPT-3.5 Turbo 是 OpenAI 的一款基础模型,结合了高效性和经济性,广泛用于文本生成、理解和分析,专为指导性提示进行调整,去除了与聊天相关的优化。', // Will be discontinued on September 13, 2024
- id: 'gpt-3.5-turbo-16k-0613',
- legacy: true,
- pricing: {
- input: 3,
- output: 4,
- },
- tokens: 16_385,
- },
],
checkModel: 'gpt-4o-mini',
description:
diff --git a/src/config/modelProviders/siliconcloud.ts b/src/config/modelProviders/siliconcloud.ts
index e4660d62ebf7..103316d7dd9a 100644
--- a/src/config/modelProviders/siliconcloud.ts
+++ b/src/config/modelProviders/siliconcloud.ts
@@ -1,6 +1,6 @@
import { ModelProviderCard } from '@/types/llm';
-// ref :https://siliconflow.cn/zh-cn/models
+// ref :https://siliconflow.cn/zh-cn/pricing
const SiliconCloud: ModelProviderCard = {
chatModels: [
{
@@ -161,18 +161,12 @@ const SiliconCloud: ModelProviderCard = {
tokens: 32_768,
},
{
- description: 'LLaMA 3.1 405B 是预训练和指令调整的强大机型。',
+ description: 'LLaMA 3.1 405B 指令微调模型针对多语言对话场景进行了优化。',
displayName: 'Llama 3.1 405B',
enabled: true,
id: 'meta-llama/Meta-Llama-3.1-405B-Instruct',
tokens: 32_768,
},
- {
- description: 'Reflection Llama 3.1 通过Reflection-Tuning技术提升推理能力。',
- displayName: 'Reflection Llama 3.1 70B',
- id: 'mattshumer/Reflection-Llama-3.1-70B',
- tokens: 32_768,
- },
{
description: 'LLaMA 3 支持大容量文本生成和指令解析。',
displayName: 'Llama 3 70B',
@@ -180,13 +174,13 @@ const SiliconCloud: ModelProviderCard = {
tokens: 8192,
},
{
- description: 'Mistral 7B 是按需 fine-tuning的模型,为任务提供优化解答。',
+ description: 'Mistral 7B 指令微调模型针对对话场景进行了优化,可用于文本生成和对话任务。',
displayName: 'Mistral 7B',
id: 'mistralai/Mistral-7B-Instruct-v0.2',
tokens: 32_768,
},
{
- description: 'Mixtral 8x7B 是预训练的稀疏混合专家模型,用于通用性文本任务。',
+ description: 'Mixtral 8x7B 模型支持多语言输入和输出,可用于文本生成和对话任务。',
displayName: 'Mistral 8x7B',
id: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
tokens: 32_768,
@@ -194,7 +188,7 @@ const SiliconCloud: ModelProviderCard = {
],
checkModel: 'Qwen/Qwen2-1.5B-Instruct',
description:
- 'SiliconFlow 致力于加速 AGI,以惠及人类,通过易用与成本低的 GenAI 堆栈提升大规模 AI 效率。',
+ 'SiliconCloud,基于优秀开源基础模型的高性价比 GenAI 云服务',
id: 'siliconcloud',
modelList: { showModelFetcher: true },
modelsUrl: 'https://siliconflow.cn/zh-cn/models',
@@ -202,7 +196,7 @@ const SiliconCloud: ModelProviderCard = {
proxyUrl: {
placeholder: 'https://api.siliconflow.cn/v1',
},
- url: 'https://siliconflow.cn',
+ url: 'https://siliconflow.cn/zh-cn/siliconcloud',
};
export default SiliconCloud;
diff --git a/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap b/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap
index 40284cef6ce9..5a756077cdff 100644
--- a/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap
+++ b/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap
@@ -14,25 +14,10 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"tokens": 16385,
},
{
- "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
- "displayName": "GPT-3.5 Turbo 16K",
"id": "gpt-3.5-turbo-16k",
- "legacy": true,
- "pricing": {
- "input": 3,
- "output": 4,
- },
- "tokens": 16385,
},
{
- "description": "GPT-3.5 Turbo 是 OpenAI 的一款基础模型,结合了高效性和经济性,广泛用于文本生成、理解和分析,专为指导性提示进行调整,去除了与聊天相关的优化。",
"id": "gpt-3.5-turbo-16k-0613",
- "legacy": true,
- "pricing": {
- "input": 3,
- "output": 4,
- },
- "tokens": 16385,
},
{
"description": "最新的 GPT-4 Turbo 模型具备视觉功能。现在,视觉请求可以使用 JSON 模式和函数调用。 GPT-4 Turbo 是一个增强版本,为多模态任务提供成本效益高的支持。它在准确性和效率之间找到平衡,适合需要进行实时交互的应用程序场景。",
@@ -83,15 +68,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
"id": "gpt-3.5-turbo-0301",
},
{
- "description": "GPT-3.5 Turbo 是 OpenAI 的一款基础模型,结合了高效性和经济性,广泛用于文本生成、理解和分析,专为指导性提示进行调整,去除了与聊天相关的优化。",
- "displayName": "GPT-3.5 Turbo 0613",
"id": "gpt-3.5-turbo-0613",
- "legacy": true,
- "pricing": {
- "input": 1.5,
- "output": 2,
- },
- "tokens": 4096,
},
{
"description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
diff --git a/src/libs/agent-runtime/openai/index.ts b/src/libs/agent-runtime/openai/index.ts
index df222bb76a2c..61ca33aeb03f 100644
--- a/src/libs/agent-runtime/openai/index.ts
+++ b/src/libs/agent-runtime/openai/index.ts
@@ -1,8 +1,34 @@
-import { ModelProvider } from '../types';
+import { ChatStreamPayload, ModelProvider, OpenAIChatMessage } from '../types';
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
+// TODO: 临时写法,后续要重构成 model card 展示配置
+const o1Models = new Set(['o1-preview', 'o1-mini']);
+const truneO1Payload = (payload: ChatStreamPayload) => ({
+ ...payload,
+ frequency_penalty: 0,
+ messages: payload.messages.map((message: OpenAIChatMessage) => ({
+ ...message,
+ role: message.role === 'system' ? 'user' : message.role,
+ })),
+ presence_penalty: 0,
+ stream: false,
+ temperature: 1,
+ top_p: 1,
+});
+
export const LobeOpenAI = LobeOpenAICompatibleFactory({
baseURL: 'https://api.openai.com/v1',
+ chatCompletion: {
+ handlePayload: (payload) => {
+ const { model } = payload;
+
+ if (o1Models.has(model)) {
+ return truneO1Payload(payload) as any;
+ }
+
+ return { ...payload, stream: payload.stream ?? true };
+ },
+ },
debug: {
chatCompletion: () => process.env.DEBUG_OPENAI_CHAT_COMPLETION === '1',
},
diff --git a/src/server/globalConfig/index.ts b/src/server/globalConfig/index.ts
index 82d8a9e6d620..004eaead6666 100644
--- a/src/server/globalConfig/index.ts
+++ b/src/server/globalConfig/index.ts
@@ -6,6 +6,7 @@ import { getLLMConfig } from '@/config/llm';
import {
BedrockProviderCard,
FireworksAIProviderCard,
+ GoogleProviderCard,
GroqProviderCard,
NovitaProviderCard,
OllamaProviderCard,
@@ -39,6 +40,7 @@ export const getServerGlobalConfig = () => {
AWS_BEDROCK_MODEL_LIST,
ENABLED_GOOGLE,
+ GOOGLE_MODEL_LIST,
ENABLED_GROQ,
GROQ_MODEL_LIST,
@@ -128,7 +130,14 @@ export const getServerGlobalConfig = () => {
}),
},
- google: { enabled: ENABLED_GOOGLE },
+ google: {
+ enabled: ENABLED_GOOGLE,
+ enabledModels: extractEnabledModels(GOOGLE_MODEL_LIST),
+ serverModelCards: transformToChatModelCards({
+ defaultChatModels: GoogleProviderCard.chatModels,
+ modelString: GOOGLE_MODEL_LIST,
+ }),
+ },
groq: {
enabled: ENABLED_GROQ,
enabledModels: extractEnabledModels(GROQ_MODEL_LIST),
diff --git a/src/server/routers/edge/config/__snapshots__/index.test.ts.snap b/src/server/routers/edge/config/__snapshots__/index.test.ts.snap
index baeadb695787..edc43ccce92e 100644
--- a/src/server/routers/edge/config/__snapshots__/index.test.ts.snap
+++ b/src/server/routers/edge/config/__snapshots__/index.test.ts.snap
@@ -61,18 +61,6 @@ exports[`configRouter > getGlobalConfig > Model Provider env > OPENAI_MODEL_LIST
},
"tokens": 16385,
},
- {
- "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
- "displayName": "GPT-3.5 Turbo 16K",
- "enabled": true,
- "id": "gpt-3.5-turbo-16k",
- "legacy": true,
- "pricing": {
- "input": 3,
- "output": 4,
- },
- "tokens": 16385,
- },
{
"description": "GPT-4 提供了一个更大的上下文窗口,能够处理更长的文本输入,适用于需要广泛信息整合和数据分析的场景。",
"displayName": "GPT-4",
diff --git a/src/server/routers/edge/config/index.test.ts b/src/server/routers/edge/config/index.test.ts
index 8ec585f1f6ba..97468da95739 100644
--- a/src/server/routers/edge/config/index.test.ts
+++ b/src/server/routers/edge/config/index.test.ts
@@ -45,7 +45,7 @@ describe('configRouter', () => {
it('should work correct with gpt-4', async () => {
process.env.OPENAI_MODEL_LIST =
- '-all,+gpt-3.5-turbo-1106,+gpt-3.5-turbo,+gpt-3.5-turbo-16k,+gpt-4,+gpt-4-32k,+gpt-4-1106-preview,+gpt-4-vision-preview';
+ '-all,+gpt-3.5-turbo-1106,+gpt-3.5-turbo,+gpt-4,+gpt-4-32k,+gpt-4-1106-preview,+gpt-4-vision-preview';
const response = await router.getGlobalConfig();
diff --git a/src/store/user/slices/modelList/selectors/modelProvider.test.ts b/src/store/user/slices/modelList/selectors/modelProvider.test.ts
index 38e755741e0a..0aeaa7a67f93 100644
--- a/src/store/user/slices/modelList/selectors/modelProvider.test.ts
+++ b/src/store/user/slices/modelList/selectors/modelProvider.test.ts
@@ -49,7 +49,14 @@ describe('modelProviderSelectors', () => {
const s = merge(initialState, {}) as unknown as UserStore;
const result = modelProviderSelectors.getDefaultEnabledModelsById('openai')(s);
- expect(result).toEqual(['gpt-4o-mini', 'gpt-4o', 'gpt-4o-2024-08-06', 'chatgpt-4o-latest']);
+ expect(result).toEqual([
+ 'o1-mini',
+ 'o1-preview',
+ 'gpt-4o-mini',
+ 'gpt-4o',
+ 'gpt-4o-2024-08-06',
+ 'chatgpt-4o-latest',
+ ]);
});
it('should return undefined for a non-existing provider', () => {