We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何支持微信或者更多的聊天客户端?
我可以贡献代码,不过需要一些指引。
The text was updated successfully, but these errors were encountered:
这不太难,下面是响应端发送消息的小示例。
在 https://github.com/LlmKira/Openaibot/tree/main/app/setting 新建新文件即可,抄写已有的模组。在run中直接调用。如果没有配置就结束协程。(我们在 https://github.com/LlmKira/Openaibot/blob/main/app/sender/app.py 和 https://github.com/LlmKira/Openaibot/blob/main/app/receiver/app.py 注册入口程序,继承实现后放在这里)
TelegramTask = Task(queue=__sender__) uploaded_file = [ await File.upload_file( creator=uid, file_name=name, file_data=downloaded_bytes_file ) ] event_message = await self.transcribe( # 这里是转译,将上传的文件和消息转译为通用消息,不同类不同实现 last_message=message, # 平台的消息 messages=history_message_list, # 如果消息回复了其他消息,这里的参数就是其他消息,和 last_message 一个类型 files=uploaded_file, ) sign = Sign.from_root( # 关于函数调用的设置 disable_tool_action=disable_tool_action, response_snapshot=True, platform=__sender__, ) _, event_message, sign = await self.hook( # Hook,原样复制即可 platform=__sender__, messages=event_message, sign=sign ) # Reply success, logs = await TelegramTask.send_task( task=TaskHeader.from_sender( task_sign=sign, event_messages=event_message, chat_id=str(message.chat.id), user_id=str(message.from_user.id), message_id=str(message.message_id), platform=__sender__, ) )
将消息转换为通用消息,即可从这里发送出去。完成接受发送两端的继承,即可完成新的平台支持。
建议直接照抄已有的 sender 代码进行更改。
直接抄写 https://github.com/LlmKira/Openaibot/blob/main/app/receiver/telegram/__init__.py 即可,将其中的发送方法改为 SDK 对应的发送方法
https://github.com/LlmKira/Openaibot/blob/main/app/sender/telegram/__init__.py#L224 (投送消息进入消息队列) https://github.com/LlmKira/Openaibot/blob/main/app/receiver/telegram/__init__.py#L117 (从消息队列中收取LLM的响应)
问题是引入可靠的SDK。
需要注意的是,收发消息是解耦的,信息需要在 EventMessage 通用信息类中传递。
Sorry, something went wrong.
你可以先提 draft pr 同步进度,方便一起行动
No branches or pull requests
如何支持微信或者更多的聊天客户端?
我可以贡献代码,不过需要一些指引。
The text was updated successfully, but these errors were encountered: