mirror of
https://github.com/coaidev/coai.git
synced 2025-05-22 06:20:14 +09:00
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package oneapi
|
|
|
|
import "chat/globals"
|
|
|
|
// ChatRequest is the request body for oneapi
|
|
type ChatRequest struct {
|
|
Model string `json:"model"`
|
|
Messages []globals.Message `json:"messages"`
|
|
MaxToken int `json:"max_tokens"`
|
|
Stream bool `json:"stream"`
|
|
}
|
|
|
|
type ChatRequestWithInfinity struct {
|
|
Model string `json:"model"`
|
|
Messages []globals.Message `json:"messages"`
|
|
Stream bool `json:"stream"`
|
|
}
|
|
|
|
// ChatResponse is the native http request body for oneapi
|
|
type ChatResponse struct {
|
|
ID string `json:"id"`
|
|
Object string `json:"object"`
|
|
Created int64 `json:"created"`
|
|
Model string `json:"model"`
|
|
Choices []struct {
|
|
Message struct {
|
|
Content string `json:"content"`
|
|
}
|
|
} `json:"choices"`
|
|
Error struct {
|
|
Message string `json:"message"`
|
|
} `json:"error"`
|
|
}
|
|
|
|
// ChatStreamResponse is the stream response body for oneapi
|
|
type ChatStreamResponse struct {
|
|
ID string `json:"id"`
|
|
Object string `json:"object"`
|
|
Created int64 `json:"created"`
|
|
Model string `json:"model"`
|
|
Data struct {
|
|
Choices []struct {
|
|
Delta struct {
|
|
Content string `json:"content"`
|
|
}
|
|
Index int `json:"index"`
|
|
} `json:"choices"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type ChatStreamErrorResponse struct {
|
|
Data struct {
|
|
Error struct {
|
|
Message string `json:"message"`
|
|
Type string `json:"type"`
|
|
} `json:"error"`
|
|
} `json:"data"`
|
|
}
|