Temperature can now be adjusted via CLI.

This commit is contained in:
Martin Sosic 2023-07-11 12:38:32 +02:00
parent 737ab428ed
commit 805aaef1dd

View File

@ -33,7 +33,8 @@ data NewProjectConfig = NewProjectConfig
{ projectAuth :: !(Maybe AuthProvider), { projectAuth :: !(Maybe AuthProvider),
-- One of the Tailwind color names: https://tailwindcss.com/docs/customizing-colors -- One of the Tailwind color names: https://tailwindcss.com/docs/customizing-colors
projectPrimaryColor :: !(Maybe String), projectPrimaryColor :: !(Maybe String),
projectDefaultGptModel :: !(Maybe GPT.Model) projectDefaultGptModel :: !(Maybe GPT.Model),
projectDefaultGptTemperature :: !(Maybe Float)
} }
deriving (Show) deriving (Show)
@ -42,11 +43,13 @@ instance Aeson.FromJSON NewProjectConfig where
auth <- obj .:? "auth" auth <- obj .:? "auth"
primaryColor <- obj .:? "primaryColor" primaryColor <- obj .:? "primaryColor"
defaultGptModel <- obj .:? "defaultGptModel" defaultGptModel <- obj .:? "defaultGptModel"
defaultGptTemperature <- obj .:? "defaultGptTemperature"
return return
( NewProjectConfig ( NewProjectConfig
{ projectAuth = auth, { projectAuth = auth,
projectPrimaryColor = primaryColor, projectPrimaryColor = primaryColor,
projectDefaultGptModel = defaultGptModel projectDefaultGptModel = defaultGptModel,
projectDefaultGptTemperature = defaultGptTemperature
} }
) )
@ -55,7 +58,8 @@ emptyNewProjectConfig =
NewProjectConfig NewProjectConfig
{ projectAuth = Nothing, { projectAuth = Nothing,
projectPrimaryColor = Nothing, projectPrimaryColor = Nothing,
projectDefaultGptModel = Nothing projectDefaultGptModel = Nothing,
projectDefaultGptTemperature = Nothing
} }
getProjectAuth :: NewProjectDetails -> AuthProvider getProjectAuth :: NewProjectDetails -> AuthProvider
@ -133,7 +137,7 @@ defaultChatGPTParams :: NewProjectDetails -> ChatGPTParams
defaultChatGPTParams projectDetails = defaultChatGPTParams projectDetails =
GPT.ChatGPTParams GPT.ChatGPTParams
{ GPT._model = fromMaybe GPT.GPT_3_5_turbo_16k (projectDefaultGptModel $ _projectConfig projectDetails), { GPT._model = fromMaybe GPT.GPT_3_5_turbo_16k (projectDefaultGptModel $ _projectConfig projectDetails),
GPT._temperature = Just 0.7 GPT._temperature = Just $ fromMaybe 0.7 (projectDefaultGptTemperature $ _projectConfig projectDetails)
} }
defaultChatGPTParamsForFixing :: NewProjectDetails -> ChatGPTParams defaultChatGPTParamsForFixing :: NewProjectDetails -> ChatGPTParams