mirror of
https://github.com/coder/coder.git
synced 2026-11-09 02:41:35 +08:00
feat(site): add AI sessions list page (#23388)
<!-- If you have used AI to produce some or all of this PR, please ensure you have read our [AI Contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) before submitting. --> Adds the AI Bridge sessions list page.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { API } from "#/api/api";
|
||||
import type { AIBridgeListInterceptionsResponse } from "#/api/typesGenerated";
|
||||
import type {
|
||||
AIBridgeListInterceptionsResponse,
|
||||
AIBridgeListSessionsResponse,
|
||||
} from "#/api/typesGenerated";
|
||||
import { useFilterParamsKey } from "#/components/Filter/Filter";
|
||||
import type { UsePaginatedQueryOptions } from "#/hooks/usePaginatedQuery";
|
||||
|
||||
@@ -20,3 +23,21 @@ export const paginatedInterceptions = (
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
export const paginatedSessions = (
|
||||
searchParams: URLSearchParams,
|
||||
): UsePaginatedQueryOptions<AIBridgeListSessionsResponse, string> => {
|
||||
return {
|
||||
searchParams,
|
||||
queryPayload: () => searchParams.get(useFilterParamsKey) ?? "",
|
||||
queryKey: ({ payload, pageNumber }) => {
|
||||
return ["aiBridgeSessions", payload, pageNumber] as const;
|
||||
},
|
||||
queryFn: ({ offset, limit, payload }) =>
|
||||
API.getAIBridgeSessionList({
|
||||
offset,
|
||||
limit,
|
||||
q: payload,
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user