mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
feat(ui): add a lens reviews query that polls the index cursor while live
This commit is contained in:
parent
db0e4df4f5
commit
2f5fb3ef44
1 changed files with 15 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ import type { KeyPage, LensApi } from "./service";
|
|||
|
||||
export type { Key } from "./service";
|
||||
|
||||
const LIVE_REVIEW_POLL_MS = 1500;
|
||||
|
||||
export const lensKeys = {
|
||||
all: ["lens"] as const,
|
||||
lists: () => [...lensKeys.all, "list"] as const,
|
||||
|
|
@ -14,6 +16,8 @@ export const lensKeys = {
|
|||
runs: () => [...lensKeys.all, "run"] as const,
|
||||
run: (scope: string, lensId: string | undefined, batchId: string) =>
|
||||
[...lensKeys.runs(), { scope, lensId, batchId }] as const,
|
||||
reviews: (scope: string, lensId: string, jobId: string, after: number) =>
|
||||
[...lensKeys.all, "reviews", { scope, lensId, jobId, after }] as const,
|
||||
evidence: (scope: string, lensId: string | undefined, evidenceId: string | undefined, offset: number) =>
|
||||
[...lensKeys.all, "evidence", { scope, lensId, evidenceId, offset }] as const,
|
||||
models: (scope: string) => [...lensKeys.all, "models", { scope }] as const,
|
||||
|
|
@ -79,6 +83,17 @@ export const lensQueries = {
|
|||
};
|
||||
return queryOptions(options);
|
||||
},
|
||||
reviews(
|
||||
api: LensApi,
|
||||
{ lensId, jobId, after, live }: { lensId: string; jobId: string; after: number; live: boolean },
|
||||
) {
|
||||
const options = {
|
||||
queryKey: lensKeys.reviews(api.scope, lensId, jobId, after),
|
||||
queryFn: () => api.reviews(lensId, jobId, after),
|
||||
refetchInterval: live ? LIVE_REVIEW_POLL_MS : (false as const),
|
||||
};
|
||||
return queryOptions(options);
|
||||
},
|
||||
evidence(
|
||||
api: LensApi,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue