feat: productionize learning engine and classroom
This commit is contained in:
1 parent
2d04197f3f
commit
ba35adfbfa
124 files changed
+9071
-796
No files matched your search
@@ -2,6 +2,7 @@ import { useState, useRef, useCallback } from 'react';
|
||||
import { ASR_PROVIDERS } from '@/lib/audio/constants';
|
||||
import { normalizeASRUploadAudio } from '@/lib/audio/wav-utils';
|
||||
import { createLogger } from '@/lib/logger';
|
||||
import { transcribeMakeloreLearningAudio } from '@/lib/makelore-runtime/browser-bridge';
|
||||
|
||||
const log = createLogger('AudioRecorder');
|
||||
|
||||
@@ -45,6 +46,14 @@ export function useAudioRecorder(options: UseAudioRecorderOptions = {}) {
|
||||
const { useSettingsStore } = await import('@/lib/store/settings');
|
||||
const { asrProviderId, asrLanguage, asrProvidersConfig } = useSettingsStore.getState();
|
||||
const uploadAudio = await normalizeASRUploadAudio(asrProviderId, audioBlob);
|
||||
if (window.__MAKELORE_COURSE_CONTEXT__) {
|
||||
const text = await transcribeMakeloreLearningAudio(uploadAudio.blob, {
|
||||
fileName: uploadAudio.fileName,
|
||||
language: asrLanguage,
|
||||
});
|
||||
onTranscription?.(text);
|
||||
return;
|
||||
}
|
||||
formData.append('audio', uploadAudio.blob, uploadAudio.fileName);
|
||||
|
||||
formData.append('providerId', asrProviderId);
|
||||
@@ -105,7 +114,7 @@ export function useAudioRecorder(options: UseAudioRecorderOptions = {}) {
|
||||
const { asrProviderId, asrLanguage } = useSettingsStore.getState();
|
||||
|
||||
// Use browser native ASR if configured
|
||||
if (asrProviderId === 'browser-native') {
|
||||
if (asrProviderId === 'browser-native' && !window.__MAKELORE_COURSE_CONTEXT__) {
|
||||
// Check if Speech Recognition is supported
|
||||
if (!window.SpeechRecognition && !window.webkitSpeechRecognition) {
|
||||
onError?.('您的浏览器不支持语音识别功能');
|
||||
|
||||
Reference in new issue
Block a user