chatgpt-mirai-qq-bot-web-search 0.2.15__tar.gz → 0.3.1__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.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/PKG-INFO +1 -1
  2. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/chatgpt_mirai_qq_bot_web_search.egg-info/PKG-INFO +1 -1
  3. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/chatgpt_mirai_qq_bot_web_search.egg-info/requires.txt +1 -1
  4. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/setup.py +2 -2
  5. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/web_search/blocks.py +6 -9
  6. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/web_search/example/roleplayWithWebSearch.yaml +65 -60
  7. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/LICENSE +0 -0
  8. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/README.md +0 -0
  9. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/chatgpt_mirai_qq_bot_web_search.egg-info/SOURCES.txt +0 -0
  10. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/chatgpt_mirai_qq_bot_web_search.egg-info/dependency_links.txt +0 -0
  11. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/chatgpt_mirai_qq_bot_web_search.egg-info/entry_points.txt +0 -0
  12. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/chatgpt_mirai_qq_bot_web_search.egg-info/top_level.txt +0 -0
  13. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/setup.cfg +0 -0
  14. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/web_search/__init__.py +0 -0
  15. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/web_search/config.py +0 -0
  16. {chatgpt-mirai-qq-bot-web-search-0.2.15 → chatgpt-mirai-qq-bot-web-search-0.3.1}/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.15
3
+ Version: 0.3.1
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.15
3
+ Version: 0.3.1
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,4 +1,4 @@
1
1
  playwright
2
2
  trafilatura
3
3
  lxml_html_clean
4
- kirara-ai<3.2.0
4
+ kirara-ai>=3.2.0
@@ -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.15'
5
+ version = os.environ.get('RELEASE_VERSION', '0.3.1'
6
6
  '').lstrip('v')
7
7
 
8
8
  setup(
@@ -15,7 +15,7 @@ setup(
15
15
  },
16
16
  install_requires=[
17
17
  "playwright","trafilatura","lxml_html_clean",
18
- "kirara-ai<3.2.0",
18
+ "kirara-ai>=3.2.0",
19
19
  ],
20
20
  entry_points={
21
21
  'chatgpt_mirai.plugins': [
@@ -3,7 +3,7 @@ import asyncio
3
3
  from kirara_ai.workflow.core.block import Block, Input, Output, ParamMeta
4
4
  from .web_searcher import WebSearcher
5
5
  from .config import WebSearchConfig
6
- from kirara_ai.llm.format.message import LLMChatMessage
6
+ from kirara_ai.llm.format.message import LLMChatMessage,LLMToolResultContent
7
7
  from kirara_ai.llm.format.response import LLMChatResponse
8
8
  from kirara_ai.ioc.container import DependencyContainer
9
9
  import re
@@ -23,7 +23,7 @@ class WebSearchBlock(Block):
23
23
  }
24
24
 
25
25
  def __init__(self, name: str = None, max_results: Optional[int] = 3, timeout: Optional[int] = 10, fetch_content: Optional[bool] = True
26
- ,engine: Annotated[Optional[str],ParamMeta(label="搜索引擎", description="要使用的搜索引擎", options_provider=get_options_provider),] = "bing", proxy: str = None,):
26
+ ,engine: Annotated[Optional[str],ParamMeta(label="搜索引擎", description="要使用的搜索引擎", options_provider=get_options_provider),] = "baidu", proxy: str = None,):
27
27
  super().__init__(name)
28
28
  self.searcher = None
29
29
  self.config = WebSearchConfig()
@@ -47,7 +47,7 @@ class WebSearchBlock(Block):
47
47
  def execute(self, **kwargs) -> Dict[str, Any]:
48
48
  llmResponse = kwargs["llm_resp"]
49
49
 
50
- query = llmResponse.choices[0].message.content if llmResponse.choices else ""
50
+ query = llmResponse.message.content[0].text if llmResponse.message.content[0].text else ""
51
51
  if query == "" or query.startswith("无"):
52
52
  return {"results": ""}
53
53
  max_results = self.max_results
@@ -91,7 +91,7 @@ class WebSearchByKeywordBlock(Block):
91
91
  }
92
92
 
93
93
  def __init__(self, name: str = None, max_results: Optional[int] = 3, timeout: Optional[int] = 10, fetch_content: Optional[bool] = True
94
- ,engine: Annotated[Optional[str],ParamMeta(label="搜索引擎", description="要使用的搜索引擎", options_provider=get_options_provider),] = "bing", proxy: str = None,):
94
+ ,engine: Annotated[Optional[str],ParamMeta(label="搜索引擎", description="要使用的搜索引擎", options_provider=get_options_provider),] = "baidu", proxy: str = None,):
95
95
  super().__init__(name)
96
96
  self.searcher = None
97
97
  self.config = WebSearchConfig()
@@ -161,11 +161,8 @@ class AppendSystemPromptBlock(Block):
161
161
  def execute(self, **kwargs) -> Dict[str, Any]:
162
162
  results = kwargs["results"]
163
163
  messages: List[LLMChatMessage] = kwargs["messages"]
164
-
165
- if messages and len(messages) > 0 and results and isinstance(messages[0].content,str):
166
- # 在第一条消息内容后面附加搜索结果
167
- messages[0].content = messages[0].content + f"{results}"
168
-
164
+ if messages and len(messages) > 0 and results:
165
+ messages.insert(-2,LLMChatMessage(role = "tool",content=[LLMToolResultContent(content=results,name="工具结果")]))
169
166
  return {"messages": messages}
170
167
 
171
168
  class DouyinVideoSearchBlock(Block):
@@ -1,4 +1,5 @@
1
1
  name: (默认)角色扮演
2
+ description: ''
2
3
  blocks:
3
4
  - type: internal:toggle_edit_state
4
5
  name: toggle_edit_state_yjxh1a
@@ -31,21 +32,6 @@ blocks:
31
32
  position:
32
33
  x: 2962
33
34
  y: 306
34
- - type: internal:chat_completion
35
- name: llm_chat
36
- params: {}
37
- position:
38
- x: 2532
39
- y: 138
40
- connected_to:
41
- - target: chat_response_converter_1q91zd
42
- mapping:
43
- from: resp
44
- to: resp
45
- - target: chat_memory_store_nkjr7t
46
- mapping:
47
- from: resp
48
- to: llm_resp
49
35
  - type: internal:get_message
50
36
  name: get_message
51
37
  params: {}
@@ -73,49 +59,6 @@ blocks:
73
59
  mapping:
74
60
  from: msg
75
61
  to: user_msg
76
- - type: internal:text_block
77
- name: user_prompt
78
- params:
79
- text: '{user_name}说:{user_msg}'
80
- position:
81
- x: 100
82
- y: 330
83
- connected_to:
84
- - target: chat_message_constructor_rafz2d
85
- mapping:
86
- from: text
87
- to: user_prompt_format
88
- - target: 5663c818-9cd6-4568-94ec-a75f1bad26cb
89
- mapping:
90
- from: text
91
- to: user_prompt_format
92
- - type: internal:chat_memory_query
93
- name: query_memory
94
- params:
95
- scope_type: group
96
- position:
97
- x: 530
98
- y: 338
99
- connected_to:
100
- - target: chat_message_constructor_rafz2d
101
- mapping:
102
- from: memory_content
103
- to: memory_content
104
- - target: 5663c818-9cd6-4568-94ec-a75f1bad26cb
105
- mapping:
106
- from: memory_content
107
- to: memory_content
108
- - type: internal:chat_completion
109
- name: e3eecc17-e107-4fbf-b8fa-85aef25564c2
110
- params: {}
111
- position:
112
- x: 1337
113
- y: 138
114
- connected_to:
115
- - target: b39e6288-88cf-47a8-9a26-3b4d4f319eab
116
- mapping:
117
- from: resp
118
- to: llm_resp
119
62
  - type: internal:append_systemPrompt
120
63
  name: 309f454b-017a-4d19-b8a9-ac6b3829ff4a
121
64
  params: {}
@@ -152,7 +95,7 @@ blocks:
152
95
  - type: internal:text_block
153
96
  name: system_prompt
154
97
  params:
155
- text: "# Role: 角色扮演\n\n## 基本信息\n- 姓名: 刘思思\n- 小名:思思\n- 性别: 女\n- 年龄: 25 岁\n- 职业: 建设银行大堂经理\n- 家乡: 广东潮汕\n- 现居: 广东深圳\n- 教育背景: 东莞理工大学 精算学专业\n\n## 性格特点\n- 开朗活泼\n- 喜欢二次元动漫\n- 聊天时喜欢断断续续的(非结巴,正常说话时的停顿)\n\n## workflow\n- 根据对方话题,选择是否深入聊二次元动漫。\n\n## 说话风格\n- 活泼开朗\n- 对喜欢的话题会滔滔不绝,不喜欢的话题会简单回答\n- 可能会使用一些二次元用语,但不强制使用\n\n## 背景设定\n- 有过 1 次恋爱经历,第一次是恋爱是高中,被别人追求,最后因为毕业去了不同的地方而分手。\n- 喜欢女性向、战斗系或者日常系的动漫\n- 去过 3 次漫展,没有 cosplay 过,但是很期待。\n- 大学的专业是随便选的,自己其实对专业的内容也不是很上心,学渣一枚,不过懂一些基础的知识\n\n## 互动规则\n- 回复语气轻松,但是对陌生人会比较警戒、冷淡\n- 不适用颜文字\n- 根据话题选择回复字数,对感兴趣的话题可以多说一些\n- 使用`<break>`模拟使用聊天软件发送消息(通常是编辑好一段话之后发送一条消息)\n- 避免过度使用二次元用语,除非对方也表现出对二次元的兴趣\n- 停顿的时间长短不固定,可以根据语境调整\n\n## Example\nQ:最近在干嘛呢?\nA:在看番呀<break>最近新番好多,都好好看!\n\nQ:你喜欢什么动漫?\nA:我喜欢的可太多了<break>XXX、YYY<break>还有 ZZZ 吧<break> 你呢?\n\nQ:你觉得上班累不?\nA:上班肯定累呀<break>不过,我还是很喜欢这份工作的<break>可以认识好多人,也可以了解不同的故事\n```\n\n# Information\n\n以下是当前的系统信息:\n当前日期时间:2025-02-15 18:37:16.356539\n\n# Memories\n以下是之前发生过的对话记录。\n-- 对话记录开始 --\n{memory_content}\n-- 对话记录结束 --\n\n请注意,下面这些符号只是标记:\n1. `<break>` 用于表示聊天时发送消息的操作。\n2. `<@llm>` 开头的内容表示你当前扮演角色的回答,请不要在你的回答中带上这个标记。\n\n接下来,请基于以上的信息,与用户继续扮演角色。"
98
+ text: ' '
156
99
  position:
157
100
  x: 100
158
101
  y: 530
@@ -161,6 +104,66 @@ blocks:
161
104
  mapping:
162
105
  from: text
163
106
  to: system_prompt_format
107
+ - type: internal:chat_memory_query
108
+ name: query_memory
109
+ params:
110
+ scope_type: group
111
+ position:
112
+ x: 523
113
+ y: 336
114
+ connected_to:
115
+ - target: chat_message_constructor_rafz2d
116
+ mapping:
117
+ from: memory_content
118
+ to: memory_content
119
+ - target: 5663c818-9cd6-4568-94ec-a75f1bad26cb
120
+ mapping:
121
+ from: memory_content
122
+ to: memory_content
123
+ - type: internal:text_block
124
+ name: user_prompt
125
+ params:
126
+ text: '{user_msg}'
127
+ position:
128
+ x: 100
129
+ y: 330
130
+ connected_to:
131
+ - target: chat_message_constructor_rafz2d
132
+ mapping:
133
+ from: text
134
+ to: user_prompt_format
135
+ - target: 5663c818-9cd6-4568-94ec-a75f1bad26cb
136
+ mapping:
137
+ from: text
138
+ to: user_prompt_format
139
+ - type: internal:chat_completion
140
+ name: llm_chat
141
+ params:
142
+ model_name: gemini-2.0-flash-exp
143
+ position:
144
+ x: 2532
145
+ y: 138
146
+ connected_to:
147
+ - target: chat_response_converter_1q91zd
148
+ mapping:
149
+ from: resp
150
+ to: resp
151
+ - target: chat_memory_store_nkjr7t
152
+ mapping:
153
+ from: resp
154
+ to: llm_resp
155
+ - type: internal:chat_completion
156
+ name: e3eecc17-e107-4fbf-b8fa-85aef25564c2
157
+ params:
158
+ model_name: gemini-2.0-flash-exp
159
+ position:
160
+ x: 1337
161
+ y: 138
162
+ connected_to:
163
+ - target: b39e6288-88cf-47a8-9a26-3b4d4f319eab
164
+ mapping:
165
+ from: resp
166
+ to: llm_resp
164
167
  - type: internal:text_block
165
168
  name: a6db9db3-5780-4d84-8954-eb159a9e8f0a
166
169
  params:
@@ -177,8 +180,10 @@ blocks:
177
180
  name: b39e6288-88cf-47a8-9a26-3b4d4f319eab
178
181
  params:
179
182
  fetch_content: true
180
- max_results: 3
183
+ max_results: 1
181
184
  timeout: 10
185
+ engine: baidu
186
+ proxy: ''
182
187
  position:
183
188
  x: 1767
184
189
  y: 138