Skip to content

Commit 723b85b

Browse files
authored
feat: default enable channel affinity (#2809)
2 parents 4f786a3 + c91d074 commit 723b85b

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

setting/operation_setting/channel_affinity_setting.go

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,40 @@ type ChannelAffinitySetting struct {
3333
}
3434

3535
var channelAffinitySetting = ChannelAffinitySetting{
36-
Enabled: false,
36+
Enabled: true,
3737
SwitchOnSuccess: true,
3838
MaxEntries: 100_000,
3939
DefaultTTLSeconds: 3600,
40-
Rules: []ChannelAffinityRule{},
40+
Rules: []ChannelAffinityRule{
41+
{
42+
Name: "codex trace",
43+
ModelRegex: []string{"^gpt-.*$"},
44+
PathRegex: []string{"/v1/responses"},
45+
KeySources: []ChannelAffinityKeySource{
46+
{Type: "gjson", Path: "prompt_cache_key"},
47+
},
48+
ValueRegex: "",
49+
TTLSeconds: 0,
50+
SkipRetryOnFailure: false,
51+
IncludeUsingGroup: true,
52+
IncludeRuleName: true,
53+
UserAgentInclude: nil,
54+
},
55+
{
56+
Name: "claude code trace",
57+
ModelRegex: []string{"^claude-.*$"},
58+
PathRegex: []string{"/v1/messages"},
59+
KeySources: []ChannelAffinityKeySource{
60+
{Type: "gjson", Path: "metadata.user_id"},
61+
},
62+
ValueRegex: "",
63+
TTLSeconds: 0,
64+
SkipRetryOnFailure: false,
65+
IncludeUsingGroup: true,
66+
IncludeRuleName: true,
67+
UserAgentInclude: nil,
68+
},
69+
},
4170
}
4271

4372
func init() {

web/src/pages/Setting/Operation/SettingsChannelAffinity.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const KEY_SOURCE_TYPES = [
6767

6868
const RULE_TEMPLATES = {
6969
codex: {
70-
name: 'codex优选',
70+
name: 'codex trace',
7171
model_regex: ['^gpt-.*$'],
7272
path_regex: ['/v1/responses'],
7373
key_sources: [{ type: 'gjson', path: 'prompt_cache_key' }],
@@ -78,7 +78,7 @@ const RULE_TEMPLATES = {
7878
include_rule_name: true,
7979
},
8080
claudeCode: {
81-
name: 'claude-code优选',
81+
name: 'claude-code trace',
8282
model_regex: ['^claude-.*$'],
8383
path_regex: ['/v1/messages'],
8484
key_sources: [{ type: 'gjson', path: 'metadata.user_id' }],

0 commit comments

Comments
 (0)