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
fa4465c4
authored
Feb 20, 2026
by
RedwindA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add models.dev preset support to upstream ratio sync
parent
d45cd9af
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
9 deletions
+35
-9
controller/ratio_sync.go
+0
-0
web/src/components/settings/ChannelSelectorModal.jsx
+13
-3
web/src/pages/Setting/Ratio/UpstreamRatioSync.jsx
+22
-6
No files found.
controller/ratio_sync.go
View file @
fa4465c4
This diff is collapsed.
Click to expand it.
web/src/components/settings/ChannelSelectorModal.jsx
View file @
fa4465c4
...
...
@@ -35,6 +35,13 @@ import {
}
from
'@douyinfe/semi-ui'
;
import
{
IconSearch
}
from
'@douyinfe/semi-icons'
;
const
OFFICIAL_RATIO_PRESET_ID
=
-
100
;
const
MODELS_DEV_PRESET_ID
=
-
101
;
const
OFFICIAL_RATIO_PRESET_NAME
=
'官方倍率预设'
;
const
MODELS_DEV_PRESET_NAME
=
'models.dev 价格预设'
;
const
OFFICIAL_RATIO_PRESET_BASE_URL
=
'https://basellm.github.io'
;
const
MODELS_DEV_PRESET_BASE_URL
=
'https://models.dev'
;
const
ChannelSelectorModal
=
forwardRef
(
(
{
...
...
@@ -70,9 +77,12 @@ const ChannelSelectorModal = forwardRef(
const
base
=
record
?.
_originalData
?.
base_url
||
''
;
const
name
=
record
?.
label
||
''
;
return
(
id
===
-
100
||
base
===
'https://basellm.github.io'
||
name
===
'官方倍率预设'
id
===
OFFICIAL_RATIO_PRESET_ID
||
id
===
MODELS_DEV_PRESET_ID
||
base
===
OFFICIAL_RATIO_PRESET_BASE_URL
||
base
===
MODELS_DEV_PRESET_BASE_URL
||
name
===
OFFICIAL_RATIO_PRESET_NAME
||
name
===
MODELS_DEV_PRESET_NAME
);
};
...
...
web/src/pages/Setting/Ratio/UpstreamRatioSync.jsx
View file @
fa4465c4
...
...
@@ -53,6 +53,16 @@ import {
}
from
'@douyinfe/semi-illustrations'
;
import
ChannelSelectorModal
from
'../../../components/settings/ChannelSelectorModal'
;
const
OFFICIAL_RATIO_PRESET_ID
=
-
100
;
const
OFFICIAL_RATIO_PRESET_NAME
=
'官方倍率预设'
;
const
OFFICIAL_RATIO_PRESET_BASE_URL
=
'https://basellm.github.io'
;
const
OFFICIAL_RATIO_PRESET_ENDPOINT
=
'/llm-metadata/api/newapi/ratio_config-v1-base.json'
;
const
MODELS_DEV_PRESET_ID
=
-
101
;
const
MODELS_DEV_PRESET_NAME
=
'models.dev 价格预设'
;
const
MODELS_DEV_PRESET_BASE_URL
=
'https://models.dev'
;
const
MODELS_DEV_PRESET_ENDPOINT
=
'https://models.dev/api.json'
;
function
ConflictConfirmModal
({
t
,
visible
,
items
,
onOk
,
onCancel
})
{
const
isMobile
=
useIsMobile
();
const
columns
=
[
...
...
@@ -155,14 +165,20 @@ export default function UpstreamRatioSync(props) {
const
base
=
channel
.
_originalData
?.
base_url
||
''
;
const
name
=
channel
.
label
||
''
;
const
channelType
=
channel
.
_originalData
?.
type
;
const
isOfficial
=
id
===
-
100
||
base
===
'https://basellm.github.io'
||
name
===
'官方倍率预设'
;
const
isOfficialRatioPreset
=
id
===
OFFICIAL_RATIO_PRESET_ID
||
base
===
OFFICIAL_RATIO_PRESET_BASE_URL
||
name
===
OFFICIAL_RATIO_PRESET_NAME
;
const
isModelsDevPreset
=
id
===
MODELS_DEV_PRESET_ID
||
base
===
MODELS_DEV_PRESET_BASE_URL
||
name
===
MODELS_DEV_PRESET_NAME
;
const
isOpenRouter
=
channelType
===
20
;
if
(
!
merged
[
id
])
{
if
(
isOfficial
)
{
merged
[
id
]
=
'/llm-metadata/api/newapi/ratio_config-v1-base.json'
;
if
(
isModelsDevPreset
)
{
merged
[
id
]
=
MODELS_DEV_PRESET_ENDPOINT
;
}
else
if
(
isOfficialRatioPreset
)
{
merged
[
id
]
=
OFFICIAL_RATIO_PRESET_ENDPOINT
;
}
else
if
(
isOpenRouter
)
{
merged
[
id
]
=
'openrouter'
;
}
else
{
...
...
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