iamai.adapter.gensokyo.config module#
GSK 适配器配置。
- class iamai.adapter.gensokyo.config.Config(*, adapter_type: Literal['ws', 'reverse-ws', 'ws-reverse'] = 'reverse-ws', host: str = '127.0.0.1', port: int = 8080, url: str = '/gsk/ws', reconnect_interval: int = 3, api_timeout: int = 1000, app_id: str = '', app_secret: str = '', token: str = '', access_token: str = '', **extra_data: Any)[source]#
Bases:
ConfigModel
GSK 配置类,将在适配器被加载时被混入到机器人主配置中。
- adapter_type#
适配器类型,需要和协议端配置相同。
- Type:
Literal[‘ws’, ‘reverse-ws’, ‘ws-reverse’]
- host#
本机域名。
- Type:
str
- port#
监听的端口。
- Type:
int
- url#
WebSocket 路径,需和协议端配置相同。
- Type:
str
- reconnect_interval#
重连等待时间。
- Type:
int
- api_timeout#
进行 API 调用时等待返回响应的超时时间。
- Type:
int
- access_token#
鉴权。
- Type:
str
- access_token: str#
- adapter_type: Literal['ws', 'reverse-ws', 'ws-reverse']#
- api_timeout: int#
- app_id: str#
- app_secret: str#
- host: str#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'access_token': FieldInfo(annotation=str, required=False, default=''), 'adapter_type': FieldInfo(annotation=Literal['ws', 'reverse-ws', 'ws-reverse'], required=False, default='reverse-ws'), 'api_timeout': FieldInfo(annotation=int, required=False, default=1000), 'app_id': FieldInfo(annotation=str, required=False, default=''), 'app_secret': FieldInfo(annotation=str, required=False, default=''), 'host': FieldInfo(annotation=str, required=False, default='127.0.0.1'), 'port': FieldInfo(annotation=int, required=False, default=8080), 'reconnect_interval': FieldInfo(annotation=int, required=False, default=3), 'token': FieldInfo(annotation=str, required=False, default=''), 'url': FieldInfo(annotation=str, required=False, default='/gsk/ws')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- port: int#
- reconnect_interval: int#
- token: str#
- url: str#