[PR #498] [MERGED] Feat: Add ChatGPT import functionality #107664

Closed
opened 2026-05-18 06:34:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/498
Author: @bhulston
Created: 1/17/2024
Status: Merged
Merged: 1/17/2024
Merged by: @tjbck

Base: mainHead: fix/chat-imports


📝 Commits (6)

  • 27d5eb4 Add chatGPT chat history Import functionality
  • 415777e Add error catching for import
  • 81bfb97 Make sure model is saved in DB for imported chats (or chats with no model saved already)
  • 1f66bbb Better solution to handle edge cases
  • f40147c refac: gpt renamed to openai
  • b6ab357 fix: more edge cases

📊 Changes

4 files changed (+110 additions, -21 deletions)

View changed files

📝 backend/apps/web/routers/chats.py (+22 -18)
📝 src/lib/components/chat/SettingsModal.svelte (+8 -1)
📝 src/lib/utils/index.ts (+71 -0)
📝 src/routes/(app)/c/[id]/+page.svelte (+9 -2)

📄 Description

For this issue: https://github.com/ollama-webui/ollama-webui/issues/337

Enable imports of ChatGPT histories (conversations.json), and ability to choose a new model upon import.

  1. Added several functions to src/lib/utils/index.ts that are used at import before sending to createNewChat api
    a) Identify if import is a chatGPT one or Ollama-webui one (as they are very different)
    b) Parses and iterates through the chatGPT json to match the ollama-webui chat structure

  2. Make sure new chats work with existing code
    a) Adjusted the "disabled" tag to let you choose what model to use for new chat
    b) Add one more check when message is sent that saves selectedModel when current saved model is different
    - With imported models, messages already exist but no model exists! so need to update. or if you import chats using models that you don't have (i.e. 'gpt-3.5-turbo')

** Note **: When we import from ChatGPT, we don't default to a model so users aren't forced to use chatgpt
Does not import context (i.e. pdf RAG) info from GPT chats.


🔄 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/498 **Author:** [@bhulston](https://github.com/bhulston) **Created:** 1/17/2024 **Status:** ✅ Merged **Merged:** 1/17/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `main` ← **Head:** `fix/chat-imports` --- ### 📝 Commits (6) - [`27d5eb4`](https://github.com/open-webui/open-webui/commit/27d5eb46847f71e0ec15c437c1064b950fca32fe) Add chatGPT chat history Import functionality - [`415777e`](https://github.com/open-webui/open-webui/commit/415777eca2f7fafef84aa7922bfc553cbe8acbe7) Add error catching for import - [`81bfb97`](https://github.com/open-webui/open-webui/commit/81bfb97c91e72a24e74bddc7ec818d98a6f73920) Make sure model is saved in DB for imported chats (or chats with no model saved already) - [`1f66bbb`](https://github.com/open-webui/open-webui/commit/1f66bbba98633133da7b6db82ad50b18feef51d9) Better solution to handle edge cases - [`f40147c`](https://github.com/open-webui/open-webui/commit/f40147ce58e746eb2825e6755cdf9a734a0b3cf4) refac: gpt renamed to openai - [`b6ab357`](https://github.com/open-webui/open-webui/commit/b6ab357e8cb8422b224cf72dfa80c6d3950de7c3) fix: more edge cases ### 📊 Changes **4 files changed** (+110 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `backend/apps/web/routers/chats.py` (+22 -18) 📝 `src/lib/components/chat/SettingsModal.svelte` (+8 -1) 📝 `src/lib/utils/index.ts` (+71 -0) 📝 `src/routes/(app)/c/[id]/+page.svelte` (+9 -2) </details> ### 📄 Description For this issue: https://github.com/ollama-webui/ollama-webui/issues/337 Enable imports of ChatGPT histories (conversations.json), and ability to choose a new model upon import. 1. Added several functions to `src/lib/utils/index.ts` that are used at import before sending to `createNewChat` api a) Identify if import is a chatGPT one or Ollama-webui one (as they are very different) b) Parses and iterates through the chatGPT json to match the ollama-webui chat structure 2. Make sure new chats work with existing code a) Adjusted the "disabled" tag to let you choose what model to use for new chat b) Add one more check when message is sent that saves selectedModel when current saved model is different - With imported models, messages already exist but no model exists! so need to update. or if you import chats using models that you don't have (i.e. 'gpt-3.5-turbo') ** Note **: When we import from ChatGPT, we don't default to a model so users aren't forced to use chatgpt Does not import context (i.e. pdf RAG) info from GPT chats. --- <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-05-18 06:34:09 -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#107664