Files
time/quc/dev.mjs
T
teahubxyz f479c5f016
ci / test (push) Successful in 52s
quc / deploy (push) Failing after 3m34s
sync / sync (push) Successful in 10s
time/worker-run cd .github/time && python3 - <<'E' p='time.py'; s=open(p).read() s=s.replace(''' try: ret
quc v0: the cage, the chair, the safeword, the magic words, the replay (#241)
2026-10-22 18:26:41 +00:00

17 lines
972 B
JavaScript

// Run the Worker locally: `npm start` in quc/, then http://localhost:8787/
// Without VENICE_API_KEY in the environment the agent gives canned offline answers; with it, it uses the real models.
import { createServer } from "node:http";
import worker from "./src/worker.js";
import { memoryStore } from "./src/runs.js";
const env = { REV: "dev", KV: memoryStore(), VENICE_API_KEY: process.env.VENICE_API_KEY || "" };
createServer(async (q, s) => {
const chunks = [];
for await (const c of q) chunks.push(c);
const body = chunks.length && q.method !== "GET" && q.method !== "HEAD" ? Buffer.concat(chunks) : undefined;
const r = await worker.fetch(new Request(`http://${q.headers.host}${q.url}`, { method: q.method, headers: q.headers, body }), env);
s.writeHead(r.status, Object.fromEntries(r.headers));
s.end(Buffer.from(await r.arrayBuffer()));
}).listen(process.env.PORT || 8787, () => console.log(`quc on http://localhost:${process.env.PORT || 8787}/`));