AstrBot 4.9.1__py3-none-any.whl → 4.9.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/__init__.py +5 -1
- astrbot/core/star/star_manager.py +12 -0
- astrbot/core/utils/plugin_kv_store.py +28 -0
- {astrbot-4.9.1.dist-info → astrbot-4.9.2.dist-info}/METADATA +1 -1
- {astrbot-4.9.1.dist-info → astrbot-4.9.2.dist-info}/RECORD +10 -9
- {astrbot-4.9.1.dist-info → astrbot-4.9.2.dist-info}/WHEEL +0 -0
- {astrbot-4.9.1.dist-info → astrbot-4.9.2.dist-info}/entry_points.txt +0 -0
- {astrbot-4.9.1.dist-info → astrbot-4.9.2.dist-info}/licenses/LICENSE +0 -0
astrbot/cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "4.9.
|
|
1
|
+
__version__ = "4.9.2"
|
astrbot/core/config/default.py
CHANGED
astrbot/core/star/__init__.py
CHANGED
|
@@ -2,15 +2,19 @@ from astrbot.core import html_renderer
|
|
|
2
2
|
from astrbot.core.provider import Provider
|
|
3
3
|
from astrbot.core.star.star_tools import StarTools
|
|
4
4
|
from astrbot.core.utils.command_parser import CommandParserMixin
|
|
5
|
+
from astrbot.core.utils.plugin_kv_store import PluginKVStoreMixin
|
|
5
6
|
|
|
6
7
|
from .context import Context
|
|
7
8
|
from .star import StarMetadata, star_map, star_registry
|
|
8
9
|
from .star_manager import PluginManager
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
class Star(CommandParserMixin):
|
|
12
|
+
class Star(CommandParserMixin, PluginKVStoreMixin):
|
|
12
13
|
"""所有插件(Star)的父类,所有插件都应该继承于这个类"""
|
|
13
14
|
|
|
15
|
+
author: str
|
|
16
|
+
name: str
|
|
17
|
+
|
|
14
18
|
def __init__(self, context: Context, config: dict | None = None):
|
|
15
19
|
StarTools.initialize(context)
|
|
16
20
|
self.context = context
|
|
@@ -467,6 +467,18 @@ class PluginManager:
|
|
|
467
467
|
metadata.star_cls = metadata.star_cls_type(
|
|
468
468
|
context=self.context,
|
|
469
469
|
)
|
|
470
|
+
|
|
471
|
+
p_name = (metadata.name or "unknown").lower().replace("/", "_")
|
|
472
|
+
p_author = (
|
|
473
|
+
(metadata.author or "unknown").lower().replace("/", "_")
|
|
474
|
+
)
|
|
475
|
+
setattr(metadata.star_cls, "name", p_name)
|
|
476
|
+
setattr(metadata.star_cls, "author", p_author)
|
|
477
|
+
setattr(
|
|
478
|
+
metadata.star_cls,
|
|
479
|
+
"plugin_id",
|
|
480
|
+
f"{p_author}/{p_name}",
|
|
481
|
+
)
|
|
470
482
|
else:
|
|
471
483
|
logger.info(f"插件 {metadata.name} 已被禁用。")
|
|
472
484
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from typing import TypeVar
|
|
2
|
+
|
|
3
|
+
from astrbot.core import sp
|
|
4
|
+
|
|
5
|
+
SUPPORTED_VALUE_TYPES = int | float | str | bytes | bool | dict | list | None
|
|
6
|
+
_VT = TypeVar("_VT")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PluginKVStoreMixin:
|
|
10
|
+
"""为插件提供键值存储功能的 Mixin 类"""
|
|
11
|
+
|
|
12
|
+
plugin_id: str
|
|
13
|
+
|
|
14
|
+
async def put_kv_data(
|
|
15
|
+
self,
|
|
16
|
+
key: str,
|
|
17
|
+
value: SUPPORTED_VALUE_TYPES,
|
|
18
|
+
) -> None:
|
|
19
|
+
"""为指定插件存储一个键值对"""
|
|
20
|
+
await sp.put_async("plugin", self.plugin_id, key, value)
|
|
21
|
+
|
|
22
|
+
async def get_kv_data(self, key: str, default: _VT) -> _VT | None:
|
|
23
|
+
"""获取指定插件存储的键值对"""
|
|
24
|
+
return await sp.get_async("plugin", self.plugin_id, key, default)
|
|
25
|
+
|
|
26
|
+
async def delete_kv_data(self, key: str) -> None:
|
|
27
|
+
"""删除指定插件存储的键值对"""
|
|
28
|
+
await sp.remove_async("plugin", self.plugin_id, key)
|
|
@@ -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=9IzaVQP787fNLdw2IGD5hgGMK5Qp0cYcqMPlh3LI8Jk,22
|
|
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=NQMP2wFXyfRxyN_1JO5CQGPMQmywrX3SbSg_p1wso4k,152197
|
|
60
60
|
astrbot/core/config/i18n_utils.py,sha256=HJn_0XeeVS9ryCBelYfnc0nEn10LlX702fcSSFrF1J8,3879
|
|
61
61
|
astrbot/core/db/__init__.py,sha256=Z3NMgMbxvxZyf5hroO9Kvn2TPKEoL2X21CTW96gzGLE,11200
|
|
62
62
|
astrbot/core/db/po.py,sha256=KIvtPCjf1i9IGOWXyhNKvxzEXmsfopfa7G0UaG98Ams,9313
|
|
@@ -208,14 +208,14 @@ astrbot/core/provider/sources/xinference_rerank_source.py,sha256=DsF4JVlXGeeqqyc
|
|
|
208
208
|
astrbot/core/provider/sources/xinference_stt_provider.py,sha256=DPEc7cVo2KXKGIgb8IXKagPH9qpNAdp5gx5PAink0j4,7731
|
|
209
209
|
astrbot/core/provider/sources/zhipu_source.py,sha256=oOCPXGsR9PLWOuu3h8RSVNRw1Qy2Se6dwmeFR3zk3GM,612
|
|
210
210
|
astrbot/core/star/README.md,sha256=LXxqxp3xv_oejO8ocBPOrbmLe0WB4feu43fYDNddHTQ,161
|
|
211
|
-
astrbot/core/star/__init__.py,sha256=
|
|
211
|
+
astrbot/core/star/__init__.py,sha256=iTlnjfEGJGy--78PhG7F1cKj9VwJVcDNFtGomX8hRO0,2229
|
|
212
212
|
astrbot/core/star/config.py,sha256=FgrBz_fUrBU0-9BxD8enX-xGNGVbFxst3UT10sboYNA,3531
|
|
213
213
|
astrbot/core/star/context.py,sha256=voL-U8XAm-yfQWW_62L5BE1wOn3qaCDstGqvpnWTk9g,21020
|
|
214
214
|
astrbot/core/star/session_llm_manager.py,sha256=W_ZgNDyUPjMQGccqnK83hFjZvSCv5BLQeyv5fHvRLUw,5307
|
|
215
215
|
astrbot/core/star/session_plugin_manager.py,sha256=8sEzOxf_Gq-dwK_S-4rwocAFsYzx7Yi4FJuMRttPTac,2830
|
|
216
216
|
astrbot/core/star/star.py,sha256=Wkf81teNZ27JE_JrENuP0SrpFc2uFYRxHQsWo8R9-No,1826
|
|
217
217
|
astrbot/core/star/star_handler.py,sha256=LQqM6szmedro_TtAMJRFt3vn8uQtiOM25Af5PmlOHKs,7529
|
|
218
|
-
astrbot/core/star/star_manager.py,sha256=
|
|
218
|
+
astrbot/core/star/star_manager.py,sha256=kOxdlxRoMtQRSL_tTtiViOdLYFbKc92UAUWRQtFh-qI,40917
|
|
219
219
|
astrbot/core/star/star_tools.py,sha256=4q8emjyTbyIsVXHmzT88kX9uK28rIhlHc0re40Xm6m0,10847
|
|
220
220
|
astrbot/core/star/updator.py,sha256=4pl42Ks_yjJ3kydx3BwOqocAczhhFBrRnxhBKh4_0Eo,3106
|
|
221
221
|
astrbot/core/star/filter/__init__.py,sha256=bC6eHXh0CjzHmn-LTvsanWReoGIPhhMnBSrMLh97hZQ,470
|
|
@@ -238,6 +238,7 @@ astrbot/core/utils/metrics.py,sha256=CxEkdV2gJai0mw1IbL4DJ81WiQ5mY7v9M_-T6UtRJDs
|
|
|
238
238
|
astrbot/core/utils/migra_helper.py,sha256=pnv3VvDD_9gj1nKjroVQYUeePpvyd0DXJz9CoJvG_Og,2763
|
|
239
239
|
astrbot/core/utils/path_util.py,sha256=FXx9oBrsL-dcq-6OlmiSwk2ygqJ9vMmkCBEi2sL50f8,3050
|
|
240
240
|
astrbot/core/utils/pip_installer.py,sha256=H8Bk5QKh-GBBRvGp7sDKDkh6A1UDy4xU9AtUL10B6Jg,1969
|
|
241
|
+
astrbot/core/utils/plugin_kv_store.py,sha256=L_XGux1K2a3fSxqukTg1XN0pq7AosZNeXPpXlAk5eWE,854
|
|
241
242
|
astrbot/core/utils/session_lock.py,sha256=fZDIbyy1nYfgsQSGUc_pWHZp4Kv6inXjENP8ay2bKGI,913
|
|
242
243
|
astrbot/core/utils/session_waiter.py,sha256=Q4zdrvxs-cLLopLCQES6bYZ6MQrajl4fzqZjmmXX170,7073
|
|
243
244
|
astrbot/core/utils/shared_preferences.py,sha256=1dod97F8dT3itDi_APZXqWNdiB57FRhbWlMyyYTbogA,6755
|
|
@@ -271,8 +272,8 @@ astrbot/dashboard/routes/static_file.py,sha256=7KnNcOb1BVqSTft114LhGsDkfg69X2jHE
|
|
|
271
272
|
astrbot/dashboard/routes/t2i.py,sha256=F6smxdL99MF7cRw3hqS6-2GErw8Zhsv0V0mfBUeEk-c,8931
|
|
272
273
|
astrbot/dashboard/routes/tools.py,sha256=YsVFrwVIhxAI-Ikme7YPrHVnPVTkJ1IaH7n6ciREjdE,14663
|
|
273
274
|
astrbot/dashboard/routes/update.py,sha256=qXiqQ_dbqRVftOzGgCQrvK8-qopVK6zKhhVVJ9SK26U,6648
|
|
274
|
-
astrbot-4.9.
|
|
275
|
-
astrbot-4.9.
|
|
276
|
-
astrbot-4.9.
|
|
277
|
-
astrbot-4.9.
|
|
278
|
-
astrbot-4.9.
|
|
275
|
+
astrbot-4.9.2.dist-info/METADATA,sha256=ak-jLSJ2et3ozqBoBddq815p72DS512c83VQHSmR94E,11932
|
|
276
|
+
astrbot-4.9.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
277
|
+
astrbot-4.9.2.dist-info/entry_points.txt,sha256=OEF09YmhBWYuViXrvTLLpstF4ccmNwDL8r7nnFD0pfI,53
|
|
278
|
+
astrbot-4.9.2.dist-info/licenses/LICENSE,sha256=zPfQj5Mq8-gThIiBcxETr7t8gND9bZWOjTGQAr80TQI,34500
|
|
279
|
+
astrbot-4.9.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|