feat: 不渲染Kexue角色提示词的首句显示。
This commit is contained in:
parent
7922227f46
commit
fb7f72fcb9
|
|
@ -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 }));
|
||||||
|
|
||||||
// 添加用户消息
|
// 添加用户消息(如果不需要跳过)
|
||||||
await chatStore.addMessage(MessageRole.USER, {
|
if (!options?.skipUserMessage) {
|
||||||
type: MessageType.TEXT,
|
await chatStore.addMessage(MessageRole.USER, {
|
||||||
text,
|
type: MessageType.TEXT,
|
||||||
images: attachments.filter((a) => a.type === "image"),
|
text,
|
||||||
files: attachments.filter((a) => a.type === "file"),
|
images: attachments.filter((a) => a.type === "image"),
|
||||||
});
|
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() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue