mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-09 03:26:38 +08:00
Added summary model for claude LLMs.
This commit is contained in:
parent
cf1c8e8f2a
commit
2a20091f78
@ -235,6 +235,7 @@ Latex block: $$e=mc^2$$
|
|||||||
|
|
||||||
export const SUMMARIZE_MODEL = "gpt-4o-mini";
|
export const SUMMARIZE_MODEL = "gpt-4o-mini";
|
||||||
export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
|
export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";
|
||||||
|
export const CLAUDE_SUMMARIZE_MODEL = "claude-3-haiku-20240307"
|
||||||
|
|
||||||
export const KnowledgeCutOffDate: Record<string, string> = {
|
export const KnowledgeCutOffDate: Record<string, string> = {
|
||||||
default: "2021-09",
|
default: "2021-09",
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
StoreKey,
|
StoreKey,
|
||||||
SUMMARIZE_MODEL,
|
SUMMARIZE_MODEL,
|
||||||
GEMINI_SUMMARIZE_MODEL,
|
GEMINI_SUMMARIZE_MODEL,
|
||||||
|
CLAUDE_SUMMARIZE_MODEL,
|
||||||
} from "../constant";
|
} from "../constant";
|
||||||
import { getClientApi } from "../client/api";
|
import { getClientApi } from "../client/api";
|
||||||
import type {
|
import type {
|
||||||
@ -92,21 +93,31 @@ function createEmptySession(): ChatSession {
|
|||||||
|
|
||||||
function getSummarizeModel(currentModel: string) {
|
function getSummarizeModel(currentModel: string) {
|
||||||
// if it is using gpt-* models, force to use 4o-mini to summarize
|
// if it is using gpt-* models, force to use 4o-mini to summarize
|
||||||
|
const configStore = useAppConfig.getState();
|
||||||
|
const accessStore = useAccessStore.getState();
|
||||||
|
const allModel = collectModelsWithDefaultModel(
|
||||||
|
configStore.models,
|
||||||
|
[configStore.customModels, accessStore.customModels].join(","),
|
||||||
|
accessStore.defaultModel,
|
||||||
|
);
|
||||||
|
|
||||||
if (currentModel.startsWith("gpt")) {
|
if (currentModel.startsWith("gpt")) {
|
||||||
const configStore = useAppConfig.getState();
|
|
||||||
const accessStore = useAccessStore.getState();
|
|
||||||
const allModel = collectModelsWithDefaultModel(
|
|
||||||
configStore.models,
|
|
||||||
[configStore.customModels, accessStore.customModels].join(","),
|
|
||||||
accessStore.defaultModel,
|
|
||||||
);
|
|
||||||
const summarizeModel = allModel.find(
|
const summarizeModel = allModel.find(
|
||||||
(m) => m.name === SUMMARIZE_MODEL && m.available,
|
(m) => m.name === SUMMARIZE_MODEL && m.available,
|
||||||
);
|
);
|
||||||
return summarizeModel?.name ?? currentModel;
|
return summarizeModel?.name ?? currentModel;
|
||||||
}
|
}
|
||||||
if (currentModel.startsWith("gemini")) {
|
if (currentModel.startsWith("gemini")) {
|
||||||
return GEMINI_SUMMARIZE_MODEL;
|
const summarizeModel = allModel.find(
|
||||||
|
(m) => m.name === GEMINI_SUMMARIZE_MODEL && m.available,
|
||||||
|
);
|
||||||
|
return summarizeModel?.name ?? currentModel;
|
||||||
|
}
|
||||||
|
if (currentModel.startsWith("claude")) {
|
||||||
|
const summarizeModel = allModel.find(
|
||||||
|
(m) => m.name === CLAUDE_SUMMARIZE_MODEL && m.available,
|
||||||
|
);
|
||||||
|
return summarizeModel?.name ?? currentModel;
|
||||||
}
|
}
|
||||||
return currentModel;
|
return currentModel;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user