chatgpt-mirai-qq-bot-web-search 0.1.2__py3-none-any.whl → 0.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: chatgpt-mirai-qq-bot-web-search
3
- Version: 0.1.2
3
+ Version: 0.1.3
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
@@ -0,0 +1,10 @@
1
+ web_search/__init__.py,sha256=ei3SAS9emIVcOnsaDa0-AJmys2_LmSnZJt1Qdowtc4M,3471
2
+ web_search/blocks.py,sha256=bVLn5kg-OMqWQsDrJLvA43AoV_eMEcZ3nrjqponHHX4,3611
3
+ web_search/config.py,sha256=DhLiERBJR2V5Boglf7Aq9Rbc4vsvLIh67CrLDIPeqA0,398
4
+ web_search/web_searcher.py,sha256=dmN1R4iyFvaPNpyBjFLWujvQ6_I3oD1GRlRyC03egpo,9707
5
+ chatgpt_mirai_qq_bot_web_search-0.1.3.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
6
+ chatgpt_mirai_qq_bot_web_search-0.1.3.dist-info/METADATA,sha256=radm_lXkf-z_A9ZmROTLHEgFbSiE0TN4p1bxj6-bhz8,1902
7
+ chatgpt_mirai_qq_bot_web_search-0.1.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
8
+ chatgpt_mirai_qq_bot_web_search-0.1.3.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
9
+ chatgpt_mirai_qq_bot_web_search-0.1.3.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
10
+ chatgpt_mirai_qq_bot_web_search-0.1.3.dist-info/RECORD,,
web_search/__init__.py CHANGED
@@ -13,8 +13,9 @@ from framework.ioc.container import DependencyContainer
13
13
  from framework.workflow.core.workflow.builder import WorkflowBuilder
14
14
  from framework.workflow.core.workflow.registry import WorkflowRegistry
15
15
  logger = get_logger("WebSearch")
16
+ import importlib.resources
16
17
  import os
17
- import os
18
+ from pathlib import Path
18
19
  class WebSearchPlugin(Plugin):
19
20
  def __init__(self, block_registry: BlockRegistry , container: DependencyContainer):
20
21
  super().__init__()
@@ -36,22 +37,20 @@ class WebSearchPlugin(Plugin):
36
37
  except Exception as e:
37
38
  logger.warning(f"WebSearchPlugin failed: {e}")
38
39
  # 获取当前文件的绝对路径
39
- current_file = os.path.abspath(__file__)
40
-
41
- # 获取当前文件所在目录
42
- current_dir = os.path.dirname(current_file)
40
+ with importlib.resources.path('your_package_name', '__init__.py') as p:
41
+ package_path = p.parent
42
+ example_dir = package_path / 'example'
43
43
 
44
- # 获取上级目录
45
- parent_dir = os.path.dirname(current_dir)
44
+ # 确保目录存在
45
+ if not example_dir.exists():
46
+ raise FileNotFoundError(f"Example directory not found at {example_dir}")
46
47
 
47
- # 构建 example 目录的路径
48
- example_dir = os.path.join(parent_dir, 'example')
49
- # 获取 example 目录下所有的 yaml 文件
50
- yaml_files = [f for f in os.listdir(example_dir) if f.endswith('.yaml') or f.endswith('.yml')]
48
+ # 获取所有yaml文件
49
+ yaml_files = list(example_dir.glob('*.yaml')) + list(example_dir.glob('*.yml'))
51
50
 
52
- for yaml in yaml_files:
53
- logger.info(os.path.join(example_dir, yaml))
54
- self.workflow_registry.register("search", os.path.splitext(yaml)[0], WorkflowBuilder.load_from_yaml(os.path.join(example_dir, yaml), self.container))
51
+ for yaml in yaml_files:
52
+ logger.info(os.path.join(example_dir, yaml))
53
+ self.workflow_registry.register("search", os.path.splitext(yaml)[0], WorkflowBuilder.load_from_yaml(os.path.join(example_dir, yaml), self.container))
55
54
  @dataclass
56
55
  class WebSearchEvent:
57
56
  """Web搜索事件"""
@@ -1,10 +0,0 @@
1
- web_search/__init__.py,sha256=PrzhpRF8sNgqQohDWxZLvtSdjpg1wUQqHQ6osk5S_lw,3438
2
- web_search/blocks.py,sha256=bVLn5kg-OMqWQsDrJLvA43AoV_eMEcZ3nrjqponHHX4,3611
3
- web_search/config.py,sha256=DhLiERBJR2V5Boglf7Aq9Rbc4vsvLIh67CrLDIPeqA0,398
4
- web_search/web_searcher.py,sha256=dmN1R4iyFvaPNpyBjFLWujvQ6_I3oD1GRlRyC03egpo,9707
5
- chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
6
- chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info/METADATA,sha256=XYlA28-QArWVBBWfwcH0Um223uO-tJuzfFhHnS5wBTE,1902
7
- chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
8
- chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
9
- chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
10
- chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info/RECORD,,