3bc4ec7 fix: handle ChatGPT exports with folder/project entries
📊 Changes
1 file changed (+11 additions, -1 deletions)
View changed files
📝src/lib/utils/index.ts (+11 -1)
📄 Description
Summary
Fixes#23505 — Import of ChatGPT export file results in "Imported 0 Chats".
Root Cause
ChatGPT export files (conversations.json) can include folder and project metadata entries that lack a mapping key. This caused two problems:
getImportOrigin() only checked _chats[0] for the mapping key. If a folder entry appeared first in the array, the export was misidentified as webui format and convertOpenAIChats() was never called — resulting in 0 imports.
convertOpenAIChats() did not skip non-conversation entries, so even when origin detection worked, folder/project entries would fail validation silently.
Changes
src/lib/utils/index.ts — getImportOrigin(): Check if any item in the array has a mapping key, instead of only checking _chats[0].
src/lib/utils/index.ts — convertOpenAIChats(): Skip entries without a mapping key (folders/projects) before attempting conversion, with a console log for visibility.
Testing
Tested with a ChatGPT export containing both folder entries and conversations — all conversations are now correctly imported.
🔄 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/23524
**Author:** [@jjjojoj](https://github.com/jjjojoj)
**Created:** 4/9/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix/23505-chatgpt-import`
---
### 📝 Commits (1)
- [`3bc4ec7`](https://github.com/open-webui/open-webui/commit/3bc4ec7242e1dd66114a5f3ab824bb229743c4dd) fix: handle ChatGPT exports with folder/project entries
### 📊 Changes
**1 file changed** (+11 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/utils/index.ts` (+11 -1)
</details>
### 📄 Description
## Summary
Fixes #23505 — Import of ChatGPT export file results in "Imported 0 Chats".
### Root Cause
ChatGPT export files (`conversations.json`) can include folder and project metadata entries that lack a `mapping` key. This caused two problems:
1. **`getImportOrigin()`** only checked `_chats[0]` for the `mapping` key. If a folder entry appeared first in the array, the export was misidentified as `webui` format and `convertOpenAIChats()` was never called — resulting in 0 imports.
2. **`convertOpenAIChats()`** did not skip non-conversation entries, so even when origin detection worked, folder/project entries would fail validation silently.
### Changes
- **`src/lib/utils/index.ts` — `getImportOrigin()`**: Check if *any* item in the array has a `mapping` key, instead of only checking `_chats[0]`.
- **`src/lib/utils/index.ts` — `convertOpenAIChats()`**: Skip entries without a `mapping` key (folders/projects) before attempting conversion, with a console log for visibility.
### Testing
Tested with a ChatGPT export containing both folder entries and conversations — all conversations are now correctly imported.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23524
Author: @jjjojoj
Created: 4/9/2026
Status: ❌ Closed
Base:
main← Head:fix/23505-chatgpt-import📝 Commits (1)
3bc4ec7fix: handle ChatGPT exports with folder/project entries📊 Changes
1 file changed (+11 additions, -1 deletions)
View changed files
📝
src/lib/utils/index.ts(+11 -1)📄 Description
Summary
Fixes #23505 — Import of ChatGPT export file results in "Imported 0 Chats".
Root Cause
ChatGPT export files (
conversations.json) can include folder and project metadata entries that lack amappingkey. This caused two problems:getImportOrigin()only checked_chats[0]for themappingkey. If a folder entry appeared first in the array, the export was misidentified aswebuiformat andconvertOpenAIChats()was never called — resulting in 0 imports.convertOpenAIChats()did not skip non-conversation entries, so even when origin detection worked, folder/project entries would fail validation silently.Changes
src/lib/utils/index.ts—getImportOrigin(): Check if any item in the array has amappingkey, instead of only checking_chats[0].src/lib/utils/index.ts—convertOpenAIChats(): Skip entries without amappingkey (folders/projects) before attempting conversion, with a console log for visibility.Testing
Tested with a ChatGPT export containing both folder entries and conversations — all conversations are now correctly imported.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.