Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
705131e1
Commit
705131e1
authored
Mar 31, 2026
by
erio
Browse files
fix(channel): 前端重复模型校验改为按平台检查
后端 validateNoDuplicateModels 使用 platform:model 复合键, 前端之前跨平台扁平化检查导致不同平台下的同名模型误报重复。
parent
88759407
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/views/admin/ChannelsView.vue
View file @
705131e1
...
...
@@ -877,12 +877,21 @@ async function handleSubmit() {
}
}
// Check duplicate models across all enabled platform sections
const
allModels
=
form
.
platforms
.
filter
(
s
=>
s
.
enabled
).
flatMap
(
s
=>
s
.
model_pricing
.
flatMap
(
e
=>
e
.
models
.
map
(
m
=>
m
.
toLowerCase
())))
const
duplicates
=
allModels
.
filter
((
m
,
i
)
=>
allModels
.
indexOf
(
m
)
!==
i
)
if
(
duplicates
.
length
>
0
)
{
appStore
.
showError
(
t
(
'
admin.channels.duplicateModels
'
,
`模型 "
${
duplicates
[
0
]}
" 在多个定价条目中重复`
))
return
// Check duplicate models per platform (same model in different platforms is allowed)
for
(
const
section
of
form
.
platforms
.
filter
(
s
=>
s
.
enabled
))
{
const
seen
=
new
Set
()
for
(
const
entry
of
section
.
model_pricing
)
{
for
(
const
m
of
entry
.
models
)
{
const
key
=
m
.
toLowerCase
()
if
(
seen
.
has
(
key
))
{
const
platformLabel
=
t
(
'
admin.groups.platforms.
'
+
section
.
platform
,
section
.
platform
)
appStore
.
showError
(
t
(
'
admin.channels.duplicateModels
'
,
`
${
platformLabel
}
平台下模型 "
${
m
}
" 在多个定价条目中重复`
))
activeTab
.
value
=
section
.
platform
return
}
seen
.
add
(
key
)
}
}
}
// 校验 per_request/image 模式必须有价格 (只校验启用的平台)
...
...
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