chatgpt-mirai-qq-bot-web-search 0.1.8__py3-none-any.whl → 0.1.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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: chatgpt-mirai-qq-bot-web-search
3
- Version: 0.1.8
3
+ Version: 0.1.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
@@ -16,17 +16,7 @@ Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
  Requires-Dist: playwright
18
18
  Requires-Dist: trafilatura
19
- Requires-Dist: lxml_html_clean
20
- Dynamic: author
21
- Dynamic: author-email
22
- Dynamic: classifier
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: home-page
26
- Dynamic: project-url
27
- Dynamic: requires-dist
28
- Dynamic: requires-python
29
- Dynamic: summary
19
+ Requires-Dist: lxml-html-clean
30
20
 
31
21
  # OneBot-adapter for ChatGPT-Mirai-QQ-Bot
32
22
 
@@ -41,7 +31,7 @@ pip install chatgpt-mirai-qq-bot-web-search
41
31
  ## 使用
42
32
 
43
33
  在 chatgpt-mirai-qq-bot的web_ui中配置
44
- 使用示例请参考 [web_search/example/normal.yml](web_search/example/roleplayWithWebSearch.yaml)
34
+ 使用示例请参考 [web_search/example/roleplayWithWebSearch.yml](web_search/example/roleplayWithWebSearch.yaml)
45
35
  工作流请参考 [示例图片](web_search/example/workflow.png)
46
36
 
47
37
  ## 开源协议
@@ -0,0 +1,11 @@
1
+ web_search/__init__.py,sha256=MtbzSr02EekF2lW2W0EBWWzsT5GUWj5cYx6rcEh4spA,4360
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
+ web_search/example/roleplayWithWebSearch.yaml,sha256=C-dGy3z8gcRcmxzurssP-kPRLqMf1TYR-nnNUaJjISE,7468
6
+ chatgpt_mirai_qq_bot_web_search-0.1.10.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
7
+ chatgpt_mirai_qq_bot_web_search-0.1.10.dist-info/METADATA,sha256=BnpMaWu2TaTqTGyBcuQA8VllnpO5gV0jdCKPEX9Reec,1739
8
+ chatgpt_mirai_qq_bot_web_search-0.1.10.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
+ chatgpt_mirai_qq_bot_web_search-0.1.10.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
10
+ chatgpt_mirai_qq_bot_web_search-0.1.10.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
11
+ chatgpt_mirai_qq_bot_web_search-0.1.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
web_search/__init__.py CHANGED
@@ -36,21 +36,40 @@ class WebSearchPlugin(Plugin):
36
36
  self.block_registry.register("append_systemPrompt", "internal", AppendSystemPromptBlock)
37
37
  except Exception as e:
38
38
  logger.warning(f"WebSearchPlugin failed: {e}")
39
- # 获取当前文件的绝对路径
40
- with importlib.resources.path('web_search', '__init__.py') as p:
41
- package_path = p.parent
42
- example_dir = package_path / 'example'
39
+ try:
40
+ # 获取当前文件的绝对路径
41
+ with importlib.resources.path('web_search', '__init__.py') as p:
42
+ package_path = p.parent
43
+ example_dir = package_path / 'example'
44
+
45
+ # 确保目录存在
46
+ if not example_dir.exists():
47
+ raise FileNotFoundError(f"Example directory not found at {example_dir}")
48
+
49
+ # 获取所有yaml文件
50
+ yaml_files = list(example_dir.glob('*.yaml')) + list(example_dir.glob('*.yml'))
51
+
52
+ for yaml in yaml_files:
53
+ logger.info(yaml)
54
+ self.workflow_registry.register("chat", yaml.stem, WorkflowBuilder.load_from_yaml(os.path.join(example_dir, yaml), self.container))
55
+ except Exception as e:
56
+ try:
57
+ current_file = os.path.abspath(__file__)
58
+
59
+ # 获取当前文件所在目录
60
+ parent_dir = os.path.dirname(current_file)
43
61
 
44
- # 确保目录存在
45
- if not example_dir.exists():
46
- raise FileNotFoundError(f"Example directory not found at {example_dir}")
62
+ # 构建 example 目录的路径
63
+ example_dir = os.path.join(parent_dir, 'example')
64
+ # 获取 example 目录下所有的 yaml 文件
65
+ yaml_files = [f for f in os.listdir(example_dir) if f.endswith('.yaml') or f.endswith('.yml')]
47
66
 
48
- # 获取所有yaml文件
49
- yaml_files = list(example_dir.glob('*.yaml')) + list(example_dir.glob('*.yml'))
67
+ for yaml in yaml_files:
68
+ logger.info(os.path.join(example_dir, yaml))
69
+ self.workflow_registry.register("search", "roleplayWithWebSearch", WorkflowBuilder.load_from_yaml(os.path.join(example_dir, yaml), self.container))
70
+ except Exception as e:
71
+ logger.warning(f"workflow_registry failed: {e}")
50
72
 
51
- for yaml in yaml_files:
52
- logger.info(yaml)
53
- self.workflow_registry.register("chat", yaml.stem, WorkflowBuilder.load_from_yaml(os.path.join(example_dir, yaml), self.container))
54
73
  @dataclass
55
74
  class WebSearchEvent:
56
75
  """Web搜索事件"""
@@ -1,11 +0,0 @@
1
- web_search/__init__.py,sha256=bdinhnZOl-5t9LV-UT3-Tdfc5ylb-E3t-g9uhYyhunc,3419
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
- web_search/example/roleplayWithWebSearch.yaml,sha256=C-dGy3z8gcRcmxzurssP-kPRLqMf1TYR-nnNUaJjISE,7468
6
- chatgpt_mirai_qq_bot_web_search-0.1.8.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
7
- chatgpt_mirai_qq_bot_web_search-0.1.8.dist-info/METADATA,sha256=T2hl3dW__kL5KSrIG-9HwX6WeLpP_X6yB82lhyHAH5U,1951
8
- chatgpt_mirai_qq_bot_web_search-0.1.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
- chatgpt_mirai_qq_bot_web_search-0.1.8.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
10
- chatgpt_mirai_qq_bot_web_search-0.1.8.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
11
- chatgpt_mirai_qq_bot_web_search-0.1.8.dist-info/RECORD,,