mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-17 13:43:42 +08:00
🔖 chore: Rename relay/util to relay/relay_util package and add utils package
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"one-api/common"
|
||||
"one-api/common/requester"
|
||||
"one-api/common/utils"
|
||||
"one-api/types"
|
||||
"strings"
|
||||
)
|
||||
@@ -85,9 +86,9 @@ func (p *CloudflareAIProvider) convertToChatOpenai(response *ChatRespone, reques
|
||||
}
|
||||
|
||||
openaiResponse = &types.ChatCompletionResponse{
|
||||
ID: fmt.Sprintf("chatcmpl-%s", common.GetUUID()),
|
||||
ID: fmt.Sprintf("chatcmpl-%s", utils.GetUUID()),
|
||||
Object: "chat.completion",
|
||||
Created: common.GetTimestamp(),
|
||||
Created: utils.GetTimestamp(),
|
||||
Model: request.Model,
|
||||
Choices: []types.ChatCompletionChoice{{
|
||||
Index: 0,
|
||||
@@ -155,9 +156,9 @@ func (h *CloudflareAIStreamHandler) handlerStream(rawLine *[]byte, dataChan chan
|
||||
|
||||
func (h *CloudflareAIStreamHandler) convertToOpenaiStream(chatResponse *ChatResult, dataChan chan string, isStop bool) {
|
||||
streamResponse := types.ChatCompletionStreamResponse{
|
||||
ID: fmt.Sprintf("chatcmpl-%s", common.GetUUID()),
|
||||
ID: fmt.Sprintf("chatcmpl-%s", utils.GetUUID()),
|
||||
Object: "chat.completion.chunk",
|
||||
Created: common.GetTimestamp(),
|
||||
Created: utils.GetTimestamp(),
|
||||
Model: h.Request.Model,
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"one-api/common"
|
||||
"one-api/common/storage"
|
||||
"one-api/common/utils"
|
||||
"one-api/types"
|
||||
"time"
|
||||
)
|
||||
@@ -46,7 +47,7 @@ func (p *CloudflareAIProvider) CreateImageGenerations(request *types.ImageReques
|
||||
|
||||
url := ""
|
||||
if request.ResponseFormat == "" || request.ResponseFormat == "url" {
|
||||
url = storage.Upload(body, common.GetUUID()+".png")
|
||||
url = storage.Upload(body, utils.GetUUID()+".png")
|
||||
}
|
||||
|
||||
openaiResponse := &types.ImageResponse{
|
||||
|
||||
Reference in New Issue
Block a user