Target branch: Pull requests should target the dev branch.
Description: Briefly describe the changes in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Testing: Have you written and run sufficient tests for the changes?
Code Review: Have you self-reviewed your code and addressed any coding standard issues?
Description
Add support for ollama connection that require a token access. The token can be set with the environment variable OLLAMA_AUTH_KEY or in the connection settings.
Changelog Entry
Added
Optional environment variables OLLAMA_AUTH_KEY and OLLAMA_AUTH_KEYS to set access token
Option to set access token in connections settings
Fixed
In ollama router, improve ollama response checking for get_ollama_versions(...) (route /api/version) and get_all_models() methods to avoid errors
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/2336
**Author:** [@ymerejeremy](https://github.com/ymerejeremy)
**Created:** 5/17/2024
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `dev`
---
### 📝 Commits (10+)
- [`7628498`](https://github.com/open-webui/open-webui/commit/7628498f85dad26c217e6b61ed1123b9cd1c1a90) Add auth token settings
- [`8a60724`](https://github.com/open-webui/open-webui/commit/8a60724acd915f29de2b759d37e0de74cb935554) Add headers to ollama's requests
- [`ee14f11`](https://github.com/open-webui/open-webui/commit/ee14f118663f4a559924cba10dfbaee7bb25210d) Add OLLAMA_AUTH_KEYS env var
- [`012fe4d`](https://github.com/open-webui/open-webui/commit/012fe4d73caa509890fb91d603e6fbed7363a641) Keep essentials headers to avoid decoding error
- [`b221c22`](https://github.com/open-webui/open-webui/commit/b221c22844e455c3892524c79e0ff2f2bfb4ce95) Normalize code
- [`e3508bb`](https://github.com/open-webui/open-webui/commit/e3508bbd837330aeda34c9eb33b08c006265a8d4) Set OLLAMA_AUTH_KEY env. var. as optional
- [`bb1086c`](https://github.com/open-webui/open-webui/commit/bb1086ca649c67b7a48cfb2876290c086f5909d6) Avoid OLLAMA connection failed python error to show javascript error message
- [`35ee9ba`](https://github.com/open-webui/open-webui/commit/35ee9bacf906cfd002c928742d2658e80c2afbe8) Add PersistentConfig support
- [`24a88b6`](https://github.com/open-webui/open-webui/commit/24a88b6bec69be8e195de2375db86c6e97f32326) Fix rebase error
- [`0cdb767`](https://github.com/open-webui/open-webui/commit/0cdb767fa0269631b2229963f75a2e3d05aae64d) Fix build_headers url compare
### 📊 Changes
**4 files changed** (+218 additions, -11 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/apps/ollama/main.py` (+52 -8)
📝 `backend/config.py` (+12 -0)
📝 `src/lib/apis/ollama/index.ts` (+67 -0)
📝 `src/lib/components/chat/Settings/Connections.svelte` (+87 -3)
</details>
### 📄 Description
## Pull Request Checklist
- [x] **Target branch:** Pull requests should target the `dev` branch.
- [x] **Description:** Briefly describe the changes in this pull request.
- [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
- [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [x] **Testing:** Have you written and run sufficient tests for the changes?
- [x] **Code Review:** Have you self-reviewed your code and addressed any coding standard issues?
---
## Description
Add support for ollama connection that require a token access. The token can be set with the environment variable OLLAMA_AUTH_KEY or in the connection settings.
---
### Changelog Entry
### Added
- Optional environment variables OLLAMA_AUTH_KEY and OLLAMA_AUTH_KEYS to set access token
- Option to set access token in connections settings
### Fixed
- In ollama router, improve ollama response checking for `get_ollama_versions(...)` (route `/api/version`) and `get_all_models()` methods to avoid errors
### Changed
- Use token access for ollama connection
---
### Additional Information

Issue : #2305
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/2336
Author: @ymerejeremy
Created: 5/17/2024
Status: ❌ Closed
Base:
dev← Head:dev📝 Commits (10+)
7628498Add auth token settings8a60724Add headers to ollama's requestsee14f11Add OLLAMA_AUTH_KEYS env var012fe4dKeep essentials headers to avoid decoding errorb221c22Normalize codee3508bbSet OLLAMA_AUTH_KEY env. var. as optionalbb1086cAvoid OLLAMA connection failed python error to show javascript error message35ee9baAdd PersistentConfig support24a88b6Fix rebase error0cdb767Fix build_headers url compare📊 Changes
4 files changed (+218 additions, -11 deletions)
View changed files
📝
backend/apps/ollama/main.py(+52 -8)📝
backend/config.py(+12 -0)📝
src/lib/apis/ollama/index.ts(+67 -0)📝
src/lib/components/chat/Settings/Connections.svelte(+87 -3)📄 Description
Pull Request Checklist
devbranch.Description
Add support for ollama connection that require a token access. The token can be set with the environment variable OLLAMA_AUTH_KEY or in the connection settings.
Changelog Entry
Added
Fixed
get_ollama_versions(...)(route/api/version) andget_all_models()methods to avoid errorsChanged
Additional Information
Issue : #2305
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.