mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-19 00:37:46 +02:00
Prepare Relay production infrastructure for the PlanetScale PS_20 HA topology, upgrade Effect and Alchemy to compatible betas, reconcile migration state, and preserve patched MCP session termination behavior.\n\nCo-authored-by: codex <codex@users.noreply.github.com>
31 lines
884 B
TypeScript
31 lines
884 B
TypeScript
import type { AiAsyncWorkerEnv } from "./AiAsyncWorker.ts";
|
|
|
|
const MODEL = "@cf/meta/llama-3.3-70b-instruct-fp8-fast";
|
|
|
|
export default {
|
|
async fetch(request: Request, env: AiAsyncWorkerEnv): Promise<Response> {
|
|
const url = new URL(request.url);
|
|
const prompt =
|
|
url.searchParams.get("prompt") ??
|
|
"Say the single word 'pong' and nothing else.";
|
|
|
|
if (url.pathname === "/run") {
|
|
const result = await env.AI.run(MODEL, {
|
|
messages: [{ role: "user", content: prompt }],
|
|
max_tokens: 128,
|
|
});
|
|
return Response.json({ mode: "async", result });
|
|
}
|
|
|
|
if (url.pathname === "/models") {
|
|
const models = await env.AI.models({ search: "llama-3.3" });
|
|
return Response.json({
|
|
mode: "async",
|
|
count: models.length,
|
|
names: models.map((m) => m.name),
|
|
});
|
|
}
|
|
|
|
return new Response("ok");
|
|
},
|
|
};
|