[PR #15194] [CLOSED] feat: Improve folders to act like ChatGPT "projects" #39380

Closed
opened 2026-04-25 11:59:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/15194
Author: @Classic298
Created: 6/21/2025
Status: Closed

Base: devHead: projects


📝 Commits (10+)

📊 Changes

16 files changed (+486 additions, -175 deletions)

View changed files

backend/open_webui/migrations/versions/e7f8a9b2c5d1_add_system_prompt_to_folder.py (+22 -0)
📝 backend/open_webui/models/chats.py (+2 -0)
📝 backend/open_webui/models/folders.py (+47 -0)
📝 backend/open_webui/routers/folders.py (+16 -16)
📝 backend/open_webui/utils/chat.py (+25 -0)
📝 src/lib/apis/chats/index.ts (+4 -1)
📝 src/lib/apis/folders/index.ts (+6 -4)
📝 src/lib/components/chat/Chat.svelte (+16 -9)
📝 src/lib/components/chat/ChatPlaceholder.svelte (+24 -1)
📝 src/lib/components/chat/Placeholder.svelte (+25 -1)
📝 src/lib/components/layout/Sidebar.svelte (+40 -21)
📝 src/lib/components/layout/Sidebar/Folders.svelte (+65 -2)
src/lib/components/layout/Sidebar/Folders/EditFolderModal.svelte (+139 -0)
📝 src/lib/components/layout/Sidebar/Folders/FolderMenu.svelte (+2 -2)
📝 src/lib/components/layout/Sidebar/RecursiveFolder.svelte (+48 -118)
📝 src/lib/stores/index.ts (+5 -0)

📄 Description

Pull Request Checklist

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 to validate 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 clearly categorize this pull request, prefix the pull request title using one of the following:
    • feat: Introduces a new feature or enhancement to the codebase

Changelog Entry

Description

This pull request introduces a highly requested evolution of the existing folder system, transforming folders into powerful, project-like workspaces. This work is a direct response to a significant number of community discussions and feature requests calling for project-based organization, custom instructions per folder, and more streamlined workflows, similar to features found in OpenAI ChatGPT's projects feature or in Claude's folders where you can also adjust them similarly.

By enhancing folders with dedicated system prompts and improving the user experience for chat creation, this PR addresses the core feedback from a wide range of community discussions. The community has clearly expressed a desire for more structured and contextualized chat management, and this implementation delivers a foundational and robust solution.

Added

  • Folder-Specific System Prompts: Folders can now have a dedicated System Prompt that is automatically prepended to every new chat created within them, enabling customized behavior on a per-folder basis. This system prompt is optional. You can still use folders as just folders.
  • "Edit Folder" Modal: A new modal has been introduced to edit folder properties, allowing users to edit both the folder name and its system prompt from a single, unified interface.
  • Direct Chat Creation in Folders: A new "plus" icon now appears when hovering over a folder in the sidebar, allowing users to create a new chat directly within that folder. This was never possible before. Before you'd have to create a new chat (outside a folder) and then move it into the folder. Now, this annoyance is gone and it's also important that it is gone, since you need to be able to make use of the new system prompt that is stored inside folders.
  • UI Notification Banner: When a folder is selected for direct chat creation, a blue banner appears on the chat screen, notifying the user which folder the next chat will be created in.
  • Database Migration: An Alembic migration has been added to introduce the system_prompt column to the folder table.

Changed

  • Folder Renaming UX: The previous inline folder renaming has been replaced by the more robust "Edit Folder" modal.
  • Default Folder Name: The default name for new folders has been changed from "Untitled" to "📁 Untitled Folder" for better visual distinction.
    Tim: feel free to change this if you like, but during my heavy testing, i found this new name for newly created folders to be visually much better and more clearly differentiated from the rest of the UI and it allowed me to more quickly identify folders in the sidebar.
  • Sidebar State Management: The frontend state management for the sidebar has been refactored to use global Svelte stores (folders, refreshSidebar) for consistent and reactive updates.
  • Folder Update API: The backend endpoint POST /api/folders/{id}/update has been enhanced to accept both name and system_prompt fields.

Deprecated

  • Inline Folder Renaming: The UX pattern of double-clicking a folder to rename it inline has been deprecated in favor of the new "Edit Folder" modal.

Removed

  • The previous backend logic for updating only a folder's name has been removed and consolidated into the more comprehensive update_folder_details_by_id_and_user_id function.

Security

  • System Prompt Permissions: The new "Edit Folder" modal includes a permission check ($user?.role === 'admin' || ($user?.permissions.chat?.system_prompt ?? true)), ensuring that only authorized users can view or edit the system prompt field.

Breaking Changes

  • None.

Additional Information

Community Context & Discussion References

This work is a direct response to extensive community feedback. The core improvements in this PR are directly linked to the following discussions and issues:

  • #12620 - feat: Projects

    • Community Request: Users asked for a "Projects" feature like OpenAI's, suggesting folder enhancements as a viable alternative.
    • This PR's Solution: We implement the core of that "Projects" concept by empowering folders with specific system prompts, turning them into distinct project workspaces.
  • #14299 - enh: folders are like projects

    • Community Request: Users provided detailed mockups and use-cases for enriching folders with custom instructions and a "start conversation in folder" UI button.
    • This PR's Solution: We directly implement both key suggestions: folder-specific system prompts via the "Edit Folder" modal and the new UI for creating chats directly inside folders.
  • #13040 - Implement a "Project" feature

    • Community Request: Users described the need for project-like features to better organize tasks, manage long-term goals, and structure conversations.
    • This PR's Solution: By allowing folders to have unique system prompts, we provide the foundational mechanism to achieve the structured, goal-oriented conversations that users described.
  • #12597 - feat: Projects (Issue)

    • Community Request: This issue formally tracked the need for a project-like feature, with a key comment highlighting the value of project-specific system prompts.
    • This PR's Solution: We directly resolve this issue by adding the highly requested folder-specific system prompt capability, fulfilling the issue's primary goal.
  • #15132 - Feature Request: System Prompt Profiles

    • Community Request: Users requested reusable "System Prompt Profiles" to efficiently manage different contexts for their chats.
    • This PR's Solution: We introduce the first step towards this goal by enabling system prompts to be scoped to a folder, providing the powerful contextual benefit users were seeking. This could serve as a powerful alternative to "System Prompt Profiles" since the Folders could now act as those requested Profiles!
  • #10562 - feat: Enhance Folder Management with "New Chat in Folder" and "Create Subfolder" Options

    • Community Request: "New Chat in Folder: This option would enable users to initiate a new chat directly within a selected folder, eliminating the need for manual drag-and-drop operations."
    • This PR: hits the nail in the head and implements this.
  • https://github.com/open-webui/open-webui/issues/12084

  • This feature request is related to https://github.com/open-webui/open-webui/issues/10562 and also asks for an ability to create new chats directly within a folder.

Technical Notes

A significant part of this effort involved refactoring the sidebar's state management. We moved the folder list from a local component variable into a global Svelte store ($folders). This was essential to fix reactivity bugs and allow components like Chat.svelte to trigger a sidebar refresh via a second global store, $refreshSidebar. This creates a robust, decoupled architecture that is easier to maintain and extend in the future.

Screenshots or Videos

https://github.com/user-attachments/assets/8eef986d-8e51-492f-8a59-fd812a7edb6b

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.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/15194 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 6/21/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `projects` --- ### 📝 Commits (10+) - [`83910e6`](https://github.com/open-webui/open-webui/commit/83910e6fec7118caaa7a36c5f3d91234b1c0c30b) Create e7f8a9b2c5d1_add_system_prompt_to_folder.py - [`9e7735e`](https://github.com/open-webui/open-webui/commit/9e7735e69566a4371bbe207b11f5324c0e8cbf92) Update chats.py - [`92af07a`](https://github.com/open-webui/open-webui/commit/92af07afce6607484d537454006e54e0f1cce4c6) Update folders.py - [`93991b8`](https://github.com/open-webui/open-webui/commit/93991b858a2f367292cf97f9ce23ffe904c19b5a) Update folders.py - [`4cd0119`](https://github.com/open-webui/open-webui/commit/4cd0119fd1f7587e6f04351d5adef255e62bf950) Update chat.py - [`05ffb93`](https://github.com/open-webui/open-webui/commit/05ffb9363f3130832a2bad156aa5f55d683a4b01) Update index.ts - [`e97bd47`](https://github.com/open-webui/open-webui/commit/e97bd4733655d7549f2ac99236d2b3d79de8f110) Update index.ts - [`62ff79d`](https://github.com/open-webui/open-webui/commit/62ff79d350acd96736adc5ea9967d231231b7de2) Update Chat.svelte - [`c6fc09b`](https://github.com/open-webui/open-webui/commit/c6fc09b6c3996e92a1e896f1b190ba816aedff89) Update ChatPlaceholder.svelte - [`8f01f72`](https://github.com/open-webui/open-webui/commit/8f01f72d287fa7e5155782a2bd6bfe493f4185eb) Update Placeholder.svelte ### 📊 Changes **16 files changed** (+486 additions, -175 deletions) <details> <summary>View changed files</summary> ➕ `backend/open_webui/migrations/versions/e7f8a9b2c5d1_add_system_prompt_to_folder.py` (+22 -0) 📝 `backend/open_webui/models/chats.py` (+2 -0) 📝 `backend/open_webui/models/folders.py` (+47 -0) 📝 `backend/open_webui/routers/folders.py` (+16 -16) 📝 `backend/open_webui/utils/chat.py` (+25 -0) 📝 `src/lib/apis/chats/index.ts` (+4 -1) 📝 `src/lib/apis/folders/index.ts` (+6 -4) 📝 `src/lib/components/chat/Chat.svelte` (+16 -9) 📝 `src/lib/components/chat/ChatPlaceholder.svelte` (+24 -1) 📝 `src/lib/components/chat/Placeholder.svelte` (+25 -1) 📝 `src/lib/components/layout/Sidebar.svelte` (+40 -21) 📝 `src/lib/components/layout/Sidebar/Folders.svelte` (+65 -2) ➕ `src/lib/components/layout/Sidebar/Folders/EditFolderModal.svelte` (+139 -0) 📝 `src/lib/components/layout/Sidebar/Folders/FolderMenu.svelte` (+2 -2) 📝 `src/lib/components/layout/Sidebar/RecursiveFolder.svelte` (+48 -118) 📝 `src/lib/stores/index.ts` (+5 -0) </details> ### 📄 Description # Pull Request Checklist **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? - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests to validate 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 clearly categorize this pull request, prefix the pull request title using one of the following: - **feat**: Introduces a new feature or enhancement to the codebase # Changelog Entry ### Description This pull request introduces a **highly requested** evolution of the existing folder system, **transforming folders into powerful, project-like workspaces**. This work is a direct response to a significant number of community discussions and feature requests calling for project-based organization, custom instructions per folder, and more streamlined workflows, similar to features found in OpenAI ChatGPT's projects feature or in Claude's folders where you can also adjust them similarly. **By enhancing folders with dedicated system prompts and improving the user experience for chat creation, this PR addresses the core feedback from a wide range of community discussions**. The community has clearly expressed a desire for more structured and contextualized chat management, and this implementation delivers a foundational and robust solution. ### Added - **Folder-Specific System Prompts:** Folders can now have a dedicated System Prompt that is automatically prepended to every new chat created within them, enabling customized behavior on a per-folder basis. This system prompt is optional. You can still use folders as just folders. - **"Edit Folder" Modal:** A new modal has been introduced to edit folder properties, allowing users to edit both the folder name and its system prompt from a single, unified interface. - **Direct Chat Creation in Folders:** A new "plus" icon now appears when hovering over a folder in the sidebar, allowing users to create a new chat directly within that folder. This was never possible before. Before you'd have to create a new chat (outside a folder) and then move it into the folder. Now, this annoyance is gone and it's also important that it is gone, since you need to be able to make use of the new system prompt that is stored inside folders. - **UI Notification Banner:** When a folder is selected for direct chat creation, a blue banner appears on the chat screen, notifying the user which folder the next chat will be created in. - **Database Migration:** An Alembic migration has been added to introduce the `system_prompt` column to the `folder` table. ### Changed - **Folder Renaming UX:** The previous inline folder renaming has been replaced by the more robust "Edit Folder" modal. - **Default Folder Name:** The default name for new folders has been changed from "Untitled" to "📁 Untitled Folder" for better visual distinction. __**Tim:**__ feel free to change this if you like, but during my heavy testing, i found this new name for newly created folders to be visually much better and more clearly differentiated from the rest of the UI and it allowed me to more quickly identify folders in the sidebar. - **Sidebar State Management:** The frontend state management for the sidebar has been refactored to use global Svelte stores (`folders`, `refreshSidebar`) for consistent and reactive updates. - **Folder Update API:** The backend endpoint `POST /api/folders/{id}/update` has been enhanced to accept both `name` and `system_prompt` fields. ### Deprecated - **Inline Folder Renaming:** The UX pattern of double-clicking a folder to rename it inline has been deprecated in favor of the new "Edit Folder" modal. ### Removed - The previous backend logic for updating only a folder's name has been removed and consolidated into the more comprehensive `update_folder_details_by_id_and_user_id` function. ### Security - **System Prompt Permissions:** The new "Edit Folder" modal includes a permission check (`$user?.role === 'admin' || ($user?.permissions.chat?.system_prompt ?? true)`), ensuring that only authorized users can view or edit the system prompt field. ### Breaking Changes - None. --- ### Additional Information #### Community Context & Discussion References **This work is a direct response to extensive community feedback.** The core improvements in this PR are directly linked to the following discussions and issues: - **[#12620 - feat: Projects](https://github.com/open-webui/open-webui/discussions/12620)** - *Community Request:* Users asked for a "Projects" feature like OpenAI's, suggesting folder enhancements as a viable alternative. - *This PR's Solution:* We implement the core of that "Projects" concept by empowering folders with specific system prompts, turning them into distinct project workspaces. - **[#14299 - enh: folders are like projects](https://github.com/open-webui/open-webui/discussions/14299)** - *Community Request:* Users provided detailed mockups and use-cases for enriching folders with custom instructions and a "start conversation in folder" UI button. - *This PR's Solution:* **We directly implement both key suggestions:** folder-specific system prompts via the "Edit Folder" modal and the new UI for creating chats directly inside folders. - **[#13040 - Implement a "Project" feature](https://github.com/open-webui/open-webui/discussions/13040)** - *Community Request:* Users described the need for project-like features to better organize tasks, manage long-term goals, and structure conversations. - *This PR's Solution:* By allowing folders to have unique system prompts, we provide the foundational mechanism to achieve the structured, goal-oriented conversations that users described. - **[#12597 - feat: Projects (Issue)](https://github.com/open-webui/open-webui/issues/12597)** - *Community Request:* This issue formally tracked the need for a project-like feature, with a key comment highlighting the value of **project-specific system prompts.** - *This PR's Solution:* We directly resolve this issue by adding the highly requested folder-specific system prompt capability, fulfilling the issue's primary goal. - **[#15132 - Feature Request: System Prompt Profiles](https://github.com/open-webui/open-webui/discussions/15132)** - *Community Request:* Users requested reusable "System Prompt Profiles" to efficiently manage different contexts for their chats. - *This PR's Solution:* We introduce the first step towards this goal by enabling **system prompts to be scoped to a folder**, providing the powerful contextual benefit users were seeking. This could serve as a powerful alternative to "System Prompt Profiles" **since the Folders could now act as those requested Profiles!** - **[#10562 - feat: Enhance Folder Management with "New Chat in Folder" and "Create Subfolder" Options](https://github.com/open-webui/open-webui/issues/10562)** - **Community Request:** "New Chat in Folder: This option would enable users to initiate a new chat directly within a selected folder, eliminating the need for manual drag-and-drop operations." - **This PR:** hits the nail in the head and implements this. - https://github.com/open-webui/open-webui/issues/12084 - This feature request is related to https://github.com/open-webui/open-webui/issues/10562 and also asks for an ability to create new chats directly within a folder. #### Technical Notes A significant part of this effort involved refactoring the sidebar's state management. We moved the folder list from a local component variable into a global Svelte store (`$folders`). This was essential to fix reactivity bugs and allow components like `Chat.svelte` to trigger a sidebar refresh via a second global store, `$refreshSidebar`. This creates a robust, decoupled architecture that is easier to maintain and extend in the future. ### Screenshots or Videos https://github.com/user-attachments/assets/8eef986d-8e51-492f-8a59-fd812a7edb6b ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <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 2026-04-25 11:59:15 -05: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#39380