Add assistant-ui data agent frontend
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import type { ExportedMessageRepository } from "@assistant-ui/core";
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
type ClawSessionReplayContextValue = {
|
||||
replaySession: (
|
||||
sessionId: string,
|
||||
repository: ExportedMessageRepository,
|
||||
) => void;
|
||||
};
|
||||
|
||||
const ClawSessionReplayContext =
|
||||
createContext<ClawSessionReplayContextValue | null>(null);
|
||||
|
||||
export const ClawSessionReplayProvider = ClawSessionReplayContext.Provider;
|
||||
|
||||
export function useClawSessionReplay() {
|
||||
const value = useContext(ClawSessionReplayContext);
|
||||
if (!value) {
|
||||
throw new Error(
|
||||
"useClawSessionReplay must be used within ClawSessionReplayProvider",
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
Reference in New Issue
Block a user