I hope you've found a solution to your problem, but if not, I may have an idea for you.
In this article, the author uses ChatOllama instead of OllamaLLM: https://medium.com/@dimosdennis/personal-photo-library-with-langchain-ollama-llava-fully-local-e82edfe07f54
I had a problem similar to the one you describe here and changing it helped me get rid of it!
I must admit I haven't gone through all your code, but maybe following the Medium tutorial (for part of it) might help.
Good luck ;)