From e654cee3c8f46ee457b425b19778f28801fd95c8 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Sun, 23 Apr 2023 21:54:18 +0800 Subject: [PATCH] fixup: request params --- app/components/chat.tsx | 5 ++++- app/components/model-config.tsx | 2 +- app/requests.ts | 13 +++++++------ app/store/config.ts | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index a3529527..b38b0835 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -241,7 +241,10 @@ export function SessionConfigModel(props: { onClose: () => void }) { open={showPicker} onClose={() => setShowPicker(false)} > -
setShowPicker(true)}> +
setShowPicker(true)} + style={{ cursor: "pointer" }} + > {session.avatar ? ( ) : ( diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx index 112e6b2e..797bcb37 100644 --- a/app/components/model-config.tsx +++ b/app/components/model-config.tsx @@ -37,7 +37,7 @@ export function ModelConfigList(props: { { props.updateConfig( diff --git a/app/requests.ts b/app/requests.ts index 0e757090..6ab075a8 100644 --- a/app/requests.ts +++ b/app/requests.ts @@ -28,11 +28,10 @@ const makeRequestParam = ( sendMessages = sendMessages.filter((m) => m.role !== "assistant"); } - const modelConfig = { ...useAppConfig.getState().modelConfig }; - - // @yidadaa: wont send max_tokens, because it is nonsense for Muggles - // @ts-expect-error - delete modelConfig.max_tokens; + const modelConfig = { + ...useAppConfig.getState().modelConfig, + ...useChatStore.getState().currentSession().modelConfig, + }; // override model config if (options?.model) { @@ -42,7 +41,9 @@ const makeRequestParam = ( return { messages: sendMessages, stream: options?.stream, - ...modelConfig, + model: modelConfig.model, + temperature: modelConfig.temperature, + presence_penalty: modelConfig.presence_penalty, }; }; diff --git a/app/store/config.ts b/app/store/config.ts index 05d3383d..06a95835 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -108,7 +108,7 @@ export const ModalConfigValidator = { return limitNumber(x, -2, 2, 0); }, temperature(x: number) { - return limitNumber(x, 0, 2, 1); + return limitNumber(x, 0, 1, 1); }, };