feat: initial support of Dall-E

This commit is contained in:
ckt1031
2023-07-09 19:15:15 +08:00
parent 6215d2e71c
commit d61dc4a9ca
6 changed files with 185 additions and 11 deletions

View File

@@ -2,10 +2,11 @@ package controller
import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"strings"
"github.com/gin-gonic/gin"
)
type Message struct {
@@ -37,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 {
@@ -76,6 +78,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 {