Skip to content

Commit

Permalink
fix(chat): fix applying temperature (Issue #588)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaBondar committed Feb 16, 2024
1 parent a84fc54 commit ef39a3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/constants/default-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const DEFAULT_SYSTEM_PROMPT =
export const DIAL_API_HOST = process.env.DIAL_API_HOST;

export const DEFAULT_TEMPERATURE = parseFloat(
process.env.NEXT_PUBLIC_DEFAULT_TEMPERATURE || '1',
process.env.NEXT_PUBLIC_DEFAULT_TEMPERATURE ?? '1',
);

export const DEFAULT_CONVERSATION_NAME = 'New conversation';
Expand Down
4 changes: 3 additions & 1 deletion src/pages/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
}

let temperatureToUse = temperature;
if (temperatureToUse && model.type !== EntityType.Application) {
if (!temperatureToUse
&& temperatureToUse !== 0
&& model.type !== EntityType.Application) {
temperatureToUse = DEFAULT_TEMPERATURE;
}

Expand Down

0 comments on commit ef39a3b

Please sign in to comment.