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
485ea965
authored
May 24, 2025
by
Apple\Apple
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/main' into ui/refactor
parents
f764a27e
268be18b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
29 deletions
+48
-29
relay/channel/aws/constants.go
+1
-1
web/src/components/ModelSetting.js
+4
-1
web/src/pages/Setting/Model/SettingGeminiModel.js
+43
-27
No files found.
relay/channel/aws/constants.go
View file @
485ea965
...
@@ -46,7 +46,7 @@ var awsModelCanCrossRegionMap = map[string]map[string]bool{
...
@@ -46,7 +46,7 @@ var awsModelCanCrossRegionMap = map[string]map[string]bool{
"ap"
:
true
,
"ap"
:
true
,
"eu"
:
true
,
"eu"
:
true
,
},
},
"a
pac.a
nthropic.claude-sonnet-4-20250514-v1:0"
:
{
"anthropic.claude-sonnet-4-20250514-v1:0"
:
{
"us"
:
true
,
"us"
:
true
,
"ap"
:
true
,
"ap"
:
true
,
"eu"
:
true
,
"eu"
:
true
,
...
...
web/src/components/ModelSetting.js
View file @
485ea965
...
@@ -39,7 +39,9 @@ const ModelSetting = () => {
...
@@ -39,7 +39,9 @@ const ModelSetting = () => {
item
.
key
===
'claude.default_max_tokens'
||
item
.
key
===
'claude.default_max_tokens'
||
item
.
key
===
'gemini.supported_imagine_models'
item
.
key
===
'gemini.supported_imagine_models'
)
{
)
{
item
.
value
=
JSON
.
stringify
(
JSON
.
parse
(
item
.
value
),
null
,
2
);
if
(
item
.
value
!==
''
)
{
item
.
value
=
JSON
.
stringify
(
JSON
.
parse
(
item
.
value
),
null
,
2
);
}
}
}
if
(
item
.
key
.
endsWith
(
'Enabled'
)
||
item
.
key
.
endsWith
(
'enabled'
))
{
if
(
item
.
key
.
endsWith
(
'Enabled'
)
||
item
.
key
.
endsWith
(
'enabled'
))
{
newInputs
[
item
.
key
]
=
item
.
value
===
'true'
?
true
:
false
;
newInputs
[
item
.
key
]
=
item
.
value
===
'true'
?
true
:
false
;
...
@@ -60,6 +62,7 @@ const ModelSetting = () => {
...
@@ -60,6 +62,7 @@ const ModelSetting = () => {
// showSuccess('刷新成功');
// showSuccess('刷新成功');
}
catch
(
error
)
{
}
catch
(
error
)
{
showError
(
'刷新失败'
);
showError
(
'刷新失败'
);
console
.
error
(
error
);
}
finally
{
}
finally
{
setLoading
(
false
);
setLoading
(
false
);
}
}
...
...
web/src/pages/Setting/Model/SettingGeminiModel.js
View file @
485ea965
...
@@ -27,40 +27,48 @@ export default function SettingGeminiModel(props) {
...
@@ -27,40 +27,48 @@ export default function SettingGeminiModel(props) {
const
[
inputs
,
setInputs
]
=
useState
({
const
[
inputs
,
setInputs
]
=
useState
({
'gemini.safety_settings'
:
''
,
'gemini.safety_settings'
:
''
,
'gemini.version_settings'
:
''
,
'gemini.version_settings'
:
''
,
'gemini.supported_imagine_models'
:
[]
,
'gemini.supported_imagine_models'
:
''
,
'gemini.thinking_adapter_enabled'
:
false
,
'gemini.thinking_adapter_enabled'
:
false
,
'gemini.thinking_adapter_budget_tokens_percentage'
:
0.6
,
'gemini.thinking_adapter_budget_tokens_percentage'
:
0.6
,
});
});
const
refForm
=
useRef
();
const
refForm
=
useRef
();
const
[
inputsRow
,
setInputsRow
]
=
useState
(
inputs
);
const
[
inputsRow
,
setInputsRow
]
=
useState
(
inputs
);
function
onSubmit
()
{
async
function
onSubmit
()
{
const
updateArray
=
compareObjects
(
inputs
,
inputsRow
);
await
refForm
.
current
if
(
!
updateArray
.
length
)
return
showWarning
(
t
(
'你似乎并没有修改什么'
));
.
validate
()
const
requestQueue
=
updateArray
.
map
((
item
)
=>
{
.
then
(()
=>
{
let
value
=
String
(
inputs
[
item
.
key
]);
const
updateArray
=
compareObjects
(
inputs
,
inputsRow
);
return
API
.
put
(
'/api/option/'
,
{
if
(
!
updateArray
.
length
)
return
showWarning
(
t
(
'你似乎并没有修改什么'
));
key
:
item
.
key
,
const
requestQueue
=
updateArray
.
map
((
item
)
=>
{
value
,
let
value
=
String
(
inputs
[
item
.
key
]);
});
return
API
.
put
(
'/api/option/'
,
{
});
key
:
item
.
key
,
setLoading
(
true
);
value
,
Promise
.
all
(
requestQueue
)
});
.
then
((
res
)
=>
{
});
if
(
requestQueue
.
length
===
1
)
{
setLoading
(
true
);
if
(
res
.
includes
(
undefined
))
return
;
Promise
.
all
(
requestQueue
)
}
else
if
(
requestQueue
.
length
>
1
)
{
.
then
((
res
)
=>
{
if
(
res
.
includes
(
undefined
))
if
(
requestQueue
.
length
===
1
)
{
return
showError
(
t
(
'部分保存失败,请重试'
));
if
(
res
.
includes
(
undefined
))
return
;
}
}
else
if
(
requestQueue
.
length
>
1
)
{
showSuccess
(
t
(
'保存成功'
));
if
(
res
.
includes
(
undefined
))
props
.
refresh
();
return
showError
(
t
(
'部分保存失败,请重试'
));
})
}
.
catch
(()
=>
{
showSuccess
(
t
(
'保存成功'
));
showError
(
t
(
'保存失败,请重试'
));
props
.
refresh
();
})
.
catch
(()
=>
{
showError
(
t
(
'保存失败,请重试'
));
})
.
finally
(()
=>
{
setLoading
(
false
);
});
})
})
.
finally
(()
=>
{
.
catch
((
error
)
=>
{
setLoading
(
false
);
console
.
error
(
'Validation failed:'
,
error
);
showError
(
t
(
'请检查输入'
));
});
});
}
}
...
@@ -146,6 +154,14 @@ export default function SettingGeminiModel(props) {
...
@@ -146,6 +154,14 @@ export default function SettingGeminiModel(props) {
label
=
{
t
(
'支持的图像模型'
)}
label
=
{
t
(
'支持的图像模型'
)}
placeholder
=
{
t
(
'例如:'
)
+
'\n'
+
JSON
.
stringify
([
'gemini-2.0-flash-exp-image-generation'
],
null
,
2
)}
placeholder
=
{
t
(
'例如:'
)
+
'\n'
+
JSON
.
stringify
([
'gemini-2.0-flash-exp-image-generation'
],
null
,
2
)}
onChange
=
{(
value
)
=>
setInputs
({
...
inputs
,
'gemini.supported_imagine_models'
:
value
})}
onChange
=
{(
value
)
=>
setInputs
({
...
inputs
,
'gemini.supported_imagine_models'
:
value
})}
trigger
=
'blur'
stopValidateWithError
rules
=
{[
{
validator
:
(
rule
,
value
)
=>
verifyJSON
(
value
),
message
:
t
(
'不是合法的 JSON 字符串'
),
},
]}
/
>
/
>
<
/Col
>
<
/Col
>
<
/Row
>
<
/Row
>
...
...
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