AstrBot 4.10.1__py3-none-any.whl → 4.10.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/cli/__init__.py +1 -1
- astrbot/core/config/default.py +1 -1
- astrbot/core/star/command_management.py +45 -4
- astrbot/dashboard/routes/command.py +2 -1
- {astrbot-4.10.1.dist-info → astrbot-4.10.2.dist-info}/METADATA +2 -2
- {astrbot-4.10.1.dist-info → astrbot-4.10.2.dist-info}/RECORD +9 -9
- {astrbot-4.10.1.dist-info → astrbot-4.10.2.dist-info}/WHEEL +0 -0
- {astrbot-4.10.1.dist-info → astrbot-4.10.2.dist-info}/entry_points.txt +0 -0
- {astrbot-4.10.1.dist-info → astrbot-4.10.2.dist-info}/licenses/LICENSE +0 -0
astrbot/cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "4.10.
|
|
1
|
+
__version__ = "4.10.2"
|
astrbot/core/config/default.py
CHANGED
|
@@ -90,6 +90,7 @@ async def toggle_command(handler_full_name: str, enabled: bool) -> CommandDescri
|
|
|
90
90
|
async def rename_command(
|
|
91
91
|
handler_full_name: str,
|
|
92
92
|
new_fragment: str,
|
|
93
|
+
aliases: list[str] | None = None,
|
|
93
94
|
) -> CommandDescriptor:
|
|
94
95
|
descriptor = _build_descriptor_by_full_name(handler_full_name)
|
|
95
96
|
if not descriptor:
|
|
@@ -99,9 +100,24 @@ async def rename_command(
|
|
|
99
100
|
if not new_fragment:
|
|
100
101
|
raise ValueError("指令名不能为空。")
|
|
101
102
|
|
|
103
|
+
# 校验主指令名
|
|
102
104
|
candidate_full = _compose_command(descriptor.parent_signature, new_fragment)
|
|
103
105
|
if _is_command_in_use(handler_full_name, candidate_full):
|
|
104
|
-
raise ValueError("
|
|
106
|
+
raise ValueError(f"指令名 '{candidate_full}' 已被其他指令占用。")
|
|
107
|
+
|
|
108
|
+
# 校验别名
|
|
109
|
+
if aliases:
|
|
110
|
+
for alias in aliases:
|
|
111
|
+
alias = alias.strip()
|
|
112
|
+
if not alias:
|
|
113
|
+
continue
|
|
114
|
+
alias_full = _compose_command(descriptor.parent_signature, alias)
|
|
115
|
+
if _is_command_in_use(handler_full_name, alias_full):
|
|
116
|
+
raise ValueError(f"别名 '{alias_full}' 已被其他指令占用。")
|
|
117
|
+
|
|
118
|
+
existing_cfg = await db_helper.get_command_config(handler_full_name)
|
|
119
|
+
merged_extra = dict(existing_cfg.extra_data or {}) if existing_cfg else {}
|
|
120
|
+
merged_extra["resolved_aliases"] = aliases or []
|
|
105
121
|
|
|
106
122
|
config = await db_helper.upsert_command_config(
|
|
107
123
|
handler_full_name=handler_full_name,
|
|
@@ -114,7 +130,7 @@ async def rename_command(
|
|
|
114
130
|
conflict_key=descriptor.original_command,
|
|
115
131
|
resolution_strategy="manual_rename",
|
|
116
132
|
note=None,
|
|
117
|
-
extra_data=
|
|
133
|
+
extra_data=merged_extra,
|
|
118
134
|
auto_managed=False,
|
|
119
135
|
)
|
|
120
136
|
_bind_descriptor_with_config(descriptor, config)
|
|
@@ -363,14 +379,27 @@ def _apply_config_to_descriptor(
|
|
|
363
379
|
new_fragment,
|
|
364
380
|
)
|
|
365
381
|
|
|
382
|
+
extra = config.extra_data or {}
|
|
383
|
+
resolved_aliases = extra.get("resolved_aliases")
|
|
384
|
+
if isinstance(resolved_aliases, list):
|
|
385
|
+
descriptor.aliases = [str(x) for x in resolved_aliases if str(x).strip()]
|
|
386
|
+
|
|
366
387
|
|
|
367
388
|
def _apply_config_to_runtime(
|
|
368
389
|
descriptor: CommandDescriptor,
|
|
369
390
|
config: CommandConfig,
|
|
370
391
|
) -> None:
|
|
371
392
|
descriptor.handler.enabled = config.enabled
|
|
372
|
-
if descriptor.filter_ref
|
|
373
|
-
|
|
393
|
+
if descriptor.filter_ref:
|
|
394
|
+
if descriptor.current_fragment:
|
|
395
|
+
_set_filter_fragment(descriptor.filter_ref, descriptor.current_fragment)
|
|
396
|
+
extra = config.extra_data or {}
|
|
397
|
+
resolved_aliases = extra.get("resolved_aliases")
|
|
398
|
+
if isinstance(resolved_aliases, list):
|
|
399
|
+
_set_filter_aliases(
|
|
400
|
+
descriptor.filter_ref,
|
|
401
|
+
[str(x) for x in resolved_aliases if str(x).strip()],
|
|
402
|
+
)
|
|
374
403
|
|
|
375
404
|
|
|
376
405
|
def _bind_configs_to_descriptors(
|
|
@@ -409,6 +438,18 @@ def _set_filter_fragment(
|
|
|
409
438
|
filter_ref._cmpl_cmd_names = None
|
|
410
439
|
|
|
411
440
|
|
|
441
|
+
def _set_filter_aliases(
|
|
442
|
+
filter_ref: CommandFilter | CommandGroupFilter,
|
|
443
|
+
aliases: list[str],
|
|
444
|
+
) -> None:
|
|
445
|
+
current_aliases = getattr(filter_ref, "alias", set())
|
|
446
|
+
if set(aliases) == current_aliases:
|
|
447
|
+
return
|
|
448
|
+
setattr(filter_ref, "alias", set(aliases))
|
|
449
|
+
if hasattr(filter_ref, "_cmpl_cmd_names"):
|
|
450
|
+
filter_ref._cmpl_cmd_names = None
|
|
451
|
+
|
|
452
|
+
|
|
412
453
|
def _is_command_in_use(
|
|
413
454
|
target_handler_full_name: str,
|
|
414
455
|
candidate_full_command: str,
|
|
@@ -61,12 +61,13 @@ class CommandRoute(Route):
|
|
|
61
61
|
data = await request.get_json()
|
|
62
62
|
handler_full_name = data.get("handler_full_name")
|
|
63
63
|
new_name = data.get("new_name")
|
|
64
|
+
aliases = data.get("aliases")
|
|
64
65
|
|
|
65
66
|
if not handler_full_name or not new_name:
|
|
66
67
|
return Response().error("handler_full_name 与 new_name 均为必填。").__dict__
|
|
67
68
|
|
|
68
69
|
try:
|
|
69
|
-
await rename_command_service(handler_full_name, new_name)
|
|
70
|
+
await rename_command_service(handler_full_name, new_name, aliases=aliases)
|
|
70
71
|
except ValueError as exc:
|
|
71
72
|
return Response().error(str(exc)).__dict__
|
|
72
73
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AstrBot
|
|
3
|
-
Version: 4.10.
|
|
3
|
+
Version: 4.10.2
|
|
4
4
|
Summary: Easy-to-use multi-platform LLM chatbot and development framework
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Keywords: Astrbot,Astrbot Module,Astrbot Plugin
|
|
@@ -36,7 +36,7 @@ Requires-Dist: openai>=1.78.0
|
|
|
36
36
|
Requires-Dist: ormsgpack>=1.9.1
|
|
37
37
|
Requires-Dist: pillow>=11.2.1
|
|
38
38
|
Requires-Dist: pip>=25.1.1
|
|
39
|
-
Requires-Dist: psutil
|
|
39
|
+
Requires-Dist: psutil<7.2.0,>=5.8.0
|
|
40
40
|
Requires-Dist: py-cord>=2.6.1
|
|
41
41
|
Requires-Dist: pydantic~=2.10.3
|
|
42
42
|
Requires-Dist: pydub>=0.25.1
|
|
@@ -8,7 +8,7 @@ astrbot/api/platform/__init__.py,sha256=HXvAy_KLtOJspoGVgDtLa7VjIZoF6WK3Puww55yy
|
|
|
8
8
|
astrbot/api/provider/__init__.py,sha256=mJVcon0snjn_xYirk2hntwba6ymIYYC-ZKKmxvx-jok,379
|
|
9
9
|
astrbot/api/star/__init__.py,sha256=OxgHGtWn3lEQGjb4twbpbWnRepUevPu7gxtDAkAsfhQ,250
|
|
10
10
|
astrbot/api/util/__init__.py,sha256=L1O_mFEUDk8V4lEPsT5iiNbIiOVh7HbrNmitqzUWMZg,180
|
|
11
|
-
astrbot/cli/__init__.py,sha256=
|
|
11
|
+
astrbot/cli/__init__.py,sha256=Lz7nX3XkIPR0fNRX1jz-UKG0VryQUovCCcfeIL4MNJU,23
|
|
12
12
|
astrbot/cli/__main__.py,sha256=QobgMyFoLNTgI_OYddhGOZ9ZvQeBVjjz79mA2cC2OEU,1758
|
|
13
13
|
astrbot/cli/commands/__init__.py,sha256=eAgppZQIqFO1ylQJFABeYrzQ0oZqPWjtE80aKIPB3ks,149
|
|
14
14
|
astrbot/cli/commands/cmd_conf.py,sha256=6-YLicBt_zjWTzaVLUJ1VQLQPbDEPYACB9IVnN8Zvng,6330
|
|
@@ -56,7 +56,7 @@ astrbot/core/agent/runners/dify/dify_agent_runner.py,sha256=LYwpjOcBWf3XlwNVzrDv
|
|
|
56
56
|
astrbot/core/agent/runners/dify/dify_api_client.py,sha256=OXukDVgNx3VmYw6OCzjXyP8JmDWEFuy81sD9XnC4VRo,6530
|
|
57
57
|
astrbot/core/config/__init__.py,sha256=vZjtpC7vr-IvBgSUtbS04C0wpulmCG5tPmcEP1WYE_4,172
|
|
58
58
|
astrbot/core/config/astrbot_config.py,sha256=6bUTnMCOyaS8s6ELsWctDfUFTB53fKJQNu272dZXkdU,6347
|
|
59
|
-
astrbot/core/config/default.py,sha256=
|
|
59
|
+
astrbot/core/config/default.py,sha256=_y_rV_Xc0RyeVZurVKKSStCRhTncuWQ2KDI5l60bk6g,147674
|
|
60
60
|
astrbot/core/config/i18n_utils.py,sha256=HJn_0XeeVS9ryCBelYfnc0nEn10LlX702fcSSFrF1J8,3879
|
|
61
61
|
astrbot/core/db/__init__.py,sha256=OnvNaC76hYp28Bq9zkFXMl19zn7w-FC1zxyLgsemGvU,13400
|
|
62
62
|
astrbot/core/db/po.py,sha256=eoI4sjpFb9CwRy6_Gf6-zHVSka6-oJr0LA4qcepqHzU,11804
|
|
@@ -209,7 +209,7 @@ astrbot/core/provider/sources/xinference_stt_provider.py,sha256=DPEc7cVo2KXKGIgb
|
|
|
209
209
|
astrbot/core/provider/sources/zhipu_source.py,sha256=oOCPXGsR9PLWOuu3h8RSVNRw1Qy2Se6dwmeFR3zk3GM,612
|
|
210
210
|
astrbot/core/star/README.md,sha256=LXxqxp3xv_oejO8ocBPOrbmLe0WB4feu43fYDNddHTQ,161
|
|
211
211
|
astrbot/core/star/__init__.py,sha256=iTlnjfEGJGy--78PhG7F1cKj9VwJVcDNFtGomX8hRO0,2229
|
|
212
|
-
astrbot/core/star/command_management.py,sha256=
|
|
212
|
+
astrbot/core/star/command_management.py,sha256=V6LT_xNGCEQ6f6vMh0H8vSolsPx0bIPcFQnbN7QyGOY,18100
|
|
213
213
|
astrbot/core/star/config.py,sha256=FgrBz_fUrBU0-9BxD8enX-xGNGVbFxst3UT10sboYNA,3531
|
|
214
214
|
astrbot/core/star/context.py,sha256=zudyvlcVJb5zO7pAh_TGQOUQ3q8JSoKM1wldcciXypw,21234
|
|
215
215
|
astrbot/core/star/session_llm_manager.py,sha256=W_ZgNDyUPjMQGccqnK83hFjZvSCv5BLQeyv5fHvRLUw,5307
|
|
@@ -259,7 +259,7 @@ astrbot/dashboard/utils.py,sha256=KrAv0lnPaVR0bx8yevT1CLGbSNsJizlfkKkPEtVVANI,53
|
|
|
259
259
|
astrbot/dashboard/routes/__init__.py,sha256=57ZYHYQfNI-YAiA8K9m2tRJcHzMKcZ02Vu-A_eD0HUE,894
|
|
260
260
|
astrbot/dashboard/routes/auth.py,sha256=rYkvt3MpCY9BhWjG0DUoX3YaBkJT1Id7M2pKqTmXbvo,2946
|
|
261
261
|
astrbot/dashboard/routes/chat.py,sha256=ntQrgrnOTIep_9Ycb1DCZjZBJPtlIJUO2YnTvC1GXFQ,27120
|
|
262
|
-
astrbot/dashboard/routes/command.py,sha256=
|
|
262
|
+
astrbot/dashboard/routes/command.py,sha256=DYwcqUF1ibFVQ4qMX3Nob7f0Kz5HmQE0iBWrVNF3Hk8,2917
|
|
263
263
|
astrbot/dashboard/routes/config.py,sha256=4CsabE-ARxmLSGg30ZxlW-EvGHD-ppWHH03jml5-uQc,43326
|
|
264
264
|
astrbot/dashboard/routes/conversation.py,sha256=TWGY7BJ9QfmbxurAieBrbMmCi4_Ua2klxsAUlSRXbng,14302
|
|
265
265
|
astrbot/dashboard/routes/file.py,sha256=gULvXP9PnVOQlyv_PCEzZQE5ptnGQEjFPvwOLxdVgb4,708
|
|
@@ -275,8 +275,8 @@ astrbot/dashboard/routes/static_file.py,sha256=7KnNcOb1BVqSTft114LhGsDkfg69X2jHE
|
|
|
275
275
|
astrbot/dashboard/routes/t2i.py,sha256=F6smxdL99MF7cRw3hqS6-2GErw8Zhsv0V0mfBUeEk-c,8931
|
|
276
276
|
astrbot/dashboard/routes/tools.py,sha256=mMwVFw_VOlpqy_WZg1A-ddGtYa5L5QLWYawl37PT0-c,15354
|
|
277
277
|
astrbot/dashboard/routes/update.py,sha256=qXiqQ_dbqRVftOzGgCQrvK8-qopVK6zKhhVVJ9SK26U,6648
|
|
278
|
-
astrbot-4.10.
|
|
279
|
-
astrbot-4.10.
|
|
280
|
-
astrbot-4.10.
|
|
281
|
-
astrbot-4.10.
|
|
282
|
-
astrbot-4.10.
|
|
278
|
+
astrbot-4.10.2.dist-info/METADATA,sha256=fYc8r86vaBcNqrUGF0OALaIdd7y-mOXdiwFnzQ4dT9s,11932
|
|
279
|
+
astrbot-4.10.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
280
|
+
astrbot-4.10.2.dist-info/entry_points.txt,sha256=OEF09YmhBWYuViXrvTLLpstF4ccmNwDL8r7nnFD0pfI,53
|
|
281
|
+
astrbot-4.10.2.dist-info/licenses/LICENSE,sha256=zPfQj5Mq8-gThIiBcxETr7t8gND9bZWOjTGQAr80TQI,34500
|
|
282
|
+
astrbot-4.10.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|