mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-27 16:04:21 +00:00
doc: 补全部分注释
This commit is contained in:
@@ -8,6 +8,7 @@ from ...config import manager as cfg_mgr
|
||||
|
||||
@stage.stage_class('BanSessionCheckStage')
|
||||
class BanSessionCheckStage(stage.PipelineStage):
|
||||
"""访问控制处理阶段"""
|
||||
|
||||
async def initialize(self):
|
||||
pass
|
||||
|
||||
@@ -14,6 +14,7 @@ from .filters import cntignore, banwords, baiduexamine
|
||||
@stage.stage_class('PostContentFilterStage')
|
||||
@stage.stage_class('PreContentFilterStage')
|
||||
class ContentFilterStage(stage.PipelineStage):
|
||||
"""内容过滤阶段"""
|
||||
|
||||
filter_chain: list[filter.ContentFilter]
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class Controller:
|
||||
stage_index: int,
|
||||
query: entities.Query,
|
||||
):
|
||||
"""从指定阶段开始执行
|
||||
"""从指定阶段开始执行,实现了责任链模式和基于生成器的阶段分叉功能。
|
||||
|
||||
如何看懂这里为什么这么写?
|
||||
去问 GPT-4:
|
||||
|
||||
@@ -15,6 +15,8 @@ from ...config import manager as cfg_mgr
|
||||
|
||||
@stage.stage_class("LongTextProcessStage")
|
||||
class LongTextProcessStage(stage.PipelineStage):
|
||||
"""长消息处理阶段
|
||||
"""
|
||||
|
||||
strategy_impl: strategy.LongTextStrategy
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from ..platform import adapter as msadapter
|
||||
|
||||
|
||||
class QueryPool:
|
||||
"""请求池,请求获得调度进入pipeline之前,保存在这里"""
|
||||
|
||||
query_id_counter: int = 0
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from ...plugin import events
|
||||
|
||||
@stage.stage_class("PreProcessor")
|
||||
class PreProcessor(stage.PipelineStage):
|
||||
"""预处理器
|
||||
"""请求预处理阶段
|
||||
"""
|
||||
|
||||
async def process(
|
||||
|
||||
@@ -11,6 +11,7 @@ from ...config import manager as cfg_mgr
|
||||
|
||||
@stage.stage_class("MessageProcessor")
|
||||
class Processor(stage.PipelineStage):
|
||||
"""请求实际处理阶段"""
|
||||
|
||||
cmd_handler: handler.MessageHandler
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ from ...core import entities as core_entities
|
||||
@stage.stage_class("RequireRateLimitOccupancy")
|
||||
@stage.stage_class("ReleaseRateLimitOccupancy")
|
||||
class RateLimit(stage.PipelineStage):
|
||||
"""限速器控制阶段"""
|
||||
|
||||
algo: algo.ReteLimitAlgo
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ from .preproc import preproc
|
||||
from .ratelimit import ratelimit
|
||||
|
||||
|
||||
# 请求处理阶段顺序
|
||||
stage_order = [
|
||||
"GroupRespondRuleCheckStage",
|
||||
"BanSessionCheckStage",
|
||||
|
||||
Reference in New Issue
Block a user