feat: switch Query to langbot-plugin definition

This commit is contained in:
Junyan Qin
2025-06-15 22:04:31 +08:00
parent 0c2560cafb
commit 6b782f8761
88 changed files with 248 additions and 348 deletions
+6 -5
View File
@@ -3,10 +3,11 @@ from __future__ import annotations
import asyncio
import typing
from ..core import entities
from ..platform import adapter as msadapter
from ..platform.types import message as platform_message
from ..platform.types import events as platform_events
import langbot_plugin.api.entities.builtin.provider.session as provider_session
import langbot_plugin.api.entities.builtin.pipeline.query as pipeline_query
class QueryPool:
@@ -16,7 +17,7 @@ class QueryPool:
pool_lock: asyncio.Lock
queries: list[entities.Query]
queries: list[pipeline_query.Query]
condition: asyncio.Condition
@@ -29,16 +30,16 @@ class QueryPool:
async def add_query(
self,
bot_uuid: str,
launcher_type: entities.LauncherTypes,
launcher_type: provider_session.LauncherTypes,
launcher_id: typing.Union[int, str],
sender_id: typing.Union[int, str],
message_event: platform_events.MessageEvent,
message_chain: platform_message.MessageChain,
adapter: msadapter.MessagePlatformAdapter,
pipeline_uuid: typing.Optional[str] = None,
) -> entities.Query:
) -> pipeline_query.Query:
async with self.condition:
query = entities.Query(
query = pipeline_query.Query(
bot_uuid=bot_uuid,
query_id=self.query_id_counter,
launcher_type=launcher_type,