mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-11 00:13:40 -05:00
[PR #4621] [MERGED] feat: Set content-type header in Ollama backend #21525
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/4621
Author: @nthe
Created: 8/15/2024
Status: ✅ Merged
Merged: 8/15/2024
Merged by: @tjbck
Base:
dev← Head:main📝 Commits (3)
13b0e7dMerge pull request #4434 from open-webui/devf73a60dfix: set content-type header in ollama backend439cb66refac: fuzzy search threshold📊 Changes
2 files changed (+13 additions, -3 deletions)
View changed files
📝
backend/apps/ollama/main.py(+11 -2)📝
src/lib/components/chat/ModelSelector/Selector.svelte(+2 -1)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
The Ollama backend code doesn't work with custom Ollama compatible APIs made with FastAPI. The issue comes from missing (or incorrect)
Content-TypeHTTP header, which now defaults totext/plain. Without proper header, the FastAPI (or maybe Pydantic) raises and422 Unprocessable Entityexception even with valid JSON. This issue affects POST requests only.Added
Content-Type: application/jsonheader for POST requests in the Ollama backend code.Screenshots or Videos
UI and custom Ollama API without header set


The
422exception get propagated to the UI.UI and custom Ollama API with header set


No exceptions raised this time.
UI with Ollama still working

As it should be.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.