From cfd2f27b0b5f90c92c3bd3b40d3bf790416d8bb2 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Sat, 30 Sep 2023 15:21:26 +0800 Subject: [PATCH] feat: knowledge base search miss config --- bot/linkai/link_ai_bot.py | 2 +- plugins/linkai/config.json.template | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bot/linkai/link_ai_bot.py b/bot/linkai/link_ai_bot.py index 775c2e1..d32451c 100644 --- a/bot/linkai/link_ai_bot.py +++ b/bot/linkai/link_ai_bot.py @@ -195,7 +195,7 @@ class LinkAIBot(Bot, OpenAIImage): first_similarity = response.get("knowledge_base").get("first_similarity") logger.info(f"[LINKAI] knowledge base, search_hit={search_hit}, first_similarity={first_similarity}") plugin_config = pconf("linkai") - if plugin_config.get("knowledge_base"): + if plugin_config.get("knowledge_base") and plugin_config.get("knowledge_base").get("search_miss_text_enabled"): search_miss_similarity = plugin_config.get("knowledge_base").get("search_miss_similarity") search_miss_text = plugin_config.get("knowledge_base").get("search_miss_text") if not search_hit: diff --git a/plugins/linkai/config.json.template b/plugins/linkai/config.json.template index ccd8967..697d0cc 100644 --- a/plugins/linkai/config.json.template +++ b/plugins/linkai/config.json.template @@ -15,5 +15,10 @@ "enabled": true, "group_enabled": true, "max_file_size": 5000 + }, + "knowledge_base": { + "search_miss_text_enabled": false, + "search_miss_similarity": 0.8, + "search_miss_suffix": "\n-------------\n回复仅供参考,请以官方文档为准" } }