Skip to content

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

fix: reset submission when convo clears

Daniel Avilaf1aabfa543ad
diff --git a/client/src/components/Conversations/Conversation.jsx b/client/src/components/Conversations/Conversation.jsx
index 735c2f74e8..62b7b2bee0 100644
--- a/client/src/components/Conversations/Conversation.jsx
+++ b/client/src/components/Conversations/Conversation.jsx
@@ -35,7 +35,6 @@ export default function Conversation({
if (!stopStream) {
dispatch(setStopStream(true));
dispatch(setSubmission({}));
- dispatch(setSubmitState(false));
}
dispatch(setEmptyMessage());
diff --git a/client/src/components/Conversations/DeleteButton.jsx b/client/src/components/Conversations/DeleteButton.jsx
index 9b8e688cd0..00a0c68066 100644
--- a/client/src/components/Conversations/DeleteButton.jsx
+++ b/client/src/components/Conversations/DeleteButton.jsx
@@ -5,6 +5,7 @@ import manualSWR from '~/utils/fetchers';
import { useDispatch } from 'react-redux';
import { setNewConvo, removeConvo } from '~/store/convoSlice';
import { setMessages } from '~/store/messageSlice';
+import { setSubmission } from '~/store/submitSlice';
export default function DeleteButton({ conversationId, renaming, cancelHandler }) {
const dispatch = useDispatch();
@@ -15,6 +16,7 @@ export default function DeleteButton({ conversationId, renaming, cancelHandler }
dispatch(setMessages([]));
dispatch(removeConvo(conversationId));
dispatch(setNewConvo());
+ dispatch(setSubmission({}));
}
);
diff --git a/client/src/components/Models/ModelDialog.jsx b/client/src/components/Models/ModelDialog.jsx
index a1b05dfcdd..18e8241d4f 100644
--- a/client/src/components/Models/ModelDialog.jsx
+++ b/client/src/components/Models/ModelDialog.jsx
@@ -1,7 +1,7 @@
import React, { useState, useRef } from 'react';
import TextareaAutosize from 'react-textarea-autosize';
import { useSelector, useDispatch } from 'react-redux';
-import { setModel, setCustomGpt } from '~/store/submitSlice';
+import { setSubmission, setModel, setCustomGpt } from '~/store/submitSlice';
import { setNewConvo } from '~/store/convoSlice';
import manualSWR from '~/utils/fetchers';
import { Button } from '../ui/Button.tsx';
@@ -39,6 +39,7 @@ export default function ModelDialog({ mutate, setModelSave, handleSaveState }) {
handleSaveState(chatGptLabel.toLowerCase());
// Set new conversation
dispatch(setNewConvo());
+ dispatch(setSubmission({}));
};
const saveHandler = (e) => {
diff --git a/client/src/components/Models/ModelMenu.jsx b/client/src/components/Models/ModelMenu.jsx
index 94e9dd5c86..1ffc82c34b 100644
--- a/client/src/components/Models/ModelMenu.jsx
+++ b/client/src/components/Models/ModelMenu.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
-import { setModel, setDisabled, setCustomGpt, setCustomModel } from '~/store/submitSlice';
+import { setSubmission, setModel, setDisabled, setCustomGpt, setCustomModel } from '~/store/submitSlice';
import { setNewConvo } from '~/store/convoSlice';
import ModelDialog from './ModelDialog';
import MenuItems from './MenuItems';
@@ -77,6 +77,7 @@ export default function ModelMenu() {
// Set new conversation
dispatch(setNewConvo());
+ dispatch(setSubmission({}));
};
const onOpenChange = (open) => {
diff --git a/client/src/components/Nav/ClearConvos.jsx b/client/src/components/Nav/ClearConvos.jsx
index e6402b0c40..9df2e9344e 100644
--- a/client/src/components/Nav/ClearConvos.jsx
+++ b/client/src/components/Nav/ClearConvos.jsx
@@ -13,6 +13,7 @@ export default function ClearConvos() {
const { trigger } = manualSWR(`/api/convos/clear`, 'post', () => {
dispatch(setMessages([]));
dispatch(setNewConvo());
+ dispatch(setSubmission({}));
mutate(`/api/convos`);
});
diff --git a/client/src/components/Nav/MobileNav.jsx b/client/src/components/Nav/MobileNav.jsx
index 502850a80e..2a5123560d 100644
--- a/client/src/components/Nav/MobileNav.jsx
+++ b/client/src/components/Nav/MobileNav.jsx
@@ -18,6 +18,7 @@ export default function MobileNav({ setNavVisible }) {
dispatch(setText(''));
dispatch(setMessages([]));
dispatch(setNewConvo());
+ dispatch(setSubmission({}));
}
const title = convos?.find(element => element?.conversationId == conversationId)?.title || 'New Chat';
diff --git a/client/src/components/Nav/NewChat.jsx b/client/src/components/Nav/NewChat.jsx
index 540c023647..90fb88b869 100644
--- a/client/src/components/Nav/NewChat.jsx
+++ b/client/src/components/Nav/NewChat.jsx
@@ -2,6 +2,7 @@ import React from 'react';
import { useDispatch } from 'react-redux';
import { setNewConvo } from '~/store/convoSlice';
import { setMessages } from '~/store/messageSlice';
+import { setSubmission } from '~/store/submitSlice';
import { setText } from '~/store/textSlice';
export default function NewChat() {
@@ -11,6 +12,7 @@ export default function NewChat() {
dispatch(setText(''));
dispatch(setMessages([]));
dispatch(setNewConvo());
+ dispatch(setSubmission({}));
};
return (
diff --git a/client/src/store/submitSlice.js b/client/src/store/submitSlice.js
index 2a59f72e90..a1b4afee34 100644
--- a/client/src/store/submitSlice.js
+++ b/client/src/store/submitSlice.js
@@ -20,6 +20,9 @@ const currentSlice = createSlice({
},
setSubmission: (state, action) => {
state.submission = action.payload;
+ if (Object.keys(action.payload).length === 0) {
+ state.isSubmitting = false;
+ }
},
setStopStream: (state, action) => {
state.stopStream = action.payload;