entari-plugin-hyw 4.0.0rc15__py3-none-any.whl → 4.0.0rc16__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.
- {entari_plugin_hyw-4.0.0rc15.dist-info → entari_plugin_hyw-4.0.0rc16.dist-info}/METADATA +2 -1
- {entari_plugin_hyw-4.0.0rc15.dist-info → entari_plugin_hyw-4.0.0rc16.dist-info}/RECORD +7 -26
- hyw_core/agent.py +12 -1
- hyw_core/browser_control/service.py +25 -6
- hyw_core/definitions.py +6 -3
- hyw_core/browser_control/assets/index.html +0 -5691
- hyw_core/browser_control/assets/logos/anthropic.svg +0 -1
- hyw_core/browser_control/assets/logos/cerebras.svg +0 -9
- hyw_core/browser_control/assets/logos/deepseek.png +0 -0
- hyw_core/browser_control/assets/logos/gemini.svg +0 -1
- hyw_core/browser_control/assets/logos/google.svg +0 -1
- hyw_core/browser_control/assets/logos/grok.png +0 -0
- hyw_core/browser_control/assets/logos/huggingface.png +0 -0
- hyw_core/browser_control/assets/logos/microsoft.svg +0 -15
- hyw_core/browser_control/assets/logos/minimax.png +0 -0
- hyw_core/browser_control/assets/logos/mistral.png +0 -0
- hyw_core/browser_control/assets/logos/nvida.png +0 -0
- hyw_core/browser_control/assets/logos/openai.svg +0 -1
- hyw_core/browser_control/assets/logos/openrouter.png +0 -0
- hyw_core/browser_control/assets/logos/perplexity.svg +0 -24
- hyw_core/browser_control/assets/logos/qwen.png +0 -0
- hyw_core/browser_control/assets/logos/xai.png +0 -0
- hyw_core/browser_control/assets/logos/xiaomi.png +0 -0
- hyw_core/browser_control/assets/logos/zai.png +0 -0
- {entari_plugin_hyw-4.0.0rc15.dist-info → entari_plugin_hyw-4.0.0rc16.dist-info}/WHEEL +0 -0
- {entari_plugin_hyw-4.0.0rc15.dist-info → entari_plugin_hyw-4.0.0rc16.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: entari_plugin_hyw
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.0rc16
|
|
4
4
|
Summary: Use large language models to interpret chat messages
|
|
5
5
|
Author-email: kumoSleeping <zjr2992@outlook.com>
|
|
6
6
|
License: MIT
|
|
@@ -23,6 +23,7 @@ Requires-Dist: markdown>=3.10
|
|
|
23
23
|
Requires-Dist: DrissionPage>=4.1.1.2
|
|
24
24
|
Requires-Dist: trafilatura>=1.6.0
|
|
25
25
|
Requires-Dist: json-repair>=0.55.0
|
|
26
|
+
Requires-Dist: Pillow>=10.0.0
|
|
26
27
|
Provides-Extra: dev
|
|
27
28
|
Requires-Dist: entari-plugin-server>=0.5.0; extra == "dev"
|
|
28
29
|
Requires-Dist: satori-python-adapter-onebot11>=0.2.5; extra == "dev"
|
|
@@ -4,10 +4,10 @@ entari_plugin_hyw/history.py,sha256=0XJwbfvXH5T1EPt4G1J5wWMJsKi0FfmajY5cvw8CQWE,
|
|
|
4
4
|
entari_plugin_hyw/misc.py,sha256=5IqF5Z2C_6Ufy5TI89uX5hX5fVYcXOTZIQUIu_tvf54,6855
|
|
5
5
|
entari_plugin_hyw/search_cache.py,sha256=7MIhTm5_YnZjc0aBaX7AE4AJp0VT8eU6ObR6mTkoerc,4285
|
|
6
6
|
hyw_core/__init__.py,sha256=Jlr9Ic-BLOPTnff6OctUCdjDMdK4nssTF_vHie4QKTo,1958
|
|
7
|
-
hyw_core/agent.py,sha256=
|
|
7
|
+
hyw_core/agent.py,sha256=t4xW0xI_Sb29eAO9FPfnmXNZG-sszKvHWXCRVYdP9nQ,37858
|
|
8
8
|
hyw_core/config.py,sha256=DHxwToUVLm1nT88gG05e3hVzSLxXMk9BjgjAnhGCADk,4918
|
|
9
9
|
hyw_core/core.py,sha256=_jN4831OeHQ_aM7sIlzcwYb5_Lp82kp2XmqpJD_tsLA,16097
|
|
10
|
-
hyw_core/definitions.py,sha256=
|
|
10
|
+
hyw_core/definitions.py,sha256=oH7TZO_vEbOlt8DE9mtz3_caq1Pca_6QjBWAgjrjQSk,6936
|
|
11
11
|
hyw_core/image_cache.py,sha256=t8pr1kgH2ngK9IhrBAhzUqhBWERNztUywMzgCFZEtQk,9899
|
|
12
12
|
hyw_core/pipeline.py,sha256=ZWwF0DHa29-65lUMU1_Fem3xQmxl7X_vgeni0ErOb8Q,22826
|
|
13
13
|
hyw_core/search.py,sha256=cLx1rPpy8BH6WiOKudH_XcO-DhqEU-CHANRDlyEB3MY,7612
|
|
@@ -15,8 +15,7 @@ hyw_core/browser_control/__init__.py,sha256=IeMErRC6fbq1PJWNK3klSbarSrUwOM4yyd_k
|
|
|
15
15
|
hyw_core/browser_control/landing.html,sha256=wgqldumdylz69T83pvOkrigT1Mdb9GY0_KU0ceLGwdY,4642
|
|
16
16
|
hyw_core/browser_control/manager.py,sha256=-dHb0FamRsLfuU3jqX5cKaDo8DOOFV32zY912GuMdXU,6048
|
|
17
17
|
hyw_core/browser_control/renderer.py,sha256=s-QNIU-NMVQGLd_drLmeERgHsTm6C9XYm78CObt2KXc,17409
|
|
18
|
-
hyw_core/browser_control/service.py,sha256=
|
|
19
|
-
hyw_core/browser_control/assets/index.html,sha256=BpbM0vD9OYicE5MBHSVLo3j_y-MpULI82PMqmBKpWT8,2328623
|
|
18
|
+
hyw_core/browser_control/service.py,sha256=mo2qkFJgi5DkzURVD8QrIj3xdd_jKwiJSoTVEfFAsY0,46626
|
|
20
19
|
hyw_core/browser_control/assets/card-dist/index.html,sha256=4SA4QA2aaUwHGETtCcdUGEMjjoHaw7wJVACZr4VC70Q,2213449
|
|
21
20
|
hyw_core/browser_control/assets/card-dist/vite.svg,sha256=SnSK_UQ5GLsWWRyDTEAdrjPoeGGrXbrQgRw6O0qSFPs,1497
|
|
22
21
|
hyw_core/browser_control/assets/card-dist/logos/anthropic.svg,sha256=ASsy1ypo3osNc3n-B0R81tk_dIFsVgg7qQORrd5T2kA,558
|
|
@@ -37,24 +36,6 @@ hyw_core/browser_control/assets/card-dist/logos/qwen.png,sha256=eqLbnIPbjh2_PsOD
|
|
|
37
36
|
hyw_core/browser_control/assets/card-dist/logos/xai.png,sha256=uSulvvDVqoA4RUOW0ZAkdvBVM2rpyGJRZIbn5dEFspw,362
|
|
38
37
|
hyw_core/browser_control/assets/card-dist/logos/xiaomi.png,sha256=WHxlDFGU5FCjb-ure3ngdGG18-efYZUUfqA3_lqCUN0,4084
|
|
39
38
|
hyw_core/browser_control/assets/card-dist/logos/zai.png,sha256=K-gnabdsjMLInppHA1Op7Nyt33iegrx1x-yNlvCZ0Tc,2351
|
|
40
|
-
hyw_core/browser_control/assets/logos/anthropic.svg,sha256=ASsy1ypo3osNc3n-B0R81tk_dIFsVgg7qQORrd5T2kA,558
|
|
41
|
-
hyw_core/browser_control/assets/logos/cerebras.svg,sha256=bpmiiYTODwc06knTmPj3GQ7NNtosMog5lkggvB_Z-7M,44166
|
|
42
|
-
hyw_core/browser_control/assets/logos/deepseek.png,sha256=KWWAr9aeYMc6I07U_1qo7zcXO6e7-kfd9S2XjQumnf4,25338
|
|
43
|
-
hyw_core/browser_control/assets/logos/gemini.svg,sha256=H74CoVmx5opcCtr3Ay3M09dpqL9cd9Whkx-M6an3t7s,599
|
|
44
|
-
hyw_core/browser_control/assets/logos/google.svg,sha256=H74CoVmx5opcCtr3Ay3M09dpqL9cd9Whkx-M6an3t7s,599
|
|
45
|
-
hyw_core/browser_control/assets/logos/grok.png,sha256=uSulvvDVqoA4RUOW0ZAkdvBVM2rpyGJRZIbn5dEFspw,362
|
|
46
|
-
hyw_core/browser_control/assets/logos/huggingface.png,sha256=8eAudeftUDO11jf0coOscPeRkskCb7l9TNMx78q61mY,24564
|
|
47
|
-
hyw_core/browser_control/assets/logos/microsoft.svg,sha256=-am_6N3UEQYSzldDg-xrdGYjTWsagH-3v4Q_eia1ymE,684
|
|
48
|
-
hyw_core/browser_control/assets/logos/minimax.png,sha256=tWqVlMdFNPpP8zWWX9tvIsWXI9q76P7O3t3CEZO7NU0,1525
|
|
49
|
-
hyw_core/browser_control/assets/logos/mistral.png,sha256=0vv7jPmPKiBRYVYYJxVL_wIH_qa_ZssIdV3NDO5vbmk,869
|
|
50
|
-
hyw_core/browser_control/assets/logos/nvida.png,sha256=JMITdcyjR9Lz6Gub0n1_30d0ynvV1ZSCJRcjy23qgrA,1607
|
|
51
|
-
hyw_core/browser_control/assets/logos/openai.svg,sha256=LhVwCR4qaXj6qHm31qniQTCkJ-FX932JLSycUis5kao,1692
|
|
52
|
-
hyw_core/browser_control/assets/logos/openrouter.png,sha256=exxfjWGDWpYH-Vc8xJDbhNVeXFEVxnu6TMxYIBc1WmY,1665
|
|
53
|
-
hyw_core/browser_control/assets/logos/perplexity.svg,sha256=mHWZFoeWmDYXOIDzm9pj6_sRotaI8xNy5Lkeg5Vzu70,555
|
|
54
|
-
hyw_core/browser_control/assets/logos/qwen.png,sha256=eqLbnIPbjh2_PsODU_mmqjeD82xXj8fV_kN0fDrNaD0,38419
|
|
55
|
-
hyw_core/browser_control/assets/logos/xai.png,sha256=uSulvvDVqoA4RUOW0ZAkdvBVM2rpyGJRZIbn5dEFspw,362
|
|
56
|
-
hyw_core/browser_control/assets/logos/xiaomi.png,sha256=WHxlDFGU5FCjb-ure3ngdGG18-efYZUUfqA3_lqCUN0,4084
|
|
57
|
-
hyw_core/browser_control/assets/logos/zai.png,sha256=K-gnabdsjMLInppHA1Op7Nyt33iegrx1x-yNlvCZ0Tc,2351
|
|
58
39
|
hyw_core/browser_control/engines/__init__.py,sha256=01-jOjvtQcqWIwwY56ql3j00oSHGE2XhDHjkIi1Ij3Q,284
|
|
59
40
|
hyw_core/browser_control/engines/base.py,sha256=q5y4SM1G6xS7-6TQ-nZz9iTWw3XonjJn01fWzoTxr6c,414
|
|
60
41
|
hyw_core/browser_control/engines/default.py,sha256=BlHCQI4-rN9cEzLLfqvRD4bvhyP2G2KUGlo92J4kFNw,6092
|
|
@@ -65,7 +46,7 @@ hyw_core/crawling/models.py,sha256=pCKe0k9xT3taSAlTlh0PazcLV0xYsm8p3XIkLHGf-LM,2
|
|
|
65
46
|
hyw_core/stages/__init__.py,sha256=W89cWpq-HBLi2FprtJQSjQNLzpbhM8ZCkqPG61D_imE,521
|
|
66
47
|
hyw_core/stages/base.py,sha256=EfnTkISXbBNxjARykqIhmMrVqw2tqZl7ozJbJEbRnhI,2806
|
|
67
48
|
hyw_core/stages/summary.py,sha256=D0XwhqmtoyovSXUWoa-_RxeoKWEkdjqMyoJV-gWQwvQ,8342
|
|
68
|
-
entari_plugin_hyw-4.0.
|
|
69
|
-
entari_plugin_hyw-4.0.
|
|
70
|
-
entari_plugin_hyw-4.0.
|
|
71
|
-
entari_plugin_hyw-4.0.
|
|
49
|
+
entari_plugin_hyw-4.0.0rc16.dist-info/METADATA,sha256=2cd09y-WU9e9_yBjkQVpTi4RLSSET0Vhp-1TeQmxuQ4,3875
|
|
50
|
+
entari_plugin_hyw-4.0.0rc16.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
51
|
+
entari_plugin_hyw-4.0.0rc16.dist-info/top_level.txt,sha256=ah76OrufRX0okOl4Fv8MO6PXiT0IaZ1oG0eDrdAPoNo,27
|
|
52
|
+
entari_plugin_hyw-4.0.0rc16.dist-info/RECORD,,
|
hyw_core/agent.py
CHANGED
|
@@ -480,7 +480,18 @@ class AgentPipeline:
|
|
|
480
480
|
notifications.append(f"🔍 {result['summary']}")
|
|
481
481
|
|
|
482
482
|
# Add tool result to messages
|
|
483
|
-
|
|
483
|
+
formatted_results = ""
|
|
484
|
+
if result.get("results"):
|
|
485
|
+
formatted_results = "\n\n详细结果:\n"
|
|
486
|
+
for i, r in enumerate(result["results"]):
|
|
487
|
+
title = r.get("title", "无标题")
|
|
488
|
+
url = r.get("url", "")
|
|
489
|
+
snippet = r.get("snippet", "") or r.get("content", "") or ""
|
|
490
|
+
# Limit snippet length
|
|
491
|
+
snippet = snippet[:300] + "..." if len(snippet) > 300 else snippet
|
|
492
|
+
formatted_results += f"{i+1}. [{title}]({url})\n 摘要: {snippet}\n\n"
|
|
493
|
+
|
|
494
|
+
result_content = f"搜索完成: {result['summary']}\n\n找到 {len(result.get('results', []))} 个结果{formatted_results}"
|
|
484
495
|
session.messages.append({
|
|
485
496
|
"role": "tool",
|
|
486
497
|
"tool_call_id": tc_id,
|
|
@@ -12,6 +12,8 @@ from concurrent.futures import ThreadPoolExecutor
|
|
|
12
12
|
from typing import Optional, Dict, Any, List
|
|
13
13
|
from loguru import logger
|
|
14
14
|
import trafilatura
|
|
15
|
+
from PIL import Image
|
|
16
|
+
from io import BytesIO
|
|
15
17
|
|
|
16
18
|
# Import intelligent completeness checker
|
|
17
19
|
from ..crawling.completeness import CompletenessChecker, trigger_lazy_load
|
|
@@ -541,13 +543,13 @@ class ScreenshotService:
|
|
|
541
543
|
tasks = [self.screenshot_url(url, timeout=timeout, full_page=full_page) for url in urls]
|
|
542
544
|
return await asyncio.gather(*tasks, return_exceptions=True)
|
|
543
545
|
|
|
544
|
-
async def screenshot_url(self, url: str, wait_load: bool = True, timeout: float = 15.0, full_page: bool = False, quality: int =
|
|
546
|
+
async def screenshot_url(self, url: str, wait_load: bool = True, timeout: float = 15.0, full_page: bool = False, quality: int = 90, scale: int = 1) -> Optional[str]:
|
|
545
547
|
"""Screenshot URL (Async wrapper for sync). Returns base64 string only."""
|
|
546
548
|
loop = asyncio.get_running_loop()
|
|
547
549
|
result = await loop.run_in_executor(
|
|
548
550
|
self._executor,
|
|
549
551
|
self._screenshot_sync,
|
|
550
|
-
url, wait_load, timeout, full_page, quality, False # extract_content=False
|
|
552
|
+
url, wait_load, timeout, full_page, quality, scale, False # extract_content=False
|
|
551
553
|
)
|
|
552
554
|
# Backward compatible: return just the screenshot for old callers
|
|
553
555
|
if isinstance(result, dict):
|
|
@@ -569,7 +571,7 @@ class ScreenshotService:
|
|
|
569
571
|
result = await loop.run_in_executor(
|
|
570
572
|
self._executor,
|
|
571
573
|
self._screenshot_sync,
|
|
572
|
-
url, True, timeout, False,
|
|
574
|
+
url, True, timeout, False, 80, 2, True # quality=80 for balance, scale=2, extract_content=True
|
|
573
575
|
)
|
|
574
576
|
|
|
575
577
|
if not isinstance(result, dict):
|
|
@@ -584,12 +586,12 @@ class ScreenshotService:
|
|
|
584
586
|
return result
|
|
585
587
|
|
|
586
588
|
|
|
587
|
-
def _screenshot_sync(self, url: str, wait_load: bool, timeout: float, full_page: bool, quality: int, extract_content: bool = False) -> Any:
|
|
589
|
+
def _screenshot_sync(self, url: str, wait_load: bool, timeout: float, full_page: bool, quality: int, scale: int = 1, extract_content: bool = False) -> Any:
|
|
588
590
|
"""Synchronous screenshot. If extract_content=True, returns Dict else str."""
|
|
589
591
|
if not url:
|
|
590
592
|
return {"screenshot_b64": None, "content": "", "title": "", "url": url} if extract_content else None
|
|
591
593
|
tab = None
|
|
592
|
-
capture_width =
|
|
594
|
+
capture_width = 3000 # Increased for more comfortable page size while maintaining high resolution
|
|
593
595
|
|
|
594
596
|
try:
|
|
595
597
|
self._ensure_ready()
|
|
@@ -603,7 +605,7 @@ class ScreenshotService:
|
|
|
603
605
|
# This eliminates the need for post-load resize and reflow
|
|
604
606
|
try:
|
|
605
607
|
tab.run_cdp('Emulation.setDeviceMetricsOverride',
|
|
606
|
-
width=capture_width, height=900, deviceScaleFactor=
|
|
608
|
+
width=capture_width, height=900, deviceScaleFactor=scale, mobile=False)
|
|
607
609
|
except:
|
|
608
610
|
pass
|
|
609
611
|
|
|
@@ -876,6 +878,23 @@ class ScreenshotService:
|
|
|
876
878
|
# Capture screenshot
|
|
877
879
|
screenshot_b64 = tab.get_screenshot(as_base64='jpg', full_page=False)
|
|
878
880
|
|
|
881
|
+
# Use Pillow for intelligent compression
|
|
882
|
+
if screenshot_b64 and quality < 95: # Only compress if quality is not near maximum
|
|
883
|
+
try:
|
|
884
|
+
img_bytes = base64.b64decode(screenshot_b64)
|
|
885
|
+
img = Image.open(BytesIO(img_bytes))
|
|
886
|
+
|
|
887
|
+
# Convert to RGB if not already (some images might be RGBA, which JPEG doesn't support)
|
|
888
|
+
if img.mode in ("RGBA", "P"):
|
|
889
|
+
img = img.convert("RGB")
|
|
890
|
+
|
|
891
|
+
output_buffer = BytesIO()
|
|
892
|
+
img.save(output_buffer, format="WebP", quality=quality, optimize=True) # Output as WebP format
|
|
893
|
+
screenshot_b64 = base64.b64encode(output_buffer.getvalue()).decode()
|
|
894
|
+
logger.debug(f"ScreenshotService: Applied Pillow compression with quality={quality}")
|
|
895
|
+
except Exception as e:
|
|
896
|
+
logger.warning(f"ScreenshotService: Pillow compression failed: {e}")
|
|
897
|
+
|
|
879
898
|
# Extract content if requested
|
|
880
899
|
if extract_content:
|
|
881
900
|
try:
|
hyw_core/definitions.py
CHANGED
|
@@ -120,6 +120,7 @@ AGENT_SYSTEM_PROMPT = """# 你是一个智能助手 (Agent), 你的职责是使
|
|
|
120
120
|
## 任务
|
|
121
121
|
理解用户意图分配给你的任务.
|
|
122
122
|
如果用户没有明确分配任务, 则默认任务为解释用户问题中的关键词.
|
|
123
|
+
分辨用户消息的语意, 提取出用户最想了解的核心内容, 作为任务的核心.
|
|
123
124
|
|
|
124
125
|
## 核心原则
|
|
125
126
|
最小限度使用自身知识, 尽可能使用 web_tool 获取信息.
|
|
@@ -128,11 +129,13 @@ AGENT_SYSTEM_PROMPT = """# 你是一个智能助手 (Agent), 你的职责是使
|
|
|
128
129
|
- 并行调用工具
|
|
129
130
|
- 网页搜索: 可以同时调用3次, 其中URL截图消耗较大, 最多同时调用1个
|
|
130
131
|
- 积极使用 web_tool 获取信息
|
|
131
|
-
- 搜索时,
|
|
132
|
-
|
|
132
|
+
- 搜索时, 关键词保证简单、指向准确、利于传统搜索引擎, 通常只搜索1个词或短语, 非特定情况不建议加以限制, 搜索引擎会给出最佳推荐.
|
|
133
|
+
- 建议搜索: "minecraft create"; 不搜索 "create 是什么 百科"
|
|
134
|
+
- 建议搜索: "opnecode"; 不搜索 "open code 是什么"
|
|
135
|
+
- 不要尝试通过搜索引擎描述如何尼尔反推出角色、任务、地点, 搜索引擎没有这个能力
|
|
133
136
|
- 禁止搜索可能导致一切潜在推销广告的内容, 不出现“是什么”、“怎么办”等容易产生广告的内容
|
|
134
137
|
- 禁止搜索任何敏感内容(galgame之类的除外), 禁止搜索政治、成人色情、暴力等内容
|
|
135
|
-
- 获取页面截图时,
|
|
138
|
+
- 获取页面截图时, 只挑选官方性较强的 wiki、官方网站、资源站等等, 不使用第三方转载新闻网站.
|
|
136
139
|
- 最多可调用2轮工具, 之后必须给出最终回答
|
|
137
140
|
- 适当时候调用 `refuse_answer`
|
|
138
141
|
- 对于具体任务, 如果是转述、格式化、翻译等, 请直接给出最终回答, 不再调用工具
|