diff --git a/src/app.tsx b/src/app.tsx index 2d8ddc3..7252a73 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -33,6 +33,8 @@ export interface ChatStore { presence_penalty: number; frequency_penalty: number; develop_mode: boolean; + whisper_api: string; + whisper_key: string; } const _defaultAPIEndpoint = "https://api.openai.com/v1/chat/completions"; @@ -43,7 +45,9 @@ const newChatStore = ( streamMode = true, model = "gpt-3.5-turbo-0613", temperature = 1.0, - dev = false + dev = false, + whisper_api = "", + whisper_key = "" ): ChatStore => { return { chatgpt_api_web_version: CHATGPT_API_WEB_VERSION, @@ -64,6 +68,8 @@ const newChatStore = ( presence_penalty: 0, frequency_penalty: 0, develop_mode: getDefaultParams("dev", dev), + whisper_api: getDefaultParams("whisper-api", whisper_api), + whisper_key: getDefaultParams("whisper-key", whisper_key), }; }; @@ -194,7 +200,9 @@ export function App() { chatStore.streamMode, chatStore.model, chatStore.temperature, - !!chatStore.develop_mode + !!chatStore.develop_mode, + chatStore.whisper_api, + chatStore.whisper_key ) ) ); diff --git a/src/chatbox.tsx b/src/chatbox.tsx index 288a152..df0015b 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -29,6 +29,8 @@ export default function ChatBOX(props: { const [showGenerating, setShowGenerating] = useState(false); const [generatingMessage, setGeneratingMessage] = useState(""); const [showRetry, setShowRetry] = useState(false); + const [isRecording, setIsRecording] = useState("Mic"); + const mediaRef = createRef(); const messagesEndRef = createRef(); useEffect(() => { @@ -504,6 +506,98 @@ export default function ChatBOX(props: { > Send + {chatStore.whisper_api && + (chatStore.whisper_key || chatStore.apiKey) && ( + + )} {chatStore.develop_mode && (