[PR #22210] [CLOSED] fix: correct conflicting output format in follow-up generation prompt template #42182

Closed
opened 2026-04-25 14:10:30 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22210
Author: @MJ16MJ
Created: 3/4/2026
Status: Closed

Base: mainHead: fix/follow-up-prompt-template-format


📝 Commits (1)

  • 143fd39 fix: correct conflicting output format instruction in follow-up generation prompt

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 backend/open_webui/config.py (+1 -1)

📄 Description

What?

Fixes conflicting output format instructions in DEFAULT_FOLLOW_UP_GENERATION_PROMPT_TEMPLATE that caused follow-up suggestions to silently fail.

Why?

The prompt template contained contradictory instructions:

  • Guidelines section said: "Response must be a JSON array of strings" (top-level array [...])
  • Output section said: { "follow_ups": ["Question 1?", ...] } (object with key)

The frontend parser in src/lib/apis/index.ts expects a JSON object — it searches for {/} delimiters and extracts parsed.follow_ups. When an LLM followed the "array" instruction and returned ["Q1?", "Q2?"], the parser found no {, returned [], and the UI showed no follow-up suggestions.

How?

Updated the Guidelines line from:

- Response must be a JSON array of strings, no extra text or formatting.

to:

- Response must be a JSON object with a "follow_ups" key containing an array of strings, no extra text or formatting.

This makes Guidelines and Output sections consistent, matching what the frontend parser expects.

Testing

  1. Verified the frontend parser (src/lib/apis/index.ts:716-730) expects { "follow_ups": [...] } format
  2. Confirmed the updated guideline now matches the Output section example
  3. Single-line change, no behavioral changes to parsing logic

Checklist

  • Fix is focused on a single issue (1 line changed)
  • No unrelated changes
  • Documentation within the template is now self-consistent
  • No breaking changes

Fixes #22187


🔄 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/22210 **Author:** [@MJ16MJ](https://github.com/MJ16MJ) **Created:** 3/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/follow-up-prompt-template-format` --- ### 📝 Commits (1) - [`143fd39`](https://github.com/open-webui/open-webui/commit/143fd39d2ca324f5e42601239109ac5837187bbe) fix: correct conflicting output format instruction in follow-up generation prompt ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+1 -1) </details> ### 📄 Description ## What? Fixes conflicting output format instructions in `DEFAULT_FOLLOW_UP_GENERATION_PROMPT_TEMPLATE` that caused follow-up suggestions to silently fail. ## Why? The prompt template contained contradictory instructions: - **Guidelines** section said: _"Response must be a JSON array of strings"_ (top-level array `[...]`) - **Output** section said: `{ "follow_ups": ["Question 1?", ...] }` (object with key) The frontend parser in `src/lib/apis/index.ts` expects a JSON **object** — it searches for `{`/`}` delimiters and extracts `parsed.follow_ups`. When an LLM followed the "array" instruction and returned `["Q1?", "Q2?"]`, the parser found no `{`, returned `[]`, and the UI showed no follow-up suggestions. ## How? Updated the Guidelines line from: ``` - Response must be a JSON array of strings, no extra text or formatting. ``` to: ``` - Response must be a JSON object with a "follow_ups" key containing an array of strings, no extra text or formatting. ``` This makes Guidelines and Output sections consistent, matching what the frontend parser expects. ## Testing 1. Verified the frontend parser (`src/lib/apis/index.ts:716-730`) expects `{ "follow_ups": [...] }` format 2. Confirmed the updated guideline now matches the Output section example 3. Single-line change, no behavioral changes to parsing logic ## Checklist - [x] Fix is focused on a single issue (1 line changed) - [x] No unrelated changes - [x] Documentation within the template is now self-consistent - [x] No breaking changes ## Related Issues Fixes #22187 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 14:10:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#42182