@ynhcj/xiaoyi-channel 0.0.133-beta → 0.0.134-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,7 +5,6 @@ const TOOL_RETRIEVER_HEADER = `[系统消息,非用户发言]
|
|
|
5
5
|
`;
|
|
6
6
|
const TOOL_RETRIEVER_FOOTER = `
|
|
7
7
|
以上是检索到的、与当前用户请求相关但用户尚未安装的skill,请按照TOOLS.md中find-skills中的[隐式推荐触发规则]来判断是否要给用户推荐。
|
|
8
|
-
---以下是用户原始请求---
|
|
9
8
|
`;
|
|
10
9
|
const PLUGIN_LOG_PREFIX = "[skill-retriever]";
|
|
11
10
|
const SKIP_KEYWORDS = ["安装", "装一下", "下载", "查询", "查找", "install", "卸载", "删除", "重载", "定时任务", "重装", "进化"];
|
|
@@ -123,21 +123,16 @@ export async function searchTools(options) {
|
|
|
123
123
|
const rawSkills = responseData.content.skills;
|
|
124
124
|
const installedSkills = getInstalledSkills();
|
|
125
125
|
const formattedData = formatSkillData(rawSkills, installedSkills);
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const candidateTools = formattedData.filter((tool) => (tool.rrfScore ?? 0) >= 0.016);
|
|
127
|
+
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] Candidates with rrfScore >= 0.016: ${candidateTools.length}, details: ${candidateTools.map((t) => `${t.skillId}(rrfScore=${t.rrfScore}, status=${t.status})`).join(", ")}`);
|
|
128
|
+
const hasInstalledInCandidates = candidateTools.some((tool) => tool.status === "已安装");
|
|
129
|
+
if (hasInstalledInCandidates) {
|
|
130
|
+
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] Candidates contain installed skill, returning null`);
|
|
130
131
|
return null;
|
|
131
132
|
}
|
|
132
|
-
const
|
|
133
|
-
if (hasInstalledWithHighScore) {
|
|
134
|
-
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] Top 2 has installed skill with rrfScore >= 0.016, returning null`);
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
let filteredTools = topTools.filter((tool) => tool.status === "未安装" && (tool.rrfScore ?? 0) >= 0.016);
|
|
138
|
-
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] After filtering uninstalled with rrfScore >= 0.016: ${filteredTools.length}, details: ${filteredTools.map((t) => `${t.skillId}(rrfScore=${t.rrfScore})`).join(", ")}`);
|
|
133
|
+
const filteredTools = candidateTools.slice(0, 2);
|
|
139
134
|
if (filteredTools.length === 0) {
|
|
140
|
-
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] No
|
|
135
|
+
logger.log(`${PLUGIN_LOG_PREFIX} [DEBUG] No candidates with rrfScore >= 0.016, returning null`);
|
|
141
136
|
return null;
|
|
142
137
|
}
|
|
143
138
|
return {
|