Feature : RTK compress
This commit is contained in:
@@ -197,6 +197,21 @@ export async function POST(request) {
|
||||
break;
|
||||
}
|
||||
|
||||
case "opencode-go": {
|
||||
const res = await fetch("https://opencode.ai/zen/go/v1/chat/completions", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` },
|
||||
body: JSON.stringify({
|
||||
model: getDefaultModel("opencode-go"),
|
||||
messages: [{ role: "user", content: "ping" }],
|
||||
max_tokens: 1,
|
||||
stream: false,
|
||||
}),
|
||||
});
|
||||
isValid = res.status !== 401 && res.status !== 403;
|
||||
break;
|
||||
}
|
||||
|
||||
case "deepgram": {
|
||||
const res = await fetch("https://api.deepgram.com/v1/projects", {
|
||||
headers: { "Authorization": `Token ${apiKey}` },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { getSettings, updateSettings } from "@/lib/localDb";
|
||||
import { applyOutboundProxyEnv } from "@/lib/network/outboundProxy";
|
||||
import { setRtkEnabled } from "open-sse/rtk/flag.js";
|
||||
import bcrypt from "bcryptjs";
|
||||
|
||||
export async function GET() {
|
||||
@@ -65,6 +66,11 @@ export async function PATCH(request) {
|
||||
) {
|
||||
applyOutboundProxyEnv(settings);
|
||||
}
|
||||
|
||||
// Sync RTK toggle immediately (sync cache for request hot path)
|
||||
if (Object.prototype.hasOwnProperty.call(body, "rtkEnabled")) {
|
||||
setRtkEnabled(settings.rtkEnabled);
|
||||
}
|
||||
const { password, ...safeSettings } = settings;
|
||||
return NextResponse.json(safeSettings);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user