chatgpt-mirai-qq-bot-web-search 0.2.3__py3-none-any.whl → 0.2.5__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.3.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info}/METADATA +1 -1
- chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info/RECORD +11 -0
- web_search/blocks.py +5 -5
- web_search/web_searcher.py +1 -1
- chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info/RECORD +0 -11
- {chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info}/LICENSE +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info}/WHEEL +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info}/entry_points.txt +0 -0
- {chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info → chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
web_search/__init__.py,sha256=bpu1gpf9tq3mOAoaGMM-8S6GBw2GzRAG6ClHGlp-CVw,4607
|
2
|
+
web_search/blocks.py,sha256=duMWavXLkUpoChZhA8NPj3EVqWaJR0TbDqYP8wwD5B4,9140
|
3
|
+
web_search/config.py,sha256=DhLiERBJR2V5Boglf7Aq9Rbc4vsvLIh67CrLDIPeqA0,398
|
4
|
+
web_search/web_searcher.py,sha256=760WTBGusxYntigGi5Wsbm2rRHEWq3sTwfNlf3ew3b0,20919
|
5
|
+
web_search/example/roleplayWithWebSearch.yaml,sha256=C-dGy3z8gcRcmxzurssP-kPRLqMf1TYR-nnNUaJjISE,7468
|
6
|
+
chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
|
7
|
+
chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info/METADATA,sha256=NMPI_KliHYAFbH5uqNYKDTtO1j_tIrC9wRkycBttLDY,1734
|
8
|
+
chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
9
|
+
chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
|
10
|
+
chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
|
11
|
+
chatgpt_mirai_qq_bot_web_search-0.2.5.dist-info/RECORD,,
|
web_search/blocks.py
CHANGED
@@ -8,7 +8,7 @@ from kirara_ai.llm.format.response import LLMChatResponse
|
|
8
8
|
from kirara_ai.ioc.container import DependencyContainer
|
9
9
|
import re
|
10
10
|
from kirara_ai.im.message import IMMessage
|
11
|
-
|
11
|
+
from kirara_ai.im.sender import ChatSender, ChatType
|
12
12
|
def get_options_provider(container: DependencyContainer, block: Block) -> List[str]:
|
13
13
|
return ["bing", "google", "baidu"]
|
14
14
|
class WebSearchBlock(Block):
|
@@ -73,7 +73,7 @@ class WebSearchBlock(Block):
|
|
73
73
|
proxy = self.proxy,
|
74
74
|
)
|
75
75
|
)
|
76
|
-
return {"results": "\n以下是联网搜索的结果:\n-- 搜索结果开始
|
76
|
+
return {"results": "\n以下是联网搜索的结果:\n-- 搜索结果开始 --\n"+results+"\n-- 搜索结果结束 --\n"}
|
77
77
|
except Exception as e:
|
78
78
|
print(e)
|
79
79
|
return {"results": f"搜索失败: {str(e)}"}
|
@@ -162,7 +162,7 @@ class AppendSystemPromptBlock(Block):
|
|
162
162
|
results = kwargs["results"]
|
163
163
|
messages: List[LLMChatMessage] = kwargs["messages"]
|
164
164
|
|
165
|
-
if messages and len(messages) > 0:
|
165
|
+
if messages and len(messages) > 0 and results and isinstance(content,str):
|
166
166
|
# 在第一条消息内容后面附加搜索结果
|
167
167
|
messages[0].content = messages[0].content + f"{results}"
|
168
168
|
|
@@ -214,14 +214,14 @@ class DouyinVideoSearchBlock(Block):
|
|
214
214
|
except RuntimeError:
|
215
215
|
loop = asyncio.new_event_loop()
|
216
216
|
asyncio.set_event_loop(loop)
|
217
|
-
|
217
|
+
sender = self.container.resolve(IMMessage).sender
|
218
218
|
results = loop.run_until_complete(
|
219
219
|
self.searcher.search_douyin_videos(
|
220
220
|
keyword=keyword,
|
221
221
|
count=count,
|
222
222
|
timeout=self.timeout,
|
223
223
|
proxy=self.proxy,
|
224
|
-
sender =
|
224
|
+
sender = sender.group_id if sender.chat_type == ChatType.GROUP else sender.user_id
|
225
225
|
)
|
226
226
|
)
|
227
227
|
return {"results": f"\n以下是抖音视频搜索结果:\n{results}"}
|
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=NJqWOAp7X-WMM3c3Xn3qLb9IVV090W3MqELHZTAw8tk,8959
|
3
|
-
web_search/config.py,sha256=DhLiERBJR2V5Boglf7Aq9Rbc4vsvLIh67CrLDIPeqA0,398
|
4
|
-
web_search/web_searcher.py,sha256=d6sFvaMMcm0vXPDRjAVPAvUcrPN6fU7cxbxikFyE23w,20920
|
5
|
-
web_search/example/roleplayWithWebSearch.yaml,sha256=C-dGy3z8gcRcmxzurssP-kPRLqMf1TYR-nnNUaJjISE,7468
|
6
|
-
chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info/LICENSE,sha256=ILBn-G3jdarm2w8oOrLmXeJNU3czuJvVhDLBASWdhM8,34522
|
7
|
-
chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info/METADATA,sha256=vlaZCwGj4Rts9xD-zq7nabGU7MC0vDHDP4nqFmDKQec,1734
|
8
|
-
chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
9
|
-
chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info/entry_points.txt,sha256=o3kRDSdSmSdnCKlK6qS57aN0WpI4ab-Nxub2NwUrjf0,64
|
10
|
-
chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info/top_level.txt,sha256=PoNm8MJYw_y8RTMaNlY0ePLoNHxVUAE2IHDuL5fFubI,11
|
11
|
-
chatgpt_mirai_qq_bot_web_search-0.2.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|