Add message actions (#482)

This commit is contained in:
Jeremy 2024-11-05 17:15:51 +03:00 committed by GitHub
parent 94f563f179
commit 171914941e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 1011 additions and 150 deletions

View file

@ -36,6 +36,7 @@ const suggestedActions = [
];
export function MultimodalInput({
chatId,
input,
setInput,
isLoading,
@ -48,6 +49,7 @@ export function MultimodalInput({
handleSubmit,
className,
}: {
chatId: string;
input: string;
setInput: (value: string) => void;
isLoading: boolean;
@ -114,6 +116,8 @@ export function MultimodalInput({
const [uploadQueue, setUploadQueue] = useState<Array<string>>([]);
const submitForm = useCallback(() => {
window.history.replaceState({}, '', `/chat/${chatId}`);
handleSubmit(undefined, {
experimental_attachments: attachments,
});
@ -124,7 +128,14 @@ export function MultimodalInput({
if (width && width > 768) {
textareaRef.current?.focus();
}
}, [attachments, handleSubmit, setAttachments, setLocalStorageInput, width]);
}, [
attachments,
handleSubmit,
setAttachments,
setLocalStorageInput,
width,
chatId,
]);
const uploadFile = async (file: File) => {
const formData = new FormData();