iamai.adapter.console.message module#

class iamai.adapter.console.message.ConsoleMessage(*, type: str, data: Dict[str, Any] = None)[source]#

Bases: MessageSegment[NoneType]

Console 适配器消息。

is_text() bool[source]#

是否是纯文本消息字段。

Returns:

是否是纯文本消息字段。

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'data': FieldInfo(annotation=Dict[str, Any], required=False, default_factory=dict), 'type': FieldInfo(annotation=str, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

iamai.adapter.console.message.escape_tag(s: str) str[source]#

用于记录带颜色日志时转义 <tag> 类型特殊标签

参考: [loguru color 标签](https://loguru.readthedocs.io/en/stable/api/logger.html#color)

参数:

s: 需要转义的字符串