SystemSculpt / obsidian-systemsculpt-ai

Enhance your Obsidian App experience with AI-powered tools for note-taking, task management, and much, MUCH more.
MIT License
100 stars 13 forks source link

Cors Policy Error with Ollama (in Windows) #82

Open Richie735 opened 2 weeks ago

Richie735 commented 2 weeks ago

Describe the Bug

I'm encountering a CORS policy error when trying to use the Ollama plugin in Obsidian on a Windows PC. The error message is:

Access to fetch at 'http://localhost:11434/v1/chat/completions' from origin 'app://obsidian.md' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. localhost:11434/v1/chat/completions:1

Failed to load resource: net::ERR_FAILED

It seems the plugin is blocked by CORS restrictions when attempting to access the Ollama API via a local endpoint. Could you please provide guidance on resolving this issue or adjusting the plugin configuration to allow cross-origin requests?

Environment

To Reproduce

  1. Configure Ollama to run on http://localhost:11434.
  2. Set up the plugin's "local Endpoint" with the URL http://localhost:11434
  3. Select the default model and attempt to use any plugin features in Obsidian.
  4. Observe the CORS error in the Developer Console.