Sign inSign up

he0119/open-webui

By he0119

Updated over 1 year ago
Archived

支持 reasoning_content 的版本。

Image
0

1.3K

he0119/open-webui repository overview

https://github.com/he0119/open-webui

通过比较 hack 的方法支持了 reasoning_content。

open-webui 官方不支持的理由如下:

https://github.com/open-webui/open-webui/pull/9241#issuecomment-2629707340

Let me be perfectly clear here: We will not add a reasoning_content field or any similar deviation that is not explicitly provided by OpenAI's official API. The core goal of Open WebUI's OpenAI implementation is to adhere strictly to OpenAI's original design and specifications. This is not up for debate.

Docker Hub 上的版本由于需要我在电脑上手动编译,今后不再更新。

请到 GitHub 获取最新版本:

https://github.com/he0119/open-webui/pkgs/container/open-webui

v0.5.17 版本更新后,可以用 Stream Filter 实现。

https://openwebui.com/f/he0119/reasoning

DETECT_REASONING_CONTENT = {}


class Filter:
    def stream(self, event: dict) -> dict:
        # This is where you modify streamed chunks of model output.
        global DETECT_REASONING_CONTENT
        event_id = event.get("id")
        for choice in event.get("choices", []):
            delta = choice.get("delta")

            value = delta.get("content", None)
            reasoning_value = delta.get("reasoning_content", None)

            if DETECT_REASONING_CONTENT.get(event_id, False):
                if reasoning_value is not None:
                    delta["content"] = reasoning_value
                else:
                    DETECT_REASONING_CONTENT[event_id] = False
                    delta["content"] = f"</think>\n{value}"
            elif reasoning_value is not None:
                DETECT_REASONING_CONTENT[event_id] = True
                delta["content"] = f"<think>\n{reasoning_value}"
        return event

Tag summary

Content type

Image

Digest

sha256:9a8aef102

Size

1.5 GB

Last updated

over 1 year ago

docker pull he0119/open-webui