mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-14 21:13:47 +08:00
fix: #203
This commit is contained in:
@@ -172,7 +172,10 @@ export class GeminiProApi implements LLMApi {
|
||||
// start animaion
|
||||
animateResponseText();
|
||||
fetch(streamChatPath, chatPayload)
|
||||
.then((response) => {
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(await response?.text());
|
||||
}
|
||||
const reader = response?.body?.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let partialData = "";
|
||||
@@ -220,6 +223,7 @@ export class GeminiProApi implements LLMApi {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error:", error);
|
||||
options.onError?.(error as Error);
|
||||
});
|
||||
} else {
|
||||
const res = await fetch(chatPath, chatPayload);
|
||||
|
||||
@@ -105,6 +105,7 @@ Latex block: $$e=mc^2$$
|
||||
`;
|
||||
|
||||
export const SUMMARIZE_MODEL = "gpt-3.5-turbo";
|
||||
export const GOOGLE_SUMMARIZE_MODEL = "gemini-pro";
|
||||
|
||||
export const KnowledgeCutOffDate: Record<string, string> = {
|
||||
default: "2021-09",
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
DEFAULT_INPUT_TEMPLATE,
|
||||
DEFAULT_MODELS,
|
||||
DEFAULT_SYSTEM_TEMPLATE,
|
||||
GOOGLE_SUMMARIZE_MODEL,
|
||||
KnowledgeCutOffDate,
|
||||
ModelProvider,
|
||||
StoreKey,
|
||||
@@ -96,6 +97,7 @@ function getSummarizeModel(currentModel: string) {
|
||||
const model = DEFAULT_MODELS.find((m) => m.name === currentModel);
|
||||
console.log("model", model);
|
||||
if (!model) return currentModel;
|
||||
if (model.provider.providerType === "google") return GOOGLE_SUMMARIZE_MODEL;
|
||||
// if it is using gpt-* models, force to use 3.5 to summarize
|
||||
return currentModel.startsWith("gpt") ? SUMMARIZE_MODEL : currentModel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user