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
Unverified
Commit
9b4ffb08
authored
Apr 08, 2026
by
Calcium-Ion
Committed by
GitHub
Apr 08, 2026
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4142 from seefs001/fix/skip_failure_option
fix: 修复 失败后不重试 配置项写到内存被覆盖
parents
606a4eee
c3b8fa29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
33 deletions
+49
-33
setting/operation_setting/channel_affinity_setting.go
+1
-1
web/src/pages/Setting/Operation/SettingsChannelAffinity.jsx
+48
-32
No files found.
setting/operation_setting/channel_affinity_setting.go
View file @
9b4ffb08
...
@@ -20,7 +20,7 @@ type ChannelAffinityRule struct {
...
@@ -20,7 +20,7 @@ type ChannelAffinityRule struct {
ParamOverrideTemplate
map
[
string
]
interface
{}
`json:"param_override_template,omitempty"`
ParamOverrideTemplate
map
[
string
]
interface
{}
`json:"param_override_template,omitempty"`
SkipRetryOnFailure
bool
`json:"skip_retry_on_failure
,omitempty
"`
SkipRetryOnFailure
bool
`json:"skip_retry_on_failure"`
IncludeUsingGroup
bool
`json:"include_using_group"`
IncludeUsingGroup
bool
`json:"include_using_group"`
IncludeModelName
bool
`json:"include_model_name"`
IncludeModelName
bool
`json:"include_model_name"`
...
...
web/src/pages/Setting/Operation/SettingsChannelAffinity.jsx
View file @
9b4ffb08
...
@@ -192,6 +192,36 @@ const parseOptionalObjectJson = (jsonString, label) => {
...
@@ -192,6 +192,36 @@ const parseOptionalObjectJson = (jsonString, label) => {
}
}
};
};
const
buildChannelAffinityRulePayload
=
({
values
,
isEdit
,
editingRuleId
,
rulesLength
,
modelRegex
,
pathRegex
,
keySources
,
userAgentInclude
,
paramOverrideTemplate
,
})
=>
({
id
:
isEdit
?
editingRuleId
:
rulesLength
,
name
:
(
values
?.
name
||
''
).
trim
(),
model_regex
:
modelRegex
,
path_regex
:
pathRegex
,
key_sources
:
keySources
,
value_regex
:
(
values
?.
value_regex
||
''
).
trim
(),
ttl_seconds
:
Number
(
values
?.
ttl_seconds
||
0
),
include_using_group
:
!!
values
?.
include_using_group
,
include_model_name
:
!!
values
?.
include_model_name
,
include_rule_name
:
!!
values
?.
include_rule_name
,
skip_retry_on_failure
:
!!
values
?.
skip_retry_on_failure
,
...(
userAgentInclude
.
length
>
0
?
{
user_agent_include
:
userAgentInclude
}
:
{}),
...(
paramOverrideTemplate
?
{
param_override_template
:
paramOverrideTemplate
}
:
{}),
});
export
default
function
SettingsChannelAffinity
(
props
)
{
export
default
function
SettingsChannelAffinity
(
props
)
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
...
@@ -456,14 +486,12 @@ export default function SettingsChannelAffinity(props) {
...
@@ -456,14 +486,12 @@ export default function SettingsChannelAffinity(props) {
const
templates
=
[
const
templates
=
[
CHANNEL_AFFINITY_RULE_TEMPLATES
.
codexCli
,
CHANNEL_AFFINITY_RULE_TEMPLATES
.
codexCli
,
CHANNEL_AFFINITY_RULE_TEMPLATES
.
claudeCli
,
CHANNEL_AFFINITY_RULE_TEMPLATES
.
claudeCli
,
].
map
(
].
map
((
tpl
)
=>
{
(
tpl
)
=>
{
const
baseTemplate
=
cloneChannelAffinityTemplate
(
tpl
);
const
baseTemplate
=
cloneChannelAffinityTemplate
(
tpl
);
const
name
=
makeUniqueName
(
existingNames
,
tpl
.
name
);
const
name
=
makeUniqueName
(
existingNames
,
tpl
.
name
);
existingNames
.
add
(
name
);
existingNames
.
add
(
name
);
return
{
...
baseTemplate
,
name
};
return
{
...
baseTemplate
,
name
};
});
},
);
const
next
=
[...(
rules
||
[]),
...
templates
].
map
((
r
,
idx
)
=>
({
const
next
=
[...(
rules
||
[]),
...
templates
].
map
((
r
,
idx
)
=>
({
...(
r
||
{}),
...(
r
||
{}),
...
@@ -716,27 +744,17 @@ export default function SettingsChannelAffinity(props) {
...
@@ -716,27 +744,17 @@ export default function SettingsChannelAffinity(props) {
return
showError
(
t
(
paramTemplateValidation
.
message
));
return
showError
(
t
(
paramTemplateValidation
.
message
));
}
}
const
rulePayload
=
{
const
rulePayload
=
buildChannelAffinityRulePayload
({
id
:
isEdit
?
editingRule
.
id
:
rules
.
length
,
values
,
name
:
(
values
.
name
||
''
).
trim
(),
isEdit
,
model_regex
:
modelRegex
,
editingRuleId
:
editingRule
?.
id
,
path_regex
:
normalizeStringList
(
values
.
path_regex_text
),
rulesLength
:
rules
.
length
,
key_sources
:
keySourcesValidation
.
value
,
modelRegex
,
value_regex
:
(
values
.
value_regex
||
''
).
trim
(),
pathRegex
:
normalizeStringList
(
values
.
path_regex_text
),
ttl_seconds
:
Number
(
values
.
ttl_seconds
||
0
),
keySources
:
keySourcesValidation
.
value
,
include_using_group
:
!!
values
.
include_using_group
,
userAgentInclude
,
include_model_name
:
!!
values
.
include_model_name
,
paramOverrideTemplate
:
paramTemplateValidation
.
value
,
include_rule_name
:
!!
values
.
include_rule_name
,
});
...(
values
.
skip_retry_on_failure
?
{
skip_retry_on_failure
:
true
}
:
{}),
...(
userAgentInclude
.
length
>
0
?
{
user_agent_include
:
userAgentInclude
}
:
{}),
...(
paramTemplateValidation
.
value
?
{
param_override_template
:
paramTemplateValidation
.
value
}
:
{}),
};
if
(
!
rulePayload
.
name
)
return
showError
(
t
(
'名称不能为空'
));
if
(
!
rulePayload
.
name
)
return
showError
(
t
(
'名称不能为空'
));
...
@@ -1273,9 +1291,7 @@ export default function SettingsChannelAffinity(props) {
...
@@ -1273,9 +1291,7 @@ export default function SettingsChannelAffinity(props) {
label=
{
t
(
'作用域:包含模型名称'
)
}
label=
{
t
(
'作用域:包含模型名称'
)
}
/>
/>
<
Text
type=
'tertiary'
size=
'small'
>
<
Text
type=
'tertiary'
size=
'small'
>
{
t
(
{
t
(
'开启后,模型名称会参与 cache key(不同模型隔离)。'
)
}
'开启后,模型名称会参与 cache key(不同模型隔离)。'
,
)
}
</
Text
>
</
Text
>
</
Col
>
</
Col
>
<
Col
xs=
{
24
}
sm=
{
8
}
>
<
Col
xs=
{
24
}
sm=
{
8
}
>
...
...
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