This commit is contained in:
hailin 2025-06-25 23:29:18 +08:00
parent 92ca21d2cb
commit 008bbb3643
3 changed files with 9 additions and 3 deletions

View File

@ -8,7 +8,6 @@ import { get } from "@vercel/edge-config"
import { Metadata } from "next"
import { cookies, headers } from "next/headers"
import { redirect } from "next/navigation"
//import { getRuntimeEnv } from "@/lib/ipconfig" // 新增引入
import { getRuntimeEnv } from "@/lib/runtime-env"
import { PostgrestError } from '@supabase/supabase-js';

View File

@ -31,10 +31,18 @@ export async function POST(request: Request) {
.eq("id", customModelId)
.single()
console.log("⛳ ChatSettings:", chatSettings)
console.log("⛳ Messages:", messages)
console.log("⛳ Custom Model ID:", customModelId)
console.log("⛳ Supabase URL:", getRuntimeEnv("SUPABASE_URL"))
if (!customModel) {
console.error("❌ No custom model found:", error)
throw new Error(error.message)
}
console.log("🎯 Using model:", customModel.base_url)
const custom = new OpenAI({
apiKey: customModel.api_key || "",
baseURL: customModel.base_url

View File

@ -98,8 +98,7 @@ import { headers } from "next/headers"
export function RuntimeEnvScript() {
const h = headers()
const proto =
h.get("x-forwarded-proto") ?? (h.get("host")?.includes(":443") ? "https" : "http")
const proto = h.get("x-forwarded-proto") ?? (h.get("host")?.includes(":443") ? "https" : "http")
const rawHost = h.get("x-forwarded-host") ?? h.get("host")!
const hostname = rawHost.split(",")[0].split(":")[0].trim()