From 7f61722e78da87d4c321b1c9287dbf5a8a38eec4 Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 28 Apr 2023 20:52:08 +0800 Subject: [PATCH] feat: temperature config (#256) --- src/config/index.mjs | 1 + src/popup/Popup.jsx | 23 +++++++++++++++---- src/services/apis/azure-openai-api.mjs | 1 + src/services/apis/custom-api.mjs | 1 + src/services/apis/openai-api.mjs | 2 ++ src/utils/index.mjs | 1 + src/utils/parse-float-with-clamp.mjs | 9 ++++++++ ...with-clamp.js => parse-int-with-clamp.mjs} | 0 8 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 src/utils/parse-float-with-clamp.mjs rename src/utils/{parse-int-with-clamp.js => parse-int-with-clamp.mjs} (100%) diff --git a/src/config/index.mjs b/src/config/index.mjs index a8fdc3b..777822d 100644 --- a/src/config/index.mjs +++ b/src/config/index.mjs @@ -105,6 +105,7 @@ export const defaultConfig = { maxResponseTokenLength: 1000, maxConversationContextLength: 9, + temperature: 1, customChatGptWebApiUrl: 'https://chat.openai.com', customChatGptWebApiPath: '/backend-api/conversation', customOpenAiApiUrl: 'https://api.openai.com', diff --git a/src/popup/Popup.jsx b/src/popup/Popup.jsx index 5422c4c..fbb74f9 100644 --- a/src/popup/Popup.jsx +++ b/src/popup/Popup.jsx @@ -33,6 +33,7 @@ import { isMobile, isSafari, openUrl, + parseFloatWithClamp, parseIntWithClamp, } from '../utils/index.mjs' import { useTranslation } from 'react-i18next' @@ -432,9 +433,9 @@ function AdvancedPart({ config, updateConfig }) { return ( <> +