[PR #12410] [CLOSED] feat: Chats page overhaul + Add Import/Export Chats (.zip) #9703

Closed
opened 2025-11-11 18:29:20 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/12410
Author: @silentoplayz
Created: 4/3/2025
Status: Closed

Base: devHead: export-chats-as-zip


📝 Commits (6)

📊 Changes

5 files changed (+740 additions, -175 deletions)

View changed files

📝 package-lock.json (+45 -12)
📝 package.json (+1 -0)
📝 pyproject.toml (+1 -0)
📝 src/lib/components/chat/Settings/Chats.svelte (+674 -163)
📝 src/lib/components/layout/Sidebar.svelte (+19 -0)

📄 Description

Pull Request Checklist

  • 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: The prefix "feat" was used to categorize this pull request.

Changelog Entry

Description

I WILL FILL THIS OUT BETTER SOON!

  • Import/Export Chats as .zip functionality added.

Added

  • Feature to import and export chats as .zip files.
  • New dependency: jszip==10.8.2, for .zip file handling.
  • Functionality to import single .json files from exported & extracted chats .zip file
  • Better toast notifications (okay, not really streamlined, but I blame the LLMs I was working with and my non-coding skills to standardize how they act, look, and appear.

Changes

Changelog for Sidebar.svelte:

  • Added validation and type-checking for items parameter:

    • Added a check to ensure items is not null or undefined.
    • Added a check to verify items is iterable.
    • Added handling for cases where items is a single object instead of an array, converting it to an array.
    • Added a check to log an error if items is not iterable after the previous transformations.
  • Refactored importChatHandler function:

    • Added a new log entry to print items before processing.
    • Updated the loop to process each item in items.
    • Added a new condition to handle cases where the chat object is the item itself (not nested in .chat).

The importChatHandler function now ensures that items is valid and iterable before processing, and it handles both arrays of items and single item objects.

Deprecated

  • [List any deprecated functionality or features that have been removed]

Removed

  • [List any removed features, files, or functionalities]

Fixed

  • [List any fixes, corrections, or bug fixes]

Security

  • [List any new or updated security-related changes, including vulnerability fixes]

Breaking Changes

  • BREAKING CHANGE: [List any breaking changes affecting compatibility or functionality]

Additional Information

  • [Insert any additional context, notes, or explanations for the changes]
    • [Reference any related issues, commits, or other relevant information]

Screenshots or Videos

Before:

image

After:

image

The toast notifications have mostly been streamlined/standardized with an overhaul in the major refac commit of this PR!

Import Chats (.json):

  • Successful import of a single .json chat file that came from an exported .zip file (after the fact that the .zip file has been extracted and you are importing a chat from the Chats folder contained within the .zip):
    image

  • Successful import of a .json file export of all chats:
    image

  • after waiting for it to finish:
    image

  • Failed attempt of importing an already exported .zip file for chats without using the Import Chats (.zip) option and instead having tried to use Import Chats (.json) option:
    image

Import Chats (.zip):

  • Successful import of a .zip file of chats from an exported .zip file:
    image

  • after waiting for it to finish:
    image

  • Failed attempt at importing a .json file export of all chats without using the Import Chats (.json) option, but the Import Chats as .zip option instead:
    image

Export Chats (.json):

  • Successful attempt at exporting a .json file of all chats as .json:
    image
  • Followed by:
    image

Export Chats (.zip):

  • Successful attempt at exporting a .zip file of all chats:
    image
  • Followed by:
    image
  • Followed by:
    image
  • Lastly:
    image

Bonus Notifications Added

Both Export Chats (.json) and Export Chats (.zip) options will fail with a toast notification displayed if there are no chats present to be exported:

image

The same logic also applies for trying to archive/delete chats when none exist.

image

You're now displayed a toast notification upon successfully archiving and deleting chats and their count.

image
image

Dynamic messages for import options

image
image

Chat options gray out if exporting chats

image
image

image


🔄 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/12410 **Author:** [@silentoplayz](https://github.com/silentoplayz) **Created:** 4/3/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `export-chats-as-zip` --- ### 📝 Commits (6) - [`37bea93`](https://github.com/open-webui/open-webui/commit/37bea93da39a78b59699a61dba2fcee317605146) push - [`b056e67`](https://github.com/open-webui/open-webui/commit/b056e67bd97b214fb7ed7f7f72975fe99a5022da) chore: format - [`693f2ef`](https://github.com/open-webui/open-webui/commit/693f2ef63dd3db158f91949a5c499bca3fef31c8) refac: huge refactor (hopefully for the better) - [`e8d6898`](https://github.com/open-webui/open-webui/commit/e8d68989b41bd6fd27713b7c3b62af3e04756045) chore: remove comments - [`debbe91`](https://github.com/open-webui/open-webui/commit/debbe9118d30a923c48ddd51b8b644050ef3e829) chore: format again - [`98ebeaf`](https://github.com/open-webui/open-webui/commit/98ebeafd804ad79463c85f34dcddfbc593923229) headers added ### 📊 Changes **5 files changed** (+740 additions, -175 deletions) <details> <summary>View changed files</summary> 📝 `package-lock.json` (+45 -12) 📝 `package.json` (+1 -0) 📝 `pyproject.toml` (+1 -0) 📝 `src/lib/components/chat/Settings/Chats.svelte` (+674 -163) 📝 `src/lib/components/layout/Sidebar.svelte` (+19 -0) </details> ### 📄 Description # Pull Request Checklist - [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 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:** The prefix "feat" was used to categorize this pull request. # Changelog Entry ### Description **I WILL FILL THIS OUT BETTER SOON!** - Import/Export Chats as .zip functionality added. ### Added - Feature to import and export chats as .zip files. - New dependency: `jszip==10.8.2`, for .zip file handling. - Functionality to import single .json files from exported & extracted chats .zip file - Better toast notifications (okay, not really streamlined, but I blame the LLMs I was working with and my non-coding skills to standardize how they act, look, and appear. ### Changes ### Changelog for `Sidebar.svelte`: - **Added validation and type-checking for `items` parameter**: - Added a check to ensure `items` is not null or undefined. - Added a check to verify `items` is iterable. - Added handling for cases where `items` is a single object instead of an array, converting it to an array. - Added a check to log an error if `items` is not iterable after the previous transformations. - **Refactored `importChatHandler` function**: - Added a new log entry to print `items` before processing. - Updated the loop to process each item in `items`. - Added a new condition to handle cases where the chat object is the item itself (not nested in `.chat`). The `importChatHandler` function now ensures that `items` is valid and iterable before processing, and it handles both arrays of items and single item objects. ### Deprecated - [List any deprecated functionality or features that have been removed] ### Removed - [List any removed features, files, or functionalities] ### Fixed - [List any fixes, corrections, or bug fixes] ### Security - [List any new or updated security-related changes, including vulnerability fixes] ### Breaking Changes - **BREAKING CHANGE**: [List any breaking changes affecting compatibility or functionality] --- ### Additional Information - [Insert any additional context, notes, or explanations for the changes] - [Reference any related issues, commits, or other relevant information] ### Screenshots or Videos # `Before:` ![image](https://github.com/user-attachments/assets/425c5683-ab62-455b-9dc4-b88abbd368af) # `After:` ![image](https://github.com/user-attachments/assets/422c3f64-73dd-4c5a-ac5c-4f54b6947d76) # The toast notifications have *mostly* been streamlined/standardized with an overhaul in the [major refac commit](https://github.com/open-webui/open-webui/pull/12410/commits/693f2ef63dd3db158f91949a5c499bca3fef31c8) of this PR! ## `Import Chats (.json)`: - **Successful import of a single .json chat file that came from an exported .zip file (after the fact that the .zip file has been extracted and you are importing a chat from the `Chats` folder contained within the .zip):** ![image](https://github.com/user-attachments/assets/16634ca8-2589-4689-a381-aa6c678240ac) - **Successful import of a .json file export of all chats:** ![image](https://github.com/user-attachments/assets/9a61148d-d0ad-4b79-a4bb-5d98bd58923c) - **after waiting for it to finish:** ![image](https://github.com/user-attachments/assets/267f578d-1ab6-4c2b-bc26-a9470477c596) - **Failed attempt of importing an already exported .zip file for chats without using the `Import Chats (.zip)` option and instead having tried to use `Import Chats (.json)` option:** ![image](https://github.com/user-attachments/assets/6d525198-5e68-427e-8028-b1d3c114b238) ## `Import Chats (.zip)`: - **Successful import of a .zip file of chats from an exported .zip file:** ![image](https://github.com/user-attachments/assets/e6ad4f5a-81a3-4005-afb4-2eedbbf35e54) - **after waiting for it to finish:** ![image](https://github.com/user-attachments/assets/5ca57d49-3080-4153-b5cf-0b4d6125729f) - **Failed attempt at importing a .json file export of all chats without using the `Import Chats (.json)` option, but the `Import Chats as .zip` option instead:** ![image](https://github.com/user-attachments/assets/2f5e8d34-5d4d-4dea-85f9-0fe3fde39fe5) # `Export Chats (.json)`: - **Successful attempt at exporting a .json file of all chats as .json:** ![image](https://github.com/user-attachments/assets/e2c55a98-574e-4397-a84b-7cd55d084e41) - Followed by: ![image](https://github.com/user-attachments/assets/998c8009-d62d-4c4c-9cb2-e50c4912101c) ## `Export Chats (.zip)`: - **Successful attempt at exporting a .zip file of all chats:** ![image](https://github.com/user-attachments/assets/e2c55a98-574e-4397-a84b-7cd55d084e41) - Followed by: ![image](https://github.com/user-attachments/assets/f7a1e04a-e2c5-47e5-891c-fe69e929a780) - Followed by: ![image](https://github.com/user-attachments/assets/34476842-9e8b-40e8-8fe0-4209faeb81d7) - Lastly: ![image](https://github.com/user-attachments/assets/f57ba4ed-e754-4614-b40b-103dec277be3) # Bonus Notifications Added ## Both `Export Chats (.json)` and `Export Chats (.zip)` options will fail with a toast notification displayed if there are no chats present to be exported: ![image](https://github.com/user-attachments/assets/165f1bc1-8d94-4595-89a9-7a475417e35e) ## The same logic also applies for trying to archive/delete chats when none exist. ![image](https://github.com/user-attachments/assets/c3b1182b-f789-469a-8bdc-1186efa212d4) ## You're now displayed a toast notification upon successfully archiving and deleting chats and their count. ![image](https://github.com/user-attachments/assets/eef527d3-c7d0-4468-bffc-c1a13a5665a1) ![image](https://github.com/user-attachments/assets/48bbca29-4404-42db-93ce-27c521a2384f) ## Dynamic messages for import options ![image](https://github.com/user-attachments/assets/bd622b76-c748-46a7-b8ab-99f823398227) ![image](https://github.com/user-attachments/assets/b3988e18-7091-4fea-9c7a-7a32ed842f0d) ## Chat options gray out if exporting chats ![image](https://github.com/user-attachments/assets/8cdad6ad-1d7e-4902-8704-39979218d48d) ![image](https://github.com/user-attachments/assets/d45ca805-24a3-4c48-b10b-23eb13fe563e) ![image](https://github.com/user-attachments/assets/43425fef-e156-47ad-be91-21af040f97ea) --- <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:29:20 -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#9703