Skip to content

Commit

Permalink
Merge pull request #75 from sachua/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Royal-lobster authored May 21, 2024
2 parents 6fbfdac + 36d7b91 commit 6628ba9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-roses-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"syncia": patch
---

Fix Stop button not working
5 changes: 3 additions & 2 deletions src/hooks/useChatCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ interface UseChatCompletionProps {
*
* And returns them along with useful state from useCurrentChat hook
*/
let controller: AbortController

export const useChatCompletion = ({
model,
apiKey,
Expand Down Expand Up @@ -71,10 +73,9 @@ export const useChatCompletion = ({
}
})

const controller = new AbortController()

const submitQuery = async (message: MessageDraft, context?: string) => {
await addNewMessage(ChatRole.USER, message)
controller = new AbortController()
const options = {
signal: controller.signal,
callbacks: [{ handleLLMNewToken: updateAssistantMessage }],
Expand Down

0 comments on commit 6628ba9

Please sign in to comment.