mirror of
https://github.com/multipleof4/sune.git
synced 2026-01-13 16:17:55 +00:00
This build was committed by a bot.
This commit is contained in:
@@ -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: streamId, bubble: suneBubble, meta: suneMeta, text: "", done: false };
|
state.stream = { rid: null, bubble: null, meta: null, 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,9 +548,12 @@ 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?.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?.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 || "";
|
||||||
`).join("");
|
return url ? `
|
||||||
|

|
||||||
|
` : "";
|
||||||
|
}).join("");
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
const addMessage = window.addMessage = function(m, track = true) {
|
const addMessage = window.addMessage = function(m, track = true) {
|
||||||
@@ -1480,7 +1483,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, t, { enhance: false });
|
renderMarkdown(bubble, partsToText({ content: c, images: imgs }), { 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) {
|
||||||
@@ -1502,7 +1505,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) renderMarkdown(bubble, text, { enhance: false });
|
if (text || j.images && j.images.length) renderMarkdown(bubble, partsToText({ content: text, images: j.images }), { 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
2
dist/index.html
vendored
@@ -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-lc9QU1Iy.js"></script>
|
<script type="module" crossorigin src="/assets/index-CtJY5H1r.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
2
dist/sw.js
vendored
@@ -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,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const l=e=>i(e,t),c={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>c[e]||l(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:"0f0b5070479f7657801350ebf2c7789a"},{url:"assets/index-lc9QU1Iy.js",revision:null},{url:"assets/index-CZ8Js0gk.css",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} 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 l=e=>i(e,t),c={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>c[e]||l(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:"060f7826ef4f05ee64fde2b2e5828859"},{url:"assets/index-CtJY5H1r.js",revision:null},{url:"assets/index-CZ8Js0gk.css",revision:null},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});
|
||||||
|
|||||||
Reference in New Issue
Block a user