andrewnguonly / Lumos

A RAG LLM co-pilot for browsing the web, powered by local LLMs
MIT License
1.34k stars 95 forks source link

Unable to connect to Ollama API on Mac OS #145

Closed didikrm closed 5 months ago

didikrm commented 5 months ago

Hello,

The extension does not detect Ollama although I am running on another extension that detects and when I go to http://127.0.0.1:11434, it shows that it's working. Could be related to the fact that I am using Chrome on Mac OS?

Screenshot 2024-03-29 at 4 22 17 PM

Thanks

andrewnguonly commented 5 months ago

@didikrm, do you see any errors in the Chrome extension console logs?

Double checking: Is Ollama started with environment variable OLLAMA_ORIGINS=chrome-extension://*?

didikrm commented 5 months ago

Here is the error code I got:

Access to fetch at 'http://127.0.0.1:11434/api/tags' from origin 'chrome-extension://mdkmkgmeleogeakokmdmcmiphcpinamb' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. Context js/options.html Stack Trace js/options.html:0 (anonymous function)

didikrm commented 5 months ago

I see that you documented in your readme and I just missed it. This issue has also been reported in the Ollama repository https://github.com/ollama/ollama/issues/2335. A settings option is in the works to set OLLAMA_ORIGINS

andrewnguonly commented 5 months ago

In the meantime, are you able to connect to the Ollama API now? If so, I can close this issue.

didikrm commented 5 months ago

It is a problem with Oolama, so you can close it. For info, I followed Oolama's Mac OS instructions, restarted Ollama but that didn't work.

launchctl setenv OLLAMA_HOST "chrome-extension://mdkmkgmeleogeakokmdmcmiphcpinamb" Will wait for a GUI to set the ollama_host variable.

andrewnguonly commented 5 months ago

launchctl setenv OLLAMA_HOST "chrome-extension://mdkmkgmeleogeakokmdmcmiphcpinamb"

@didikrm, you need to set OLLAMA_ORIGINS.

launchctl setenv OLLAMA_ORIGINS "chrome-extension://mdkmkgmeleogeakokmdmcmiphcpinamb" 

I'll add documentation in this repo for this step.

didikrm commented 5 months ago

Oh my bad! I didn't read the instructions well. It's working now! thanks for your help.