mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
- feat(rtk): buildOutput filter + autodetect for npm/yarn/cargo logs - chore: remove unused cloud sync module and related routes - ui: hide deprecated providers (qwen, iflow, antigravity) - chore: minor tray/cli/internal adjustments
36 lines
716 B
JavaScript
36 lines
716 B
JavaScript
import { handleChat } from "@/sse/handlers/chat.js";
|
|
import { initTranslators } from "open-sse/translator/index.js";
|
|
|
|
let initialized = false;
|
|
|
|
/**
|
|
* Initialize translators once
|
|
*/
|
|
async function ensureInitialized() {
|
|
if (!initialized) {
|
|
await initTranslators();
|
|
initialized = true;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Handle CORS preflight
|
|
*/
|
|
export async function OPTIONS() {
|
|
return new Response(null, {
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
"Access-Control-Allow-Headers": "*"
|
|
}
|
|
});
|
|
}
|
|
|
|
export async function POST(request) {
|
|
// Fallback to local handling
|
|
await ensureInitialized();
|
|
|
|
return await handleChat(request);
|
|
}
|
|
|