Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 添加知识库匹配度阈值 #1634

Merged
merged 4 commits into from
Feb 16, 2025
Merged

Conversation

eeee0717
Copy link
Collaborator

feat #1617

默认0.6有2个搜索结果
CleanShot 2025-02-14 at 13 52 42@2x

修改为0.7仅显示1个
CleanShot 2025-02-14 at 13 53 07@2x

设置界面
CleanShot 2025-02-14 at 13 53 21@2x

@kangfenmao
Copy link
Collaborator

是不是也需要在选择知识库的时候过滤掉无关内容,提示知识库没有匹配到内容

@eeee0717
Copy link
Collaborator Author

这样的效果吗?
CleanShot 2025-02-14 at 15 10 29@2x

@kangfenmao
Copy link
Collaborator

我说的是聊天界面如果提问内容进行知识库查询,查询到符合阈值的数量为0,那么可以 toast 用户说没有检索到知识库内容

当没有检索到知识库内容的时候就不走知识库的逻辑了

这样阈值才真正发挥到了作用

@eeee0717
Copy link
Collaborator Author

OK

@eeee0717
Copy link
Collaborator Author

知识库检索未空时走一般逻辑已实现
没想到如何toast告知用户没有检索到知识库

@kangfenmao
Copy link
Collaborator

window.message.info

@kangfenmao
Copy link
Collaborator

kangfenmao commented Feb 14, 2025

DEFAULT_KNOWLEDGE_THRESHOLD 如果默认不设置可能会更好一些,因为有些 0.5 分的数据可能是正确的

所以建议默认不设置这个值,除非用户手动输入了这个(这代表他们想清楚了,而不是胡乱设置

把设置的行为交给用户去操作,出现问题他们自己清楚了

@eeee0717
Copy link
Collaborator Author

eeee0717 commented Feb 15, 2025

其实我本来想能不能在当前回答里加入一个warning来提示没有检索到数据,类似于引用到知识库时的样式,把引用改成warning,但是我看了一下remark-gfm没有实现GitHub样式的警告这些。

CleanShot 2025-02-15 at 10 17 27@2x

用toast是这样的效果

CleanShot 2025-02-15 at 10 15 28@2x

@kangfenmao
Copy link
Collaborator

差不多了,先有后优

@kangfenmao kangfenmao merged commit c0e0e92 into CherryHQ:main Feb 16, 2025
duanyongcheng pushed a commit that referenced this pull request Feb 16, 2025
* feat: 添加知识库匹配度阈值

* fix: 增加问答时知识库阈值

* feat: 当知识库未检索到数据时使用通用对话逻辑

* fix: add toast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Knowledge Base Feature Suggestion [功能]: 引用知识库时,允许用户设置匹配度阈值。
2 participants