mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-17 21:53:42 +08:00
🔖 chore: Rename relay/util to relay/relay_util package and add utils package
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"one-api/common"
|
||||
"one-api/common/requester"
|
||||
"one-api/common/utils"
|
||||
"one-api/types"
|
||||
"strings"
|
||||
)
|
||||
@@ -145,9 +146,9 @@ func (p *GeminiProvider) convertToChatOpenai(response *GeminiChatResponse, reque
|
||||
}
|
||||
|
||||
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: make([]types.ChatCompletionChoice, 0, len(response.Candidates)),
|
||||
}
|
||||
@@ -191,9 +192,9 @@ func (h *geminiStreamHandler) handlerStream(rawLine *[]byte, dataChan chan strin
|
||||
|
||||
func (h *geminiStreamHandler) convertToOpenaiStream(geminiResponse *GeminiChatResponse, dataChan chan string) {
|
||||
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,
|
||||
// Choices: choices,
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"one-api/common"
|
||||
"one-api/common/image"
|
||||
"one-api/common/utils"
|
||||
"one-api/types"
|
||||
)
|
||||
|
||||
@@ -120,7 +121,7 @@ func (g *GeminiFunctionCall) ToOpenAITool() *types.ChatCompletionToolCalls {
|
||||
args, _ := json.Marshal(g.Args)
|
||||
|
||||
return &types.ChatCompletionToolCalls{
|
||||
Id: "call_" + common.GetRandomString(24),
|
||||
Id: "call_" + utils.GetRandomString(24),
|
||||
Type: types.ChatMessageRoleFunction,
|
||||
Index: 0,
|
||||
Function: &types.ChatCompletionToolCallsFunction{
|
||||
|
||||
Reference in New Issue
Block a user