lanqian528 / chat2api

A service that can convert ChatGPT on the web to OpenAI API format.
https://chatgpt.aicnm.cc/login
MIT License
2.11k stars 423 forks source link

关于接口传入文件问题 #51

Closed weikecloud closed 5 months ago

weikecloud commented 5 months ago

想知道如何在接口传入文件呢?目前只知道如何传入图片,如果按照图片的逻辑,ChatGPT好像无法识别文件

lanqian528 commented 5 months ago

就是一样的逻辑

weikecloud commented 5 months ago

curl https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-4-turbo", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What'\''s in this image?" }, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" } } ] } ], "max_tokens": 300 }' 官方的示例,image_url好像只能是图片的链接,如果是文件的链接,ChatGPT无法识别

lanqian528 commented 5 months ago

我做了处理,可以识别

weikecloud commented 5 months ago

system角色这些也是可以定义吗?

lanqian528 commented 5 months ago

system角色这些也是可以定义吗?

可以

weikecloud commented 5 months ago

刚刚文件无法识别应该是普号的问题,有时候会降智,我想再了解一下,如果需要分析多个文件,该如何处理呢?还是说在image_url里面加入?

weikecloud commented 5 months ago
image

有时候会这样

Yanyutin753 commented 5 months ago

那是你的普号上传文件次数达到限制了吧

weikecloud commented 5 months ago

那是你的普号上传文件次数达到限制了吧

我也觉得是

lanqian528 commented 5 months ago

普号好像一定时间内只能上传一两次文件

weikecloud commented 5 months ago

普号好像一定时间内只能上传一两次文件

我想知道,如何识别多个文件呢?

lanqian528 commented 5 months ago

一样的逻辑

说过了,跟官方传图一样