Skip to content

Commit 2623a92

Browse files
authored
Merge pull request ChatGPTNextWeb#5850 from code-october/fix-o1
Fix o1
2 parents 3932c59 + ef24d3e commit 2623a92

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

app/api/openai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function getModels(remoteModelRes: OpenAIListModelResponse) {
1414
if (config.disableGPT4) {
1515
remoteModelRes.data = remoteModelRes.data.filter(
1616
(m) =>
17-
!(m.id.startsWith("gpt-4") || m.id.startsWith("chatgpt-4o")) ||
17+
!(m.id.startsWith("gpt-4") || m.id.startsWith("chatgpt-4o") || m.id.startsWith("o1")) ||
1818
m.id.startsWith("gpt-4o-mini"),
1919
);
2020
}

app/client/platforms/openai.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class ChatGPTApi implements LLMApi {
224224
// O1 not support image, tools (plugin in ChatGPTNextWeb) and system, stream, logprobs, temperature, top_p, n, presence_penalty, frequency_penalty yet.
225225
requestPayload = {
226226
messages,
227-
stream: !isO1 ? options.config.stream : false,
227+
stream: options.config.stream,
228228
model: modelConfig.model,
229229
temperature: !isO1 ? modelConfig.temperature : 1,
230230
presence_penalty: !isO1 ? modelConfig.presence_penalty : 0,
@@ -247,7 +247,7 @@ export class ChatGPTApi implements LLMApi {
247247

248248
console.log("[Request] openai payload: ", requestPayload);
249249

250-
const shouldStream = !isDalle3 && !!options.config.stream && !isO1;
250+
const shouldStream = !isDalle3 && !!options.config.stream;
251251
const controller = new AbortController();
252252
options.onController?.(controller);
253253

app/components/emoji.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export function Avatar(props: { model?: ModelType; avatar?: string }) {
3737
return (
3838
<div className="no-dark">
3939
{props.model?.startsWith("gpt-4") ||
40-
props.model?.startsWith("chatgpt-4o") ? (
40+
props.model?.startsWith("chatgpt-4o") ||
41+
props.model?.startsWith("o1") ? (
4142
<BlackBotIcon className="user-avatar" />
4243
) : (
4344
<BotIcon className="user-avatar" />

app/config/server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ export const getServerSideConfig = () => {
129129
if (customModels) customModels += ",";
130130
customModels += DEFAULT_MODELS.filter(
131131
(m) =>
132-
(m.name.startsWith("gpt-4") || m.name.startsWith("chatgpt-4o")) &&
132+
(m.name.startsWith("gpt-4") || m.name.startsWith("chatgpt-4o") || m.name.startsWith("o1")) &&
133133
!m.name.startsWith("gpt-4o-mini"),
134134
)
135135
.map((m) => "-" + m.name)
136136
.join(",");
137137
if (
138138
(defaultModel.startsWith("gpt-4") ||
139-
defaultModel.startsWith("chatgpt-4o")) &&
139+
defaultModel.startsWith("chatgpt-4o") ||
140+
defaultModel.startsWith("o1")) &&
140141
!defaultModel.startsWith("gpt-4o-mini")
141142
)
142143
defaultModel = "";

0 commit comments

Comments
 (0)