-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
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
poe的api能否支持文件和图片啊 #5
Comments
更新应该就是把pr改一改,加一个白名单了。 |
好的,谢谢作者!期待有大佬提pr! |
tg的话直接把file_id捕获后本地处理即可,也可以参考modal的方案进行云处理。Poe也是通过三方云计算类似modal去处理文件,然后将结果取回后丢给api进行加工。 |
async def handle_file_message(update: Update, context):
await handle_message(update, context)
msg = update.message
bot = context.bot
user_id = update.effective_chat.id
logging.info(f'update信息: {update},{user_name}')
file_id = msg.photo[-1].file_id if msg.photo else msg.document.file_id
text = await pix2text(Update, context, file_id)
logging.info(f'识别文字:{text}')
message = fp.ProtocolMessage(role="user", content=f'“{text}”,请整理并纠错。以“我收到了你的图片,内容是:\n”开始回复。')
user_context[user_id]['messages'].append(message)
await handle_user_request(user_id, update, context) pix2text可以更换成别的ocr服务即可。可以云也可以本地。 bot = context.bot
file = await bot.get_file(file_id)
out = BytesIO()
await file.download_to_memory(out)
out.seek(0) |
你这个解决方案可以,就是透过ocr之类的本地处理完成文字,再发送给poe处理。本来我想着直接整个丢给poe让poe自己处理呢,说起来我也好久没更新了😂,上传图片这个我再参考下,争取把白名单整了先 |
你好,想问一下项目还会有别的更新吗?比如支持文件和图片上传,我那天简单看了一下他的api文档好像可以(?)然后会添加别的模型支持吗😂非常感谢!
The text was updated successfully, but these errors were encountered: