This build was committed by a bot.

This commit is contained in:
github-actions[bot]
2025-12-27 16:47:09 +00:00
parent afdcd8ed17
commit fbc814b2bf
3 changed files with 8 additions and 11 deletions

View File

@@ -350,7 +350,7 @@ const SUNE = window.SUNE = new Proxy({ get list() {
const assistantMsg = Object.assign({ id: streamId, role: "assistant", content: [{ type: "text", text: "" }] }, suneMeta); const assistantMsg = Object.assign({ id: streamId, role: "assistant", content: [{ type: "text", text: "" }] }, suneMeta);
state.messages.push(assistantMsg); state.messages.push(assistantMsg);
THREAD.persist(false); THREAD.persist(false);
state.stream = { rid: null, bubble: null, meta: null, text: "", done: false }; state.stream = { rid: streamId, bubble: suneBubble, meta: suneMeta, text: "", done: false };
let buf = "", completed = false; let buf = "", completed = false;
const onDelta = (delta, done, imgs) => { const onDelta = (delta, done, imgs) => {
if (imgs) { if (imgs) {
@@ -548,12 +548,9 @@ function partsToText(m) {
if (!m) return ""; if (!m) return "";
const c = m.content, i = m.images; const c = m.content, i = m.images;
let t = Array.isArray(c) ? c.map((p) => p?.type === "text" ? p.text : p?.type === "image_url" ? `![](${p.image_url?.url || ""})` : p?.type === "file" ? `[${p.file?.filename || "file"}]` : p?.type === "input_audio" ? `(audio:${p.input_audio?.format || ""})` : "").join("\n") : String(c || ""); let t = Array.isArray(c) ? c.map((p) => p?.type === "text" ? p.text : p?.type === "image_url" ? `![](${p.image_url?.url || ""})` : p?.type === "file" ? `[${p.file?.filename || "file"}]` : p?.type === "input_audio" ? `(audio:${p.input_audio?.format || ""})` : "").join("\n") : String(c || "");
if (Array.isArray(i)) t += i.map((x) => { if (Array.isArray(i)) t += i.map((x) => `
const url = typeof x === "string" ? x : x?.image_url?.url || x?.url || ""; ![](${x.image_url?.url})
return url ? ` `).join("");
![](${url})
` : "";
}).join("");
return t; return t;
} }
const addMessage = window.addMessage = function(m, track = true) { const addMessage = window.addMessage = function(m, track = true) {
@@ -1483,7 +1480,7 @@ async function syncActiveThread() {
const prevText = bubble.textContent || ""; const prevText = bubble.textContent || "";
const j = await fetch(HTTP_BASE + "?uid=" + encodeURIComponent(id)).then((r) => r.ok ? r.json() : null).catch(() => null); const j = await fetch(HTTP_BASE + "?uid=" + encodeURIComponent(id)).then((r) => r.ok ? r.json() : null).catch(() => null);
const finalise = (t, c, imgs) => { const finalise = (t, c, imgs) => {
renderMarkdown(bubble, partsToText({ content: c, images: imgs }), { enhance: false }); renderMarkdown(bubble, t, { enhance: false });
enhanceCodeBlocks(bubble, true); enhanceCodeBlocks(bubble, true);
const i = state.messages.findIndex((x) => x.id === id); const i = state.messages.findIndex((x) => x.id === id);
if (i >= 0) { if (i >= 0) {
@@ -1505,7 +1502,7 @@ async function syncActiveThread() {
return false; return false;
} }
const text = j.text || "", isDone = j.error || j.done || j.phase === "done"; const text = j.text || "", isDone = j.error || j.done || j.phase === "done";
if (text || j.images && j.images.length) renderMarkdown(bubble, partsToText({ content: text, images: j.images }), { enhance: false }); if (text) renderMarkdown(bubble, text, { enhance: false });
if (isDone) { if (isDone) {
const finalText = text || prevText; const finalText = text || prevText;
finalise(finalText, [{ type: "text", text: finalText }], j.images); finalise(finalText, [{ type: "text", text: finalText }], j.images);

2
dist/index.html vendored
View File

@@ -12,7 +12,7 @@
<script defer src="https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js"></script> <script defer src="https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js"></script>
<script defer src="//unpkg.com/alpinejs"></script> <script defer src="//unpkg.com/alpinejs"></script>
<script type="module" crossorigin src="/assets/index-BN3sOM5b.js"></script> <script type="module" crossorigin src="/assets/index-BQ2yb7Cj.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CZ8Js0gk.css"> <link rel="stylesheet" crossorigin href="/assets/index-CZ8Js0gk.css">
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head> <link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
<body class="bg-white text-gray-900 selection:bg-black/10" x-data @click.window="if($event.target.closest('button')) haptic(); if(!document.getElementById('threadPopover').contains($event.target)&&!$event.target.closest('[data-thread-menu]')) hideThreadPopover(); if(!document.getElementById('sunePopover').contains($event.target)&&!$event.target.closest('[data-sune-menu]')) hideSunePopover(); if(!document.getElementById('userMenu').contains($event.target)&&!document.getElementById('userMenuBtn').contains($event.target)) document.getElementById('userMenu').classList.add('hidden')"> <body class="bg-white text-gray-900 selection:bg-black/10" x-data @click.window="if($event.target.closest('button')) haptic(); if(!document.getElementById('threadPopover').contains($event.target)&&!$event.target.closest('[data-thread-menu]')) hideThreadPopover(); if(!document.getElementById('sunePopover').contains($event.target)&&!$event.target.closest('[data-sune-menu]')) hideSunePopover(); if(!document.getElementById('userMenu').contains($event.target)&&!document.getElementById('userMenuBtn').contains($event.target)) document.getElementById('userMenu').classList.add('hidden')">

2
dist/sw.js vendored
View File

@@ -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} didnt 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-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"da9ea9cf9500beab87b206cbe727c5cc"},{url:"assets/index-CZ8Js0gk.css",revision:null},{url:"assets/index-BN3sOM5b.js",revision:null},{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} didnt 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-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"fa5c249ce152507839fba5200f3a5911"},{url:"assets/index-CZ8Js0gk.css",revision:null},{url:"assets/index-BQ2yb7Cj.js",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});