mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-09-27 13:46:37 +08:00
change max tokens
This commit is contained in:
parent
f682b1f4de
commit
cd0366392a
@ -374,7 +374,7 @@ export async function handle(
|
|||||||
const payload = {
|
const payload = {
|
||||||
anthropic_version: "bedrock-2023-05-31",
|
anthropic_version: "bedrock-2023-05-31",
|
||||||
max_tokens:
|
max_tokens:
|
||||||
typeof max_tokens === "number" && max_tokens > 0 ? max_tokens : 4096,
|
typeof max_tokens === "number" && max_tokens > 0 ? max_tokens : 8000,
|
||||||
temperature:
|
temperature:
|
||||||
typeof temperature === "number" && temperature >= 0 && temperature <= 1
|
typeof temperature === "number" && temperature >= 0 && temperature <= 1
|
||||||
? temperature
|
? temperature
|
||||||
|
@ -31,7 +31,7 @@ export class BedrockApi implements LLMApi {
|
|||||||
messages,
|
messages,
|
||||||
temperature: modelConfig.temperature,
|
temperature: modelConfig.temperature,
|
||||||
stream: !!modelConfig.stream,
|
stream: !!modelConfig.stream,
|
||||||
max_tokens: (modelConfig as any).max_tokens || 4096, // Cast to access max_tokens from ModelConfig
|
max_tokens: (modelConfig as any).max_tokens || 8000, // Cast to access max_tokens from ModelConfig
|
||||||
}),
|
}),
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
headers: getHeaders(), // getHeaders should handle Bedrock (no auth needed)
|
headers: getHeaders(), // getHeaders should handle Bedrock (no auth needed)
|
||||||
|
@ -244,7 +244,7 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
|
|
||||||
// add max_tokens to vision model
|
// add max_tokens to vision model
|
||||||
if (visionModel) {
|
if (visionModel) {
|
||||||
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
|
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 8000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,7 +867,7 @@ export const useChatStore = createPersistStore(
|
|||||||
|
|
||||||
const historyMsgLength = countMessages(toBeSummarizedMsgs);
|
const historyMsgLength = countMessages(toBeSummarizedMsgs);
|
||||||
|
|
||||||
if (historyMsgLength > (modelConfig?.max_tokens || 4000)) {
|
if (historyMsgLength > (modelConfig?.max_tokens || 8000)) {
|
||||||
const n = toBeSummarizedMsgs.length;
|
const n = toBeSummarizedMsgs.length;
|
||||||
toBeSummarizedMsgs = toBeSummarizedMsgs.slice(
|
toBeSummarizedMsgs = toBeSummarizedMsgs.slice(
|
||||||
Math.max(0, n - modelConfig.historyMessageCount),
|
Math.max(0, n - modelConfig.historyMessageCount),
|
||||||
|
@ -68,7 +68,7 @@ export const DEFAULT_CONFIG = {
|
|||||||
providerName: "OpenAI" as ServiceProvider,
|
providerName: "OpenAI" as ServiceProvider,
|
||||||
temperature: 0.5,
|
temperature: 0.5,
|
||||||
top_p: 1,
|
top_p: 1,
|
||||||
max_tokens: 4000,
|
max_tokens: 8000,
|
||||||
presence_penalty: 0,
|
presence_penalty: 0,
|
||||||
frequency_penalty: 0,
|
frequency_penalty: 0,
|
||||||
sendMemory: true,
|
sendMemory: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user