mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
feat: add search space snapshots frontend API
This commit is contained in:
parent
ab343b544a
commit
47b7befc55
2 changed files with 50 additions and 0 deletions
|
|
@ -5,8 +5,12 @@ import {
|
|||
createSnapshotResponse,
|
||||
type DeleteSnapshotRequest,
|
||||
deleteSnapshotRequest,
|
||||
type ListSearchSpaceSnapshotsRequest,
|
||||
type ListSearchSpaceSnapshotsResponse,
|
||||
type ListSnapshotsRequest,
|
||||
type ListSnapshotsResponse,
|
||||
listSearchSpaceSnapshotsRequest,
|
||||
listSearchSpaceSnapshotsResponse,
|
||||
listSnapshotsRequest,
|
||||
listSnapshotsResponse,
|
||||
} from "@/contracts/types/chat-threads.types";
|
||||
|
|
@ -63,6 +67,25 @@ class ChatThreadsApiService {
|
|||
`/api/v1/threads/${parsed.data.thread_id}/snapshots/${parsed.data.snapshot_id}`
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* List all snapshots for a search space.
|
||||
*/
|
||||
listSearchSpaceSnapshots = async (
|
||||
request: ListSearchSpaceSnapshotsRequest
|
||||
): Promise<ListSearchSpaceSnapshotsResponse> => {
|
||||
const parsed = listSearchSpaceSnapshotsRequest.safeParse(request);
|
||||
|
||||
if (!parsed.success) {
|
||||
const errorMessage = parsed.error.issues.map((issue) => issue.message).join(", ");
|
||||
throw new ValidationError(`Invalid request: ${errorMessage}`);
|
||||
}
|
||||
|
||||
return baseApiService.get(
|
||||
`/api/v1/searchspaces/${parsed.data.search_space_id}/snapshots`,
|
||||
listSearchSpaceSnapshotsResponse
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export const chatThreadsApiService = new ChatThreadsApiService();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue