feat: 火山引擎增加文生图
This commit is contained in:
@@ -15,6 +15,7 @@ type ImageRequest struct {
|
|||||||
Background string `json:"background,omitempty"`
|
Background string `json:"background,omitempty"`
|
||||||
Moderation string `json:"moderation,omitempty"`
|
Moderation string `json:"moderation,omitempty"`
|
||||||
OutputFormat string `json:"output_format,omitempty"`
|
OutputFormat string `json:"output_format,omitempty"`
|
||||||
|
Watermark *bool `json:"watermark,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageResponse struct {
|
type ImageResponse struct {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"one-api/relay/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getAndValidImageRequest(c *gin.Context, info *relaycommon.RelayInfo) (*dto.ImageRequest, error) {
|
func getAndValidImageRequest(c *gin.Context, info *relaycommon.RelayInfo) (*dto.ImageRequest, error) {
|
||||||
@@ -41,6 +42,11 @@ func getAndValidImageRequest(c *gin.Context, info *relaycommon.RelayInfo) (*dto.
|
|||||||
imageRequest.Quality = "standard"
|
imageRequest.Quality = "standard"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if info.ApiType == constant.APITypeVolcEngine {
|
||||||
|
watermark := formData.Has("watermark")
|
||||||
|
imageRequest.Watermark = &watermark
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
err := common.UnmarshalBodyReusable(c, imageRequest)
|
err := common.UnmarshalBodyReusable(c, imageRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user