chatgpt-mirai-qq-bot-web-search 0.1.2__py3-none-any.whl → 0.1.4__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.1.2.dist-info → chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info}/METADATA +1 -1
- chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info/RECORD +10 -0
- web_search/__init__.py +13 -14
- chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info/RECORD +0 -10
- {chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info → chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info}/LICENSE +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info → chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info}/WHEEL +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info → chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info}/entry_points.txt +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.1.2.dist-info → chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
web_search/__init__.py,sha256=5du-gZfOH1TV8FjhBPFCB7GTAX0fZl7jl_9JqDxMVXI,3485
|
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.4.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
|
6
|
+
chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info/METADATA,sha256=kFzetPmWgRZ_WtbNecn1Q-XmYiMVWLr9sPuydtS85vY,1902
|
7
|
+
chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
8
|
+
chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
|
9
|
+
chatgpt_mirai_qq_bot_web_search-0.1.4.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
|
10
|
+
chatgpt_mirai_qq_bot_web_search-0.1.4.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
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
current_dir = os.path.dirname(current_file)
|
40
|
+
with importlib.resources.path('chatgpt-mirai-qq-bot-web-search', '__init__.py') as p:
|
41
|
+
package_path = p.parent
|
42
|
+
example_dir = package_path / 'example'
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
# 确保目录存在
|
45
|
+
if not example_dir.exists():
|
46
|
+
raise FileNotFoundError(f"Example directory not found at {example_dir}")
|
46
47
|
|
47
|
-
|
48
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
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,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|