mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-23 06:00:17 +09:00
feat: stt style optimize
This commit is contained in:
parent
48fe84024f
commit
6e3d47035d
@ -28,6 +28,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.secondary {
|
||||||
|
background-color: var(--second);
|
||||||
|
color: var(--primary);
|
||||||
|
|
||||||
|
path {
|
||||||
|
fill: var(--primary) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.danger {
|
&.danger {
|
||||||
color: rgba($color: red, $alpha: 0.8);
|
color: rgba($color: red, $alpha: 0.8);
|
||||||
border-color: rgba($color: red, $alpha: 0.5);
|
border-color: rgba($color: red, $alpha: 0.5);
|
||||||
|
@ -3,7 +3,7 @@ import * as React from "react";
|
|||||||
import styles from "./button.module.scss";
|
import styles from "./button.module.scss";
|
||||||
import { CSSProperties } from "react";
|
import { CSSProperties } from "react";
|
||||||
|
|
||||||
export type ButtonType = "primary" | "danger" | null;
|
export type ButtonType = "primary" | "secondary" | "danger" | null;
|
||||||
|
|
||||||
import LoadingIcon from "../icons/three-dots-white.svg";
|
import LoadingIcon from "../icons/three-dots-white.svg";
|
||||||
|
|
||||||
|
@ -722,6 +722,15 @@
|
|||||||
.chat-input:focus {
|
.chat-input:focus {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-input-stt {
|
||||||
|
background-color: var(--primary);
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
right: 70px;
|
||||||
|
bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-input-send {
|
.chat-input-send {
|
||||||
background-color: var(--primary);
|
background-color: var(--primary);
|
||||||
color: white;
|
color: white;
|
||||||
@ -736,8 +745,11 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input-send {
|
.chat-input-send,
|
||||||
|
.chat-input-stt {
|
||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@ import React, {
|
|||||||
} from "react";
|
} from "react";
|
||||||
|
|
||||||
import SendWhiteIcon from "../icons/send-white.svg";
|
import SendWhiteIcon from "../icons/send-white.svg";
|
||||||
import VoiceWhiteIcon from "../icons/voice-white.svg";
|
import VoiceOpenIcon from "../icons/voice-open.svg";
|
||||||
|
import VoiceCloseIcon from "../icons/voice-close.svg";
|
||||||
import BrainIcon from "../icons/brain.svg";
|
import BrainIcon from "../icons/brain.svg";
|
||||||
import RenameIcon from "../icons/rename.svg";
|
import RenameIcon from "../icons/rename.svg";
|
||||||
import ExportIcon from "../icons/share.svg";
|
import ExportIcon from "../icons/share.svg";
|
||||||
@ -1210,6 +1211,7 @@ function _Chat() {
|
|||||||
|
|
||||||
const startListening = async () => {
|
const startListening = async () => {
|
||||||
if (speechApi) {
|
if (speechApi) {
|
||||||
|
showToast(Locale.Settings.STT.StartListening);
|
||||||
await speechApi.start();
|
await speechApi.start();
|
||||||
setIsListening(true);
|
setIsListening(true);
|
||||||
}
|
}
|
||||||
@ -1219,6 +1221,7 @@ function _Chat() {
|
|||||||
if (speechApi) {
|
if (speechApi) {
|
||||||
if (config.sttConfig.engine !== DEFAULT_STT_ENGINE)
|
if (config.sttConfig.engine !== DEFAULT_STT_ENGINE)
|
||||||
setIsTranscription(true);
|
setIsTranscription(true);
|
||||||
|
showToast(Locale.Settings.STT.StopListening);
|
||||||
await speechApi.stop();
|
await speechApi.stop();
|
||||||
setIsListening(false);
|
setIsListening(false);
|
||||||
}
|
}
|
||||||
@ -2328,9 +2331,21 @@ function _Chat() {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{config.sttConfig.enable && (
|
||||||
|
<IconButton
|
||||||
|
icon={isListening ? <VoiceCloseIcon /> : <VoiceOpenIcon />}
|
||||||
|
className={styles["chat-input-stt"]}
|
||||||
|
type="secondary"
|
||||||
|
onClick={async () =>
|
||||||
|
isListening
|
||||||
|
? await stopListening()
|
||||||
|
: await startListening()
|
||||||
|
}
|
||||||
|
loding={isTranscription}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={<SendWhiteIcon />}
|
icon={<SendWhiteIcon />}
|
||||||
text={Locale.Chat.Send}
|
|
||||||
className={styles["chat-input-send"]}
|
className={styles["chat-input-send"]}
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => doSubmit(userInput)}
|
onClick={() => doSubmit(userInput)}
|
||||||
|
1
app/icons/voice-close.svg
Normal file
1
app/icons/voice-close.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m3 3 18 18M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1-.13.874m-2 2A3 3 0 0 1 9 10.002v-1"></path><path d="M5 10a7 7 0 0 0 10.846 5.85m2-2A6.97 6.97 0 0 0 18.998 10M8 21h8m-4-4v4"></path></g></svg>
|
After Width: | Height: | Size: 376 B |
1
app/icons/voice-open.svg
Normal file
1
app/icons/voice-open.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9a1 1 0 0 1 1 1 8 8 0 0 1-6.999 7.938L13 20h3a1 1 0 0 1 0 2H8a1 1 0 0 1 0-2h3v-2.062A8 8 0 0 1 4 10a1 1 0 1 1 2 0 6 6 0 0 0 12 0 1 1 0 0 1 1-1m-7-8a4 4 0 0 1 4 4v5a4 4 0 1 1-8 0V5a4 4 0 0 1 4-4"></path></svg>
|
After Width: | Height: | Size: 324 B |
@ -598,6 +598,8 @@ const cn = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
STT: {
|
STT: {
|
||||||
|
StartListening: "开始听写",
|
||||||
|
StopListening: "结束听写",
|
||||||
Enable: {
|
Enable: {
|
||||||
Title: "启用语音转文本",
|
Title: "启用语音转文本",
|
||||||
SubTitle: "启用语音转文本",
|
SubTitle: "启用语音转文本",
|
||||||
|
@ -606,6 +606,8 @@ const en: LocaleType = {
|
|||||||
Engine: "TTS Engine",
|
Engine: "TTS Engine",
|
||||||
},
|
},
|
||||||
STT: {
|
STT: {
|
||||||
|
StartListening: "Start Listening",
|
||||||
|
StopListening: "Stop Listening",
|
||||||
Enable: {
|
Enable: {
|
||||||
Title: "Enable STT",
|
Title: "Enable STT",
|
||||||
SubTitle: "Enable Speech-to-Text",
|
SubTitle: "Enable Speech-to-Text",
|
||||||
|
Loading…
Reference in New Issue
Block a user