From 0ffb75656315a8e1670076e625f4769c2a3d84bd Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 15 Jan 2024 12:30:06 +0700 Subject: [PATCH] fix: #1559 Inference Parameters displayed on new thread with Openai GPT model (#1588) --- web/containers/DropdownListSidebar/index.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web/containers/DropdownListSidebar/index.tsx b/web/containers/DropdownListSidebar/index.tsx index f8ac92d6f..725e34ca0 100644 --- a/web/containers/DropdownListSidebar/index.tsx +++ b/web/containers/DropdownListSidebar/index.tsx @@ -96,9 +96,16 @@ export default function DropdownListSidebar() { const modelParams: ModelParams = { ...recommendedModel?.parameters, ...recommendedModel?.settings, - // This is to set default value for these settings instead of maximum value - max_tokens: defaultValue(recommendedModel?.parameters.max_tokens), - ctx_len: defaultValue(recommendedModel?.settings.ctx_len), + /** + * This is to set default value for these settings instead of maximum value + * Should only apply when model.json has these settings + */ + ...(recommendedModel?.parameters.max_tokens && { + max_tokens: defaultValue(recommendedModel?.parameters.max_tokens), + }), + ...(recommendedModel?.settings.ctx_len && { + ctx_len: defaultValue(recommendedModel?.settings.ctx_len), + }), } setThreadModelParams(activeThread.id, modelParams) }