Feature request: Adding temperature as parameter (#513)

* Adding temperature as parameter

* NEXT_PUBLIC_ prefix added

* add spacing

---------

Co-authored-by: Ivan Fioravanti <>
Co-authored-by: Mckay Wrigley <mckaywrigley@gmail.com>
This commit is contained in:
Ivan Fioravanti
2023-04-13 13:09:03 +02:00
committed by GitHub
parent d1eb6ee29b
commit ea1d09244a
26 changed files with 142 additions and 25 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
import { Conversation } from '@/types/chat';
import { OpenAIModelID, OpenAIModels } from '@/types/openai';
import { DEFAULT_SYSTEM_PROMPT } from './const';
import { DEFAULT_SYSTEM_PROMPT, DEFAULT_TEMPERATURE } from './const';
export const cleanSelectedConversation = (conversation: Conversation) => {
// added model for each conversation (3/20/23)
@@ -27,6 +27,13 @@ export const cleanSelectedConversation = (conversation: Conversation) => {
};
}
if (!updatedConversation.temperature) {
updatedConversation = {
...updatedConversation,
temperature: updatedConversation.temperature || DEFAULT_TEMPERATURE,
};
}
if (!updatedConversation.folderId) {
updatedConversation = {
...updatedConversation,
@@ -58,6 +65,10 @@ export const cleanConversationHistory = (history: any[]): Conversation[] => {
conversation.prompt = DEFAULT_SYSTEM_PROMPT;
}
if (!conversation.temperature) {
conversation.temperature = DEFAULT_TEMPERATURE;
}
if (!conversation.folderId) {
conversation.folderId = null;
}