mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: filter interceptions and sessions by provider name (#25640)
Allows filtering sessions & interceptions by provider name, and adds a test to vaidate that provider name is immutable (at least until #25606 lands).
This commit is contained in:
+21
-7
@@ -175,10 +175,14 @@ type AIBridgeListSessionsFilter struct {
|
||||
Initiator string `json:"initiator,omitempty"`
|
||||
StartedBefore time.Time `json:"started_before,omitempty" format:"date-time"`
|
||||
StartedAfter time.Time `json:"started_after,omitempty" format:"date-time"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
Client string `json:"client,omitempty"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
// Provider matches the provider type column (openai, anthropic,
|
||||
// copilot). Retained for backward compatibility; new clients should
|
||||
// prefer ProviderName, which scopes to a specific configured row.
|
||||
Provider string `json:"provider,omitempty"`
|
||||
ProviderName string `json:"provider_name,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
Client string `json:"client,omitempty"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
|
||||
// AfterSessionID is a cursor for pagination. It is the session ID of the
|
||||
// last session in the previous page.
|
||||
@@ -198,9 +202,13 @@ type AIBridgeListInterceptionsFilter struct {
|
||||
Initiator string `json:"initiator,omitempty"`
|
||||
StartedBefore time.Time `json:"started_before,omitempty" format:"date-time"`
|
||||
StartedAfter time.Time `json:"started_after,omitempty" format:"date-time"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
Client string `json:"client,omitempty"`
|
||||
// Provider matches the provider type column (openai, anthropic,
|
||||
// copilot). Retained for backward compatibility; new clients should
|
||||
// prefer ProviderName, which scopes to a specific configured row.
|
||||
Provider string `json:"provider,omitempty"`
|
||||
ProviderName string `json:"provider_name,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
Client string `json:"client,omitempty"`
|
||||
|
||||
FilterQuery string `json:"q,omitempty"`
|
||||
}
|
||||
@@ -224,6 +232,9 @@ func (f AIBridgeListInterceptionsFilter) asRequestOption() RequestOption {
|
||||
if f.Provider != "" {
|
||||
params = append(params, fmt.Sprintf("provider:%q", f.Provider))
|
||||
}
|
||||
if f.ProviderName != "" {
|
||||
params = append(params, fmt.Sprintf("provider_name:%q", f.ProviderName))
|
||||
}
|
||||
if f.Model != "" {
|
||||
params = append(params, fmt.Sprintf("model:%q", f.Model))
|
||||
}
|
||||
@@ -257,6 +268,9 @@ func (f AIBridgeListSessionsFilter) asRequestOption() RequestOption {
|
||||
if f.Provider != "" {
|
||||
params = append(params, fmt.Sprintf("provider:%q", f.Provider))
|
||||
}
|
||||
if f.ProviderName != "" {
|
||||
params = append(params, fmt.Sprintf("provider_name:%q", f.ProviderName))
|
||||
}
|
||||
if f.Model != "" {
|
||||
params = append(params, fmt.Sprintf("model:%q", f.Model))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user