Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Hk-Gosuto
2024-05-09 09:05:26 +08:00
7 changed files with 62 additions and 28 deletions

View File

@@ -28,6 +28,8 @@ export interface ChatToolMessage {
import { createPersistStore } from "../utils/store";
import { FileInfo } from "../client/platforms/utils";
import { identifyDefaultClaudeModel } from "../utils/checkers";
import { collectModelsWithDefaultModel } from "../utils/model";
import { useAccessStore } from "./access";
export type ChatMessage = RequestMessage & {
date: string;
@@ -102,9 +104,19 @@ function getSummarizeModel(currentModel: string) {
if (model.provider.providerType === "google") return GEMINI_SUMMARIZE_MODEL;
// if it is using gpt-* models, force to use 3.5 to summarize
if (currentModel.startsWith("gpt")) {
return SUMMARIZE_MODEL;
const configStore = useAppConfig.getState();
const accessStore = useAccessStore.getState();
const allModel = collectModelsWithDefaultModel(
configStore.models,
[configStore.customModels, accessStore.customModels].join(","),
accessStore.defaultModel,
);
const summarizeModel = allModel.find(
(m) => m.name === SUMMARIZE_MODEL && m.available,
);
return summarizeModel?.name ?? currentModel;
}
if (currentModel.startsWith("gemini-pro")) {
if (currentModel.startsWith("gemini")) {
return GEMINI_SUMMARIZE_MODEL;
}
return currentModel;