From 7d0725dfc4af1f92d745ffda23dd355bc0e1f77a Mon Sep 17 00:00:00 2001 From: Triedge-sys Date: Wed, 27 Nov 2024 20:26:35 +0300 Subject: [PATCH] Revert "Merge pull request #5850 from code-october/fix-o1" This reverts commit 2623a9276388668d65f34e1ad2206bec55acde79, reversing changes made to 3932c594c71a4d52968c5bd19ab75cba2197ea76. --- app/api/openai.ts | 2 +- app/client/platforms/openai.ts | 4 ++-- app/components/emoji.tsx | 3 +-- app/config/server.ts | 5 ++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/api/openai.ts b/app/api/openai.ts index 2b5deca8be3..bbba69e569c 100644 --- a/app/api/openai.ts +++ b/app/api/openai.ts @@ -14,7 +14,7 @@ function getModels(remoteModelRes: OpenAIListModelResponse) { if (config.disableGPT4) { remoteModelRes.data = remoteModelRes.data.filter( (m) => - !(m.id.startsWith("gpt-4") || m.id.startsWith("chatgpt-4o") || m.id.startsWith("o1")) || + !(m.id.startsWith("gpt-4") || m.id.startsWith("chatgpt-4o")) || m.id.startsWith("gpt-4o-mini"), ); } diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index 15cfb7ca602..7c1588440b2 100644 --- a/app/client/platforms/openai.ts +++ b/app/client/platforms/openai.ts @@ -224,7 +224,7 @@ export class ChatGPTApi implements LLMApi { // O1 not support image, tools (plugin in ChatGPTNextWeb) and system, stream, logprobs, temperature, top_p, n, presence_penalty, frequency_penalty yet. requestPayload = { messages, - stream: options.config.stream, + stream: !isO1 ? options.config.stream : false, model: modelConfig.model, temperature: !isO1 ? modelConfig.temperature : 1, presence_penalty: !isO1 ? modelConfig.presence_penalty : 0, @@ -247,7 +247,7 @@ export class ChatGPTApi implements LLMApi { console.log("[Request] openai payload: ", requestPayload); - const shouldStream = !isDalle3 && !!options.config.stream; + const shouldStream = !isDalle3 && !!options.config.stream && !isO1; const controller = new AbortController(); options.onController?.(controller); diff --git a/app/components/emoji.tsx b/app/components/emoji.tsx index d75cdda9268..6db746c462c 100644 --- a/app/components/emoji.tsx +++ b/app/components/emoji.tsx @@ -37,8 +37,7 @@ export function Avatar(props: { model?: ModelType; avatar?: string }) { return (
{props.model?.startsWith("gpt-4") || - props.model?.startsWith("chatgpt-4o") || - props.model?.startsWith("o1") ? ( + props.model?.startsWith("chatgpt-4o") ? ( ) : ( diff --git a/app/config/server.ts b/app/config/server.ts index 9d6b3c2b8da..485f950da03 100644 --- a/app/config/server.ts +++ b/app/config/server.ts @@ -129,15 +129,14 @@ export const getServerSideConfig = () => { if (customModels) customModels += ","; customModels += DEFAULT_MODELS.filter( (m) => - (m.name.startsWith("gpt-4") || m.name.startsWith("chatgpt-4o") || m.name.startsWith("o1")) && + (m.name.startsWith("gpt-4") || m.name.startsWith("chatgpt-4o")) && !m.name.startsWith("gpt-4o-mini"), ) .map((m) => "-" + m.name) .join(","); if ( (defaultModel.startsWith("gpt-4") || - defaultModel.startsWith("chatgpt-4o") || - defaultModel.startsWith("o1")) && + defaultModel.startsWith("chatgpt-4o")) && !defaultModel.startsWith("gpt-4o-mini") ) defaultModel = "";