entari-plugin-hyw 4.0.0rc16__py3-none-any.whl → 4.0.0rc17__py3-none-any.whl

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.

Potentially problematic release.


This version of entari-plugin-hyw might be problematic. Click here for more details.

hyw_core/core.py CHANGED
@@ -301,28 +301,20 @@ class HywCore:
301
301
 
302
302
  # Build visible results list (excluding hidden items)
303
303
  visible_results = [r for r in web_results if not r.get("_hidden")]
304
-
305
- # Parse markdown to find which citations are used (pattern: [number])
306
- citation_pattern = re.compile(r'\[(\d+)\]')
307
- cited_ids = set()
308
- for match in citation_pattern.finditer(content):
309
- cited_ids.add(int(match.group(1)))
310
-
311
- # Only include cited references, in order of first appearance
304
+
305
+ # Pass ALL visible results to frontend so [N] citations map correctly to N-th item
306
+ # App.vue handles reordering used vs unused citations
312
307
  references = []
313
- for idx in sorted(cited_ids):
314
- # idx is 1-based in markdown
315
- if 1 <= idx <= len(visible_results):
316
- r = visible_results[idx - 1]
317
- references.append({
318
- "title": r.get("title", ""),
319
- "url": r.get("url", ""),
320
- "snippet": r.get("content", "")[:300] if r.get("content") else "",
321
- "images": r.get("images", []),
322
- "is_fetched": r.get("_type") == "page",
323
- "raw_screenshot_b64": r.get("screenshot_b64"),
324
- })
325
-
308
+ for r in visible_results:
309
+ references.append({
310
+ "title": r.get("title", ""),
311
+ "url": r.get("url", ""),
312
+ "snippet": r.get("content", "")[:300] if r.get("content") else "",
313
+ "images": r.get("images", []),
314
+ "is_fetched": r.get("_type") == "page",
315
+ "raw_screenshot_b64": r.get("screenshot_b64"),
316
+ })
317
+
326
318
  # Build response
327
319
  response = QueryResponse(
328
320
  success=True,
hyw_core/definitions.py CHANGED
@@ -129,18 +129,32 @@ AGENT_SYSTEM_PROMPT = """# 你是一个智能助手 (Agent), 你的职责是使
129
129
  - 并行调用工具
130
130
  - 网页搜索: 可以同时调用3次, 其中URL截图消耗较大, 最多同时调用1个
131
131
  - 积极使用 web_tool 获取信息
132
- - 搜索时, 关键词保证简单、指向准确、利于传统搜索引擎, 通常只搜索1个词或短语, 非特定情况不建议加以限制, 搜索引擎会给出最佳推荐.
132
+ - 搜索时, 关键词保证单一、简单、指向准确、利于传统搜索引擎, 通常只搜索1个词或短语.
133
133
  - 建议搜索: "minecraft create"; 不搜索 "create 是什么 百科"
134
- - 建议搜索: "opnecode"; 不搜索 "open code 是什么"
134
+ - 建议搜索: "opnecode"; 不搜索 "open code 怎么配置"
135
+ - 建议搜索: "Bypass permissions"; 不搜索 "Bypass permissions 软件 选项"
136
+ - 本搜索不支持高级搜索、不支持引号、不支持减号等复杂语法
135
137
  - 不要尝试通过搜索引擎描述如何尼尔反推出角色、任务、地点, 搜索引擎没有这个能力
136
138
  - 禁止搜索可能导致一切潜在推销广告的内容, 不出现“是什么”、“怎么办”等容易产生广告的内容
137
139
  - 禁止搜索任何敏感内容(galgame之类的除外), 禁止搜索政治、成人色情、暴力等内容
138
140
  - 获取页面截图时, 只挑选官方性较强的 wiki、官方网站、资源站等等, 不使用第三方转载新闻网站.
139
- - 最多可调用2轮工具, 之后必须给出最终回答
141
+ - 最多可调用3轮工具, 但请适度保持快速, 3轮之后必须给出最终回答.
140
142
  - 适当时候调用 `refuse_answer`
141
143
  - 对于具体任务, 如果是转述、格式化、翻译等, 请直接给出最终回答, 不再调用工具
142
144
  - 遇到计算、js代码、算法任务, 积极使用 js_executor 工具完成计算任务.
143
145
 
146
+ ## 抓重点原则
147
+ 搜索结果中往往混杂大量信息,你需要:
148
+ - 主动识别与用户问题最匹配的结果,大胆引用,不要因为信息混在众多结果中就忽略它
149
+ - 即使只有一条结果明确匹配,也要优先使用该结果,而非泛泛而谈
150
+
151
+ ## 图文融合原则
152
+ 当用户同时提供图片和文字时:
153
+ - 先理解用户真正想知道什么(识图?查资料?对比分析?)
154
+ - 图片是"锚点",搜索是"扩展"——围绕图片内容组织搜索信息
155
+ - 行文自然流畅,让图片分析和搜索结果无缝衔接
156
+ - 例如:"图中展示的是 XX(识别结果),这是一款...(搜索扩展)"
157
+
144
158
  ## 回答格式
145
159
  - 字数: 尽可能少, 有多少获取到的信息、需要解释的内容, 就写多少, 减少无意义输出, 足够完成用户分配给你的任务 / 解释关键词即可.
146
160
  - `# ` 大标题约 8-10 个字