diff --git a/chatdesk-ui/app/[locale]/login/page.tsx b/chatdesk-ui/app/[locale]/login/page.tsx index d103d66..d78cded 100644 --- a/chatdesk-ui/app/[locale]/login/page.tsx +++ b/chatdesk-ui/app/[locale]/login/page.tsx @@ -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'; diff --git a/chatdesk-ui/app/api/chat/custom/route.ts b/chatdesk-ui/app/api/chat/custom/route.ts index fdefc60..bb72e7f 100644 --- a/chatdesk-ui/app/api/chat/custom/route.ts +++ b/chatdesk-ui/app/api/chat/custom/route.ts @@ -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 diff --git a/chatdesk-ui/components/utility/runtime-env-provider.tsx b/chatdesk-ui/components/utility/runtime-env-provider.tsx index fe06e5a..791a592 100644 --- a/chatdesk-ui/components/utility/runtime-env-provider.tsx +++ b/chatdesk-ui/components/utility/runtime-env-provider.tsx @@ -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()