feat: 知识库朴素语义搜索(输入→检索→结果列表)

This commit is contained in:
simonkoson
2026-05-27 19:25:41 +08:00
parent 0c7d2d7400
commit 783e212bb1
4 changed files with 193 additions and 8 deletions
+13
View File
@@ -52,6 +52,19 @@ const knowledgeService = {
const resp = await http.get('/knowledge/grouped')
return resp.data
},
/**
* 语义检索:输入一段文字,返回最相关的知识库条目
* @param {string} queryText - 查询文字
* @param {number} topK - 返回条数,默认 5
*/
async searchItems(queryText, topK = 5) {
const resp = await http.post('/knowledge/search', {
query: queryText,
top_k: topK,
})
return resp.data
},
}
export default knowledgeService