AstrBot 4.3.0__py3-none-any.whl → 4.3.2__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.
- astrbot/core/agent/runners/tool_loop_agent_runner.py +17 -2
- astrbot/core/config/default.py +1 -1
- astrbot/core/pipeline/respond/stage.py +10 -0
- {astrbot-4.3.0.dist-info → astrbot-4.3.2.dist-info}/METADATA +1 -1
- {astrbot-4.3.0.dist-info → astrbot-4.3.2.dist-info}/RECORD +8 -8
- {astrbot-4.3.0.dist-info → astrbot-4.3.2.dist-info}/WHEEL +0 -0
- {astrbot-4.3.0.dist-info → astrbot-4.3.2.dist-info}/entry_points.txt +0 -0
- {astrbot-4.3.0.dist-info → astrbot-4.3.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -198,6 +198,17 @@ class ToolLoopAgentRunner(BaseAgentRunner[TContext]):
|
|
|
198
198
|
func_tool = req.func_tool.get_func(func_tool_name)
|
|
199
199
|
logger.info(f"使用工具:{func_tool_name},参数:{func_tool_args}")
|
|
200
200
|
|
|
201
|
+
if not func_tool:
|
|
202
|
+
logger.warning(f"未找到指定的工具: {func_tool_name},将跳过。")
|
|
203
|
+
tool_call_result_blocks.append(
|
|
204
|
+
ToolCallMessageSegment(
|
|
205
|
+
role="tool",
|
|
206
|
+
tool_call_id=func_tool_id,
|
|
207
|
+
content=f"error: 未找到工具 {func_tool_name}",
|
|
208
|
+
)
|
|
209
|
+
)
|
|
210
|
+
continue
|
|
211
|
+
|
|
201
212
|
try:
|
|
202
213
|
await self.agent_hooks.on_tool_start(
|
|
203
214
|
self.run_context, func_tool, func_tool_args
|
|
@@ -210,9 +221,12 @@ class ToolLoopAgentRunner(BaseAgentRunner[TContext]):
|
|
|
210
221
|
run_context=self.run_context,
|
|
211
222
|
**func_tool_args,
|
|
212
223
|
)
|
|
213
|
-
|
|
224
|
+
|
|
225
|
+
_final_resp: CallToolResult | None = None
|
|
226
|
+
async for resp in executor: # type: ignore
|
|
214
227
|
if isinstance(resp, CallToolResult):
|
|
215
228
|
res = resp
|
|
229
|
+
_final_resp = resp
|
|
216
230
|
if isinstance(res.content[0], TextContent):
|
|
217
231
|
tool_call_result_blocks.append(
|
|
218
232
|
ToolCallMessageSegment(
|
|
@@ -279,13 +293,14 @@ class ToolLoopAgentRunner(BaseAgentRunner[TContext]):
|
|
|
279
293
|
chain=res.chain, type="tool_direct_result"
|
|
280
294
|
)
|
|
281
295
|
else:
|
|
296
|
+
# 不应该出现其他类型
|
|
282
297
|
logger.warning(
|
|
283
298
|
f"Tool 返回了不支持的类型: {type(resp)},将忽略。"
|
|
284
299
|
)
|
|
285
300
|
|
|
286
301
|
try:
|
|
287
302
|
await self.agent_hooks.on_tool_end(
|
|
288
|
-
self.run_context, func_tool, func_tool_args,
|
|
303
|
+
self.run_context, func_tool, func_tool_args, _final_resp
|
|
289
304
|
)
|
|
290
305
|
except Exception as e:
|
|
291
306
|
logger.error(f"Error in on_tool_end hook: {e}", exc_info=True)
|
astrbot/core/config/default.py
CHANGED
|
@@ -190,6 +190,16 @@ class RespondStage(Stage):
|
|
|
190
190
|
except Exception as e:
|
|
191
191
|
logger.warning(f"空内容检查异常: {e}")
|
|
192
192
|
|
|
193
|
+
# 将 Plain 为空的消息段移除
|
|
194
|
+
result.chain = [
|
|
195
|
+
comp
|
|
196
|
+
for comp in result.chain
|
|
197
|
+
if not (
|
|
198
|
+
isinstance(comp, Comp.Plain)
|
|
199
|
+
and (not comp.text or not comp.text.strip())
|
|
200
|
+
)
|
|
201
|
+
]
|
|
202
|
+
|
|
193
203
|
# 发送消息链
|
|
194
204
|
# Record 需要强制单独发送
|
|
195
205
|
need_separately = {ComponentType.Record}
|
|
@@ -42,10 +42,10 @@ astrbot/core/agent/tool.py,sha256=fXFkQGFIIoX9Y1GYj_LIGyrybOeEKSqOo7-3F10zf58,89
|
|
|
42
42
|
astrbot/core/agent/tool_executor.py,sha256=keliOV_lyrI6CALr-MAVCdLE-HjxZh9zygoY61IVkfM,384
|
|
43
43
|
astrbot/core/agent/runners/__init__.py,sha256=KwR34OKGVSQpJ_MaGVP_MX5L1SZ4oU-lv4GuMbSF5Ys,65
|
|
44
44
|
astrbot/core/agent/runners/base.py,sha256=exZS_d2BsrLz-xgeY9ZUPuXikBDUnKxO-dU3ZFQMhRs,1625
|
|
45
|
-
astrbot/core/agent/runners/tool_loop_agent_runner.py,sha256=
|
|
45
|
+
astrbot/core/agent/runners/tool_loop_agent_runner.py,sha256=O4sYg1V3dbUcZFLek5Izi-aEJb983tk9DJOCBQvQjro,13558
|
|
46
46
|
astrbot/core/config/__init__.py,sha256=0CO_3sKtI3WOwWT0k4i6TleWq1SAWJFfB8KjnYB8Zig,172
|
|
47
47
|
astrbot/core/config/astrbot_config.py,sha256=X-b3c5m4msgJrdYFH2LXic5XKY0ViuUMdNZ335zqSBw,6335
|
|
48
|
-
astrbot/core/config/default.py,sha256=
|
|
48
|
+
astrbot/core/config/default.py,sha256=DyrHaNp82t7kaXwyE14xZrBpk0MVl50dZJK28z5iB8M,123320
|
|
49
49
|
astrbot/core/db/__init__.py,sha256=JOAMt7_j0y96CuArXJ-YY_qXisSartOZwyDTKf9ZDn8,8844
|
|
50
50
|
astrbot/core/db/po.py,sha256=NDOJpUXI1i4BF1uymCj07opwXM0gdHBtwCoL16Xj4jc,7798
|
|
51
51
|
astrbot/core/db/sqlite.py,sha256=5o4nsGnq5NsFkhZEv-eM_rXq_w859TcHk-m602B3mCM,25612
|
|
@@ -76,7 +76,7 @@ astrbot/core/pipeline/process_stage/stage.py,sha256=2hCX5LdUCzX2RbleMLF_Yqiot9YD
|
|
|
76
76
|
astrbot/core/pipeline/process_stage/method/llm_request.py,sha256=NaWr0eRhuxqb4ZIscVNce_f_kP7GL12ME4Ph-WF4dog,25370
|
|
77
77
|
astrbot/core/pipeline/process_stage/method/star_request.py,sha256=IuPP7qnxvBgKV6a9D3wLU4_KU3Ec3Ml7IOADQCXDgqk,2501
|
|
78
78
|
astrbot/core/pipeline/rate_limit_check/stage.py,sha256=I_GkpSgioN0-T_catMwpRKtxx-TiMmvu8vV_FE5ORIA,4072
|
|
79
|
-
astrbot/core/pipeline/respond/stage.py,sha256=
|
|
79
|
+
astrbot/core/pipeline/respond/stage.py,sha256=XE5yGsHGxESP0zAGmx3qHovP1wGaJDXUgfLb5Z4wasE,10837
|
|
80
80
|
astrbot/core/pipeline/result_decorate/stage.py,sha256=An9797dUMWoYlEPXwtzvSkpe2bIPhEKccePb3pOwiY8,13681
|
|
81
81
|
astrbot/core/pipeline/session_status_check/stage.py,sha256=woucuVbzzQoi62MDoP3lTha4es_fUu4p-IPCzSiYDBw,1262
|
|
82
82
|
astrbot/core/pipeline/waking_check/stage.py,sha256=URBFmfid1CKhtCGjH7OzFmxBE-Gt9vv1eYlp6msIv_Q,8240
|
|
@@ -218,8 +218,8 @@ astrbot/dashboard/routes/static_file.py,sha256=7KnNcOb1BVqSTft114LhGsDkfg69X2jHE
|
|
|
218
218
|
astrbot/dashboard/routes/t2i.py,sha256=scp05AxoJM9cubrkSMBu1BbIWP1BMS50eFEPZ9S6WKM,8893
|
|
219
219
|
astrbot/dashboard/routes/tools.py,sha256=FvWgjzImgeIGFWJM_r2tku3UTj0J5LwZXfmZJxfJWHM,13975
|
|
220
220
|
astrbot/dashboard/routes/update.py,sha256=vhG6ET0GJNLTpfkKABYf3Aq5ChUCID1BvoZissWRBZg,6517
|
|
221
|
-
astrbot-4.3.
|
|
222
|
-
astrbot-4.3.
|
|
223
|
-
astrbot-4.3.
|
|
224
|
-
astrbot-4.3.
|
|
225
|
-
astrbot-4.3.
|
|
221
|
+
astrbot-4.3.2.dist-info/METADATA,sha256=bJs_S9odxMkmrmby7JCgNxdg28UuHBRIkggXr9BNea0,11095
|
|
222
|
+
astrbot-4.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
223
|
+
astrbot-4.3.2.dist-info/entry_points.txt,sha256=OEF09YmhBWYuViXrvTLLpstF4ccmNwDL8r7nnFD0pfI,53
|
|
224
|
+
astrbot-4.3.2.dist-info/licenses/LICENSE,sha256=zPfQj5Mq8-gThIiBcxETr7t8gND9bZWOjTGQAr80TQI,34500
|
|
225
|
+
astrbot-4.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|