This commit is contained in:
hailin 2025-05-29 00:14:27 +08:00
parent 035a93a439
commit ec484afcaa
1 changed files with 17 additions and 1 deletions

View File

@ -99,6 +99,17 @@ export async function POST(request: Request) {
// 新增:使用 BGE-M3 嵌入
console.log("......[retrieve] userInput=",userInput)
const bgeEmbedding = await generateBgeM3Embedding(userInput)
console.log("......[retrieve] [bge-m3] got embedding:", bgeEmbedding)
// 3. 调用 RPC 之前打印参数
console.log(
"......[retrieve] [bge-m3] calling RPC match_file_items_bge_m3 with:",
{
query_embedding: bgeEmbedding,
match_count: sourceCount,
file_ids: uniqueFileIds,
}
)
// 调用对应的 RPC需要在数据库侧提前定义 match_file_items_bge_m3
const { data: bgeFileItems, error: bgeError } =
@ -107,7 +118,12 @@ export async function POST(request: Request) {
match_count: sourceCount,
file_ids: uniqueFileIds
})
if (bgeError) throw bgeError
if (bgeError) {
console.error("......[retrieve] [bge-m3] RPC error:", bgeError)
throw bgeError
}
console.log("......[retrieve] [bge-m3] RPC result count =", bgeFileItems?.length)
chunks = bgeFileItems
}