fix: audio error message
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ const isProduction = env === 'production';
|
|||||||
const t = Date.now();
|
const t = Date.now();
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
proxy: {
|
proxy: {
|
||||||
...proxy('http://192.168.50.4')
|
...proxy('http://192.168.50.3')
|
||||||
},
|
},
|
||||||
history: {
|
history: {
|
||||||
type: 'hash'
|
type: 'hash'
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import './index.less';
|
|||||||
interface AudioAnimationProps {
|
interface AudioAnimationProps {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
|
maxWidth?: number;
|
||||||
scaleFactor?: number;
|
scaleFactor?: number;
|
||||||
maxBarCount?: number;
|
maxBarCount?: number;
|
||||||
fixedHeight?: boolean;
|
fixedHeight?: boolean;
|
||||||
@@ -18,6 +19,7 @@ const AudioAnimation: React.FC<AudioAnimationProps> = (props) => {
|
|||||||
const {
|
const {
|
||||||
scaleFactor = 1.2,
|
scaleFactor = 1.2,
|
||||||
maxBarCount = 128,
|
maxBarCount = 128,
|
||||||
|
maxWidth,
|
||||||
fixedHeight = true,
|
fixedHeight = true,
|
||||||
analyserData,
|
analyserData,
|
||||||
width: initialWidth,
|
width: initialWidth,
|
||||||
@@ -133,12 +135,16 @@ const AudioAnimation: React.FC<AudioAnimationProps> = (props) => {
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (size) {
|
if (size) {
|
||||||
setWidth(size?.width || 0);
|
if (maxWidth) {
|
||||||
|
setWidth(Math.min(size.width, maxWidth));
|
||||||
|
} else {
|
||||||
|
setWidth(size?.width || 0);
|
||||||
|
}
|
||||||
if (!fixedHeight) {
|
if (!fixedHeight) {
|
||||||
setHeight(size?.height || 0);
|
setHeight(size?.height || 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [size]);
|
}, [size, maxWidth]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!canvasRef.current) return;
|
if (!canvasRef.current) return;
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
|
|||||||
|
|
||||||
const updateContent = useCallback(
|
const updateContent = useCallback(
|
||||||
(inputStr: string) => {
|
(inputStr: string) => {
|
||||||
|
console.log('inputStr===', inputStr);
|
||||||
const data = inputStr.replace(replaceLineRegex, '\n');
|
const data = inputStr.replace(replaceLineRegex, '\n');
|
||||||
if (isClean(data)) {
|
if (isClean(data)) {
|
||||||
cacheDataRef.current = data;
|
cacheDataRef.current = data;
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ const SpeechItem: React.FC<SpeechContentProps> = (props) => {
|
|||||||
debounceSeek(value);
|
debounceSeek(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handlOnChangeComplete = useCallback((value: number) => {
|
||||||
|
ref.current?.seekTo(value / duration);
|
||||||
|
setCurrentTime(value);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const onDownload = useCallback(() => {
|
const onDownload = useCallback(() => {
|
||||||
const url = props.audioUrl || '';
|
const url = props.audioUrl || '';
|
||||||
const filename = `audio-${dayjs().format('YYYYMMDDHHmmss')}.${props.format}`;
|
const filename = `audio-${dayjs().format('YYYYMMDDHHmmss')}.${props.format}`;
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
export default {
|
const externalLinks = {
|
||||||
documentation: 'https://docs.gpustack.ai/',
|
documentation: 'https://docs.gpustack.ai/',
|
||||||
github: 'https://github.com/gpustack/gpustack',
|
github: 'https://github.com/gpustack/gpustack',
|
||||||
discord: 'https://discord.gg/VXYJzuaqwD',
|
discord: 'https://discord.gg/VXYJzuaqwD',
|
||||||
site: 'https://gpustack.ai/',
|
site: 'https://gpustack.ai/',
|
||||||
release: 'https://github.com/gpustack/gpustack/releases'
|
release: 'https://github.com/gpustack/gpustack/releases'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default externalLinks;
|
||||||
|
|
||||||
|
export const externalRefer = {
|
||||||
|
audioPermission: `${externalLinks.documentation}latest/user-guide/playground/#audio-playground`
|
||||||
|
};
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ export default {
|
|||||||
'Upload an audio file or start recording',
|
'Upload an audio file or start recording',
|
||||||
'playground.audio.enablemic':
|
'playground.audio.enablemic':
|
||||||
"Enable microphone access in your browser's settings.",
|
"Enable microphone access in your browser's settings.",
|
||||||
|
'playground.audio.enablemic.doc': 'Refer to',
|
||||||
'playground.audio.startrecord': 'Start Recording',
|
'playground.audio.startrecord': 'Start Recording',
|
||||||
'playground.audio.stoprecord': 'Stop Recording',
|
'playground.audio.stoprecord': 'Stop Recording',
|
||||||
'playground.audio.generating.tips': 'Generated text will appear here.',
|
'playground.audio.generating.tips': 'Generated text will appear here.',
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export default {
|
|||||||
'playground.audio.texttospeech.tips': '生成的语音将出现在这里',
|
'playground.audio.texttospeech.tips': '生成的语音将出现在这里',
|
||||||
'playground.audio.speechtotext.tips': '上传音频文件或开始录音',
|
'playground.audio.speechtotext.tips': '上传音频文件或开始录音',
|
||||||
'playground.audio.enablemic': '请允许浏览器访问麦克风,以便开始录音',
|
'playground.audio.enablemic': '请允许浏览器访问麦克风,以便开始录音',
|
||||||
|
'playground.audio.enablemic.doc': '参考文档',
|
||||||
'playground.audio.startrecord': '开始录音',
|
'playground.audio.startrecord': '开始录音',
|
||||||
'playground.audio.stoprecord': '停止录音',
|
'playground.audio.stoprecord': '停止录音',
|
||||||
'playground.audio.generating.tips': '生成的文本将出现在这里',
|
'playground.audio.generating.tips': '生成的文本将出现在这里',
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { externalRefer } from '@/constants/external-links';
|
||||||
import { AudioOutlined } from '@ant-design/icons';
|
import { AudioOutlined } from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Space, Tooltip } from 'antd';
|
import { Button, Space, Tooltip } from 'antd';
|
||||||
@@ -215,7 +216,25 @@ const AudioInput: React.FC<AudioInputProps> = (props) => {
|
|||||||
|
|
||||||
const renderRecordButtonTips = useMemo(() => {
|
const renderRecordButtonTips = useMemo(() => {
|
||||||
if (!audioPermission) {
|
if (!audioPermission) {
|
||||||
return intl.formatMessage({ id: 'playground.audio.enablemic' });
|
return (
|
||||||
|
<span>
|
||||||
|
<span>
|
||||||
|
{intl.formatMessage({ id: 'playground.audio.enablemic' })}
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
color="primary"
|
||||||
|
variant="link"
|
||||||
|
href={`${externalRefer.audioPermission}`}
|
||||||
|
target="_blank"
|
||||||
|
style={{
|
||||||
|
color: 'var(--ant-blue-5)'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{intl.formatMessage({ id: 'playground.audio.enablemic.doc' })}
|
||||||
|
</Button>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return isRecording
|
return isRecording
|
||||||
? intl.formatMessage({ id: 'playground.audio.stoprecord' })
|
? intl.formatMessage({ id: 'playground.audio.stoprecord' })
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result?.status_code !== 200) {
|
if (result?.status_code && result?.status_code !== 200) {
|
||||||
setTokenResult({
|
setTokenResult({
|
||||||
error: true,
|
error: true,
|
||||||
errorMessage:
|
errorMessage:
|
||||||
@@ -211,6 +211,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
setIsRecording(val);
|
setIsRecording(val);
|
||||||
setAudioData(null);
|
setAudioData(null);
|
||||||
setTokenResult(null);
|
setTokenResult(null);
|
||||||
|
setMessageList([]);
|
||||||
console.log('data===', val);
|
console.log('data===', val);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -52,17 +52,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
autoplay: boolean;
|
autoplay: boolean;
|
||||||
audioUrl: string;
|
audioUrl: string;
|
||||||
}[]
|
}[]
|
||||||
>([
|
>([]);
|
||||||
{
|
|
||||||
input: '',
|
|
||||||
voice: '',
|
|
||||||
format: '',
|
|
||||||
speed: 0,
|
|
||||||
uid: 0,
|
|
||||||
autoplay: false,
|
|
||||||
audioUrl: ''
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
const locale = getLocale();
|
const locale = getLocale();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
|
|||||||
Reference in New Issue
Block a user