prevent undefined on new models

This commit is contained in:
2023-03-31 15:00:57 +08:00
parent 464e417537
commit 11d9b09e36
2 changed files with 7 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ const newChatStore = (
postBeginIndex: 0,
tokenMargin: 1024,
totalTokens: 0,
maxTokens: models[getDefaultParams("model", model)].maxToken,
maxTokens: models[getDefaultParams("model", model)]?.maxToken ?? 4096,
apiKey: getDefaultParams("key", apiKey),
apiEndpoint: getDefaultParams("api", apiEndpoint),
streamMode: getDefaultParams("mode", streamMode),