From d3b17aff5577c1459fc785df02348a13f0275f70 Mon Sep 17 00:00:00 2001 From: tristandostaler Date: Tue, 24 Sep 2024 11:42:25 -0300 Subject: [PATCH] Fix for title generation with new models --- src/hooks/useSubmit.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hooks/useSubmit.ts b/src/hooks/useSubmit.ts index 89547868a..ac2327c1d 100644 --- a/src/hooks/useSubmit.ts +++ b/src/hooks/useSubmit.ts @@ -6,7 +6,7 @@ import { ChatInterface, ConfigInterface, MessageInterface, ModelOptions } from ' import { getChatCompletion, getChatCompletionStream } from '@api/api'; import { parseEventSource } from '@api/helper'; import { limitMessageTokens } from '@utils/messageUtils'; -import { _defaultChatConfig, minResponseSize } from '@constants/chat'; +import { _defaultChatConfig, minResponseSize, modelCost } from '@constants/chat'; import { officialAPIEndpoint } from '@constants/auth'; import { executeFunction, functionsSchemaTokens, functionsSchemas } from '@api/functions'; import { ZodError } from 'zod'; @@ -134,15 +134,21 @@ const useSubmit = () => { model: ModelOptions, ): Promise => { let data; + var temp = _defaultChatConfig.temperature + if(!modelCost[model].supportTemperature) { + temp = 1; + } const adjustedConfig: ConfigInterface = { frequency_penalty: _defaultChatConfig.frequency_penalty, max_tokens: max_tokens, model: model, presence_penalty: _defaultChatConfig.presence_penalty, - temperature: _defaultChatConfig.temperature, + temperature: temp, top_p: _defaultChatConfig.top_p, }; + + if (!apiKey || apiKey.length === 0) { // official endpoint if (apiEndpoint === officialAPIEndpoint) {