diff --git a/client/components/Application/Dialogs/Assistant/Assistant.store.ts b/client/components/Application/Dialogs/Assistant/Assistant.store.ts index 2b93b127..c47fa211 100644 --- a/client/components/Application/Dialogs/Assistant/Assistant.store.ts +++ b/client/components/Application/Dialogs/Assistant/Assistant.store.ts @@ -35,7 +35,6 @@ export const { state, useState, resetState } = helpers.createState( export function closeDialog() { if (!state.progress?.blocking) { appStore.closeDialog() - resetState() } } diff --git a/client/components/Application/Dialogs/Assistant/Assistant.tsx b/client/components/Application/Dialogs/Assistant/Assistant.tsx index 7a7d7ff8..61765110 100644 --- a/client/components/Application/Dialogs/Assistant/Assistant.tsx +++ b/client/components/Application/Dialogs/Assistant/Assistant.tsx @@ -1,4 +1,5 @@ import TwoButtonDialog from '@client/components/Parts/Dialogs/TwoButton' +import * as appStore from '@client/store' import AutoFixHighIcon from '@mui/icons-material/AutoFixHigh' import Box from '@mui/material/Box' import LinearProgress from '@mui/material/LinearProgress' @@ -18,6 +19,11 @@ and provide descriptions for each of them export function AssistantDialog() { const state = store.useState() + const dialog = appStore.useStore((state) => state.dialog) + + React.useEffect(() => { + store.resetState() + }, [dialog]) switch (state.step) { case 'terms': @@ -61,6 +67,7 @@ function CredsStepDialog() { Please enter your OpenAI API key: Please enter your prompt to the AI assistant: state.dialog) + + React.useEffect(() => { + store.resetState() + }, [dialog]) return ( - + - + @@ -191,6 +197,7 @@ function AddRemoteTextField(props: { = maxAttempts) { - const serverUrl = client.serverUrl + const serverUrl = settings.SERVER_URL const message = `Client cannot connect to server on "${serverUrl}"` sendFatalError ? sendFatalError(message) : alert(message) }