mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-25 13:22:59 -05:00
[PR #24649] feat: auto-fill name, id, and description for tools and functions from frontmatter #115066
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24649
Author: @silentoplayz
Created: 5/13/2026
Status: 🔄 Open
Base:
dev← Head:feat/autofill-tool-function-metadata📝 Commits (1)
282a943feat(ui): auto-fill name, id, and description for tools and functions from frontmatter📊 Changes
2 files changed (+63 additions, -4 deletions)
View changed files
📝
src/lib/components/admin/Functions/FunctionEditor.svelte(+31 -2)📝
src/lib/components/workspace/Tools/ToolkitEditor.svelte(+32 -2)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.dev, and contains no unrelated commits.Changelog Entry
Description
Problem: When creating a new Tool or Function in Open WebUI, users must manually type the Name, ID, and Description fields even when the pasted code already contains this metadata in its frontmatter header. This is inconsistent with the Skill editor, which already auto-fills these fields from the skill's YAML frontmatter when code is pasted.
Solution: This PR extends the same auto-fill behavior to the Tool and Function editors. When a user pastes (or types) Python code containing a valid
"""triple-quote frontmatter block into a new Tool or Function, thetitle:anddescription:fields are automatically extracted and used to populate:title:frontmatter keytitle:frontmatter key using the existingnameToId()utilitydescription:frontmatter keyThis reuses the existing
extractFrontmatter()utility from$lib/utils(the same function already used by theImportModaland the create/edit page wrappers for version checking), so no new utilities or dependencies are introduced.Key design decisions:
on:inputhandlers. Once a field is manually edited, the frontmatter auto-fill stops overwriting it — giving the user full control.handleContentChangefunction is only invoked from the CodeEditor'sonChangecallback (user-initiated edits), not from the initial prop-based content assignment, so cloning a Tool or Function does not trigger unwanted auto-fill overwrites.SkillEditor.svelteimplementation (which usesparseFrontmatter()for---YAML headers), adapted for the Python"""triple-quote format that Tools and Functions use.Added
src/lib/components/workspace/Tools/ToolkitEditor.svelte) from Python triple-quote frontmatter when creating a new Tool.src/lib/components/admin/Functions/FunctionEditor.svelte) from Python triple-quote frontmatter when creating a new Function.hasManualName,hasManualId,hasManualDescriptionflags) on all three input fields in both editors to prevent auto-fill from overwriting user edits.Changed
nameToIdderivation in both editors is now additionally guarded by!isFrontmatterDetectedto prevent the name-based ID from fighting with the frontmatter-derived ID.ToolkitEditor.sveltewas consolidated to import bothextractFrontmatterandnameToIdfrom$lib/utilsin a single import.Additional Information
extractFrontmatter()andnameToId()utilities already present in$lib/utils/index.ts."""), e.g.:Screenshots or Videos
Screencast from 2026-05-13 03-49-25.webm
Manual Verification Performed
"""frontmatter containingtitle:anddescription:keys. Verify the Name, ID, and Description fields auto-populate."""frontmatter. Verify the same auto-population behavior."""frontmatter block. Verify the fields remain empty and the fallbacknameToIdderivation from the Name field still works as before.Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.