mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-09 22:33:29 +00:00
fix: handle ChatGPT exports containing folder/project metadata entries
ChatGPT exports now include folder and project metadata entries in conversations.json that lack a 'mapping' key. When such an entry appeared first in the array, getImportOrigin() misidentified the export as 'webui' format, causing convertOpenAIChats() to never run and resulting in "Imported 0 Chats". - getImportOrigin: check if any item has 'mapping', not just _chats[0] - convertOpenAIChats: skip entries without 'mapping' before conversion Fixes #23505
This commit is contained in:
parent
cb0fd6ed41
commit
d26050081c
1 changed files with 8 additions and 1 deletions
|
|
@ -677,7 +677,9 @@ export const calculateSHA256 = async (file) => {
|
|||
|
||||
export const getImportOrigin = (_chats) => {
|
||||
// Check what external service chat imports are from
|
||||
if ('mapping' in _chats[0]) {
|
||||
// ChatGPT exports may include folder/project entries without 'mapping',
|
||||
// so check all items rather than only _chats[0].
|
||||
if (_chats.some((chat) => chat != null && typeof chat === 'object' && 'mapping' in chat)) {
|
||||
return 'openai';
|
||||
}
|
||||
return 'webui';
|
||||
|
|
@ -800,6 +802,11 @@ export const convertOpenAIChats = (_chats) => {
|
|||
const chats = [];
|
||||
let failed = 0;
|
||||
for (const convo of _chats) {
|
||||
// Skip non-conversation entries (e.g. folder/project metadata)
|
||||
if (!convo['mapping']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const chat = convertOpenAIMessages(convo);
|
||||
|
||||
if (validateChat(chat)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue