AstrBot 4.1.5__py3-none-any.whl → 4.1.6__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.
@@ -6,7 +6,7 @@ import os
6
6
 
7
7
  from astrbot.core.utils.astrbot_path import get_astrbot_data_path
8
8
 
9
- VERSION = "4.1.5"
9
+ VERSION = "4.1.6"
10
10
  DB_PATH = os.path.join(get_astrbot_data_path(), "data_v4.db")
11
11
 
12
12
  # 默认配置
astrbot/core/db/sqlite.py CHANGED
@@ -159,6 +159,7 @@ class SQLiteDatabase(BaseDatabase):
159
159
  or_(
160
160
  ConversationV2.title.ilike(f"%{search_query}%"),
161
161
  ConversationV2.content.ilike(f"%{search_query}%"),
162
+ ConversationV2.user_id.ilike(f"%{search_query}%"),
162
163
  )
163
164
  )
164
165
  if "message_types" in kwargs and len(kwargs["message_types"]) > 0:
@@ -7,7 +7,13 @@ from astrbot.core.astrbot_config_mgr import AstrBotConfigManager
7
7
  from astrbot.core.db import BaseDatabase
8
8
 
9
9
  from .entities import ProviderType
10
- from .provider import Provider, STTProvider, TTSProvider, EmbeddingProvider
10
+ from .provider import (
11
+ Provider,
12
+ STTProvider,
13
+ TTSProvider,
14
+ EmbeddingProvider,
15
+ RerankProvider,
16
+ )
11
17
  from .register import llm_tools, provider_cls_map
12
18
  from ..persona_mgr import PersonaManager
13
19
 
@@ -38,7 +44,12 @@ class ProviderManager:
38
44
  """加载的 Text To Speech Provider 的实例"""
39
45
  self.embedding_provider_insts: List[EmbeddingProvider] = []
40
46
  """加载的 Embedding Provider 的实例"""
41
- self.inst_map: dict[str, Provider | STTProvider | TTSProvider] = {}
47
+ self.rerank_provider_insts: List[RerankProvider] = []
48
+ """加载的 Rerank Provider 的实例"""
49
+ self.inst_map: dict[
50
+ str,
51
+ Provider | STTProvider | TTSProvider | EmbeddingProvider | RerankProvider,
52
+ ] = {}
42
53
  """Provider 实例映射. key: provider_id, value: Provider 实例"""
43
54
  self.llm_tools = llm_tools
44
55
 
@@ -378,14 +389,16 @@ class ProviderManager:
378
389
  if not self.curr_provider_inst:
379
390
  self.curr_provider_inst = inst
380
391
 
381
- elif provider_metadata.provider_type in [
382
- ProviderType.EMBEDDING,
383
- ProviderType.RERANK,
384
- ]:
392
+ elif provider_metadata.provider_type == ProviderType.EMBEDDING:
385
393
  inst = cls_type(provider_config, self.provider_settings)
386
394
  if getattr(inst, "initialize", None):
387
395
  await inst.initialize()
388
396
  self.embedding_provider_insts.append(inst)
397
+ elif provider_metadata.provider_type == ProviderType.RERANK:
398
+ inst = cls_type(provider_config, self.provider_settings)
399
+ if getattr(inst, "initialize", None):
400
+ await inst.initialize()
401
+ self.rerank_provider_insts.append(inst)
389
402
 
390
403
  self.inst_map[provider_config["id"]] = inst
391
404
  except Exception as e:
@@ -6,6 +6,7 @@ from astrbot.core.provider.provider import (
6
6
  TTSProvider,
7
7
  STTProvider,
8
8
  EmbeddingProvider,
9
+ RerankProvider,
9
10
  )
10
11
  from astrbot.core.provider.entities import ProviderType
11
12
  from astrbot.core.db import BaseDatabase
@@ -103,11 +104,13 @@ class Context:
103
104
  """
104
105
  self.provider_manager.provider_insts.append(provider)
105
106
 
106
- def get_provider_by_id(self, provider_id: str) -> Provider | None:
107
- """通过 ID 获取对应的 LLM Provider(Chat_Completion 类型)。"""
107
+ def get_provider_by_id(
108
+ self, provider_id: str
109
+ ) -> (
110
+ Provider | TTSProvider | STTProvider | EmbeddingProvider | RerankProvider | None
111
+ ):
112
+ """通过 ID 获取对应的 LLM Provider。"""
108
113
  prov = self.provider_manager.inst_map.get(provider_id)
109
- if prov and not isinstance(prov, Provider):
110
- raise ValueError("返回的 Provider 不是 Provider 类型")
111
114
  return prov
112
115
 
113
116
  def get_all_providers(self) -> List[Provider]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AstrBot
3
- Version: 4.1.5
3
+ Version: 4.1.6
4
4
  Summary: 易上手的多平台 LLM 聊天机器人及开发框架
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.10
@@ -45,10 +45,10 @@ 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=tm3qrOkgowigcjLfK7dbXfXb4chgWZ680y7lcyJg91M,119209
48
+ astrbot/core/config/default.py,sha256=U2UFrtpdrfZhyacTBjqWtRjNVIzkXwTHQb51uqZw6J4,119209
49
49
  astrbot/core/db/__init__.py,sha256=CAtPQ7lfNSNE4hUylUBWks_49ah2amgYmw1V1lA9FwQ,8291
50
50
  astrbot/core/db/po.py,sha256=9MfQf4oEOYCUz7qnCjs4isWkGNpQKhaDVYqKIY8W-l0,7707
51
- astrbot/core/db/sqlite.py,sha256=A5ZDyNK-RvVc8tx37oeJpujhHG3MIrX39fLxWpSEpvU,20866
51
+ astrbot/core/db/sqlite.py,sha256=EsGyK54Yi_rA-rzUNMAwdSbWYGw0PHIaIF-FhYjdIBQ,20941
52
52
  astrbot/core/db/migration/helper.py,sha256=FcwpvBANNeyBSrRhXyd3hudHYEyhTyrcRg9mU9lZtqY,1935
53
53
  astrbot/core/db/migration/migra_3_to_4.py,sha256=I1CesaBbf5wj9agtNWxDl1V-qixmwdURbBQf5Vzagrk,15025
54
54
  astrbot/core/db/migration/shared_preferences_v3.py,sha256=tE11WIpwT-Q8yVBkw4eveRr1PmFdNRJQSprH4xdO3G4,1245
@@ -132,7 +132,7 @@ astrbot/core/provider/__init__.py,sha256=fhD_KB1-KpqJ7woaXDXc7kdlmL3XPQz3xlc5IkF
132
132
  astrbot/core/provider/entites.py,sha256=-353AdRDA6ST4AS48cQ1RRAXHSy3F7pVS_28hW4cG2U,388
133
133
  astrbot/core/provider/entities.py,sha256=CkC-U9nafBKo2n2kLZqzukosDX7RuZWAK4DMBHQkasA,11238
134
134
  astrbot/core/provider/func_tool_manager.py,sha256=NuWMmAJaEwoJ3XCSvhwtmzDPdzX4K4BIRKuKgF0FlQk,20881
135
- astrbot/core/provider/manager.py,sha256=OBN96yiGvrlJno6C2XFA8TbALrLhG8pqdnKfRFKsLzQ,21163
135
+ astrbot/core/provider/manager.py,sha256=R3JqtnV-kRg8monqry6PaPVJL1tQHp5gv4vKOeV8_cQ,21618
136
136
  astrbot/core/provider/provider.py,sha256=rzzlUTUn3cRCRgfd2PhA5RcboHkEDlk3Dw9Q1P3DoJ8,7203
137
137
  astrbot/core/provider/register.py,sha256=bWAF9zWNnSYQWjmZIXiWgxFaeWIiWjEoEIN_xhmq3mM,1830
138
138
  astrbot/core/provider/sources/anthropic_source.py,sha256=9I6VEZ5ANv-SIx7TaNGr2o_9S1xK0eTMOxt1ZF4XrBM,14974
@@ -160,7 +160,7 @@ astrbot/core/provider/sources/zhipu_source.py,sha256=w-0C00U9_24HURUB5ppqcEvMr8l
160
160
  astrbot/core/star/README.md,sha256=LXxqxp3xv_oejO8ocBPOrbmLe0WB4feu43fYDNddHTQ,161
161
161
  astrbot/core/star/__init__.py,sha256=ynSwMrdCLyVMN3Q9flS_mcDDjdIGrkLBpfeDVoFj6PM,2080
162
162
  astrbot/core/star/config.py,sha256=f4h1YFt1Tn6S2D-LvnhM483qaD8JdWjl-TBRV9CeYBo,3593
163
- astrbot/core/star/context.py,sha256=eE1zRPk38A1uENHpVvtKL97vt1wDwWqspsxI_qzvN8A,12996
163
+ astrbot/core/star/context.py,sha256=6s2EdmIghQhLj2MFeRb5zwqO_wbug9zDTrljQgn-FvI,12961
164
164
  astrbot/core/star/session_llm_manager.py,sha256=B2URKTxPW9FXUW1goZ0HkyuqE3PZ2X7o22GSPKnIAj0,8596
165
165
  astrbot/core/star/session_plugin_manager.py,sha256=3vxbqPikZg4ZTHG_STvEKeqNplo78wknILSnFCmHTr0,5291
166
166
  astrbot/core/star/star.py,sha256=fEgg7pxiIsnRg4Xw_KBIyOy3V919MpIgAWQ7FoE7bWc,1690
@@ -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.5.dist-info/METADATA,sha256=ygr7ONOnIvGfoPO1sDwZ9VsCHpstUSvPl3dRdVBHQSg,11043
220
- astrbot-4.1.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
221
- astrbot-4.1.5.dist-info/entry_points.txt,sha256=OEF09YmhBWYuViXrvTLLpstF4ccmNwDL8r7nnFD0pfI,53
222
- astrbot-4.1.5.dist-info/licenses/LICENSE,sha256=zPfQj5Mq8-gThIiBcxETr7t8gND9bZWOjTGQAr80TQI,34500
223
- astrbot-4.1.5.dist-info/RECORD,,
219
+ astrbot-4.1.6.dist-info/METADATA,sha256=8MC8EHaWx-NWaVAIRRgmZ7uBps5N53aFeqhOpMVQ3lY,11043
220
+ astrbot-4.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
221
+ astrbot-4.1.6.dist-info/entry_points.txt,sha256=OEF09YmhBWYuViXrvTLLpstF4ccmNwDL8r7nnFD0pfI,53
222
+ astrbot-4.1.6.dist-info/licenses/LICENSE,sha256=zPfQj5Mq8-gThIiBcxETr7t8gND9bZWOjTGQAr80TQI,34500
223
+ astrbot-4.1.6.dist-info/RECORD,,