feat(agent): control reasoning visibility
This commit is contained in:
@@ -150,9 +150,16 @@ async function send(message: string, complete: (success: boolean) => void) {
|
||||
currentAssistant().content += chunk;
|
||||
if (followingOutput.value) await messageList.value?.scrollToBottom();
|
||||
},
|
||||
async (statusMessage, statusType) => {
|
||||
async (chunk) => {
|
||||
currentAssistant().reasoning = (currentAssistant().reasoning || "") + chunk;
|
||||
if (followingOutput.value) await messageList.value?.scrollToBottom();
|
||||
},
|
||||
async (statusMessage, statusType, reasoningVisible) => {
|
||||
if (statusType === "queued") currentAssistant().content = statusMessage || "当前请求较多,正在排队中。";
|
||||
if (statusType === "generating" && !hasContent) currentAssistant().content = "";
|
||||
if (statusType === "generating") {
|
||||
currentAssistant().showReasoning = reasoningVisible;
|
||||
if (!hasContent) currentAssistant().content = "";
|
||||
}
|
||||
if (followingOutput.value) await messageList.value?.scrollToBottom();
|
||||
},
|
||||
activeAbortController.value.signal,
|
||||
@@ -256,6 +263,7 @@ function toUiMessage(message: ApiMessage): DisplayMessage {
|
||||
id: String(message.id),
|
||||
role: message.role,
|
||||
content: message.content,
|
||||
showReasoning: message.role === "assistant" && /<think(?:\s[^>]*)?>/i.test(message.content),
|
||||
createdAt: message.created_at,
|
||||
streaming: message.message_status === "GENERATING",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user