feat: initial support of Dall-E (#148, #266)

* feat: initial support of Dall-E

* fix: fix N not timed

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com>
This commit is contained in:
ckt
2023-07-15 12:30:06 +08:00
committed by GitHub
parent 81c5901123
commit b520b54625
7 changed files with 191 additions and 13 deletions

View File

@@ -38,6 +38,7 @@ type GeneralOpenAIRequest struct {
N int `json:"n,omitempty"`
Input any `json:"input,omitempty"`
Instruction string `json:"instruction,omitempty"`
Size string `json:"size,omitempty"`
}
type ChatRequest struct {
@@ -54,6 +55,12 @@ type TextRequest struct {
//Stream bool `json:"stream"`
}
type ImageRequest struct {
Prompt string `json:"prompt"`
N int `json:"n"`
Size string `json:"size"`
}
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
@@ -77,6 +84,13 @@ type TextResponse struct {
Error OpenAIError `json:"error"`
}
type ImageResponse struct {
Created int `json:"created"`
Data []struct {
Url string `json:"url"`
}
}
type ChatCompletionsStreamResponse struct {
Choices []struct {
Delta struct {