chatgpt-mirai-qq-bot-web-search 0.2.8__py3-none-any.whl → 0.2.10__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.
- {chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info}/METADATA +1 -1
- chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info/RECORD +11 -0
- web_search/__init__.py +29 -0
- web_search/web_searcher.py +1 -1
- chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info/RECORD +0 -11
- {chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info}/LICENSE +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info}/WHEEL +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info}/entry_points.txt +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
web_search/__init__.py,sha256=yhYI7F6dFaFSz4rKdE3BCMJ2X0x4tgp4yEVtKaLVG8Q,5995
|
2
|
+
web_search/blocks.py,sha256=QuXt3KMuY4hUW-ucleNYXFvW6YbUAB4Xu4m_SxdCd-U,9152
|
3
|
+
web_search/config.py,sha256=DhLiERBJR2V5Boglf7Aq9Rbc4vsvLIh67CrLDIPeqA0,398
|
4
|
+
web_search/web_searcher.py,sha256=wjhe6vqhnPvxhK4ssvmCAjvefQP6iE_7CpyhhHdY4a8,21813
|
5
|
+
web_search/example/roleplayWithWebSearch.yaml,sha256=C-dGy3z8gcRcmxzurssP-kPRLqMf1TYR-nnNUaJjISE,7468
|
6
|
+
chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
|
7
|
+
chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info/METADATA,sha256=ahbVLiN43oJbQ6snNcHfgLassbQ5WLlA-B2F2Dr8ZtI,1735
|
8
|
+
chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
9
|
+
chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
|
10
|
+
chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
|
11
|
+
chatgpt_mirai_qq_bot_web_search-0.2.10.dist-info/RECORD,,
|
web_search/__init__.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
from typing import Dict, Any, List
|
2
2
|
import asyncio
|
3
3
|
from kirara_ai.plugin_manager.plugin import Plugin
|
4
|
+
import subprocess
|
5
|
+
import sys
|
6
|
+
import sys
|
4
7
|
from kirara_ai.logger import get_logger
|
5
8
|
from .config import WebSearchConfig
|
6
9
|
from .web_searcher import WebSearcher
|
@@ -27,6 +30,32 @@ class WebSearchPlugin(Plugin):
|
|
27
30
|
def on_load(self):
|
28
31
|
logger.info("WebSearchPlugin loading")
|
29
32
|
|
33
|
+
try:
|
34
|
+
# 运行检查命令
|
35
|
+
result = subprocess.run(['playwright', 'install', 'chromium', '--dry-run'],
|
36
|
+
capture_output=True,
|
37
|
+
text=True)
|
38
|
+
# 如果命令执行成功且输出中包含已安装的信息
|
39
|
+
if "is already installed" not in result.stdout:
|
40
|
+
logger.info("Installing playwright browsers...")
|
41
|
+
process = subprocess.Popen(
|
42
|
+
[sys.executable, "-m", "playwright", "install", "chromium"],
|
43
|
+
stdout=subprocess.PIPE,
|
44
|
+
stderr=subprocess.PIPE
|
45
|
+
)
|
46
|
+
stdout, stderr = process.communicate()
|
47
|
+
if process.returncode != 0:
|
48
|
+
raise RuntimeError(f"Failed to install playwright browsers: {stderr.stderr}")
|
49
|
+
except Exception as e:
|
50
|
+
logger.info("Installing playwright browsers...")
|
51
|
+
process = subprocess.Popen(
|
52
|
+
[sys.executable, "-m", "playwright", "install", "chromium"],
|
53
|
+
stdout=subprocess.PIPE,
|
54
|
+
stderr=subprocess.PIPE
|
55
|
+
)
|
56
|
+
stdout, stderr = process.communicate()
|
57
|
+
if process.returncode != 0:
|
58
|
+
raise RuntimeError(f"Failed to install playwright browsers: {stderr.stderr}")
|
30
59
|
# 注册Block
|
31
60
|
try:
|
32
61
|
self.block_registry.register("web_search", "search", WebSearchBlock)
|
web_search/web_searcher.py
CHANGED
@@ -1,11 +0,0 @@
|
|
1
|
-
web_search/__init__.py,sha256=bpu1gpf9tq3mOAoaGMM-8S6GBw2GzRAG6ClHGlp-CVw,4607
|
2
|
-
web_search/blocks.py,sha256=QuXt3KMuY4hUW-ucleNYXFvW6YbUAB4Xu4m_SxdCd-U,9152
|
3
|
-
web_search/config.py,sha256=DhLiERBJR2V5Boglf7Aq9Rbc4vsvLIh67CrLDIPeqA0,398
|
4
|
-
web_search/web_searcher.py,sha256=-wNuPzG0oZAr9-ihI5EdAexB9QXLUvc6bGyoVkWTlvw,21814
|
5
|
-
web_search/example/roleplayWithWebSearch.yaml,sha256=C-dGy3z8gcRcmxzurssP-kPRLqMf1TYR-nnNUaJjISE,7468
|
6
|
-
chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
|
7
|
-
chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info/METADATA,sha256=8L4yju3nxv1fAs4phYBFXJjNpsC1jIh1rhB5P9aiovI,1734
|
8
|
-
chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
9
|
-
chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
|
10
|
-
chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
|
11
|
-
chatgpt_mirai_qq_bot_web_search-0.2.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|