mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-31 03:09:04 +08:00
Compare commits
7 Commits
Leizhenpen
...
6305-bugth
Author | SHA1 | Date | |
---|---|---|---|
|
2d4180f5be | ||
|
9f0182b55e | ||
|
2167076652 | ||
|
e123076250 | ||
|
ebcb4db245 | ||
|
f3154b20a5 | ||
|
f5f3ce94f6 |
@@ -75,6 +75,25 @@ export class DeepSeekApi implements LLMApi {
|
||||
}
|
||||
}
|
||||
|
||||
// 检测并修复消息顺序,确保除system外的第一个消息是user
|
||||
const filteredMessages: ChatOptions["messages"] = [];
|
||||
let hasFoundFirstUser = false;
|
||||
|
||||
for (const msg of messages) {
|
||||
if (msg.role === "system") {
|
||||
// Keep all system messages
|
||||
filteredMessages.push(msg);
|
||||
} else if (msg.role === "user") {
|
||||
// User message directly added
|
||||
filteredMessages.push(msg);
|
||||
hasFoundFirstUser = true;
|
||||
} else if (hasFoundFirstUser) {
|
||||
// After finding the first user message, all subsequent non-system messages are retained.
|
||||
filteredMessages.push(msg);
|
||||
}
|
||||
// If hasFoundFirstUser is false and it is not a system message, it will be skipped.
|
||||
}
|
||||
|
||||
const modelConfig = {
|
||||
...useAppConfig.getState().modelConfig,
|
||||
...useChatStore.getState().currentSession().mask.modelConfig,
|
||||
@@ -85,7 +104,7 @@ export class DeepSeekApi implements LLMApi {
|
||||
};
|
||||
|
||||
const requestPayload: RequestPayload = {
|
||||
messages,
|
||||
messages: filteredMessages,
|
||||
stream: options.config.stream,
|
||||
model: modelConfig.model,
|
||||
temperature: modelConfig.temperature,
|
||||
|
@@ -66,11 +66,11 @@ export function Avatar(props: { model?: ModelType; avatar?: string }) {
|
||||
LlmIcon = BotIconGemma;
|
||||
} else if (modelName.startsWith("claude")) {
|
||||
LlmIcon = BotIconClaude;
|
||||
} else if (modelName.toLowerCase().includes("llama")) {
|
||||
} else if (modelName.includes("llama")) {
|
||||
LlmIcon = BotIconMeta;
|
||||
} else if (modelName.startsWith("mixtral")) {
|
||||
} else if (modelName.startsWith("mixtral") || modelName.startsWith("codestral")) {
|
||||
LlmIcon = BotIconMistral;
|
||||
} else if (modelName.toLowerCase().includes("deepseek")) {
|
||||
} else if (modelName.includes("deepseek")) {
|
||||
LlmIcon = BotIconDeepseek;
|
||||
} else if (modelName.startsWith("moonshot")) {
|
||||
LlmIcon = BotIconMoonshot;
|
||||
@@ -85,7 +85,7 @@ export function Avatar(props: { model?: ModelType; avatar?: string }) {
|
||||
} else if (modelName.startsWith("doubao") || modelName.startsWith("ep-")) {
|
||||
LlmIcon = BotIconDoubao;
|
||||
} else if (
|
||||
modelName.toLowerCase().includes("glm") ||
|
||||
modelName.includes("glm") ||
|
||||
modelName.startsWith("cogview-") ||
|
||||
modelName.startsWith("cogvideox-")
|
||||
) {
|
||||
|
@@ -535,6 +535,8 @@ const anthropicModels = [
|
||||
"claude-3-5-sonnet-20240620",
|
||||
"claude-3-5-sonnet-20241022",
|
||||
"claude-3-5-sonnet-latest",
|
||||
"claude-3-7-sonnet-20250219",
|
||||
"claude-3-7-sonnet-latest",
|
||||
];
|
||||
|
||||
const baiduModels = [
|
||||
|
Reference in New Issue
Block a user