Skip to content
Discussion options

You must be logged in to vote

@kamen007 感谢关注,目前的对话接口是通过 chat 这个接口实现的:

https://github.com/xerrors/Yuxi-Know/blob/427f9bbae46709a65e35a6b965668299c141ddac/server/routers/chat_router.py#L23-L28

所以,你需要在这个参数里面传入用户上传的图片的路径,然后在历史消息管理里面新增消息的时候,除了增加这个 content 之外,也要新增 image(base64编码)。参考各个模型供应商对图片消息的支持,一般都是支持 base64格式的图片的。

https://github.com/xerrors/Yuxi-Know/blob/427f9bbae46709a65e35a6b965668299c141ddac/src/core/history.py#L4-L40

尤其需要注意的就是这个 add_user 和 get_history_with_msg。

这个其实比输入文档要复杂一些

如果实现了的话,欢迎PR 😘

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by xerrors
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #155 on April 18, 2025 11:53.