@@ -153,6 +153,8 @@ func buildTestRequest(model string) *dto.GeneralOpenAIRequest {
|
|||||||
}
|
}
|
||||||
if strings.HasPrefix(model, "o1-") {
|
if strings.HasPrefix(model, "o1-") {
|
||||||
testRequest.MaxCompletionTokens = 1
|
testRequest.MaxCompletionTokens = 1
|
||||||
|
} else if strings.HasPrefix(model, "gemini-2.0-flash-thinking") {
|
||||||
|
testRequest.MaxTokens = 2
|
||||||
} else {
|
} else {
|
||||||
testRequest.MaxTokens = 1
|
testRequest.MaxTokens = 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ const (
|
|||||||
var ModelList = []string{
|
var ModelList = []string{
|
||||||
"gemini-1.5-pro-latest", "gemini-1.5-flash-latest",
|
"gemini-1.5-pro-latest", "gemini-1.5-flash-latest",
|
||||||
"gemini-1.5-pro-exp-0827", "gemini-1.5-flash-exp-0827",
|
"gemini-1.5-pro-exp-0827", "gemini-1.5-flash-exp-0827",
|
||||||
"gemini-exp-1114", "gemini-exp-1206",
|
"gemini-exp-1114", "gemini-exp-1121", "gemini-exp-1206",
|
||||||
"gemini-2.0-flash-exp",
|
"gemini-2.0-flash-exp",
|
||||||
|
"gemini-2.0-flash-thinking-exp-1219",
|
||||||
}
|
}
|
||||||
|
|
||||||
var ChannelName = "google gemini"
|
var ChannelName = "google gemini"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"one-api/common"
|
"one-api/common"
|
||||||
@@ -13,6 +12,8 @@ import (
|
|||||||
relaycommon "one-api/relay/common"
|
relaycommon "one-api/relay/common"
|
||||||
"one-api/service"
|
"one-api/service"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Setting safety to the lowest possible values since Gemini is already powerless enough
|
// Setting safety to the lowest possible values since Gemini is already powerless enough
|
||||||
@@ -36,6 +37,10 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest) *GeminiChatReques
|
|||||||
Category: "HARM_CATEGORY_DANGEROUS_CONTENT",
|
Category: "HARM_CATEGORY_DANGEROUS_CONTENT",
|
||||||
Threshold: common.GeminiSafetySetting,
|
Threshold: common.GeminiSafetySetting,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Category: "HARM_CATEGORY_CIVIC_INTEGRITY",
|
||||||
|
Threshold: common.GeminiSafetySetting,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
GenerationConfig: GeminiChatGenerationConfig{
|
GenerationConfig: GeminiChatGenerationConfig{
|
||||||
Temperature: textRequest.Temperature,
|
Temperature: textRequest.Temperature,
|
||||||
@@ -215,7 +220,11 @@ func responseGeminiChat2OpenAI(response *GeminiChatResponse) *dto.OpenAITextResp
|
|||||||
choice.FinishReason = constant.FinishReasonToolCalls
|
choice.FinishReason = constant.FinishReasonToolCalls
|
||||||
choice.Message.ToolCalls = getToolCalls(&candidate)
|
choice.Message.ToolCalls = getToolCalls(&candidate)
|
||||||
} else {
|
} else {
|
||||||
choice.Message.SetStringContent(candidate.Content.Parts[0].Text)
|
var texts []string
|
||||||
|
for _, part := range candidate.Content.Parts {
|
||||||
|
texts = append(texts, part.Text)
|
||||||
|
}
|
||||||
|
choice.Message.SetStringContent(strings.Join(texts, "\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fullTextResponse.Choices = append(fullTextResponse.Choices, choice)
|
fullTextResponse.Choices = append(fullTextResponse.Choices, choice)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const EditRedemption = (props) => {
|
|||||||
let name = inputs.name;
|
let name = inputs.name;
|
||||||
if (!isEdit && inputs.name === '') {
|
if (!isEdit && inputs.name === '') {
|
||||||
// set default name
|
// set default name
|
||||||
name = t('新建兑换码') + ' ' + renderQuota(quota);
|
name = renderQuota(quota);
|
||||||
}
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
let localInputs = inputs;
|
let localInputs = inputs;
|
||||||
|
|||||||
Reference in New Issue
Block a user