[GH-ISSUE #8785] In version 0.5.6, there is a parsing error with the <think> tag in Pipe. #15255

Closed
opened 2026-04-19 21:31:39 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @cr-zhichen on GitHub (Jan 23, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8785

Installation Method

Deployed using Docker-compose.

Environment

  • Open WebUI Version: v0.5.6

  • Ollama (if applicable): N/A (Not explicitly mentioned)

  • Operating System: [Please specify your OS]

  • Browser: Microsoft Edge 132.0.2957.115 (Official build) (64-bit)

Confirmation:

  • I have read and followed all the instructions in README.md
  • I am using the latest version of Open WebUI
  • I have included browser console logs (via screenshot)
  • I have included Docker container logs (Please provide if available)
  • I have provided reproduction steps below

Expected Behavior:

When using a custom Pipe function to generate content wrapped in <think> tags, the frontend should properly parse and display the content without duplication.

Actual Behavior:

The frontend parsing shows duplicated content errors when using the custom Pipe implementation.

Description

Bug Summary:
Custom Pipe implementation with <think> tag generation causes duplicate parsing errors in frontend rendering.

Reproduction Details

Steps to Reproduce:

  1. Deploy Open WebUI v0.5.6 using Docker-compose
  2. Implement custom Pipe with the provided Python code
  3. Trigger the pipeline generation
  4. Observe frontend rendering anomalies

Code Implementation:

import asyncio
from typing import AsyncGenerator, Callable, Awaitable
from pydantic import BaseModel, Field

class Pipe:
    class Valves(BaseModel):
        NULL: str = Field(
            default="",
            description="Test empty field",
        )

    def __init__(self):
        self.valves = self.Valves()
        self.emitter = None

    def pipes(self):
        return [{"id": "deepseek-reasoner", "name": "deepseek-reasoner"}]

    async def pipe(
        self, body: dict, __event_emitter__: Callable[[dict], Awaitable[None]] = None
    ) -> AsyncGenerator[str, None]:
        yield "<think>\n"
        await asyncio.sleep(1)
        for i in range(10):
            await asyncio.sleep(0.1)
            yield str(i)
        yield "\n</think>\n\n"

Screenshots

Screenshot 1
Screenshot 2

Additional Information

  • The duplication error occurs specifically when using the <think> tag structure
  • The issue persists across browser refreshes

Note

Please help investigate why the frontend parser duplicates content when handling custom XML-style tags through the Pipe implementation. The provided screenshots show unexpected duplicated "0" values in the output.

Originally created by @cr-zhichen on GitHub (Jan 23, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/8785 ## Installation Method Deployed using Docker-compose. ## Environment - **Open WebUI Version:** v0.5.6 - **Ollama (if applicable):** N/A (Not explicitly mentioned) - **Operating System:** [Please specify your OS] - **Browser:** Microsoft Edge 132.0.2957.115 (Official build) (64-bit) **Confirmation:** - [X] I have read and followed all the instructions in README.md - [X] I am using the latest version of Open WebUI - [X] I have included browser console logs (via screenshot) - [ ] I have included Docker container logs (Please provide if available) - [X] I have provided reproduction steps below ## Expected Behavior: When using a custom Pipe function to generate content wrapped in `<think>` tags, the frontend should properly parse and display the content without duplication. ## Actual Behavior: The frontend parsing shows duplicated content errors when using the custom Pipe implementation. ## Description **Bug Summary:** Custom Pipe implementation with `<think>` tag generation causes duplicate parsing errors in frontend rendering. ## Reproduction Details **Steps to Reproduce:** 1. Deploy Open WebUI v0.5.6 using Docker-compose 2. Implement custom Pipe with the provided Python code 3. Trigger the pipeline generation 4. Observe frontend rendering anomalies **Code Implementation:** ```python import asyncio from typing import AsyncGenerator, Callable, Awaitable from pydantic import BaseModel, Field class Pipe: class Valves(BaseModel): NULL: str = Field( default="", description="Test empty field", ) def __init__(self): self.valves = self.Valves() self.emitter = None def pipes(self): return [{"id": "deepseek-reasoner", "name": "deepseek-reasoner"}] async def pipe( self, body: dict, __event_emitter__: Callable[[dict], Awaitable[None]] = None ) -> AsyncGenerator[str, None]: yield "<think>\n" await asyncio.sleep(1) for i in range(10): await asyncio.sleep(0.1) yield str(i) yield "\n</think>\n\n" ``` ## Screenshots ![Screenshot 1](https://img-cdn.ccrui.cn/2025/01/23/6791a3bd90009.png) ![Screenshot 2](https://img-cdn.ccrui.cn/2025/01/23/6791a3cd21c8d.png) ## Additional Information - The duplication error occurs specifically when using the `<think>` tag structure - The issue persists across browser refreshes ## Note Please help investigate why the frontend parser duplicates content when handling custom XML-style tags through the Pipe implementation. The provided screenshots show unexpected duplicated "0" values in the output.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#15255