You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
📦 部署环境
📌 软件版本
0.162.9
💻 系统环境
🌐 浏览器
🐛 问题描述
使用支持图片分析的模型时,上传的图片也是需要消耗token的,而聊天界面-上下文明细中,只计算了文字占有的token。
📷 复现步骤
No response
🚦 期望结果
No response
📝 补充信息
至少在使用OPENAI提供的模型服务时,计算是比较简洁方便的。官方说明:https://platform.openai.com/docs/guides/vision。
示例代码:
`from math import ceil
def resize(width, height):
if width > 1024 or height > 1024:
if width > height:
height = int(height * 1024 / width)
width = 1024
else:
width = int(width * 1024 / height)
height = 1024
return width, height
def count_image_tokens(width: int, height: int):
width, height = resize(width, height)
h = ceil(height / 512)
w = ceil(width / 512)
total = 85 + 170 * h * w
return total`
The text was updated successfully, but these errors were encountered: