create chatStore if not equal params

This commit is contained in:
2023-03-27 13:42:53 +08:00
parent e791367d2d
commit 26a66d112b

View File

@@ -111,11 +111,17 @@ export function App() {
// if there are any params in URL, create a new chatStore
useEffect(() => {
const api = getDefaultParams("api", "");
const key = getDefaultParams("key", "");
const sys = getDefaultParams("sys", "");
const mode = getDefaultParams("mode", "");
// only create new chatStore if the params in URL are NOT
// equal to the current selected chatStore
if (
getDefaultParams("api", "") ||
getDefaultParams("key", "") ||
getDefaultParams("mode", "") ||
getDefaultParams("sys", "")
(api && api !== chatStore.apiEndpoint) ||
(key && key !== chatStore.apiKey) ||
(sys && sys !== chatStore.systemMessageContent) ||
(mode && mode !== (chatStore.streamMode ? "stream" : "fetch"))
) {
handleNewChatStore();
}