mirror of
https://github.com/multipleof4/devsune.git
synced 2026-01-13 16:07:55 +00:00
This build was committed by a bot.
This commit is contained in:
@@ -215,5 +215,64 @@ async function init(){threads=await tload();await renderHistory();renderSidebar(
|
||||
window.addEventListener('resize',()=>{hideHistoryMenu();hideSuneMenu()})
|
||||
init()
|
||||
</script>
|
||||
<script>
|
||||
const WS_URL="wss://orp.awww.workers.dev/ws";
|
||||
|
||||
const buildBody=()=>{const msgs=[];if(store.system_prompt)msgs.push({role:"system",content:[{type:"text",text:store.system_prompt}]});msgs.push(...state.messages.filter(m=>m.role!=="system").map(m=>({role:m.role,content:m.content})));const b=payloadWithSampling({model:store.model,messages:msgs,stream:true});if(store.reasoning_effort&&store.reasoning_effort!=="default")b.reasoning={effort:store.reasoning_effort};return b};
|
||||
|
||||
class RunWS{
|
||||
constructor(onDelta){
|
||||
this.onDelta=onDelta;
|
||||
this.ws=null;
|
||||
this.seq=-1;
|
||||
this.done=false;
|
||||
this.manual=false;
|
||||
this.signaled=false;
|
||||
this.rid=Math.random().toString(36).slice(2);
|
||||
this.backoff=300;
|
||||
}
|
||||
start(){ this.open("begin") }
|
||||
abort(){
|
||||
this.manual=true; this.done=true;
|
||||
try{ this.ws?.send(JSON.stringify({type:"stop",rid:this.rid})) }catch{}
|
||||
try{ this.ws?.close() }catch{}
|
||||
if(!this.signaled){ this.signaled=true; this.onDelta("",true) } // ensure UI resets
|
||||
}
|
||||
open(mode){
|
||||
if(this.done)return;
|
||||
this.ws=new WebSocket(WS_URL);
|
||||
this.ws.onopen=()=>this.ws.send(JSON.stringify(
|
||||
mode==="begin"
|
||||
? {type:"begin",rid:this.rid,apiKey:store.apiKey,or_body:buildBody()}
|
||||
: {type:"resume",rid:this.rid,after:this.seq}
|
||||
));
|
||||
this.ws.onmessage=e=>{
|
||||
let m; try{ m=JSON.parse(e.data) }catch{ return }
|
||||
if(m.type==="delta"&&typeof m.seq==="number"&&m.seq>this.seq){
|
||||
this.seq=m.seq; this.onDelta(m.text,false);
|
||||
}else if(m.type==="done"){
|
||||
this.done=true; if(!this.signaled){this.signaled=true; this.onDelta("",true)}; this.ws.close();
|
||||
}else if(m.type==="err"){
|
||||
this.done=true; if(!this.signaled){this.signaled=true; this.onDelta("\n\n"+(m.message||"error"),true)}; this.ws.close();
|
||||
}
|
||||
};
|
||||
this.ws.onclose=()=>{
|
||||
if(!this.done&&!this.manual){
|
||||
setTimeout(()=>this.open("resume"), this.backoff=Math.min(this.backoff*1.5,5000));
|
||||
}
|
||||
};
|
||||
this.ws.onerror=()=>{};
|
||||
}
|
||||
}
|
||||
|
||||
async function askViaWS(onDelta){
|
||||
const r=new RunWS(onDelta);
|
||||
state.controller={abort:()=>r.abort()};
|
||||
r.start();
|
||||
return {ok:true};
|
||||
}
|
||||
|
||||
askOpenRouterStreaming=askViaWS;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1 +1 @@
|
||||
if(!self.define){let e,i={};const t=(t,n)=>(t=new URL(t+".js",n).href,i[t]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=t,e.onload=i,document.head.appendChild(e)}else e=t,importScripts(t),i()}).then(()=>{let e=i[t];if(!e)throw new Error(`Module ${t} didn’t register its module`);return e}));self.define=(n,r)=>{const s=e||("document"in self?document.currentScript.src:"")||location.href;if(i[s])return;let o={};const c=e=>t(e,s),d={module:{uri:s},exports:o,require:c};i[s]=Promise.all(n.map(e=>d[e]||c(e))).then(e=>(r(...e),o))}}define(["./workbox-5ffe50d4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"8b6264835981ce4fcfba0206f0dcf5a9"},{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,i={};const t=(t,n)=>(t=new URL(t+".js",n).href,i[t]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=t,e.onload=i,document.head.appendChild(e)}else e=t,importScripts(t),i()}).then(()=>{let e=i[t];if(!e)throw new Error(`Module ${t} didn’t register its module`);return e}));self.define=(n,r)=>{const s=e||("document"in self?document.currentScript.src:"")||location.href;if(i[s])return;let o={};const c=e=>t(e,s),d={module:{uri:s},exports:o,require:c};i[s]=Promise.all(n.map(e=>d[e]||c(e))).then(e=>(r(...e),o))}}define(["./workbox-5ffe50d4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"9777d1af286200aeb1a2ce195e831e70"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"manifest.webmanifest",revision:"7a6c5c6ab9cb5d3605d21df44c6b17a2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||

|
||||
|
||||
> Each sune is like a module. You can have many. And share them.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
💠 New!
|
||||
|
||||
You can script inside the app either to function call or extend functionality of the app almost like modding. Each sune is like a module. You can have many. And share them.
|
||||
> You can have scripts which run on the page of each sune — either to function call or extend functionality of the app or sune.
|
||||
|
||||

|
||||
Here is an example of some HTML/JS artwork.
|
||||

|
||||
@@ -45,4 +48,5 @@ v0.31: html is functional 🌐
|
||||
v0.32: sune html/js fix
|
||||
v0.33: api json format update
|
||||
v0.34: scroll past sune html
|
||||
v0.35: ws intro
|
||||
```
|
||||
Reference in New Issue
Block a user