chore: audio model deploy

This commit is contained in:
jialin
2024-11-27 11:04:31 +08:00
parent 5e0772fae9
commit ba76498acc
31 changed files with 708 additions and 241 deletions
@@ -4,6 +4,7 @@ import './styles/dark.less';
interface CodeViewerProps {
code: string;
copyValue?: string;
lang: string;
autodetect?: boolean;
ignoreIllegals?: boolean;
@@ -14,6 +15,7 @@ interface CodeViewerProps {
const DarkViewer: React.FC<CodeViewerProps> = (props) => {
const {
code,
copyValue,
lang,
autodetect,
ignoreIllegals,
@@ -26,6 +28,7 @@ const DarkViewer: React.FC<CodeViewerProps> = (props) => {
style={props.style}
height={height}
code={code}
copyValue={copyValue}
lang={lang}
theme="dark"
autodetect={autodetect}
@@ -4,6 +4,7 @@ import './styles/light.less';
interface CodeViewerProps {
code: string;
copyValue?: string;
lang: string;
autodetect?: boolean;
ignoreIllegals?: boolean;
@@ -14,6 +15,7 @@ interface CodeViewerProps {
const LightViewer: React.FC<CodeViewerProps> = (props) => {
const {
code,
copyValue,
lang,
autodetect,
ignoreIllegals,
@@ -27,6 +29,7 @@ const LightViewer: React.FC<CodeViewerProps> = (props) => {
style={style}
height={height}
code={code}
copyValue={copyValue}
lang={lang}
theme="light"
autodetect={autodetect}
@@ -6,6 +6,7 @@ import { escapeHtml } from './utils';
interface CodeViewerProps {
code: string;
copyValue?: string;
lang: string;
autodetect?: boolean;
ignoreIllegals?: boolean;
@@ -17,6 +18,7 @@ interface CodeViewerProps {
const CodeViewer: React.FC<CodeViewerProps> = (props) => {
const {
code,
copyValue,
lang,
autodetect = true,
ignoreIllegals = true,
@@ -87,7 +89,7 @@ const CodeViewer: React.FC<CodeViewerProps> = (props) => {
></code>
{copyable && (
<CopyButton
text={code}
text={copyValue || code}
size="small"
style={{ color: '#abb2bf' }}
></CopyButton>
+4
View File
@@ -10,10 +10,12 @@ const HighlightCode: React.FC<{
theme?: 'light' | 'dark';
height?: string | number;
style?: React.CSSProperties;
copyValue?: string;
}> = (props) => {
const {
style,
code,
copyValue,
lang = 'bash',
copyable = true,
theme = 'dark',
@@ -26,6 +28,7 @@ const HighlightCode: React.FC<{
<CodeViewerDark
lang={lang}
code={code}
copyValue={copyValue}
copyable={copyable}
height={height}
style={style}
@@ -35,6 +38,7 @@ const HighlightCode: React.FC<{
style={style}
lang={lang}
code={code}
copyValue={copyValue}
copyable={copyable}
height={height}
/>
@@ -12,6 +12,7 @@ interface SystemMessageProps {
label?: React.ReactNode;
height?: number;
onChange: (e: any) => void;
onPaste?: (e: any) => void;
}
const RowTextarea: React.FC<SystemMessageProps> = (props) => {
@@ -52,6 +53,9 @@ const RowTextarea: React.FC<SystemMessageProps> = (props) => {
const handleClear = () => {
onChange?.({ target: { value: '' } });
};
const handleOnPaste = (e: any) => {
props.onPaste?.(e);
};
return (
<div
@@ -83,6 +87,7 @@ const RowTextarea: React.FC<SystemMessageProps> = (props) => {
onBlur={handleBlur}
allowClear={false}
onChange={handleOnChange}
onPaste={handleOnPaste}
></Input.TextArea>
</div>
}
@@ -9,7 +9,7 @@ import React, { useRef, useState } from 'react';
import AudioPlayer from './audio-player';
import './styles/index.less';
const audioUrl = require('./ih.mp4');
// const audioUrl = require('./ih.mp4');
interface SpeechContentProps {
prompt: string;
@@ -17,6 +17,7 @@ interface SpeechContentProps {
voice: string;
format: string;
speed: number;
audioUrl: string;
}
const SpeechItem: React.FC<SpeechContentProps> = (props) => {
console.log('porps=======', props);
@@ -34,13 +35,16 @@ const SpeechItem: React.FC<SpeechContentProps> = (props) => {
return (
<div>
<div className="speech-item">
{/* <audio controls autoPlay={true} src={require('./ih.mp4')}></audio> */}
<div className="voice">
<IconFont type="icon-user_voice" className="font-size-16" />
<span className="text">{props.voice}</span>
</div>
<div className="wrapper">
<AudioPlayer {...props} audioUrl={audioUrl} ref={ref}></AudioPlayer>
<AudioPlayer
{...props}
audioUrl={props.audioUrl}
ref={ref}
></AudioPlayer>
</div>
</div>
<div className="speech-actions">
@@ -75,11 +79,11 @@ const SpeechItem: React.FC<SpeechContentProps> = (props) => {
</Tooltip>
</div>
</div>
{collapsed && (
{/* {collapsed && (
<div className="prompt-box">
<div className="prompt">{props.prompt}</div>
</div>
)}
)} */}
</div>
);
};
+9 -1
View File
@@ -1,4 +1,5 @@
import { UploadOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { Button, Tooltip, Upload } from 'antd';
import React from 'react';
@@ -10,6 +11,7 @@ interface UploadAudioProps {
}
const UploadAudio: React.FC<UploadAudioProps> = (props) => {
const intl = useIntl();
const beforeUpload = (file: any) => {
return true;
};
@@ -22,7 +24,13 @@ const UploadAudio: React.FC<UploadAudioProps> = (props) => {
[]
);
return (
<Tooltip title={`Upload an audio file, support for ${props.accept}`}>
<Tooltip
overlayInnerStyle={{ maxWidth: 265, width: 'max-content' }}
title={intl.formatMessage(
{ id: 'playground.audio.uploadfile.tips' },
{ formats: props.accept }
)}
>
<Upload
beforeUpload={beforeUpload}
onChange={handleOnChange}