Browse Source

feat: knowledge base search miss config

develop
zhayujie 1 year ago
parent
commit
cfd2f27b0b
2 changed files with 6 additions and 1 deletions
  1. +1
    -1
      bot/linkai/link_ai_bot.py
  2. +5
    -0
      plugins/linkai/config.json.template

+ 1
- 1
bot/linkai/link_ai_bot.py View File

@@ -195,7 +195,7 @@ class LinkAIBot(Bot, OpenAIImage):
first_similarity = response.get("knowledge_base").get("first_similarity") first_similarity = response.get("knowledge_base").get("first_similarity")
logger.info(f"[LINKAI] knowledge base, search_hit={search_hit}, first_similarity={first_similarity}") logger.info(f"[LINKAI] knowledge base, search_hit={search_hit}, first_similarity={first_similarity}")
plugin_config = pconf("linkai") 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_similarity = plugin_config.get("knowledge_base").get("search_miss_similarity")
search_miss_text = plugin_config.get("knowledge_base").get("search_miss_text") search_miss_text = plugin_config.get("knowledge_base").get("search_miss_text")
if not search_hit: if not search_hit:


+ 5
- 0
plugins/linkai/config.json.template View File

@@ -15,5 +15,10 @@
"enabled": true, "enabled": true,
"group_enabled": true, "group_enabled": true,
"max_file_size": 5000 "max_file_size": 5000
},
"knowledge_base": {
"search_miss_text_enabled": false,
"search_miss_similarity": 0.8,
"search_miss_suffix": "\n-------------\n回复仅供参考,请以官方文档为准"
} }
} }

Loading…
Cancel
Save