mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00: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:
@@ -48,6 +48,7 @@ func (r *RootCmd) aibridgeInterceptionsList() *serpent.Command {
|
||||
startedBeforeRaw string
|
||||
startedAfterRaw string
|
||||
provider string
|
||||
providerName string
|
||||
model string
|
||||
client string
|
||||
afterIDRaw string
|
||||
@@ -82,6 +83,12 @@ func (r *RootCmd) aibridgeInterceptionsList() *serpent.Command {
|
||||
Default: "",
|
||||
Value: serpent.StringOf(&provider),
|
||||
},
|
||||
{
|
||||
Flag: "provider-name",
|
||||
Description: `Only return interceptions from the named provider.`,
|
||||
Default: "",
|
||||
Value: serpent.StringOf(&providerName),
|
||||
},
|
||||
{
|
||||
Flag: "model",
|
||||
Description: `Only return interceptions from this model.`,
|
||||
@@ -152,6 +159,7 @@ func (r *RootCmd) aibridgeInterceptionsList() *serpent.Command {
|
||||
StartedBefore: startedBefore,
|
||||
StartedAfter: startedAfter,
|
||||
Provider: provider,
|
||||
ProviderName: providerName,
|
||||
Model: model,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -26,6 +26,9 @@ OPTIONS:
|
||||
--provider string
|
||||
Only return interceptions from this provider.
|
||||
|
||||
--provider-name string
|
||||
Only return interceptions from the named provider.
|
||||
|
||||
--started-after string
|
||||
Only return interceptions started after this time. Must be before
|
||||
'started-before' if set. Accepts a time in the RFC 3339 format, e.g.
|
||||
|
||||
@@ -103,7 +103,7 @@ func aibridgeHandler(api *API, middlewares ...func(http.Handler) http.Handler) f
|
||||
// @Security CoderSessionToken
|
||||
// @Produce json
|
||||
// @Tags AI Bridge
|
||||
// @Param q query string false "Search query in the format `key:value`. Available keys are: initiator, provider, model, started_after, started_before."
|
||||
// @Param q query string false "Search query in the format `key:value`. Available keys are: initiator, provider, provider_name, model, started_after, started_before."
|
||||
// @Param limit query int false "Page limit"
|
||||
// @Param after_id query string false "Cursor pagination after ID (cannot be used with offset)"
|
||||
// @Param offset query int false "Offset pagination (cannot be used with after_id)"
|
||||
@@ -164,6 +164,7 @@ func (api *API) aiBridgeListInterceptions(rw http.ResponseWriter, r *http.Reques
|
||||
StartedBefore: filter.StartedBefore,
|
||||
InitiatorID: filter.InitiatorID,
|
||||
Provider: filter.Provider,
|
||||
ProviderName: filter.ProviderName,
|
||||
Model: filter.Model,
|
||||
Client: filter.Client,
|
||||
})
|
||||
@@ -217,7 +218,7 @@ func (api *API) aiBridgeListInterceptions(rw http.ResponseWriter, r *http.Reques
|
||||
// @Security CoderSessionToken
|
||||
// @Produce json
|
||||
// @Tags AI Bridge
|
||||
// @Param q query string false "Search query in the format `key:value`. Available keys are: initiator, provider, model, client, session_id, started_after, started_before."
|
||||
// @Param q query string false "Search query in the format `key:value`. Available keys are: initiator, provider, provider_name, model, client, session_id, started_after, started_before."
|
||||
// @Param limit query int false "Page limit"
|
||||
// @Param after_session_id query string false "Cursor pagination after session ID (cannot be used with offset)"
|
||||
// @Param offset query int false "Offset pagination (cannot be used with after_session_id)"
|
||||
@@ -296,6 +297,7 @@ func (api *API) aiBridgeListSessions(rw http.ResponseWriter, r *http.Request) {
|
||||
StartedBefore: filter.StartedBefore,
|
||||
InitiatorID: filter.InitiatorID,
|
||||
Provider: filter.Provider,
|
||||
ProviderName: filter.ProviderName,
|
||||
Model: filter.Model,
|
||||
Client: filter.Client,
|
||||
SessionID: filter.SessionID,
|
||||
|
||||
Reference in New Issue
Block a user