mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-12 16:56:02 +00:00
perf: add cmd enable config & fix announce request timeout & fix send card with disconnect ai platform (#1633)
* add cmd config && fix bugs * perf: use `get` * update bansess fix block match rule * perf: comment for access-control session str --------- Co-authored-by: Junyan Qin <rockchinq@gmail.com>
This commit is contained in:
@@ -42,12 +42,14 @@ class Processor(stage.PipelineStage):
|
||||
|
||||
async def generator():
|
||||
cmd_prefix = self.ap.instance_config.data['command']['prefix']
|
||||
cmd_enable = self.ap.instance_config.data['command'].get('enable', True)
|
||||
|
||||
if any(message_text.startswith(prefix) for prefix in cmd_prefix):
|
||||
async for result in self.cmd_handler.handle(query):
|
||||
yield result
|
||||
if cmd_enable and any(message_text.startswith(prefix) for prefix in cmd_prefix):
|
||||
handler_to_use = self.cmd_handler
|
||||
else:
|
||||
async for result in self.chat_handler.handle(query):
|
||||
yield result
|
||||
handler_to_use = self.chat_handler
|
||||
|
||||
async for result in handler_to_use.handle(query):
|
||||
yield result
|
||||
|
||||
return generator()
|
||||
|
||||
Reference in New Issue
Block a user