From 5ead504e66546c2af5809e2f15e729e7f8a1da7b Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 29 May 2025 13:42:54 +0800 Subject: [PATCH] . --- chatdesk-ui/components/chat/chat-helpers/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chatdesk-ui/components/chat/chat-helpers/index.ts b/chatdesk-ui/components/chat/chat-helpers/index.ts index b6f4918..de6d763 100644 --- a/chatdesk-ui/components/chat/chat-helpers/index.ts +++ b/chatdesk-ui/components/chat/chat-helpers/index.ts @@ -77,7 +77,18 @@ export const handleRetrieval = async ( results: Tables<"file_items">[] } - return results + // return results + + // ✅ 打印全部相似度得分和对应内容 + results.forEach((item, index) => { + console.log(`Result ${index + 1}: similarity = ${(item.similarity * 100).toFixed(2)}%, content = ${item.content.slice(0, 100)}...`) + }) + + // ✅ 只保留 similarity >= 0.8 的记录(大于等于 80%) + const filteredResults = results.filter(item => item.similarity >= 0.8) + + return filteredResults + } export const createTempMessages = (