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
e4a7f0c7
authored
Jun 19, 2025
by
wans10
Committed by
GitHub
Jun 19, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复渠道界面模型选择下拉框模型重复显示
parent
423796e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
web/src/pages/Channel/EditChannel.js
+21
-12
No files found.
web/src/pages/Channel/EditChannel.js
View file @
e4a7f0c7
...
@@ -298,18 +298,27 @@ const EditChannel = (props) => {
...
@@ -298,18 +298,27 @@ const EditChannel = (props) => {
}
}
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
let
localModelOptions
=
[...
originModelOptions
];
// 使用 Map 来避免重复,以 value 为键
inputs
.
models
.
forEach
((
model
)
=>
{
const
modelMap
=
new
Map
();
if
(
!
localModelOptions
.
find
((
option
)
=>
option
.
label
===
model
))
{
localModelOptions
.
push
({
// 先添加原始模型选项
label
:
model
,
originModelOptions
.
forEach
(
option
=>
{
value
:
model
,
modelMap
.
set
(
option
.
value
,
option
);
});
});
}
});
// 再添加当前选中的模型(如果不存在)
setModelOptions
(
localModelOptions
);
inputs
.
models
.
forEach
(
model
=>
{
},
[
originModelOptions
,
inputs
.
models
]);
if
(
!
modelMap
.
has
(
model
))
{
modelMap
.
set
(
model
,
{
label
:
model
,
value
:
model
,
});
}
});
setModelOptions
(
Array
.
from
(
modelMap
.
values
()));
},
[
originModelOptions
,
inputs
.
models
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
fetchModels
().
then
();
fetchModels
().
then
();
...
...
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