chatgpt-mirai-qq-bot-web-search 0.2.9__tar.gz → 0.2.10__tar.gz

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.
Files changed (16) hide show
  1. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/PKG-INFO +1 -1
  2. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/chatgpt_mirai_qq_bot_web_search.egg-info/PKG-INFO +1 -1
  3. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/setup.py +1 -1
  4. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/web_search/__init__.py +29 -0
  5. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/LICENSE +0 -0
  6. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/README.md +0 -0
  7. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/chatgpt_mirai_qq_bot_web_search.egg-info/SOURCES.txt +0 -0
  8. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/chatgpt_mirai_qq_bot_web_search.egg-info/dependency_links.txt +0 -0
  9. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/chatgpt_mirai_qq_bot_web_search.egg-info/entry_points.txt +0 -0
  10. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/chatgpt_mirai_qq_bot_web_search.egg-info/requires.txt +0 -0
  11. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/chatgpt_mirai_qq_bot_web_search.egg-info/top_level.txt +0 -0
  12. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/setup.cfg +0 -0
  13. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/web_search/blocks.py +0 -0
  14. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/web_search/config.py +0 -0
  15. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/web_search/example/roleplayWithWebSearch.yaml +0 -0
  16. {chatgpt-mirai-qq-bot-web-search-0.2.9 → chatgpt-mirai-qq-bot-web-search-0.2.10}/web_search/web_searcher.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chatgpt-mirai-qq-bot-web-search
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: WebSearch adapter for lss233/chatgpt-mirai-qq-bot
5
5
  Home-page: https://github.com/chuanSir123/web_search
6
6
  Author: chuanSir
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chatgpt-mirai-qq-bot-web-search
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: WebSearch adapter for lss233/chatgpt-mirai-qq-bot
5
5
  Home-page: https://github.com/chuanSir123/web_search
6
6
  Author: chuanSir
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  import io
3
3
  import os
4
4
 
5
- version = os.environ.get('RELEASE_VERSION', '0.2.9'
5
+ version = os.environ.get('RELEASE_VERSION', '0.2.10'
6
6
  '').lstrip('v')
7
7
 
8
8
  setup(
@@ -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)