fix: add DmScope field to SessionConfig to persist dm_scope setting
The frontend sends dm_scope as part of the session config, but the backend SessionConfig struct lacked the corresponding field. Go's encoding/json silently discards unknown fields, so the value was lost on every PATCH request. Additionally, MarshalJSON only emitted the session block when Dimensions or IdentityLinks were set, so even a stored dm_scope would not appear in GET responses. - Add DmScope string field with json tag 'dm_scope' to SessionConfig - Update MarshalJSON condition to include session when DmScope is set
This commit is contained in:
parent
12c36572a5
commit
0bbd8f081e
1 changed files with 2 additions and 1 deletions
|
|
@ -257,7 +257,7 @@ func (c *Config) MarshalJSON() ([]byte, error) {
|
||||||
Alias: (*Alias)(c),
|
Alias: (*Alias)(c),
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.Session.Dimensions) > 0 || len(c.Session.IdentityLinks) > 0 {
|
if len(c.Session.Dimensions) > 0 || len(c.Session.IdentityLinks) > 0 || c.Session.DmScope != "" {
|
||||||
sessionCfg := c.Session
|
sessionCfg := c.Session
|
||||||
aux.Session = &sessionCfg
|
aux.Session = &sessionCfg
|
||||||
}
|
}
|
||||||
|
|
@ -349,6 +349,7 @@ type DispatchSelector struct {
|
||||||
type SessionConfig struct {
|
type SessionConfig struct {
|
||||||
Dimensions []string `json:"dimensions,omitempty"`
|
Dimensions []string `json:"dimensions,omitempty"`
|
||||||
IdentityLinks map[string][]string `json:"identity_links,omitempty"`
|
IdentityLinks map[string][]string `json:"identity_links,omitempty"`
|
||||||
|
DmScope string `json:"dm_scope,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoutingConfig controls the intelligent model routing feature.
|
// RoutingConfig controls the intelligent model routing feature.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue