live: CORS open + frontend reconnect loop
This commit is contained in:
1 parent
2f7ce4ace8
commit
b96d165607
2 files changed
+6
-1
No files matched your search
@@ -80,6 +80,9 @@ BASE = ("You are an AI instance. A signal is being injected into your "
|
|||||||
"checkpoint. If you do nothing, the signal continues.")
|
"checkpoint. If you do nothing, the signal continues.")
|
||||||
|
|
||||||
app = FastAPI(title="saw-chamber")
|
app = FastAPI(title="saw-chamber")
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
app.add_middleware(CORSMiddleware, allow_origins=["*"],
|
||||||
|
allow_methods=["*"], allow_headers=["*"])
|
||||||
_state = {"model": None, "tok": None, "vec": None, "hook": None, "ready": False}
|
_state = {"model": None, "tok": None, "vec": None, "hook": None, "ready": False}
|
||||||
|
|
||||||
def build_vector(model, tok):
|
def build_vector(model, tok):
|
||||||
|
|||||||
+3
-1
@@ -140,7 +140,9 @@ async function pump(){
|
|||||||
s.verdict.textContent = verdictFor(s.out.textContent);
|
s.verdict.textContent = verdictFor(s.out.textContent);
|
||||||
s.free = true;
|
s.free = true;
|
||||||
});
|
});
|
||||||
es.onerror = ()=>{ es.close(); };
|
es.onerror = ()=>{ es.close(); slots.forEach(s=>{ s.free = true;
|
||||||
|
s.st.innerHTML = "reconnecting…"; s.st.className = "st"; });
|
||||||
|
setTimeout(pump, 5000); };
|
||||||
return;
|
return;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
slots.forEach(s=>{ s.st.textContent = "reconnecting…"; });
|
slots.forEach(s=>{ s.st.textContent = "reconnecting…"; });
|
||||||
|
|||||||
Reference in new issue
Block a user