|
@@ -90,9 +90,9 @@ async function findMatchingContentsPage(discipline, content, page) {
|
|
|
try {
|
|
|
// 使用余弦相似度进行内容向量匹配
|
|
|
const query = `
|
|
|
- SELECT id, content,
|
|
|
+ SELECT title, id, content, file_url,
|
|
|
1 - (content_vector <#> $1::vector) AS contentSimilarity
|
|
|
- FROM (select id, content, content_vector from knowledgefiles as a where top_dir_id in (select id from directory_files where $2 = '' or folder_name = ANY(string_to_array($2, ',')))) as a
|
|
|
+ FROM (select file_url, title, id, content, content_vector from knowledgefiles as a where top_dir_id in (select id from directory_files where $2 = '' or folder_name = ANY(string_to_array($2, ',')))) as a
|
|
|
ORDER BY contentSimilarity DESC
|
|
|
LIMIT 5 OFFSET $3;
|
|
|
`;
|