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
723b85b8
authored
Feb 03, 2026
by
Calcium-Ion
Committed by
GitHub
Feb 03, 2026
Browse files
Options
Browse Files
Download
Plain Diff
feat: default enable channel affinity (#2809)
parents
4f786a35
c91d0746
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
4 deletions
+33
-4
setting/operation_setting/channel_affinity_setting.go
+31
-2
web/src/pages/Setting/Operation/SettingsChannelAffinity.jsx
+2
-2
No files found.
setting/operation_setting/channel_affinity_setting.go
View file @
723b85b8
...
...
@@ -33,11 +33,40 @@ type ChannelAffinitySetting struct {
}
var
channelAffinitySetting
=
ChannelAffinitySetting
{
Enabled
:
fals
e
,
Enabled
:
tru
e
,
SwitchOnSuccess
:
true
,
MaxEntries
:
100
_000
,
DefaultTTLSeconds
:
3600
,
Rules
:
[]
ChannelAffinityRule
{},
Rules
:
[]
ChannelAffinityRule
{
{
Name
:
"codex trace"
,
ModelRegex
:
[]
string
{
"^gpt-.*$"
},
PathRegex
:
[]
string
{
"/v1/responses"
},
KeySources
:
[]
ChannelAffinityKeySource
{
{
Type
:
"gjson"
,
Path
:
"prompt_cache_key"
},
},
ValueRegex
:
""
,
TTLSeconds
:
0
,
SkipRetryOnFailure
:
false
,
IncludeUsingGroup
:
true
,
IncludeRuleName
:
true
,
UserAgentInclude
:
nil
,
},
{
Name
:
"claude code trace"
,
ModelRegex
:
[]
string
{
"^claude-.*$"
},
PathRegex
:
[]
string
{
"/v1/messages"
},
KeySources
:
[]
ChannelAffinityKeySource
{
{
Type
:
"gjson"
,
Path
:
"metadata.user_id"
},
},
ValueRegex
:
""
,
TTLSeconds
:
0
,
SkipRetryOnFailure
:
false
,
IncludeUsingGroup
:
true
,
IncludeRuleName
:
true
,
UserAgentInclude
:
nil
,
},
},
}
func
init
()
{
...
...
web/src/pages/Setting/Operation/SettingsChannelAffinity.jsx
View file @
723b85b8
...
...
@@ -67,7 +67,7 @@ const KEY_SOURCE_TYPES = [
const
RULE_TEMPLATES
=
{
codex
:
{
name
:
'codex
优选
'
,
name
:
'codex
trace
'
,
model_regex
:
[
'^gpt-.*$'
],
path_regex
:
[
'/v1/responses'
],
key_sources
:
[{
type
:
'gjson'
,
path
:
'prompt_cache_key'
}],
...
...
@@ -78,7 +78,7 @@ const RULE_TEMPLATES = {
include_rule_name
:
true
,
},
claudeCode
:
{
name
:
'claude-code
优选
'
,
name
:
'claude-code
trace
'
,
model_regex
:
[
'^claude-.*$'
],
path_regex
:
[
'/v1/messages'
],
key_sources
:
[{
type
:
'gjson'
,
path
:
'metadata.user_id'
}],
...
...
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