feat(ai-proxy): add consumer affinity for stateful APIs (#3499)

This commit is contained in:
澄潭
2026-02-14 09:22:12 +08:00
committed by GitHub
parent 5d5d20df1f
commit 95f86d7ab5
5 changed files with 652 additions and 2 deletions

View File

@@ -605,7 +605,7 @@ func (c *ProviderConfig) SetApiTokenInUse(ctx wrapper.HttpContext) {
if c.isFailoverEnabled() {
apiToken = c.GetGlobalRandomToken()
} else {
apiToken = c.GetRandomToken()
apiToken = c.GetOrSetTokenWithContext(ctx)
}
log.Debugf("Use apiToken %s to send request", apiToken)
ctx.SetContext(c.failover.ctxApiTokenInUse, apiToken)