This commit is contained in:
parent
92ca21d2cb
commit
008bbb3643
|
|
@ -8,7 +8,6 @@ import { get } from "@vercel/edge-config"
|
||||||
import { Metadata } from "next"
|
import { Metadata } from "next"
|
||||||
import { cookies, headers } from "next/headers"
|
import { cookies, headers } from "next/headers"
|
||||||
import { redirect } from "next/navigation"
|
import { redirect } from "next/navigation"
|
||||||
//import { getRuntimeEnv } from "@/lib/ipconfig" // 新增引入
|
|
||||||
import { getRuntimeEnv } from "@/lib/runtime-env"
|
import { getRuntimeEnv } from "@/lib/runtime-env"
|
||||||
import { PostgrestError } from '@supabase/supabase-js';
|
import { PostgrestError } from '@supabase/supabase-js';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,18 @@ export async function POST(request: Request) {
|
||||||
.eq("id", customModelId)
|
.eq("id", customModelId)
|
||||||
.single()
|
.single()
|
||||||
|
|
||||||
|
console.log("⛳ ChatSettings:", chatSettings)
|
||||||
|
console.log("⛳ Messages:", messages)
|
||||||
|
console.log("⛳ Custom Model ID:", customModelId)
|
||||||
|
console.log("⛳ Supabase URL:", getRuntimeEnv("SUPABASE_URL"))
|
||||||
|
|
||||||
if (!customModel) {
|
if (!customModel) {
|
||||||
|
console.error("❌ No custom model found:", error)
|
||||||
throw new Error(error.message)
|
throw new Error(error.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("🎯 Using model:", customModel.base_url)
|
||||||
|
|
||||||
const custom = new OpenAI({
|
const custom = new OpenAI({
|
||||||
apiKey: customModel.api_key || "",
|
apiKey: customModel.api_key || "",
|
||||||
baseURL: customModel.base_url
|
baseURL: customModel.base_url
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,7 @@ import { headers } from "next/headers"
|
||||||
export function RuntimeEnvScript() {
|
export function RuntimeEnvScript() {
|
||||||
const h = headers()
|
const h = headers()
|
||||||
|
|
||||||
const proto =
|
const proto = h.get("x-forwarded-proto") ?? (h.get("host")?.includes(":443") ? "https" : "http")
|
||||||
h.get("x-forwarded-proto") ?? (h.get("host")?.includes(":443") ? "https" : "http")
|
|
||||||
const rawHost = h.get("x-forwarded-host") ?? h.get("host")!
|
const rawHost = h.get("x-forwarded-host") ?? h.get("host")!
|
||||||
const hostname = rawHost.split(",")[0].split(":")[0].trim()
|
const hostname = rawHost.split(",")[0].split(":")[0].trim()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue