From c58566c82e2705334bf8e04a0aca7213b929be05 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 13 Feb 2025 12:45:36 +0100 Subject: [PATCH] more --- .../trace-viewer/src/ui/aiConversation.tsx | 26 +++++++++++-------- packages/trace-viewer/src/ui/llm.tsx | 21 ++++++++------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/packages/trace-viewer/src/ui/aiConversation.tsx b/packages/trace-viewer/src/ui/aiConversation.tsx index f9bc550fe0..adbc64f70f 100644 --- a/packages/trace-viewer/src/ui/aiConversation.tsx +++ b/packages/trace-viewer/src/ui/aiConversation.tsx @@ -7,11 +7,11 @@ import type { Conversation, LLMMessage } from './llm'; export function AIConversation({ history, conversation }: { history: LLMMessage[], conversation: Conversation }) { const [input, setInput] = useState(''); - const onSubmit = useCallback(async (event: React.FormEvent) => { - event.preventDefault(); - setInput(''); - const content = new FormData(event.target as any).get('content') as string; - await conversation.send(content); + const onSubmit = useCallback(() => { + setInput(content => { + conversation.send(content); + return ''; + }); }, [conversation]); return ( @@ -34,29 +34,33 @@ export function AIConversation({ history, conversation }: { history: LLMMessage[ ))} -
- +