AstrBot 4.1.6__py3-none-any.whl → 4.1.7__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/config/default.py +1 -1
- astrbot/core/pipeline/process_stage/method/llm_request.py +5 -5
- astrbot/core/utils/io.py +6 -18
- astrbot/dashboard/routes/config.py +7 -24
- astrbot/dashboard/routes/conversation.py +58 -8
- {astrbot-4.1.6.dist-info → astrbot-4.1.7.dist-info}/METADATA +3 -2
- {astrbot-4.1.6.dist-info → astrbot-4.1.7.dist-info}/RECORD +10 -10
- {astrbot-4.1.6.dist-info → astrbot-4.1.7.dist-info}/WHEEL +0 -0
- {astrbot-4.1.6.dist-info → astrbot-4.1.7.dist-info}/entry_points.txt +0 -0
- {astrbot-4.1.6.dist-info → astrbot-4.1.7.dist-info}/licenses/LICENSE +0 -0
astrbot/core/config/default.py
CHANGED
|
@@ -285,11 +285,11 @@ async def run_agent(
|
|
|
285
285
|
|
|
286
286
|
except Exception as e:
|
|
287
287
|
logger.error(traceback.format_exc())
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
288
|
+
err_msg = f"\n\nAstrBot 请求失败。\n错误类型: {type(e).__name__}\n错误信息: {str(e)}\n\n请在控制台查看和分享错误详情。\n"
|
|
289
|
+
if agent_runner.streaming:
|
|
290
|
+
yield MessageChain().message(err_msg)
|
|
291
|
+
else:
|
|
292
|
+
astr_event.set_result(MessageEventResult().message(err_msg))
|
|
293
293
|
return
|
|
294
294
|
asyncio.create_task(
|
|
295
295
|
Metric.upload(
|
astrbot/core/utils/io.py
CHANGED
|
@@ -227,9 +227,11 @@ async def download_dashboard(
|
|
|
227
227
|
path = os.path.join(get_astrbot_data_path(), "dashboard.zip")
|
|
228
228
|
|
|
229
229
|
if latest or len(str(version)) != 40:
|
|
230
|
-
logger.info(f"准备下载 {version} 发行版本的 AstrBot WebUI 文件")
|
|
231
230
|
ver_name = "latest" if latest else version
|
|
232
231
|
dashboard_release_url = f"https://astrbot-registry.soulter.top/download/astrbot-dashboard/{ver_name}/dist.zip"
|
|
232
|
+
logger.info(
|
|
233
|
+
f"准备下载指定发行版本的 AstrBot WebUI 文件: {dashboard_release_url}"
|
|
234
|
+
)
|
|
233
235
|
try:
|
|
234
236
|
await download_file(dashboard_release_url, path, show_progress=True)
|
|
235
237
|
except BaseException as _:
|
|
@@ -241,24 +243,10 @@ async def download_dashboard(
|
|
|
241
243
|
dashboard_release_url = f"{proxy}/{dashboard_release_url}"
|
|
242
244
|
await download_file(dashboard_release_url, path, show_progress=True)
|
|
243
245
|
else:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
url = (
|
|
247
|
-
"https://api.github.com/repos/AstrBotDevs/astrbot-release-harbour/releases"
|
|
248
|
-
)
|
|
246
|
+
url = f"https://github.com/AstrBotDevs/astrbot-release-harbour/releases/download/release-{version}/dist.zip"
|
|
247
|
+
logger.info(f"准备下载指定版本的 AstrBot WebUI: {url}")
|
|
249
248
|
if proxy:
|
|
250
249
|
url = f"{proxy}/{url}"
|
|
251
|
-
|
|
252
|
-
async with session.get(url) as resp:
|
|
253
|
-
if resp.status == 200:
|
|
254
|
-
releases = await resp.json()
|
|
255
|
-
for release in releases:
|
|
256
|
-
if version in release["tag_name"]:
|
|
257
|
-
download_url = release["assets"][0]["browser_download_url"]
|
|
258
|
-
await download_file(download_url, path, show_progress=True)
|
|
259
|
-
else:
|
|
260
|
-
logger.warning(f"未找到指定的版本的 Dashboard 构建文件: {version}")
|
|
261
|
-
return
|
|
262
|
-
|
|
250
|
+
await download_file(url, path, show_progress=True)
|
|
263
251
|
with zipfile.ZipFile(path, "r") as z:
|
|
264
252
|
z.extractall(extract_path)
|
|
@@ -51,24 +51,6 @@ def validate_config(
|
|
|
51
51
|
def validate(data: dict, metadata: dict = schema, path=""):
|
|
52
52
|
for key, value in data.items():
|
|
53
53
|
if key not in metadata:
|
|
54
|
-
# 无 schema 的配置项,执行类型猜测
|
|
55
|
-
if isinstance(value, str):
|
|
56
|
-
try:
|
|
57
|
-
data[key] = int(value)
|
|
58
|
-
continue
|
|
59
|
-
except ValueError:
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
try:
|
|
63
|
-
data[key] = float(value)
|
|
64
|
-
continue
|
|
65
|
-
except ValueError:
|
|
66
|
-
pass
|
|
67
|
-
|
|
68
|
-
if value.lower() == "true":
|
|
69
|
-
data[key] = True
|
|
70
|
-
elif value.lower() == "false":
|
|
71
|
-
data[key] = False
|
|
72
54
|
continue
|
|
73
55
|
meta = metadata[key]
|
|
74
56
|
if "type" not in meta:
|
|
@@ -127,12 +109,12 @@ def validate_config(
|
|
|
127
109
|
)
|
|
128
110
|
|
|
129
111
|
if is_core:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
112
|
+
meta_all = {
|
|
113
|
+
**schema["platform_group"]["metadata"],
|
|
114
|
+
**schema["provider_group"]["metadata"],
|
|
115
|
+
**schema["misc_config_group"]["metadata"],
|
|
116
|
+
}
|
|
117
|
+
validate(data, meta_all)
|
|
136
118
|
else:
|
|
137
119
|
validate(data, schema)
|
|
138
120
|
|
|
@@ -142,6 +124,7 @@ def validate_config(
|
|
|
142
124
|
def save_config(post_config: dict, config: AstrBotConfig, is_core: bool = False):
|
|
143
125
|
"""验证并保存配置"""
|
|
144
126
|
errors = None
|
|
127
|
+
logger.info(f"Saving config, is_core={is_core}")
|
|
145
128
|
try:
|
|
146
129
|
if is_core:
|
|
147
130
|
errors, post_config = validate_config(
|
|
@@ -169,15 +169,65 @@ class ConversationRoute(Route):
|
|
|
169
169
|
"""删除对话"""
|
|
170
170
|
try:
|
|
171
171
|
data = await request.get_json()
|
|
172
|
-
user_id = data.get("user_id")
|
|
173
|
-
cid = data.get("cid")
|
|
174
172
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
173
|
+
# 检查是否是批量删除
|
|
174
|
+
if "conversations" in data:
|
|
175
|
+
# 批量删除
|
|
176
|
+
conversations = data.get("conversations", [])
|
|
177
|
+
if not conversations:
|
|
178
|
+
return (
|
|
179
|
+
Response().error("批量删除时conversations参数不能为空").__dict__
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
deleted_count = 0
|
|
183
|
+
failed_items = []
|
|
184
|
+
|
|
185
|
+
for conv in conversations:
|
|
186
|
+
user_id = conv.get("user_id")
|
|
187
|
+
cid = conv.get("cid")
|
|
188
|
+
|
|
189
|
+
if not user_id or not cid:
|
|
190
|
+
failed_items.append(
|
|
191
|
+
f"user_id:{user_id}, cid:{cid} - 缺少必要参数"
|
|
192
|
+
)
|
|
193
|
+
continue
|
|
194
|
+
|
|
195
|
+
try:
|
|
196
|
+
await self.core_lifecycle.conversation_manager.delete_conversation(
|
|
197
|
+
unified_msg_origin=user_id, conversation_id=cid
|
|
198
|
+
)
|
|
199
|
+
deleted_count += 1
|
|
200
|
+
except Exception as e:
|
|
201
|
+
failed_items.append(f"user_id:{user_id}, cid:{cid} - {str(e)}")
|
|
202
|
+
|
|
203
|
+
message = f"成功删除 {deleted_count} 个对话"
|
|
204
|
+
if failed_items:
|
|
205
|
+
message += f",失败 {len(failed_items)} 个"
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
Response()
|
|
209
|
+
.ok(
|
|
210
|
+
{
|
|
211
|
+
"message": message,
|
|
212
|
+
"deleted_count": deleted_count,
|
|
213
|
+
"failed_count": len(failed_items),
|
|
214
|
+
"failed_items": failed_items,
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
.__dict__
|
|
218
|
+
)
|
|
219
|
+
else:
|
|
220
|
+
# 单个删除
|
|
221
|
+
user_id = data.get("user_id")
|
|
222
|
+
cid = data.get("cid")
|
|
223
|
+
|
|
224
|
+
if not user_id or not cid:
|
|
225
|
+
return Response().error("缺少必要参数: user_id 和 cid").__dict__
|
|
226
|
+
|
|
227
|
+
await self.core_lifecycle.conversation_manager.delete_conversation(
|
|
228
|
+
unified_msg_origin=user_id, conversation_id=cid
|
|
229
|
+
)
|
|
230
|
+
return Response().ok({"message": "对话删除成功"}).__dict__
|
|
181
231
|
|
|
182
232
|
except Exception as e:
|
|
183
233
|
logger.error(f"删除对话失败: {str(e)}\n{traceback.format_exc()}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AstrBot
|
|
3
|
-
Version: 4.1.
|
|
3
|
+
Version: 4.1.7
|
|
4
4
|
Summary: 易上手的多平台 LLM 聊天机器人及开发框架
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -72,7 +72,8 @@ Description-Content-Type: text/markdown
|
|
|
72
72
|
|
|
73
73
|
<a href="https://github.com/Soulter/AstrBot/blob/master/README_en.md">English</a> |
|
|
74
74
|
<a href="https://github.com/Soulter/AstrBot/blob/master/README_ja.md">日本語</a> |
|
|
75
|
-
<a href="https://astrbot.app/"
|
|
75
|
+
<a href="https://astrbot.app/">文档</a> |
|
|
76
|
+
<a href="https://blog.astrbot.app/">Blog</a> |
|
|
76
77
|
<a href="https://github.com/Soulter/AstrBot/issues">问题提交</a>
|
|
77
78
|
</div>
|
|
78
79
|
|
|
@@ -45,7 +45,7 @@ astrbot/core/agent/runners/base.py,sha256=exZS_d2BsrLz-xgeY9ZUPuXikBDUnKxO-dU3ZF
|
|
|
45
45
|
astrbot/core/agent/runners/tool_loop_agent_runner.py,sha256=rdGgu_QUjOIO5mEDbb7Fe-WZFDqVnOzrW5_D4Th5mcI,12894
|
|
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=j-RQr859DQWgOeKT2qLa2XH9YtFU9ncMOEH6gd8TOys,119209
|
|
49
49
|
astrbot/core/db/__init__.py,sha256=CAtPQ7lfNSNE4hUylUBWks_49ah2amgYmw1V1lA9FwQ,8291
|
|
50
50
|
astrbot/core/db/po.py,sha256=9MfQf4oEOYCUz7qnCjs4isWkGNpQKhaDVYqKIY8W-l0,7707
|
|
51
51
|
astrbot/core/db/sqlite.py,sha256=EsGyK54Yi_rA-rzUNMAwdSbWYGw0PHIaIF-FhYjdIBQ,20941
|
|
@@ -73,7 +73,7 @@ astrbot/core/pipeline/content_safety_check/strategies/keywords.py,sha256=j3Ns_IH
|
|
|
73
73
|
astrbot/core/pipeline/content_safety_check/strategies/strategy.py,sha256=G32Xf42EgeyEnhyPLVYlUMiSnDNHUUnnz_MG0PXqfV4,1234
|
|
74
74
|
astrbot/core/pipeline/preprocess_stage/stage.py,sha256=hHDUsSvOVlyzdWEQEk-P2oSNC0H4FmYI5WrdoP38Zbc,3329
|
|
75
75
|
astrbot/core/pipeline/process_stage/stage.py,sha256=2hCX5LdUCzX2RbleMLF_Yqiot9YDyutF3ePPOZsWeA0,2677
|
|
76
|
-
astrbot/core/pipeline/process_stage/method/llm_request.py,sha256=
|
|
76
|
+
astrbot/core/pipeline/process_stage/method/llm_request.py,sha256=AdYtuLEWFjdrvbQzX9L9Km7zDdmv3Y8yOMfmdy09LFQ,24659
|
|
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
79
|
astrbot/core/pipeline/respond/stage.py,sha256=K_CrogwVS1EYNv9oAe3We95QwahPef1S9oBMwd5wdsw,10525
|
|
@@ -182,7 +182,7 @@ astrbot/core/star/register/star_handler.py,sha256=prfI_-uwe7AL-nzOMJCLCIJCyI1dC8
|
|
|
182
182
|
astrbot/core/utils/astrbot_path.py,sha256=ZK-OmCTOxH63GQ4kBMGZs9ybKmKuHMNXdW9RKqLbYRk,1227
|
|
183
183
|
astrbot/core/utils/command_parser.py,sha256=ktdaw4kdvhfCHIGLTIX7AfMjT9CCL_iuJq1I-V9LEUA,603
|
|
184
184
|
astrbot/core/utils/dify_api_client.py,sha256=RAKS3zjSl3nmhlNPCzN-byJZyZcwE6GR-8xZ9wzc-yE,5590
|
|
185
|
-
astrbot/core/utils/io.py,sha256=
|
|
185
|
+
astrbot/core/utils/io.py,sha256=zFxFVNEPA04Jr15GGdf6K3-9gBe4pxxGfsxqkqSXZ0Q,9082
|
|
186
186
|
astrbot/core/utils/log_pipe.py,sha256=AU-y7vvAUtegH3XRenJqsFpmH0UIV4zUfLWh-5uPkCI,883
|
|
187
187
|
astrbot/core/utils/metrics.py,sha256=uFGS3ZU81vcUbhiIrc-VAy9t5Lc6Oxh13wGYcl3oVGY,2456
|
|
188
188
|
astrbot/core/utils/path_util.py,sha256=_PKjMtQBGD_C7o5BzN4-NSsqCffPSr9NwiHQHTSehkM,3130
|
|
@@ -203,8 +203,8 @@ astrbot/dashboard/server.py,sha256=4d_0xDfMW-qKabVLBEVzOnjxF3qIiNMr3dvaxZO-cEk,9
|
|
|
203
203
|
astrbot/dashboard/routes/__init__.py,sha256=Bn6_rbYtujttHKHEn8Smv2RiObhwWyH9TagW4HZSzGw,710
|
|
204
204
|
astrbot/dashboard/routes/auth.py,sha256=igVjZWluaQpF-lrg-Ueb4IA553dA_Sn6pAxY34-83i8,2964
|
|
205
205
|
astrbot/dashboard/routes/chat.py,sha256=hfKrxS07qEYA3SxwgPymh08-Doi74hwmaYhwxRcwrkk,11601
|
|
206
|
-
astrbot/dashboard/routes/config.py,sha256=
|
|
207
|
-
astrbot/dashboard/routes/conversation.py,sha256=
|
|
206
|
+
astrbot/dashboard/routes/config.py,sha256=y6p6KcsCUWckhOyaDCogH-tL-lfO_WY1g7enOJ33Im0,31023
|
|
207
|
+
astrbot/dashboard/routes/conversation.py,sha256=4-jGtd5ApzcN1Jh6UAGet0A7oPkRMvvxk1gKc47KHmo,10768
|
|
208
208
|
astrbot/dashboard/routes/file.py,sha256=y3yi4ari-ELwiDicuniBlvXhVe8d1JgWRl6FdC42v9k,706
|
|
209
209
|
astrbot/dashboard/routes/log.py,sha256=hDl6Niz_Vs4xb64USjCBzdOcm68GDpEsQrNrLr8yKGc,2114
|
|
210
210
|
astrbot/dashboard/routes/persona.py,sha256=6icnNNE8A0Yy1WI0INWD9ZPKC7VcZG-xHDfYElhaP8M,7857
|
|
@@ -216,8 +216,8 @@ astrbot/dashboard/routes/static_file.py,sha256=7KnNcOb1BVqSTft114LhGsDkfg69X2jHE
|
|
|
216
216
|
astrbot/dashboard/routes/t2i.py,sha256=scp05AxoJM9cubrkSMBu1BbIWP1BMS50eFEPZ9S6WKM,8893
|
|
217
217
|
astrbot/dashboard/routes/tools.py,sha256=FvWgjzImgeIGFWJM_r2tku3UTj0J5LwZXfmZJxfJWHM,13975
|
|
218
218
|
astrbot/dashboard/routes/update.py,sha256=vhG6ET0GJNLTpfkKABYf3Aq5ChUCID1BvoZissWRBZg,6517
|
|
219
|
-
astrbot-4.1.
|
|
220
|
-
astrbot-4.1.
|
|
221
|
-
astrbot-4.1.
|
|
222
|
-
astrbot-4.1.
|
|
223
|
-
astrbot-4.1.
|
|
219
|
+
astrbot-4.1.7.dist-info/METADATA,sha256=Zjs2TXggb5s-DTJ9c91lhAJRT5LNJvRXHJrDRWRvmKQ,11086
|
|
220
|
+
astrbot-4.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
221
|
+
astrbot-4.1.7.dist-info/entry_points.txt,sha256=OEF09YmhBWYuViXrvTLLpstF4ccmNwDL8r7nnFD0pfI,53
|
|
222
|
+
astrbot-4.1.7.dist-info/licenses/LICENSE,sha256=zPfQj5Mq8-gThIiBcxETr7t8gND9bZWOjTGQAr80TQI,34500
|
|
223
|
+
astrbot-4.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|