mirror of
https://github.com/decolua/9router.git
synced 2026-05-08 12:01:28 +00:00
- Refactored handleChatCore to include Caveman functionality, allowing for terse-style system prompts to reduce output token usage. - Updated APIPageClient to manage Caveman settings, including enabling/disabling and selecting compression levels. - Adjusted AntigravityExecutor to consolidate function declarations for compatibility with Gemini. - Removed unnecessary console logs during translator initialization across multiple routes.
37 lines
782 B
JavaScript
37 lines
782 B
JavaScript
import { callCloudWithMachineId } from "@/shared/utils/cloud.js";
|
|
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);
|
|
}
|
|
|