Fix test profile implementation

This commit is contained in:
ramnique 2025-03-03 19:39:51 +05:30
parent 4bd72ba245
commit 645d0c27f9
18 changed files with 128 additions and 190 deletions

View file

@ -24,16 +24,14 @@ export function App({
projectId,
workflow,
messageSubscriber,
initialTestProfile,
}: {
hidden?: boolean;
projectId: string;
workflow: z.infer<typeof Workflow>;
messageSubscriber?: (messages: z.infer<typeof apiV1.ChatMessage>[]) => void;
initialTestProfile: z.infer<typeof TestProfile>;
}) {
const [counter, setCounter] = useState<number>(0);
const [testProfile, setTestProfile] = useState<z.infer<typeof TestProfile>>(initialTestProfile);
const [testProfile, setTestProfile] = useState<z.infer<typeof TestProfile> | null>(null);
const [chat, setChat] = useState<z.infer<typeof PlaygroundChat>>({
projectId,
createdAt: new Date().toISOString(),
@ -42,7 +40,7 @@ export function App({
systemMessage: defaultSystemMessage,
});
function handleTestProfileChange(profile: WithStringId<z.infer<typeof TestProfile>>) {
function handleTestProfileChange(profile: WithStringId<z.infer<typeof TestProfile>> | null) {
setTestProfile(profile);
setCounter(counter + 1);
}