diff --git a/package.json b/package.json index f019f27..c105e7c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@magicul/react-chat-stream", "description": "A React hook that lets you easily integrate your custom ChatGPT-like chat in React.", - "version": "0.3.0", + "version": "0.3.1", "main": "dist/index.js", "types": "dist/index.d.ts", "homepage": "https://github.com/XD2Sketch/react-chat-stream#readme", diff --git a/src/hooks/useChatStream.ts b/src/hooks/useChatStream.ts index 75ec601..8ac8d1a 100644 --- a/src/hooks/useChatStream.ts +++ b/src/hooks/useChatStream.ts @@ -58,7 +58,7 @@ const useChatStream = (input: UseChatStreamInput) => { setFormInput(''); try { - const addedMessage = await fetchAndUpdateAIResponse(formInput); + const addedMessage = await fetchAndUpdateAIResponse(message ?? formInput); await input.handlers.onMessageAdded?.(addedMessage); } catch { const addedMessage = addMessage({ content: BOT_ERROR_MESSAGE, role: 'bot' });