andrewnguonly / Lumos

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

Server not detected #116

Closed odevroed closed 6 months ago

odevroed commented 6 months ago

Hi,

the pop-up sais 'unable to connect to ollama api'. However, I have the correct address and another UI is correctly accessing the API.

When I do 'inspect pop-up', I get the following error: Access to fetch at 'http://127.0.0.1:11434/api/tags' from origin 'chrome-extension://lchglknfjpkcpceecjmopnlgekdlogae' 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.

Any idea what might go wrong?

andrewnguonly commented 6 months ago

The Ollama server needs to be started with the OLLAMA_ORIGINS environment variable set to chrome-extension://*.

Example:

OLLAMA_ORIGINS=chrome-extension://* ollama serve

I'll update the documentation to be more explicit about the error.

fatinghenji commented 6 months ago

I'm having the same problem, but I'm using the edge browser, how should I set the environment variables? image Is that what it looks like?

andrewnguonly commented 6 months ago

@fatinghenji, for Microsoft Edge browser, the Ollama server should be started with OLLAMA_ORIGINS=chrome-extension://*. I typically start the Ollama server from the command line (OLLAMA_ORIGINS=chrome-extension://* ollama serve). I'm not familiar with the screenshot you shared.

odevroed commented 6 months ago

@andrewnguonly this indeed worked like a charm. Maybe you can add that for Linux, one should add this to the config of systemctl. The way to do this is to edit /etc/systemd/system/ollama.service and add Environment="OLLAMA_ORIGINS=chrome-extension://*" before the execstart statement.

Thanks a lot for your help.

andrewnguonly commented 6 months ago

Maybe you can add that for Linux, one should add this to the config of systemctl. The way to do this is to edit /etc/systemd/system/ollama.service and add Environment="OLLAMA_ORIGINS=chrome-extension://*" before the execstart statement.

I'll find a place to document this :+1:

andrewnguonly commented 6 months ago

@fatinghenji, I'm closing this issue for now, but feel free to reopen it or create a new issue if you're still having trouble connecting on Microsoft Edge. Instructions for installing on Microsoft Edge are here.