Skip to content

Commit

Permalink
feat: call fetch ai response with direct value
Browse files Browse the repository at this point in the history
  • Loading branch information
niels-bosman committed Oct 17, 2023
1 parent 0656501 commit bd68615
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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.1.7",
"version": "0.2.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"homepage": "https://github.com/XD2Sketch/react-chat-stream#readme",
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useChatStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const useChatStream = (input: UseChatStreamInput): UseChatStreamResult => {
});
};

const fetchAndUpdateAIResponse = async () => {
const fetchAndUpdateAIResponse = async (message: string) => {
const stream = await getStream(message, input.options, input.method);
if (!stream) throw new Error();

Expand All @@ -82,7 +82,7 @@ const useChatStream = (input: UseChatStreamInput): UseChatStreamResult => {
setMessage('');

try {
await fetchAndUpdateAIResponse();
await fetchAndUpdateAIResponse(newMessage ?? message);
} catch {
addMessageToChat(BOT_ERROR_MESSAGE, 'bot');
}
Expand Down

0 comments on commit bd68615

Please # to comment.