From 2bcd22cd091666b87d226226747fd68b6b6b2ab0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 04:01:41 +0000 Subject: [PATCH] This build was committed by a bot. --- .../{index-mliZjutQ.js => index-DfSXZB8u.js} | 42 +++++++++++++------ dist/index.html | 2 +- dist/sw.js | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) rename dist/assets/{index-mliZjutQ.js => index-DfSXZB8u.js} (97%) diff --git a/dist/assets/index-mliZjutQ.js b/dist/assets/index-DfSXZB8u.js similarity index 97% rename from dist/assets/index-mliZjutQ.js rename to dist/assets/index-DfSXZB8u.js index da4a8a6..173df9d 100644 --- a/dist/assets/index-mliZjutQ.js +++ b/dist/assets/index-DfSXZB8u.js @@ -213,17 +213,25 @@ const SUNE = window.SUNE = new Proxy({ get list() { state.messages.push(assistantMsg); THREAD.persist(false); state.stream = { rid: streamId, bubble: suneBubble, meta: suneMeta, text: "", done: false }; - let buf = "", completed = false; + let contentBuf = "", reasoningBuf = "", completed = false, reasoningEl = null; const onDelta = (delta, done) => { - buf += delta; - state.stream.text = buf; - renderMarkdown(suneBubble, buf, { enhance: false }); - assistantMsg.content[0].text = buf; + contentBuf += delta.content; + reasoningBuf += delta.reasoning; + state.stream.text = contentBuf; + renderMarkdown(suneBubble, contentBuf, { enhance: false }); + assistantMsg.content[0].text = contentBuf; + if (reasoningBuf && !reasoningEl) { + reasoningEl = document.createElement("div"); + reasoningEl.className = "markdown-body rounded-none px-4 py-3 w-full bg-blue-50 border-l-4 border-blue-300 text-sm text-gray-600"; + suneBubble.parentElement.insertBefore(reasoningEl, suneBubble); + } + if (reasoningEl) renderMarkdown(reasoningEl, reasoningBuf, { enhance: false }); if (done && !completed) { completed = true; setBtnSend(); state.busy = false; enhanceCodeBlocks(suneBubble, true); + if (reasoningEl) enhanceCodeBlocks(reasoningEl, true); THREAD.persist(true); el.composer.dispatchEvent(new CustomEvent("sune:newSuneResponse", { detail: { message: assistantMsg } })); state.stream = { rid: null, bubble: null, meta: null, text: "", done: false }; @@ -797,17 +805,25 @@ $(el.composer).on("submit", async (e) => { state.messages.push(assistantMsg); THREAD.persist(false); state.stream = { rid: streamId, bubble: suneBubble, meta: suneMeta, text: "", done: false }; - let buf = "", completed = false; + let contentBuf = "", reasoningBuf = "", completed = false, reasoningEl = null; const onDelta = (delta, done) => { - buf += delta; - state.stream.text = buf; - renderMarkdown(suneBubble, buf, { enhance: false }); - assistantMsg.content[0].text = buf; + contentBuf += delta.content; + reasoningBuf += delta.reasoning; + state.stream.text = contentBuf; + renderMarkdown(suneBubble, contentBuf, { enhance: false }); + assistantMsg.content[0].text = contentBuf; + if (reasoningBuf && !reasoningEl) { + reasoningEl = document.createElement("div"); + reasoningEl.className = "markdown-body rounded-none px-4 py-3 w-full bg-blue-50 border-l-4 border-blue-300 text-sm text-gray-600"; + suneBubble.parentElement.insertBefore(reasoningEl, suneBubble); + } + if (reasoningEl) renderMarkdown(reasoningEl, reasoningBuf, { enhance: false }); if (done && !completed) { completed = true; setBtnSend(); state.busy = false; enhanceCodeBlocks(suneBubble, true); + if (reasoningEl) enhanceCodeBlocks(reasoningEl, true); THREAD.persist(true); el.composer.dispatchEvent(new CustomEvent("sune:newSuneResponse", { detail: { message: assistantMsg } })); state.stream = { rid: null, bubble: null, meta: null, text: "", done: false }; @@ -1195,7 +1211,7 @@ const buildBody = () => { async function askOpenRouterStreaming(onDelta, streamId) { const model = SUNE.model, provider = model.startsWith("oai:") ? "openai" : model.startsWith("g:") ? "google" : model.startsWith("cla:") ? "claude" : model.startsWith("cf:") ? "cloudflare" : model.startsWith("or:") ? "openrouter" : USER.provider, apiKey = provider === "openai" ? USER.apiKeyOpenAI : provider === "google" ? USER.apiKeyGoogle : provider === "claude" ? USER.apiKeyClaude : provider === "cloudflare" ? USER.apiKeyCloudflare : USER.apiKeyOpenRouter; if (!apiKey) { - onDelta(localDemoReply(), true); + onDelta({ content: localDemoReply(), reasoning: "" }, true); return { ok: true, rid: streamId || null }; } const r = { rid: streamId || gid(), seq: -1, done: false, signaled: false, ws: null }; @@ -1203,7 +1219,7 @@ async function askOpenRouterStreaming(onDelta, streamId) { const signal = (t) => { if (!r.signaled) { r.signaled = true; - onDelta(t || "", true); + onDelta({ content: t || "", reasoning: "" }, true); } }; const ws = new WebSocket(HTTP_BASE.replace("https", "wss") + "?uid=" + encodeURIComponent(r.rid)); @@ -1218,7 +1234,7 @@ async function askOpenRouterStreaming(onDelta, streamId) { } if (m.type === "delta" && typeof m.seq === "number" && m.seq > r.seq) { r.seq = m.seq; - onDelta(m.text || "", false); + onDelta({ content: m.content || "", reasoning: m.reasoning || "" }, false); } else if (m.type === "done" || m.type === "err") { r.done = true; cacheStore.setItem(r.rid, "done"); diff --git a/dist/index.html b/dist/index.html index d2e53f7..929389b 100644 --- a/dist/index.html +++ b/dist/index.html @@ -11,7 +11,7 @@ - + diff --git a/dist/sw.js b/dist/sw.js index 8e57d68..f92e450 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let c={};const o=e=>i(e,r),l={module:{uri:r},exports:c,require:o};s[r]=Promise.all(n.map(e=>l[e]||o(e))).then(e=>(t(...e),c))}}define(["./workbox-5ffe50d4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-CZ8Js0gk.css",revision:null},{url:"assets/index-mliZjutQ.js",revision:null},{url:"index.html",revision:"449e7e44cc39205c06610cc6f33ffcc8"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const c=e=>i(e,t),l={module:{uri:t},exports:o,require:c};s[t]=Promise.all(n.map(e=>l[e]||c(e))).then(e=>(r(...e),o))}}define(["./workbox-5ffe50d4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-CZ8Js0gk.css",revision:null},{url:"assets/index-DfSXZB8u.js",revision:null},{url:"index.html",revision:"ca3c2ca1f8a160c237c3b3a4b5671316"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});