@@ -23,10 +23,7 @@ import { ChatBody } from '@/src/types/chat';
2323import { EntityType } from '@/src/types/common' ;
2424
2525import { DEFAULT_SYSTEM_PROMPT } from '@/src/constants/default-server-settings' ;
26- import {
27- DEFAULT_TEMPERATURE ,
28- FALLBACK_TEMPERATURE ,
29- } from '@/src/constants/default-ui-settings' ;
26+ import { DEFAULT_TEMPERATURE } from '@/src/constants/default-ui-settings' ;
3027import { errorsMessages } from '@/src/constants/errors' ;
3128
3229import { authOptions } from './auth/[...nextauth]' ;
@@ -65,9 +62,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
6562 }
6663
6764 let temperatureToUse = temperature ;
68- if ( ! doesModelAllowTemperature ( model ) ) {
69- temperatureToUse = FALLBACK_TEMPERATURE ;
70- } else if (
65+ if (
66+ doesModelAllowTemperature ( model ) &&
7167 ! temperatureToUse &&
7268 temperatureToUse !== 0 &&
7369 model . type !== EntityType . Application
@@ -111,7 +107,6 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
111107
112108 const stream = await OpenAIStream ( {
113109 model,
114- temperature : temperatureToUse ,
115110 messages : messagesToSend ,
116111 userJWT : token ?. access_token as string ,
117112 chatReference : reference ?? id ,
@@ -120,6 +115,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
120115 ? limits ?. maxRequestTokens
121116 : undefined ,
122117 configurationSchemaValue : configurationValue ,
118+ ...( temperatureToUse !== undefined && { temperature : temperatureToUse } ) ,
123119 } ) ;
124120 res . setHeader ( 'Transfer-Encoding' , 'chunked' ) ;
125121
0 commit comments