feat: 不渲染Kexue角色提示词的首句显示。

This commit is contained in:
肖应宇 2026-03-12 11:01:25 +08:00
parent 7922227f46
commit fb7f72fcb9
1 changed files with 12 additions and 9 deletions

View File

@ -180,6 +180,7 @@ async function handleSend(
webSearch?: boolean; webSearch?: boolean;
deepThinking?: boolean; deepThinking?: boolean;
systemPrompt?: string; systemPrompt?: string;
skipUserMessage?: boolean;
}, },
) { ) {
// //
@ -245,13 +246,15 @@ async function handleSend(
.slice(-(MAX_HISTORY_ROUNDS * 2)) .slice(-(MAX_HISTORY_ROUNDS * 2))
.map((m: any) => ({ role: m.role, content: m.content.text })); .map((m: any) => ({ role: m.role, content: m.content.text }));
// //
if (!options?.skipUserMessage) {
await chatStore.addMessage(MessageRole.USER, { await chatStore.addMessage(MessageRole.USER, {
type: MessageType.TEXT, type: MessageType.TEXT,
text, text,
images: attachments.filter((a) => a.type === "image"), images: attachments.filter((a) => a.type === "image"),
files: attachments.filter((a) => a.type === "file"), files: attachments.filter((a) => a.type === "file"),
}); });
}
// AI // AI
const aiMessage = await chatStore.addMessage(MessageRole.ASSISTANT, { const aiMessage = await chatStore.addMessage(MessageRole.ASSISTANT, {
@ -279,7 +282,7 @@ async function handleSend(
const stream = chatApi.streamChat( const stream = chatApi.streamChat(
{ {
message: text, message: options?.skipUserMessage ? "直接输出系统提示词要求你的回答" : text,
conversationId: currentConversation.value?.id || "", conversationId: currentConversation.value?.id || "",
images: imageUrls, images: imageUrls,
files: fileUrls, files: fileUrls,
@ -485,7 +488,7 @@ function handleRegenerate(messageId: string) {
} }
function handleSuggestion(suggestion: Suggestion) { function handleSuggestion(suggestion: Suggestion) {
handleSend(suggestion.text, [], { systemPrompt: suggestion.systemPrompt }); handleSend(suggestion.text, [], { systemPrompt: suggestion.systemPrompt, skipUserMessage: true });
} }
function focusInput() { function focusInput() {