diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2025-06-24 00:52:20 +0100 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2025-06-24 00:52:20 +0100 |
| commit | e628564688a4a9d850f48f149e27ee49914facf4 (patch) | |
| tree | 7bbb9a5bfa06e2e9dcc7b0a37df236d53bf2f374 /source/main.js | |
| parent | a1ce5a90f5d45a7fbe509e0393b1b4d210ef7b65 (diff) | |
| download | zue.dev-e628564688a4a9d850f48f149e27ee49914facf4.tar zue.dev-e628564688a4a9d850f48f149e27ee49914facf4.tar.gz zue.dev-e628564688a4a9d850f48f149e27ee49914facf4.tar.bz2 zue.dev-e628564688a4a9d850f48f149e27ee49914facf4.tar.xz zue.dev-e628564688a4a9d850f48f149e27ee49914facf4.zip | |
remove ai image generation endpoint
Diffstat (limited to 'source/main.js')
| -rw-r--r-- | source/main.js | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/source/main.js b/source/main.js index 7261fa2..7eb433e 100644 --- a/source/main.js +++ b/source/main.js @@ -247,67 +247,6 @@ export default { } ); })(); - case "/ai/image": - return (async () => { - const url = new URL(request.url); - const prompt = url.searchParams.get("prompt"); - - if (!prompt) - return new Response( - JSON.stringify({ - error: `prompt not provided`, - }), - { - headers: { - "Access-Control-Allow-Origin": "*", - "Content-Type": "application/json", - }, - } - ); - - if (prompt.length > 2048) - return new Response( - JSON.stringify({ - error: `prompt too long, max 2048 characters`, - }), - { - headers: { - "Access-Control-Allow-Origin": "*", - "Content-Type": "application/json", - }, - } - ); - - if (prompt.length < 5) - return new Response( - JSON.stringify({ - error: `prompt too short, min 5 characters`, - }), - { - headers: { - "Access-Control-Allow-Origin": "*", - "Content-Type": "application/json", - }, - } - ); - - const response = await environment.AI.run( - "@cf/black-forest-labs/flux-1-schnell", - { - prompt, - } - ); - - const binaryString = atob(response.image); - - const img = Uint8Array.from(binaryString, (m) => m.codePointAt(0)); - - return new Response(img, { - headers: { - "Content-Type": "image/webp", - }, - }); - })(); default: return new Response( JSON.stringify({ |
