Skip to content

Commit

Permalink
feat: close #2580 only use 3.5 to summarize when not using custom models
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Aug 27, 2023
1 parent ada4e3c commit 3bd76b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Knowledge cutoff: 2021-09
Current model: {{model}}
Current time: {{time}}`;

export const SUMMARIZE_MODEL = "gpt-3.5-turbo";

export const DEFAULT_MODELS = [
{
name: "gpt-4",
Expand Down
14 changes: 12 additions & 2 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
DEFAULT_INPUT_TEMPLATE,
DEFAULT_SYSTEM_TEMPLATE,
StoreKey,
SUMMARIZE_MODEL,
} from "../constant";
import { api, RequestMessage } from "../client/api";
import { ChatControllerPool } from "../client/controller";
Expand Down Expand Up @@ -80,6 +81,11 @@ function createEmptySession(): ChatSession {
};
}

function getSummarizeModel(currentModel: string) {
// if it is using gpt-* models, force to use 3.5 to summarize
return currentModel.startsWith("gpt") ? SUMMARIZE_MODEL : currentModel;
}

interface ChatStore {
sessions: ChatSession[];
currentSessionIndex: number;
Expand Down Expand Up @@ -501,7 +507,7 @@ export const useChatStore = create<ChatStore>()(
api.llm.chat({
messages: topicMessages,
config: {
model: "gpt-3.5-turbo",
model: getSummarizeModel(session.mask.modelConfig.model),
},
onFinish(message) {
get().updateCurrentSession(
Expand Down Expand Up @@ -555,7 +561,11 @@ export const useChatStore = create<ChatStore>()(
date: "",
}),
),
config: { ...modelConfig, stream: true, model: "gpt-3.5-turbo" },
config: {
...modelConfig,
stream: true,
model: getSummarizeModel(session.mask.modelConfig.model),
},
onUpdate(message) {
session.memoryPrompt = message;
},
Expand Down

1 comment on commit 3bd76b9

@gitsang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// if it is using gpt-* models, force to use 3.5 to summarize

Why force use gpt-3.5 to summarize? Are there any issues with using the current model to generate titles?

Or should we support configuring the SUMMARIZE model?

Please sign in to comment.