show reasoning in frontend

This commit is contained in:
2026-09-21 19:50:16 +02:00
parent 8c13f50bd1
commit ceb3c752ff
12 changed files with 104 additions and 40 deletions
+8
View File
@@ -1,5 +1,6 @@
import {del, get, post, put, stream} from "./app/api.js?v=20260909-account-controls";
import {appendSources, createWebSearchToggle} from "./app/webSearch.js";
import {updateReasoning} from "./app/reasoning.js";
import {closeChatDrawer, openChatDrawer} from "./app/chatDrawer.js?v=20260909-account-controls";
import {onboardingPrompts, requestedChatId} from "./app/constants.js?v=20260909-account-controls";
import {getModelProfile} from "./app/modelProfiles.js?v=20260909-account-controls";
@@ -741,6 +742,7 @@ function addMessage(contentOrMessage, isUser = false, isLoading = false, options
}
msgDiv.append(header, body);
if (!isMessageUser) updateReasoning(msgDiv, message.thinking);
if (!isMessageUser) appendSources(msgDiv, message.sources);
if (message.deliveryStatus === "failed" && message.errorMessage) {
const error = document.createElement("p");
@@ -1832,7 +1834,13 @@ async function sendMessage() {
loadingLabel.textContent = status === "searching" ? "Searching the web..."
: sourceCount === 0 ? "No web results found. Generating response..." : "Generating response...";
},
onThinking: ({fullThinking}) => {
updateReasoning(loadingMsg, fullThinking, true);
loadingLabel.textContent = "Thinking…";
},
onChunk: ({fullReply}) => {
const reasoningSummary = loadingMsg.querySelector(".msg-reasoning summary");
if (reasoningSummary) reasoningSummary.textContent = "Reasoning";
if (loadingBody) {
loadingShell?.classList.add("hidden");
loadingBody.classList.add("has-content");