mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-09 02:03:42 +08:00
Merge branch 'upstream/main'
This commit is contained in:
@@ -37,16 +37,16 @@ func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) {
|
||||
action := ""
|
||||
switch meta.Mode {
|
||||
case relaymode.Embeddings:
|
||||
action = "batchEmbedContents?"
|
||||
action = "batchEmbedContents"
|
||||
default:
|
||||
action = "generateContent?"
|
||||
action = "generateContent"
|
||||
}
|
||||
|
||||
if meta.IsStream {
|
||||
action = "streamGenerateContent?alt=sse&"
|
||||
action = "streamGenerateContent?alt=sse"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s/%s/models/%s:%skey=%s", meta.BaseURL, version, meta.ActualModelName, action, meta.APIKey), nil
|
||||
return fmt.Sprintf("%s/%s/models/%s:%s", meta.BaseURL, version, meta.ActualModelName, action), nil
|
||||
}
|
||||
|
||||
func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, meta *meta.Meta) error {
|
||||
|
||||
@@ -22,25 +22,9 @@ import (
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
// // ImagesEditsHandler just copy response body to client
|
||||
// //
|
||||
// // https://replicate.com/black-forest-labs/flux-fill-pro
|
||||
// func ImagesEditsHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *model.Usage) {
|
||||
// c.Writer.WriteHeader(resp.StatusCode)
|
||||
// for k, v := range resp.Header {
|
||||
// c.Writer.Header().Set(k, v[0])
|
||||
// }
|
||||
|
||||
// if _, err := io.Copy(c.Writer, resp.Body); err != nil {
|
||||
// return openai.ErrorWrapper(err, "copy_response_body_failed", http.StatusInternalServerError), nil
|
||||
// }
|
||||
// defer resp.Body.Close()
|
||||
|
||||
// return nil, nil
|
||||
// }
|
||||
|
||||
var errNextLoop = errors.New("next_loop")
|
||||
|
||||
// ImageHandler handles the response from the image creation or remix request
|
||||
func ImageHandler(c *gin.Context, resp *http.Response) (
|
||||
*model.ErrorWithStatusCode, *model.Usage) {
|
||||
if resp.StatusCode != http.StatusCreated {
|
||||
|
||||
Reference in New Issue
Block a user