Skip to content

Support for Ollama #616

Closed
Closed

Description

@Mulugruntz

Is your feature request related to a problem? Please describe.
新功能是否与解决某个问题相关, 请描述
When trying to have the extension target my local Mistral handled by Ollama, it fails (HTTP 403).
image

The settings:
image
I haven't digged into the code yet, but maybe it's because it uses a different API.

Can see here that Ollama WebUI works as expected
image

and that Ollama is running
image

Describe the solution you'd like
你期望的新功能实现方案
ChatGPTBox to work with Ollama.

Additional context
其他
Yes, see above :).

Activity

  1. josStorer commented on Jan 26, 2024

    @josStorer
    Member

    Could you please capture the request through F12 Network in the Ollama WebUI, and provide the relevant request headers and body

  2. Donno191 commented on Feb 15, 2024

    @Donno191

    It would be nice to use ollama ! Maybe it works with the support of ollama openai api ? Example of settings ?

  3. josStorer commented on Mar 3, 2024

    @josStorer
    Member

    @Mulugruntz @Donno191

    After consulting the documentation of ollama, I found that ollama provides APIs compatible with OpenAI API.

    And for the 403 error, it is actually caused by cross-origin requests. According to https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-allow-additional-web-origins-to-access-ollama, you can set environment variable OLLAMA_ORIGINS to *, and then restart ollama to allow requests from browser extensions.

    The settings of ChatGPTBox are as follows:
    image

  4. BarfingLemurs commented on Mar 5, 2024

    @BarfingLemurs

    thanks for the tip, filling the model name eg: "gemma:2b" is a requirement for ollama to works, along with: export OLLAMA_ORIGINS=* on linux.

  5. Katzenwerfer commented on Jul 3, 2024

    @Katzenwerfer

    Something to note.
    Setting origins with a wildcard is generally not recommended.
    It is better to be specific and ideally add moz-extension://[ID OF THE EXTENSION], or with a wildcard if you can't find the ID moz-extension://*

  6. lrq3000 commented on Nov 28, 2024

    @lrq3000

    For reference, the issue was discussed here on the ollama issues tracker:

    For better security, it was suggested here to set the var to the following:

    OLLAMA_ORIGINS=chrome-extension://* ollama serve

    Note that on Windows you need to logout and log back in, or restart the computer, for the environment variable change to take effect. If you want to try asap, you can instead kill ollama, then open a command line terminal and write:

    ollama serve```
    
    This will temporarily allow cross origin access. But this won't persist, if you want a permanent environment change, use instead:
    
    ```setx OLLAMA_ORIGINS *```
    
    Of course you need to have downloaded a model in ollama beforehand (eg, ```ollama run phi3.5```).
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions