mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-26 23:44:19 +00:00
feat: preliminarily implement pipeline invoking
This commit is contained in:
@@ -5,8 +5,10 @@ import asyncio
|
||||
|
||||
|
||||
from ...core import app
|
||||
from ...platform.types import events as platform_events
|
||||
from ...platform.types import message as platform_message
|
||||
|
||||
from .. import stage, entities, stagemgr
|
||||
from .. import stage, entities
|
||||
from ...core import entities as core_entities
|
||||
from ...config import manager as cfg_mgr
|
||||
|
||||
@@ -19,8 +21,8 @@ class SendResponseBackStage(stage.PipelineStage):
|
||||
async def process(self, query: core_entities.Query, stage_inst_name: str) -> entities.StageProcessResult:
|
||||
"""处理
|
||||
"""
|
||||
|
||||
random_range = (self.ap.platform_cfg.data['force-delay']['min'], self.ap.platform_cfg.data['force-delay']['max'])
|
||||
|
||||
random_range = (query.pipeline_config['output']['force-delay']['min'], query.pipeline_config['output']['force-delay']['max'])
|
||||
|
||||
random_delay = random.uniform(*random_range)
|
||||
|
||||
@@ -31,10 +33,20 @@ class SendResponseBackStage(stage.PipelineStage):
|
||||
|
||||
await asyncio.sleep(random_delay)
|
||||
|
||||
await self.ap.platform_mgr.send(
|
||||
query.message_event,
|
||||
query.resp_message_chain[-1],
|
||||
adapter=query.adapter
|
||||
if query.pipeline_config['output']['misc']['at-sender'] and isinstance(query.message_event, platform_events.GroupMessage):
|
||||
query.resp_message_chain[-1].insert(
|
||||
0,
|
||||
platform_message.At(
|
||||
query.message_event.sender.id
|
||||
)
|
||||
)
|
||||
|
||||
quote_origin = query.pipeline_config['output']['misc']['quote-origin']
|
||||
|
||||
await query.adapter.reply_message(
|
||||
message_source=query.message_event,
|
||||
message=query.resp_message_chain[-1],
|
||||
quote_origin=quote_origin
|
||||
)
|
||||
|
||||
return entities.StageProcessResult(
|
||||
|
||||
Reference in New Issue
Block a user