This commit is contained in:
parent
936d7c298d
commit
035a93a439
|
|
@ -21,8 +21,14 @@ export async function POST(request: Request) {
|
||||||
const uniqueFileIds = [...new Set(fileIds)]
|
const uniqueFileIds = [...new Set(fileIds)]
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
const rawSupaUrl = getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000"
|
||||||
|
const supaUrlObj = new URL(rawSupaUrl)
|
||||||
|
supaUrlObj.port = "8000"
|
||||||
|
|
||||||
const supabaseAdmin = createClient<Database>(
|
const supabaseAdmin = createClient<Database>(
|
||||||
getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000",
|
supaUrlObj.origin,
|
||||||
|
// getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000",
|
||||||
process.env.SUPABASE_SERVICE_ROLE_KEY!
|
process.env.SUPABASE_SERVICE_ROLE_KEY!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,19 +59,7 @@ export const handleRetrieval = async (
|
||||||
embeddingsProvider: "openai" | "local" | "bge-m3",
|
embeddingsProvider: "openai" | "local" | "bge-m3",
|
||||||
sourceCount: number
|
sourceCount: number
|
||||||
) => {
|
) => {
|
||||||
|
const response = await fetch("/api/retrieval/retrieve", {
|
||||||
// 在 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, {
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
userInput,
|
userInput,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue