Skip to content

Commit

Permalink
Fix for title generation with new models
Browse files Browse the repository at this point in the history
  • Loading branch information
tristandostaler authored Sep 24, 2024
1 parent 221e4dc commit d3b17af
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hooks/useSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -134,15 +134,21 @@ const useSubmit = () => {
model: ModelOptions,
): Promise<string> => {
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) {
Expand Down

0 comments on commit d3b17af

Please sign in to comment.