This commit is contained in:
hailin 2025-05-28 23:48:20 +08:00
parent 936d7c298d
commit 035a93a439
2 changed files with 8 additions and 14 deletions

View File

@ -21,8 +21,14 @@ export async function POST(request: Request) {
const uniqueFileIds = [...new Set(fileIds)]
try {
const rawSupaUrl = getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000"
const supaUrlObj = new URL(rawSupaUrl)
supaUrlObj.port = "8000"
const supabaseAdmin = createClient<Database>(
getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000",
supaUrlObj.origin,
// getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000",
process.env.SUPABASE_SERVICE_ROLE_KEY!
)

View File

@ -59,19 +59,7 @@ export const handleRetrieval = async (
embeddingsProvider: "openai" | "local" | "bge-m3",
sourceCount: number
) => {
// 在 handleRetrieval 或者你发这条请求的地方:
const supaUrl = getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000"
// 构造 URL 对象并把端口改成 8001
const urlObj = new URL(supaUrl)
urlObj.port = "8001"
// 拼出检索接口的完整地址
const retrieveUrl = `${urlObj.origin}/api/retrieval/retrieve`
console.debug("[handleRetrieval] retrieveUrl =", retrieveUrl)
// const response = await fetch("/api/retrieval/retrieve", {
const response = await fetch(retrieveUrl, {
const response = await fetch("/api/retrieval/retrieve", {
method: "POST",
body: JSON.stringify({
userInput,