mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add offset-based pagination support to aibridge list endpoint (#20393)
Necessary for the frontend to be able to paginate easily. Cursor pagination is good for fetching all events, but doesn't play very well when a pagination component gets involved. Adds support for `?offset=x` to the existing endpoint. The cursor-based pagination (`?after_id=x`) is still supported. The two pagination modes are mutually exclusive, and are documented as such. If both are supplied, the request will be rejected. Also adds a `total` property to the response that contains the full count of items matching the filter. We already have indices in place so I don't think this will impact performance (or we can revisit it before GA).
This commit is contained in:
Generated
+4
-2
@@ -19,7 +19,8 @@ curl -X GET http://coder-server:8080/api/v2/api/experimental/aibridge/intercepti
|
||||
|------------|-------|---------|----------|------------------------------------------------------------------------------------------------------------------------|
|
||||
| `q` | query | string | false | Search query in the format `key:value`. Available keys are: initiator, provider, model, started_after, started_before. |
|
||||
| `limit` | query | integer | false | Page limit |
|
||||
| `after_id` | query | string | false | Cursor pagination after ID |
|
||||
| `after_id` | query | string | false | Cursor pagination after ID (cannot be used with offset) |
|
||||
| `offset` | query | integer | false | Offset pagination (cannot be used with after_id) |
|
||||
|
||||
### Example responses
|
||||
|
||||
@@ -83,7 +84,8 @@ curl -X GET http://coder-server:8080/api/v2/api/experimental/aibridge/intercepti
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"total": 0
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Generated
+3
-1
@@ -566,7 +566,8 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"total": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -575,6 +576,7 @@
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|-----------|-------------------------------------------------------------------------|----------|--------------|-------------|
|
||||
| `results` | array of [codersdk.AIBridgeInterception](#codersdkaibridgeinterception) | false | | |
|
||||
| `total` | integer | false | | |
|
||||
|
||||
## codersdk.AIBridgeOpenAIConfig
|
||||
|
||||
|
||||
Reference in New Issue
Block a user