mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #16249] [MERGED] fix(frontend): Attempt to resolve TypeError in RichTextInput.svelte #39711
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/16249
Author: @silentoplayz
Created: 8/4/2025
Status: ✅ Merged
Merged: 8/4/2025
Merged by: @tjbck
Base:
dev← Head:fix-richtext-getwordatdocpos📝 Commits (2)
7a80e60fix(frontend): Attempt to resolve TypeError in RichTextInput.svelte55d3c07revert: Reverts requested📊 Changes
7 files changed (+20 additions, -20 deletions)
View changed files
📝
src/lib/apis/index.ts(+4 -4)📝
src/lib/apis/ollama/index.ts(+1 -1)📝
src/lib/apis/users/index.ts(+1 -1)📝
src/lib/i18n/index.ts(+2 -2)📝
src/lib/utils/characters/index.ts(+5 -5)📝
src/lib/utils/marked/katex-extension.ts(+6 -6)📝
src/lib/workers/pyodide.worker.ts(+1 -1)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.This pull request addresses a potential
TypeErrorinMessageInput.svelterelated togetWordAtDocPosnot being a function. The changes aim to ensure that thegetWordAtDocPosfunction, which is now provided by theRichTextInputcomponent, is correctly referenced and called.Changelog Entry
Description
This pull request attempts to fix a
TypeError(ue.getWordAtDocPos is not a function) that occurs inMessageInput.sveltewhen a production instance of Open WebUI is restarted, and the user remains on the same page without refreshing. The issue is difficult to reproduce in a development environment due to hot-reloading. The changes involve refactoring howgetWordAtDocPosis accessed, ensuring that the function is properly passed and used from theRichTextInputcomponent.Changed
MessageInput.svelte:chatInputElementType?.getWordAtDocPos()togetWordAtDocPosFromRichText(), to properly access the function provided byRichTextInput.getWordAtDocPosFromRichTextvariable initialized to an empty string, which will be updated via a callback fromRichTextInput.RichTextInputcomponent instantiation to pass a newgetWordAtDocPosCallbackprop.RichTextInput.svelte:getWordAtDocPosCallbackfunction which accepts a function (func) and assigns it togetWordAtDocPosFromRichText.getWordAtDocPosCallbackwith the internalgetWordAtDocPosfunction to provide it to the parent component.Fixed
TypeError: ue.getWordAtDocPos is not a functionby ensuringMessageInput.sveltecorrectly receives and uses thegetWordAtDocPosfunction fromRichTextInput.sveltevia a callback mechanism.Additional Information
getWordAtDocPosCallback) to pass thegetWordAtDocPosfunction fromRichTextInput(the component that knows how to get the word at the document position) up toMessageInput, which needs to call it. This avoids direct reliance on thechatInputElementTypewhich seemed to lose its methods after a restart.Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.