fixup: request params

This commit is contained in:
Yidadaa 2023-04-23 21:54:18 +08:00
parent b23adf9d5d
commit e654cee3c8
4 changed files with 13 additions and 9 deletions

View File

@ -241,7 +241,10 @@ export function SessionConfigModel(props: { onClose: () => void }) {
open={showPicker}
onClose={() => setShowPicker(false)}
>
<div onClick={() => setShowPicker(true)}>
<div
onClick={() => setShowPicker(true)}
style={{ cursor: "pointer" }}
>
{session.avatar ? (
<Avatar avatar={session.avatar} />
) : (

View File

@ -37,7 +37,7 @@ export function ModelConfigList(props: {
<InputRange
value={props.modelConfig.temperature?.toFixed(1)}
min="0"
max="2"
max="1" // lets limit it to 0-1
step="0.1"
onChange={(e) => {
props.updateConfig(

View File

@ -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,
};
};

View File

@ -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);
},
};