diff --git a/src/app.tsx b/src/app.tsx index 0e32477..854becd 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -43,6 +43,7 @@ export interface ChatStore { develop_mode: boolean; whisper_api: string; whisper_key: string; + audioDeviceID: string; } const _defaultAPIEndpoint = "https://api.openai.com/v1/chat/completions"; @@ -80,6 +81,7 @@ const newChatStore = ( develop_mode: getDefaultParams("dev", dev), whisper_api: getDefaultParams("whisper-api", whisper_api), whisper_key: getDefaultParams("whisper-key", whisper_key), + audioDeviceID: "", }; }; diff --git a/src/settings.tsx b/src/settings.tsx index 2c7b07b..ecd9cb6 100644 --- a/src/settings.tsx +++ b/src/settings.tsx @@ -249,6 +249,8 @@ export default (props: { const [totalCost, setTotalCost] = useState(getTotalCost()); // @ts-ignore const { langCode, setLangCode } = useContext(langCodeContext); + // type is MediaDeviceInfo + const [devices, setDevices] = useState([] as MediaDeviceInfo[]); useEffect(() => { const handleKeyPress = (event: any) => { @@ -409,6 +411,52 @@ export default (props: { help="用于 Whisper 服务的 key,默认为 上方使用的OPENAI key,可在此单独配置专用key" {...props} /> + +

+ + {devices.length === 0 && ( + + )} + {devices.length > 0 && ( + + )} +

+

{Tr("Accumulated cost in all sessions")} ${totalCost.toFixed(4)}