robot
feishu.robot
¶
handle_chat
¶
Python
handle_chat(request: dict, max_num_messages: int | None = ..., max_message_length: int | None = ..., stop_words: set[str] | None = ..., stream: bool = ...) -> dict
Python
handle_chat(request: dict, max_num_messages: int | None = ..., max_message_length: int | None = ..., stream: bool = ...) -> dict
Python
handle_chat(request: NestedDict, max_num_messages: int | None = None, max_message_length: int | None = None, stop_words: set[str] | None = None, stream: bool = True) -> dict
回复飞书消息。
这个函数会根据消息的类型选择不同的回复方式。
对于私聊,会访问所有聊天记录,直到遇到停用词,或者达到最大消息数量。 对于群聊,会访问消息及其回复链中所有的消息,直到达到最大消息数量。
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
NestedDict
|
飞书请求。 |
required |
|
int | None
|
最大消息数量。默认为 feishu.variables 中的 |
None
|
|
int | None
|
最大消息长度。默认为 feishu.variables 中的 |
None
|
|
set[str] | None
|
停用词集合。默认为 feishu.variables 中的 |
None
|
|
bool
|
是否使用流式 API。默认为 |
True
|
功能 | 实现函数 |
---|---|
回复私聊消息 | feishu.robot.chat.handle_chat_history |
回复群聊消息 | feishu.robot.chat.handle_chat_chain |
Source code in feishu/robot/chat.py
handle_verification
¶
处理飞书URL验证请求