fix: tts show error message
This commit is contained in:
@@ -360,7 +360,12 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
const formValues = form.current?.form?.getFieldsValue();
|
||||
return ImageAdvancedParamsConfig.map((item: ParamsSchema) => {
|
||||
return (
|
||||
<Form.Item name={item.name} rules={item.rules} key={item.name}>
|
||||
<Form.Item
|
||||
name={item.name}
|
||||
rules={item.rules}
|
||||
key={item.name}
|
||||
noStyle={item.name === 'random_seed'}
|
||||
>
|
||||
<FieldComponent
|
||||
disabled={
|
||||
item.disabledConfig
|
||||
|
||||
@@ -60,7 +60,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
const [parameters, setParams] = useState<any>({});
|
||||
const [show, setShow] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [tokenResult, setTokenResult] = useState<any>(null);
|
||||
const [tokenResult, setTokenResult] = useState<any>();
|
||||
const [collapse, setCollapse] = useState(false);
|
||||
const controllerRef = useRef<any>(null);
|
||||
const scroller = useRef<any>(null);
|
||||
@@ -96,7 +96,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
};
|
||||
|
||||
const submitMessage = async (current?: { role: string; content: string }) => {
|
||||
// await formRef.current?.form.validateFields();
|
||||
await formRef.current?.form.validateFields();
|
||||
if (!parameters.model) return;
|
||||
try {
|
||||
setLoading(true);
|
||||
@@ -174,12 +174,26 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
const res = await queryModelVoices({
|
||||
model: value
|
||||
});
|
||||
console.log('res:', res);
|
||||
if (res.error) {
|
||||
setTokenResult({
|
||||
error: true,
|
||||
errorMessage:
|
||||
res?.data?.error?.message ||
|
||||
res?.data?.error ||
|
||||
res.error?.detail ||
|
||||
''
|
||||
});
|
||||
setVoiceList([]);
|
||||
return;
|
||||
}
|
||||
const voiceList = _.map(res.voices || [], (item: any) => {
|
||||
return {
|
||||
label: item,
|
||||
value: item
|
||||
};
|
||||
});
|
||||
|
||||
setVoiceList(voiceList);
|
||||
setParams((pre: any) => {
|
||||
return {
|
||||
@@ -188,7 +202,16 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
};
|
||||
});
|
||||
formRef.current?.form.setFieldValue('voice', voiceList[0]?.value);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
const res = error?.response?.data;
|
||||
if (res.error) {
|
||||
setTokenResult({
|
||||
error: true,
|
||||
errorMessage:
|
||||
res?.error?.message || res?.data?.error || res.error?.detail || ''
|
||||
});
|
||||
}
|
||||
console.log('error:', error);
|
||||
setVoiceList([]);
|
||||
formRef.current?.form.setFieldValue('voice', '');
|
||||
setParams((pre: any) => {
|
||||
|
||||
Reference in New Issue
Block a user