Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
fix: convos correctly delete
Danny Avilaf2b092545fca
diff --git a/api/app/bingai.js b/api/app/bingai.jsindex a1af8ad7e0..e33278b9a2 100644--- a/api/app/bingai.js+++ b/api/app/bingai.js@@ -10,7 +10,7 @@ const askBing = async ({ text, progressCallback, convo }) => {// If the above doesn't work, provide all your cookies as a string instead// cookies: '',debug: false,- store: new KeyvFile({ filename: './api/data/cache.json' })+ store: new KeyvFile({ filename: './data/cache.json' })});let options = {diff --git a/api/app/chatgpt-browser.js b/api/app/chatgpt-browser.jsindex 09f0ca41ed..c6debc0d91 100644--- a/api/app/chatgpt-browser.js+++ b/api/app/chatgpt-browser.js@@ -12,7 +12,7 @@ const browserClient = async ({ text, progressCallback, convo }) => {const { ChatGPTBrowserClient } = await import('@waylaidwanderer/chatgpt-api');const store = {- store: new KeyvFile({ filename: './api/data/cache.json' })+ store: new KeyvFile({ filename: './data/cache.json' })};const client = new ChatGPTBrowserClient(clientOptions, store);diff --git a/api/app/chatgpt-client.js b/api/app/chatgpt-client.jsindex 95991de367..ce3c0e2271 100644--- a/api/app/chatgpt-client.js+++ b/api/app/chatgpt-client.js@@ -11,7 +11,7 @@ const clientOptions = {const askClient = async ({ text, progressCallback, convo }) => {const ChatGPTClient = (await import('@waylaidwanderer/chatgpt-api')).default;const store = {- store: new KeyvFile({ filename: './api/data/cache.json' })+ store: new KeyvFile({ filename: './data/cache.json' })};const client = new ChatGPTClient(process.env.OPENAI_KEY, clientOptions, store);diff --git a/api/app/chatgpt-custom.js b/api/app/chatgpt-custom.jsindex 55b900eae5..d31901c75f 100644--- a/api/app/chatgpt-custom.js+++ b/api/app/chatgpt-custom.js@@ -11,7 +11,7 @@ const clientOptions = {const customClient = async ({ text, progressCallback, convo, promptPrefix, chatGptLabel }) => {const ChatGPTClient = (await import('@waylaidwanderer/chatgpt-api')).default;const store = {- store: new KeyvFile({ filename: './api/data/cache.json' })+ store: new KeyvFile({ filename: './data/cache.json' })};clientOptions.chatGptLabel = chatGptLabel;diff --git a/client/src/components/Conversations/Conversation.jsx b/client/src/components/Conversations/Conversation.jsxindex fae8b4cec8..a887867c8b 100644--- a/client/src/components/Conversations/Conversation.jsx+++ b/client/src/components/Conversations/Conversation.jsx@@ -16,7 +16,7 @@ export default function Conversation({title = 'New conversation',bingData,chatGptLabel = null,- promptPrefix = null+ promptPrefix = null,}) {const [renaming, setRenaming] = useState(false);const [titleInput, setTitleInput] = useState(title);@@ -97,7 +97,7 @@ export default function Conversation({rename.trigger({ conversationId, title: titleInput });};- const handleKeyPress = (e) => {+ const handleKeyDown = (e) => {if (e.key === 'Enter') {onRename(e);}@@ -128,7 +128,7 @@ export default function Conversation({value={titleInput}onChange={(e) => setTitleInput(e.target.value)}onBlur={onRename}- onKeyPress={handleKeyPress}+ onKeyDown={handleKeyDown}/>) : (titleInputdiff --git a/client/src/components/Conversations/DeleteButton.jsx b/client/src/components/Conversations/DeleteButton.jsxindex 560ab1d88e..6dff5682fe 100644--- a/client/src/components/Conversations/DeleteButton.jsx+++ b/client/src/components/Conversations/DeleteButton.jsx@@ -3,7 +3,7 @@ import TrashIcon from '../svg/TrashIcon';import CrossIcon from '../svg/CrossIcon';import manualSWR from '~/utils/fetchers';import { useDispatch } from 'react-redux';-import { setConversation } from '~/store/convoSlice';+import { setConversation, removeConvo } from '~/store/convoSlice';import { setMessages } from '~/store/messageSlice';export default function DeleteButton({ conversationId, renaming, cancelHandler }) {@@ -13,6 +13,7 @@ export default function DeleteButton({ conversationId, renaming, cancelHandler }'post',() => {dispatch(setMessages([]));+ dispatch(removeConvo(conversationId));dispatch(setConversation({ title: 'New chat', conversationId: null, parentMessageId: null }));});diff --git a/client/src/components/Nav/index.jsx b/client/src/components/Nav/index.jsxindex 27c6622e3c..2ae96d22cc 100644--- a/client/src/components/Nav/index.jsx+++ b/client/src/components/Nav/index.jsx@@ -17,17 +17,20 @@ export default function Nav() {};const { data, isLoading, mutate } = swr(- `http://localhost:3080/api/convos?pageNumber=${pageNumber}`- , onSuccess);+ `http://localhost:3080/api/convos?pageNumber=${pageNumber}`,+ onSuccess+ );const containerRef = useRef(null);const scrollPositionRef = useRef(null);- const showMore = async () => {- const container = containerRef.current;- if (container) {- scrollPositionRef.current = container.scrollTop;+ const showMore = async (increment = true) => {+ if (increment) {+ const container = containerRef.current;+ if (container) {+ scrollPositionRef.current = container.scrollTop;+ }+ dispatch(incrementPage());}- dispatch(incrementPage());await mutate();};@@ -44,9 +47,10 @@ export default function Nav() {}}, [data]);- const containerClasses = isLoading && pageNumber === 1- ? 'flex flex-col gap-2 text-gray-100 text-sm h-full justify-center items-center'- : 'flex flex-col gap-2 text-gray-100 text-sm';+ const containerClasses =+ isLoading && pageNumber === 1+ ? 'flex flex-col gap-2 text-gray-100 text-sm h-full justify-center items-center'+ : 'flex flex-col gap-2 text-gray-100 text-sm';return (<div className="dark hidden bg-gray-900 md:fixed md:inset-y-0 md:flex md:w-[260px] md:flex-col">diff --git a/client/src/store/convoSlice.js b/client/src/store/convoSlice.jsindex 167f712d07..98a8c09c70 100644--- a/client/src/store/convoSlice.js+++ b/client/src/store/convoSlice.js@@ -35,10 +35,14 @@ const currentSlice = createSlice({state.convos = [...state.convos, ...newConvos].sort((a, b) => new Date(b.created) - new Date(a.created));+ },+ removeConvo: (state, action) => {+ state.convos = state.convos.filter((convo) => convo.conversationId !== action.payload);}}});-export const { setConversation, setConvos, setError, incrementPage } = currentSlice.actions;+export const { setConversation, setConvos, setError, incrementPage, removeConvo } =+ currentSlice.actions;export default currentSlice.reducer;