Skip to content

fix: show the current knowledge file name in citations after a rename - #9

Draft
macodev00 wants to merge 1 commit into
devfrom
fix/knowledge-file-rename-citations-30318
Draft

macodev00 wants to merge 1 commit into
devfrom
fix/knowledge-file-rename-citations-30318

Conversation

@macodev00

Copy link
Copy Markdown
Owner

Pull Request

Do not open a code pull request unless a maintainer has explicitly requested it or the change is limited to i18n/localization.

The most useful way to help is to give us a clear understanding of the problem: report reproducible bugs in Issues and share proposals in Discussions. We use that context to evaluate solutions and refine the implementation internally, accounting for the broader codebase and ongoing work. External implementations usually require substantial reworking to fit the project's standards, and coordinating those revisions usually takes more effort than developing the solution internally. Please follow this process before investing time in a pull request. PRs opened outside these guidelines are generally closed without review.

Maintainer Request

No maintainer request. Draft only, so it does not take a ready-for-review slot. Relates to open-webui#30318.

Checklist

  • I have read and I understand the contribution policy.
  • This PR targets the dev branch.
  • This PR links to a well-described, confirmed Issue or active Discussion: Relates to open-webui/open-webui#30318.
  • A maintainer explicitly asked me to open this PR, or this PR only updates i18n/localization.
  • The change is one logical unit with no unrelated commits.
  • I matched nearby code patterns and avoided unnecessary new settings, abstractions, or dependencies.
  • I manually tested the changed workflow and any nearby behavior that could be affected.
  • I have not added or rewritten automated tests, fixtures, snapshots, or testing infrastructure unless a maintainer explicitly requested them.
  • I updated relevant docs, including the Open WebUI Docs Repository, if needed.
  • I added screenshots for UI changes, and a recording when motion or interaction matters.
  • I reviewed any AI-generated code before submitting it.
  • The PR title uses one of the prefixes listed below.

Title Prefix

Use one of the following prefixes:

  • BREAKING CHANGE: Changes affecting backward compatibility
  • build: Build system or dependency changes
  • ci: CI/CD workflow changes
  • chore: Refactoring, cleanup, or non-functional changes
  • docs: Documentation additions or updates
  • feat: New features or enhancements
  • fix: Bug fixes or corrections
  • i18n: Internationalization or localization changes
  • perf: Performance improvements
  • refactor: Code restructuring

Summary

Renaming a knowledge-base file updates the file record, but each indexed chunk still carries the filename copied in at process time. New chats then cite that stale name in the source chip and the citation panel.

When sources are built, name and source on chunks that belong to a real file are replaced with the current filename from the files table. Deleted files, external documents, and URL sources keep the stored value. The same resolution is applied to query_knowledge_files, which builds citations from those chunks directly.

Verification

Reproduced the stale-name path from the issue description: chunk metadata is written with file.filename in process_file, and rename_file_by_id updates only the file row. Citations render metadata.name, and group on metadata.source.

Checked the resolver against the cases that matter: a renamed file overwrites both fields, a second chunk for the same id does one lookup, a missing file and an empty filename stay unchanged, external metadata and external- ids stay unchanged, and http:// / https:// values stay unchanged so link citations keep their URL.

I did not run the full app, upload a knowledge file, rename it, and open a chat. That needs a running stack, embeddings, and a vector database.

Changelog Entry

Added

Changed

Fixed

  • Citations for a renamed knowledge-base file use the current filename instead of the name stored when the file was indexed.

Removed

Security

Breaking Changes

Additional Context

Draft. Not requested by a maintainer. Issue open-webui#30318 is still open; an earlier pull request (open-webui#30344) was closed without merge and targeted main.

Contributor License Agreement

Open in Web Open in Cursor 

Indexed chunks keep the filename from when the file was processed, so sources and the citation panel stayed on the old name after a rename. Read the current filename when those citations are built.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant