feat: add ref_text, x_vector_only_mode
This commit is contained in:
@@ -169,5 +169,7 @@ export default {
|
|||||||
'playground.params.maxTokens': 'Max New Tokens',
|
'playground.params.maxTokens': 'Max New Tokens',
|
||||||
'playground.params.refAudio': 'Reference Audio',
|
'playground.params.refAudio': 'Reference Audio',
|
||||||
'playground.params.refAudio.tips':
|
'playground.params.refAudio.tips':
|
||||||
'Enter a reference audio URL, or upload an audio file.'
|
'Enter a reference audio URL, or upload an audio file.',
|
||||||
|
'playground.params.refAudio.text': 'Transcript of Reference Audio',
|
||||||
|
'playground.params.refAudio.vectorMode': 'Use Speaker Embedding'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -172,7 +172,9 @@ export default {
|
|||||||
'playground.params.maxTokens': 'Max New Tokens',
|
'playground.params.maxTokens': 'Max New Tokens',
|
||||||
'playground.params.refAudio': 'Reference Audio',
|
'playground.params.refAudio': 'Reference Audio',
|
||||||
'playground.params.refAudio.tips':
|
'playground.params.refAudio.tips':
|
||||||
'Enter a reference audio URL, or upload an audio file.'
|
'Enter a reference audio URL, or upload an audio file.',
|
||||||
|
'playground.params.refAudio.text': 'Transcript of Reference Audio',
|
||||||
|
'playground.params.refAudio.vectorMode': 'Use Speaker Embedding'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
|
|||||||
@@ -166,7 +166,9 @@ export default {
|
|||||||
'playground.params.maxTokens': 'Max New Tokens',
|
'playground.params.maxTokens': 'Max New Tokens',
|
||||||
'playground.params.refAudio': 'Reference Audio',
|
'playground.params.refAudio': 'Reference Audio',
|
||||||
'playground.params.refAudio.tips':
|
'playground.params.refAudio.tips':
|
||||||
'Enter a reference audio URL, or upload an audio file.'
|
'Enter a reference audio URL, or upload an audio file.',
|
||||||
|
'playground.params.refAudio.text': 'Transcript of Reference Audio',
|
||||||
|
'playground.params.refAudio.vectorMode': 'Use Speaker Embedding'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
|
|||||||
@@ -162,5 +162,7 @@ export default {
|
|||||||
'playground.params.maxTokens': '最大生成 Token 数',
|
'playground.params.maxTokens': '最大生成 Token 数',
|
||||||
'playground.params.refAudio': '参考音频',
|
'playground.params.refAudio': '参考音频',
|
||||||
'playground.params.refAudio.tips':
|
'playground.params.refAudio.tips':
|
||||||
'输入一个参考音频的 URL,或上传一个音频文件。'
|
'输入一个参考音频的 URL,或上传一个音频文件。',
|
||||||
|
'playground.params.refAudio.text': '参考音频文本',
|
||||||
|
'playground.params.refAudio.vectorMode': '使用扬声器嵌入'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import CheckboxField from '@/components/seal-form/checkbox-field';
|
||||||
import SealInput from '@/components/seal-form/seal-input';
|
import SealInput from '@/components/seal-form/seal-input';
|
||||||
import UploadAudio from '@/components/upload-audio';
|
import UploadAudio from '@/components/upload-audio';
|
||||||
import { convertFileToBase64 } from '@/utils/load-audio-file';
|
import { convertFileToBase64 } from '@/utils/load-audio-file';
|
||||||
@@ -8,8 +9,13 @@ import React from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { useFormContext } from '../config/form-context';
|
import { useFormContext } from '../config/form-context';
|
||||||
|
|
||||||
const SuffixWrapper = styled.div`
|
const SuffixWrapper = styled.div.attrs({
|
||||||
|
className: 'suffix-wrapper'
|
||||||
|
})`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.icon {
|
.icon {
|
||||||
|
display: none;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--ant-color-text-quaternary);
|
color: var(--ant-color-text-quaternary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -19,6 +25,16 @@ const SuffixWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const Container = styled.div`
|
||||||
|
&:hover {
|
||||||
|
.suffix-wrapper {
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const RefAudioFormItem: React.FC = () => {
|
export const RefAudioFormItem: React.FC = () => {
|
||||||
const { meta, onValuesChange } = useFormContext();
|
const { meta, onValuesChange } = useFormContext();
|
||||||
const form = Form.useFormInstance();
|
const form = Form.useFormInstance();
|
||||||
@@ -34,7 +50,6 @@ export const RefAudioFormItem: React.FC = () => {
|
|||||||
});
|
});
|
||||||
setFileName(file.name);
|
setFileName(file.name);
|
||||||
|
|
||||||
console.log('Uploaded file base64 url:', base64);
|
|
||||||
onValuesChange?.(
|
onValuesChange?.(
|
||||||
{ ref_audio: base64 },
|
{ ref_audio: base64 },
|
||||||
{ ...form.getFieldsValue(), ref_audio: base64 }
|
{ ...form.getFieldsValue(), ref_audio: base64 }
|
||||||
@@ -53,33 +68,51 @@ export const RefAudioFormItem: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<>
|
||||||
name="ref_audio"
|
<Container>
|
||||||
getValueProps={(value) => ({ value: fileName ? fileName : value })}
|
<Form.Item
|
||||||
>
|
name="ref_audio"
|
||||||
<SealInput.Input
|
getValueProps={(value) => ({ value: fileName ? fileName : value })}
|
||||||
allowClear
|
>
|
||||||
readOnly={!!fileName}
|
<SealInput.Input
|
||||||
suffix={
|
allowClear
|
||||||
<SuffixWrapper>
|
readOnly={!!fileName}
|
||||||
{fileName ? (
|
suffix={
|
||||||
<span onClick={handleClear}>
|
<SuffixWrapper>
|
||||||
<CloseCircleFilled className="icon" />
|
{fileName ? (
|
||||||
</span>
|
<span onClick={handleClear}>
|
||||||
) : null}
|
<CloseCircleFilled className="icon" />
|
||||||
<UploadAudio
|
</span>
|
||||||
size="small"
|
) : null}
|
||||||
type="text"
|
<UploadAudio
|
||||||
accept={['.mp3', '.mp4', '.wav', '.m4a'].join(', ')}
|
size="small"
|
||||||
onChange={handleUploadChange}
|
type="text"
|
||||||
></UploadAudio>
|
accept={['.mp3', '.mp4', '.wav', '.m4a'].join(', ')}
|
||||||
</SuffixWrapper>
|
onChange={handleUploadChange}
|
||||||
}
|
></UploadAudio>
|
||||||
description={intl.formatMessage({
|
</SuffixWrapper>
|
||||||
id: 'playground.params.refAudio.tips'
|
}
|
||||||
})}
|
description={intl.formatMessage({
|
||||||
label={intl.formatMessage({ id: 'playground.params.refAudio' })}
|
id: 'playground.params.refAudio.tips'
|
||||||
></SealInput.Input>
|
})}
|
||||||
</Form.Item>
|
label={intl.formatMessage({ id: 'playground.params.refAudio' })}
|
||||||
|
></SealInput.Input>
|
||||||
|
</Form.Item>
|
||||||
|
</Container>
|
||||||
|
<Form.Item name="ref_text" style={{ marginBottom: 8 }}>
|
||||||
|
<SealInput.TextArea
|
||||||
|
allowClear
|
||||||
|
scaleSize={true}
|
||||||
|
label={intl.formatMessage({ id: 'playground.params.refAudio.text' })}
|
||||||
|
></SealInput.TextArea>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="x_vector_only_mode" valuePropName="checked">
|
||||||
|
<CheckboxField
|
||||||
|
label={intl.formatMessage({
|
||||||
|
id: 'playground.params.refAudio.vectorMode'
|
||||||
|
})}
|
||||||
|
></CheckboxField>
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user