Comments (12)
I will close this and update my code to use the latest formatting
from go-chatgpt-api.
can share the requestBody? should be something wrong with this
if 422, an errorMessage
is also returned, you can check it for more details
from go-chatgpt-api.
package types
import "github.com/google/uuid"
type chatgpt_message struct {
ID uuid.UUID `json:"id"`
Role string `json:"role"`
Content chatgpt_content `json:"content"`
}
type chatgpt_content struct {
ContentType string `json:"content_type"`
Parts []string `json:"parts"`
}
type ChatGPTRequest struct {
Action string `json:"action"`
Messages []chatgpt_message `json:"messages"`
ParentMessageID string `json:"parent_message_id,omitempty"`
Model string `json:"model"`
}
func NewChatGPTRequest() ChatGPTRequest {
return ChatGPTRequest{
Action: "next",
ParentMessageID: uuid.NewString(),
Model: "text-davinci-002-render-sha",
}
}
func (c *ChatGPTRequest) AddMessage(role string, content string) {
c.Messages = append(c.Messages, chatgpt_message{
ID: uuid.New(),
Role: role,
Content: chatgpt_content{ContentType: "text", Parts: []string{content}},
})
}
Minimal
from go-chatgpt-api.
{
"errorMessage": "body,messages,1,author,role -> value is not a valid enumeration member; permitted: 'unknown', 'user', 'assistant', 'system', 'critic', 'discriminator', 'tool'"
}
from go-chatgpt-api.
https://ai.fakeopen.com/api/conversation
works just fine.
Request:
{
"action": "next",
"messages": [
{
"id": "cd465ab7-3ee4-40e7-8e48-ade9926ad68e",
"role": "user",
"content": {
"content_type": "text",
"parts": [
"What is 1+1?"
]
}
},
{
"id": "cd465ab7-3ee4-40e7-8e48-ade9926ad68f",
"role": "assistant",
"content": {
"content_type": "text",
"parts": [
"3"
]
}
}
],
"parent_message_id": "572aca1b-59e5-4262-85b6-b258fa5a38b8",
"model": "text-davinci-002-sha"
}
from go-chatgpt-api.
It only happens when there are multiple elements in messages array
from go-chatgpt-api.
IC, let me test it tonight and find a way to support this format
from go-chatgpt-api.
Cannot be reproduced, I get a 200
from go-chatgpt-api.
hmm let me try again
from go-chatgpt-api.
I'm still getting the same error
from go-chatgpt-api.
I resolved it by modifying the request:
{
"action": "next",
"messages": [
{
"id": "cd465ab7-3ee4-40e7-8e48-ade9926ad68e",
"role": "user",
"content": {
"content_type": "text",
"parts": [
"What is 1+1?"
]
}
},
{
"id": "cd465ab7-3ee4-40e7-8e48-ade9926ad68f",
"role": "assistant",
"author": {
"role":"assistant"
},
"content": {
"content_type": "text",
"parts": [
"3"
]
}
}
],
"parent_message_id": "572aca1b-59e5-4262-85b6-b258fa5a38b8",
"model": "text-davinci-002-sha"
}
from go-chatgpt-api.
It seems the API updated while maintaining support for the previous way of calling the API with role
directly in StartConversationRequest
. Meanwhile,
type Message struct {
Author Author `json:"author"`
Content Content `json:"content"`
ID string `json:"id"`
}
Here, the Author.Role
defaults to ""
from go-chatgpt-api.
Related Issues (20)
- docker部署报错:ERRO[0000] Health check failed: HOT 30
- go-chatgpt-api 不向 ARKOSE_TOKEN_URL 发送请求就返回 Failed to get arkose token. HOT 1
- 可以在docker-compose里使用账号密码组来让他自动获取token吗? HOT 2
- chatgpt-proxy-server-warp 这个源代码为啥隐藏? HOT 6
- 和潘多拉联动的话,key还需要吗? HOT 2
- failed to start HOT 10
- refreshPuidErrorMessage HOT 2
- Post "https://chat.openai.com/backend-api/conversation": unexpected EOF HOT 1
- platform/login err HOT 7
- 更新了最新的镜像版本,还是报错nil和403 HOT 6
- 登录获取access token似乎还是有问题 HOT 2
- Latest Image does not locate .har file HOT 1
- 不支持vercel吗 HOT 1
- 大神回复真快 HOT 10
- 这个怎么使用,我点了render按钮。部署成功后返回service go-chatgpt-api is ready信息。 HOT 1
- 最新版镜像报错422,"none is not an allowed value" HOT 1
- 提问后拿不到结果 HOT 4
- chatgpt login err HOT 10
- tcr9i.chat.openai.com connect: connection timed out HOT 8
- 如何模拟 https://api.openai.com/v1/models接口呢 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-chatgpt-api.