Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e95d6520
authored
Dec 20, 2024
by
TAKO
Committed by
GitHub
Dec 20, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Calcium-Ion:main' into fix/smfix
parents
8170ed6b
1dfdb44d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
controller/channel-test.go
+2
-0
relay/channel/gemini/constant.go
+7
-1
relay/channel/gemini/relay-gemini.go
+11
-2
web/src/pages/Redemption/EditRedemption.js
+1
-1
No files found.
controller/channel-test.go
View file @
e95d6520
...
...
@@ -153,6 +153,8 @@ func buildTestRequest(model string) *dto.GeneralOpenAIRequest {
}
if
strings
.
HasPrefix
(
model
,
"o1-"
)
{
testRequest
.
MaxCompletionTokens
=
1
}
else
if
strings
.
HasPrefix
(
model
,
"gemini-2.0-flash-thinking"
)
{
testRequest
.
MaxTokens
=
2
}
else
{
testRequest
.
MaxTokens
=
1
}
...
...
relay/channel/gemini/constant.go
View file @
e95d6520
...
...
@@ -6,9 +6,15 @@ const (
var
ModelList
=
[]
string
{
"gemini-1.5-pro-latest"
,
"gemini-1.5-flash-latest"
,
// old version
"gemini-1.5-pro-exp-0827"
,
"gemini-1.5-flash-exp-0827"
,
"gemini-exp-1114"
,
"gemini-exp-1206"
,
// exp
"gemini-exp-1114"
,
"gemini-exp-1121"
,
"gemini-exp-1206"
,
// flash exp
"gemini-2.0-flash-exp"
,
// thinking exp
"gemini-2.0-flash-thinking-exp"
,
"gemini-2.0-flash-thinking-exp-1219"
,
}
var
ChannelName
=
"google gemini"
relay/channel/gemini/relay-gemini.go
View file @
e95d6520
...
...
@@ -4,7 +4,6 @@ import (
"bufio"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"io"
"net/http"
"one-api/common"
...
...
@@ -13,6 +12,8 @@ import (
relaycommon
"one-api/relay/common"
"one-api/service"
"strings"
"github.com/gin-gonic/gin"
)
// 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"
,
Threshold
:
common
.
GeminiSafetySetting
,
},
{
Category
:
"HARM_CATEGORY_CIVIC_INTEGRITY"
,
Threshold
:
common
.
GeminiSafetySetting
,
},
},
GenerationConfig
:
GeminiChatGenerationConfig
{
Temperature
:
textRequest
.
Temperature
,
...
...
@@ -215,7 +220,11 @@ func responseGeminiChat2OpenAI(response *GeminiChatResponse) *dto.OpenAITextResp
choice
.
FinishReason
=
constant
.
FinishReasonToolCalls
choice
.
Message
.
ToolCalls
=
getToolCalls
(
&
candidate
)
}
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
)
...
...
web/src/pages/Redemption/EditRedemption.js
View file @
e95d6520
...
...
@@ -71,7 +71,7 @@ const EditRedemption = (props) => {
let
name
=
inputs
.
name
;
if
(
!
isEdit
&&
inputs
.
name
===
''
)
{
// set default name
name
=
t
(
'新建兑换码'
)
+
' '
+
renderQuota
(
quota
);
name
=
renderQuota
(
quota
);
}
setLoading
(
true
);
let
localInputs
=
inputs
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment