[PR #6107] [CLOSED] feat: Add ability to pin prompts as reference above prompt field #8617

Closed
opened 2025-11-11 18:01:12 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/6107
Author: @davidsuarezcdo
Created: 10/10/2024
Status: Closed

Base: devHead: feat-chat-prompts-attached


📝 Commits (10+)

  • 4809ee5 feat: add prompt attached feature
  • 09d2f73 chore: formated files
  • 54ad6e7 chore: remove unnecesary console logs
  • 3aa8f4f feat: replace feature by prompt behavior
  • dc46c38 Merge branch 'dev' into feat-chat-prompts-attached
  • 770aed8 chore: remove sticky option
  • b770996 Merge branch 'dev' into feat-chat-prompts-attached
  • 8f87025 chore: update background color
  • 8474f4f Merge branch 'dev' into feat-chat-prompts-attached
  • 850fa5f Merge branch 'dev' into feat-chat-prompts-attached

📊 Changes

12 files changed (+247 additions, -32 deletions)

View changed files

📝 backend/open_webui/apps/webui/models/prompts.py (+6 -1)
backend/open_webui/migrations/versions/12e4b5f95a73_add_prompt_behavior_property.py (+37 -0)
📝 src/lib/apis/prompts/index.ts (+8 -4)
📝 src/lib/components/chat/Chat.svelte (+7 -1)
📝 src/lib/components/chat/MessageInput.svelte (+45 -6)
📝 src/lib/components/chat/MessageInput/Commands.svelte (+9 -1)
📝 src/lib/components/chat/MessageInput/Commands/Prompts.svelte (+14 -4)
📝 src/lib/components/chat/Placeholder.svelte (+3 -1)
src/lib/components/icons/Terminal.svelte (+20 -0)
📝 src/lib/stores/index.ts (+4 -1)
📝 src/routes/(app)/workspace/prompts/create/+page.svelte (+47 -7)
📝 src/routes/(app)/workspace/prompts/edit/+page.svelte (+47 -6)

📄 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:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • This PR introduces a new feature that allows prompts to be "pinned" as a reference above the input field, rather than being directly inserted into the input. This improves user experience by allowing users to select a command prompt and view it as a hint/reference without modifying the input content directly. It also adds a Boolean field attached to manage this behavior in the prompts.

Added

  • Added a new attached property in the Prompt model to indicate whether a prompt should be pinned as a reference instead of inserted directly into the input field.
  • Updated the user interface to display pinned prompts above the input field with a dismiss button.
  • Added the ability to handle pinned prompts in the message submission process without altering the input content directly.
  • Created a new migration to add the attached column to the Prompt table in the database.

Changed

  • Updated the existing createNewPrompt and updatePromptByCommand methods to support the new attached parameter.
  • Modified the Chat.svelte and MessageInput.svelte components to manage and display pinned prompts.
  • Updated the prompt creation and editing forms to include a checkbox for selecting whether a prompt should be pinned as a reference.

Deprecated

Removed

Fixed

Security

Breaking Changes

  • No breaking changes: This PR introduces a new feature but does not affect existing functionality or backward compatibility.

Additional Information ⚠️

  • Work in Progress: This feature is still in progress, and I'm awaiting feedback from the community. I'm open to making any necessary changes based on the input received.
  • This PR is related to the ongoing discussion in Open WebUI Discussions #6029.
  • Feel free to provide feedback or suggestions

Screenshots or Videos

https://github.com/user-attachments/assets/34866b50-1d76-4f32-9a57-9c635dce2108


🔄 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/6107 **Author:** [@davidsuarezcdo](https://github.com/davidsuarezcdo) **Created:** 10/10/2024 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feat-chat-prompts-attached` --- ### 📝 Commits (10+) - [`4809ee5`](https://github.com/open-webui/open-webui/commit/4809ee584adc86e374bb57a1aeb270f52d04868e) feat: add prompt attached feature - [`09d2f73`](https://github.com/open-webui/open-webui/commit/09d2f731c572c1a8eec208b8e5cdd0730b768d3b) chore: formated files - [`54ad6e7`](https://github.com/open-webui/open-webui/commit/54ad6e736a23eff5168c316a15fb3ae7208652e0) chore: remove unnecesary console logs - [`3aa8f4f`](https://github.com/open-webui/open-webui/commit/3aa8f4fcc0a62ad027b28f48c630e10693cb8c93) feat: replace feature by prompt behavior - [`dc46c38`](https://github.com/open-webui/open-webui/commit/dc46c38f56f2052f299a649e98f4889e3b96093a) Merge branch 'dev' into feat-chat-prompts-attached - [`770aed8`](https://github.com/open-webui/open-webui/commit/770aed8f533dd2417e8f43250202e6b2ead0d6bc) chore: remove sticky option - [`b770996`](https://github.com/open-webui/open-webui/commit/b770996884f437f18cd9e7ec51bb08e24fea841c) Merge branch 'dev' into feat-chat-prompts-attached - [`8f87025`](https://github.com/open-webui/open-webui/commit/8f870257b03c737caaf2741fcab963b056f7d054) chore: update background color - [`8474f4f`](https://github.com/open-webui/open-webui/commit/8474f4f990d7f9a831842fcfe64327d720adaa2c) Merge branch 'dev' into feat-chat-prompts-attached - [`850fa5f`](https://github.com/open-webui/open-webui/commit/850fa5f601fb5bdf46ee22ecf41921c122606506) Merge branch 'dev' into feat-chat-prompts-attached ### 📊 Changes **12 files changed** (+247 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/apps/webui/models/prompts.py` (+6 -1) ➕ `backend/open_webui/migrations/versions/12e4b5f95a73_add_prompt_behavior_property.py` (+37 -0) 📝 `src/lib/apis/prompts/index.ts` (+8 -4) 📝 `src/lib/components/chat/Chat.svelte` (+7 -1) 📝 `src/lib/components/chat/MessageInput.svelte` (+45 -6) 📝 `src/lib/components/chat/MessageInput/Commands.svelte` (+9 -1) 📝 `src/lib/components/chat/MessageInput/Commands/Prompts.svelte` (+14 -4) 📝 `src/lib/components/chat/Placeholder.svelte` (+3 -1) ➕ `src/lib/components/icons/Terminal.svelte` (+20 -0) 📝 `src/lib/stores/index.ts` (+4 -1) 📝 `src/routes/(app)/workspace/prompts/create/+page.svelte` (+47 -7) 📝 `src/routes/(app)/workspace/prompts/edit/+page.svelte` (+47 -6) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [x] ~~**Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?~~ - [x] ~~**Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?~~ - [x] **Testing:** Have you written and run sufficient tests for validating the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - This PR introduces a new feature that allows prompts to be "pinned" as a reference above the input field, rather than being directly inserted into the input. This improves user experience by allowing users to select a command prompt and view it as a hint/reference without modifying the input content directly. It also adds a Boolean field attached to manage this behavior in the prompts. ### Added - Added a new attached property in the Prompt model to indicate whether a prompt should be pinned as a reference instead of inserted directly into the input field. - Updated the user interface to display pinned prompts above the input field with a dismiss button. - Added the ability to handle pinned prompts in the message submission process without altering the input content directly. - Created a new migration to add the attached column to the Prompt table in the database. ### Changed - Updated the existing createNewPrompt and updatePromptByCommand methods to support the new attached parameter. - Modified the Chat.svelte and MessageInput.svelte components to manage and display pinned prompts. - Updated the prompt creation and editing forms to include a checkbox for selecting whether a prompt should be pinned as a reference. ### Deprecated - ### Removed - ### Fixed - ### Security - ### Breaking Changes - No breaking changes: This PR introduces a new feature but does not affect existing functionality or backward compatibility. --- ### Additional Information ⚠️ - Work in Progress: This feature is still in progress, and I'm awaiting feedback from the community. I'm open to making any necessary changes based on the input received. - This PR is related to the ongoing discussion in [Open WebUI Discussions #6029](https://github.com/open-webui/open-webui/discussions/6029). - Feel free to provide feedback or suggestions ### Screenshots or Videos https://github.com/user-attachments/assets/34866b50-1d76-4f32-9a57-9c635dce2108 --- <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 2025-11-11 18:01:12 -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#8617