Autorun chat in playground to show greeting

This commit is contained in:
ramnique 2025-03-07 01:23:13 +05:30
parent d15eddc951
commit 3ea08895b8
4 changed files with 47 additions and 41 deletions

View file

@ -25,6 +25,7 @@ export function App({
}) {
const [counter, setCounter] = useState<number>(0);
const [testProfile, setTestProfile] = useState<z.infer<typeof TestProfile> | null>(null);
const [systemMessage, setSystemMessage] = useState<string>(defaultSystemMessage);
const [chat, setChat] = useState<z.infer<typeof PlaygroundChat>>({
projectId,
createdAt: new Date().toISOString(),
@ -33,6 +34,11 @@ export function App({
systemMessage: defaultSystemMessage,
});
function handleSystemMessageChange(message: string) {
setSystemMessage(message);
setCounter(counter + 1);
}
function handleTestProfileChange(profile: WithStringId<z.infer<typeof TestProfile>> | null) {
setTestProfile(profile);
setCounter(counter + 1);
@ -105,6 +111,8 @@ export function App({
testProfile={testProfile}
messageSubscriber={messageSubscriber}
onTestProfileChange={handleTestProfileChange}
systemMessage={systemMessage}
onSystemMessageChange={handleSystemMessageChange}
/>
</div>
</Pane>