Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbortableAsyncIterator have proprieties undefined when doing stream.abort() #148

Open
ZaMeR12 opened this issue Oct 9, 2024 · 3 comments

Comments

@ZaMeR12
Copy link

ZaMeR12 commented Oct 9, 2024

In brief, i want to stop the request the user just made while ollama is responding to them. The problem is that i followed the example given by this lib but my console tell that the property abort is undefined. And my code editor them something similar. So i guess i have to create a new variable from the constructor of AbortableAsyncIterator when i declare the stream variable, but i don't know how to do that. Can someone help me? I use typescript and React.

There is a screenshot that the web console show me when i try to stream.abort() like the example show:

image

@hopperelec
Copy link
Contributor

Could you show your code?

@hopperelec
Copy link
Contributor

hopperelec commented Oct 18, 2024

Just experienced this same issue. The stream doesn't get created until Ollama starts responding to the request (which could be a while if you're loading a large model), so you will get this error if you try to abort before that. Just add an if (stream) check before trying to abort it. I'll modify the example to demonstrate this!

@hopperelec
Copy link
Contributor

Nevermind, there's already a PR to fix this! #146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants