We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<div className={${chatStyle["chat-input-action"]} clickable} onMouseDown={(e) => startRecorder(e)} onMouseUp={(e) => endRecorder(e)} onTouchStart={(e) => startRecorder(e)} onTouchEnd={(e) => endRecorder(e)} > <MicIcon /> </div> `const startRecorder = (e: any) => { // 调用open方法进行授权 rec.open( function () { console.log("授权成功,开始录音"); rec.start(); }, function (msg: any, isUserNotAllow: any) { //用户拒绝未授权或不支持 console.log("用户拒绝未授权或不支持", msg); }, function (msg: any) { alert(msg); }, ); // 开始录音 // rec.start(); };
<div className={
} onMouseDown={(e) => startRecorder(e)} onMouseUp={(e) => endRecorder(e)} onTouchStart={(e) => startRecorder(e)} onTouchEnd={(e) => endRecorder(e)} > <MicIcon /> </div>
const endRecorder = (e: any) => { // 停止录音 rec.stop( async function (blob: any, duration: any) { // 创建指向音频文件的URL // var audioURL = (window.URL || webkitURL).createObjectURL(blob); // 把MP3文件传输到openai const file = new File([blob], "test.mp3", { type: "audio/mpeg", }); const transcription = await openai.audio.transcriptions.create({ file: file, model: "whisper-1", }); console.log("语音转文字结果:", transcription.text); // 回显在聊天框中 props.setSpeechToText(transcription.text); }, function (msg: any) { console.log(msg); }, function () { // 释放录音资源 rec.close(); rec = null; }, ); };`
The text was updated successfully, but these errors were encountered:
日志里面有个编号Recorder:28 | 29,开头的start 和 stop 并不是同一个rec,你同一时间调用了两次你的startRecorder之类的方法
Recorder:28 | 29
Sorry, something went wrong.
请问有啥办法能解决吗,我打印日志看是只调了一次startRecorder方法的,(能放我进群吗大佬,申请了好几次没人处理
No branches or pull requests
<div className={
${chatStyle["chat-input-action"]} clickable} onMouseDown={(e) => startRecorder(e)} onMouseUp={(e) => endRecorder(e)} onTouchStart={(e) => startRecorder(e)} onTouchEnd={(e) => endRecorder(e)} > <MicIcon /> </div>
`const startRecorder = (e: any) => {
// 调用open方法进行授权
rec.open(
function () {
console.log("授权成功,开始录音");
rec.start();
},
function (msg: any, isUserNotAllow: any) {
//用户拒绝未授权或不支持
console.log("用户拒绝未授权或不支持", msg);
},
function (msg: any) {
alert(msg);
},
);
// 开始录音
// rec.start();
};
const endRecorder = (e: any) => {
// 停止录音
rec.stop(
async function (blob: any, duration: any) {
// 创建指向音频文件的URL
// var audioURL = (window.URL || webkitURL).createObjectURL(blob);
// 把MP3文件传输到openai
const file = new File([blob], "test.mp3", {
type: "audio/mpeg",
});
const transcription = await openai.audio.transcriptions.create({
file: file,
model: "whisper-1",
});
console.log("语音转文字结果:", transcription.text);
// 回显在聊天框中
props.setSpeechToText(transcription.text);
},
function (msg: any) {
console.log(msg);
},
function () {
// 释放录音资源
rec.close();
rec = null;
},
);
};`
The text was updated successfully, but these errors were encountered: