issue: #4396

Closed
opened 2025-11-11 15:53:06 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @sellerskyle on GitHub (Mar 12, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

0.5.20

Ollama Version (if applicable)

No response

Operating System

Ubuntu 24.04

Browser (if applicable)

Brave v 1.76.73

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

Inline Citations link to correct document that the information comes from.

Actual Behavior

Inline citations reference the wrong documents

Steps to Reproduce

  1. Create a Knowledge Base with some files (say, 10 different files)
  2. Create a Model linking to that knowledge base
  3. Write a prompt using that Model referencing knowledge from one document
  4. Observe that the wrong document is referenced

Logs & Screenshots

No relevant logs, see Additional Information for information on images

Image

Image

Additional Information

When trying to use Model hooked to a knowledge base, inline corrections are incorrect.

The crux of the problem is in the Citations.svelte file. sources as it was sent with the LLM can be a batch of lines from multiple files, which get expanded in citations, but the inline index is based on its location in sources and pulled from citations, which is incorrect. It appears there may have been recent attempts to address this, but have not in this case https://github.com/open-webui/open-webui/commits/main/src/lib/components/chat/Messages/Citations.svelte .

                            <button
                                id={`source-${id}-${idx}`}
                                class="no-toggle outline-hidden flex dark:text-gray-300 p-1 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-850 transition rounded-xl max-w-96"
                                on:click={() => {
                                    showCitationModal = true;
                                    selectedCitation = citation;
                                }}
                            >
                                {#if citations.every((c) => c.distances !== undefined)}
                                    <div class="bg-gray-50 dark:bg-gray-800 rounded-full size-4">
                                        {idx + 1}
                                    </div>
                                {/if}
                                <div class="flex-1 mx-1 truncate">
                                    {citation.source.name}
                                </div>
                            </button>
                        {/each}```
Originally created by @sellerskyle on GitHub (Mar 12, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version 0.5.20 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu 24.04 ### Browser (if applicable) Brave v 1.76.73 ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior Inline Citations link to correct document that the information comes from. ### Actual Behavior Inline citations reference the wrong documents ### Steps to Reproduce 1. Create a Knowledge Base with some files (say, 10 different files) 2. Create a Model linking to that knowledge base 3. Write a prompt using that Model referencing knowledge from one document 4. Observe that the wrong document is referenced ### Logs & Screenshots No relevant logs, see Additional Information for information on images ![Image](https://github.com/user-attachments/assets/7165da70-d72a-4fb9-a507-994b213548e8) ![Image](https://github.com/user-attachments/assets/aebf925d-681e-4b75-a4b8-21c1533e590c) ### Additional Information When trying to use Model hooked to a knowledge base, inline corrections are incorrect. The crux of the problem is in the Citations.svelte file. sources as it was sent with the LLM can be a batch of lines from multiple files, which get expanded in citations, but the inline index is based on its location in sources and pulled from citations, which is incorrect. It appears there may have been recent attempts to address this, but have not in this case https://github.com/open-webui/open-webui/commits/main/src/lib/components/chat/Messages/Citations.svelte . ```{#each citations as citation, idx} <button id={`source-${id}-${idx}`} class="no-toggle outline-hidden flex dark:text-gray-300 p-1 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-850 transition rounded-xl max-w-96" on:click={() => { showCitationModal = true; selectedCitation = citation; }} > {#if citations.every((c) => c.distances !== undefined)} <div class="bg-gray-50 dark:bg-gray-800 rounded-full size-4"> {idx + 1} </div> {/if} <div class="flex-1 mx-1 truncate"> {citation.source.name} </div> </button> {/each}```
GiteaMirror added the bug label 2025-11-11 15:53:06 -06: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#4396