This commit is contained in:
parent
035a93a439
commit
ec484afcaa
|
|
@ -99,6 +99,17 @@ export async function POST(request: Request) {
|
||||||
// 新增:使用 BGE-M3 嵌入
|
// 新增:使用 BGE-M3 嵌入
|
||||||
console.log("......[retrieve] userInput=",userInput)
|
console.log("......[retrieve] userInput=",userInput)
|
||||||
const bgeEmbedding = await generateBgeM3Embedding(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
|
// 调用对应的 RPC,需要在数据库侧提前定义 match_file_items_bge_m3
|
||||||
const { data: bgeFileItems, error: bgeError } =
|
const { data: bgeFileItems, error: bgeError } =
|
||||||
|
|
@ -107,7 +118,12 @@ export async function POST(request: Request) {
|
||||||
match_count: sourceCount,
|
match_count: sourceCount,
|
||||||
file_ids: uniqueFileIds
|
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
|
chunks = bgeFileItems
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue