create chatStore if not equal params
This commit is contained in:
14
src/app.tsx
14
src/app.tsx
@@ -111,11 +111,17 @@ export function App() {
|
|||||||
|
|
||||||
// if there are any params in URL, create a new chatStore
|
// if there are any params in URL, create a new chatStore
|
||||||
useEffect(() => {
|
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 (
|
if (
|
||||||
getDefaultParams("api", "") ||
|
(api && api !== chatStore.apiEndpoint) ||
|
||||||
getDefaultParams("key", "") ||
|
(key && key !== chatStore.apiKey) ||
|
||||||
getDefaultParams("mode", "") ||
|
(sys && sys !== chatStore.systemMessageContent) ||
|
||||||
getDefaultParams("sys", "")
|
(mode && mode !== (chatStore.streamMode ? "stream" : "fetch"))
|
||||||
) {
|
) {
|
||||||
handleNewChatStore();
|
handleNewChatStore();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user