mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? add support for Tencent Cloud ASR ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Zhedong Cen <cenzhedong2@126.com> Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
102 lines
2.7 KiB
TypeScript
102 lines
2.7 KiB
TypeScript
import { useTranslate } from '@/hooks/common-hooks';
|
|
import { IModalProps } from '@/interfaces/common';
|
|
import { IAddLlmRequestBody } from '@/interfaces/request/llm';
|
|
import { Flex, Form, Input, Modal, Select, Space } from 'antd';
|
|
import omit from 'lodash/omit';
|
|
|
|
type FieldType = IAddLlmRequestBody & {
|
|
fish_audio_ak: string;
|
|
fish_audio_refid: string;
|
|
};
|
|
|
|
const { Option } = Select;
|
|
|
|
const FishAudioModal = ({
|
|
visible,
|
|
hideModal,
|
|
onOk,
|
|
loading,
|
|
llmFactory,
|
|
}: IModalProps<IAddLlmRequestBody> & { llmFactory: string }) => {
|
|
const [form] = Form.useForm<FieldType>();
|
|
|
|
const { t } = useTranslate('setting');
|
|
|
|
const handleOk = async () => {
|
|
const values = await form.validateFields();
|
|
const modelType = values.model_type;
|
|
|
|
const data = {
|
|
...omit(values),
|
|
model_type: modelType,
|
|
llm_factory: llmFactory,
|
|
};
|
|
console.info(data);
|
|
|
|
onOk?.(data);
|
|
};
|
|
|
|
return (
|
|
<Modal
|
|
title={t('addLlmTitle', { name: llmFactory })}
|
|
open={visible}
|
|
onOk={handleOk}
|
|
onCancel={hideModal}
|
|
okButtonProps={{ loading }}
|
|
footer={(originNode: React.ReactNode) => {
|
|
return (
|
|
<Flex justify={'space-between'}>
|
|
<a href={`https://fish.audio`} target="_blank" rel="noreferrer">
|
|
{t('FishAudioLink')}
|
|
</a>
|
|
<Space>{originNode}</Space>
|
|
</Flex>
|
|
);
|
|
}}
|
|
confirmLoading={loading}
|
|
>
|
|
<Form
|
|
name="basic"
|
|
style={{ maxWidth: 600 }}
|
|
autoComplete="off"
|
|
layout={'vertical'}
|
|
form={form}
|
|
>
|
|
<Form.Item<FieldType>
|
|
label={t('modelType')}
|
|
name="model_type"
|
|
initialValue={'tts'}
|
|
rules={[{ required: true, message: t('modelTypeMessage') }]}
|
|
>
|
|
<Select placeholder={t('modelTypeMessage')}>
|
|
<Option value="tts">tts</Option>
|
|
</Select>
|
|
</Form.Item>
|
|
<Form.Item<FieldType>
|
|
label={t('modelName')}
|
|
name="llm_name"
|
|
rules={[{ required: true, message: t('FishAudioModelNameMessage') }]}
|
|
>
|
|
<Input placeholder={t('FishAudioModelNameMessage')} />
|
|
</Form.Item>
|
|
<Form.Item<FieldType>
|
|
label={t('addFishAudioAK')}
|
|
name="fish_audio_ak"
|
|
rules={[{ required: true, message: t('FishAudioAKMessage') }]}
|
|
>
|
|
<Input placeholder={t('FishAudioAKMessage')} />
|
|
</Form.Item>
|
|
<Form.Item<FieldType>
|
|
label={t('addFishAudioRefID')}
|
|
name="fish_audio_refid"
|
|
rules={[{ required: false, message: t('FishAudioRefIDMessage') }]}
|
|
>
|
|
<Input placeholder={t('FishAudioRefIDMessage')} />
|
|
</Form.Item>
|
|
</Form>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default FishAudioModal;
|