chores: 移除对话界面无用的tts、点赞和反馈功能
- 删除了消息项中的点赞和反馈功能 - 移除了聊天配置中的 TTS 设置
This commit is contained in:
parent
d3eac75d56
commit
180443bfbf
|
@ -2,16 +2,8 @@ import { PromptIcon } from '@/assets/icon/Icon';
|
|||
import CopyToClipboard from '@/components/copy-to-clipboard';
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import { IRemoveMessageById } from '@/hooks/logic-hooks';
|
||||
import {
|
||||
DeleteOutlined,
|
||||
DislikeOutlined,
|
||||
LikeOutlined,
|
||||
PauseCircleOutlined,
|
||||
SoundOutlined,
|
||||
SyncOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { DeleteOutlined, SyncOutlined } from '@ant-design/icons';
|
||||
import { Radio, Tooltip } from 'antd';
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import FeedbackModal from './feedback-modal';
|
||||
import { useRemoveMessage, useSendFeedback, useSpeech } from './hooks';
|
||||
|
@ -31,22 +23,16 @@ export const AssistantGroupButton = ({
|
|||
content,
|
||||
prompt,
|
||||
audioBinary,
|
||||
showLikeButton,
|
||||
showLoudspeaker = true,
|
||||
}: IProps) => {
|
||||
const { visible, hideModal, showModal, onFeedbackOk, loading } =
|
||||
const { visible, hideModal, onFeedbackOk, loading } =
|
||||
useSendFeedback(messageId);
|
||||
const {
|
||||
visible: promptVisible,
|
||||
hideModal: hidePromptModal,
|
||||
showModal: showPromptModal,
|
||||
} = useSetModalState();
|
||||
const { t } = useTranslation();
|
||||
const { handleRead, ref, isPlaying } = useSpeech(content, audioBinary);
|
||||
|
||||
const handleLike = useCallback(() => {
|
||||
onFeedbackOk({ thumbup: true });
|
||||
}, [onFeedbackOk]);
|
||||
useTranslation();
|
||||
useSpeech(content, audioBinary);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -54,24 +40,6 @@ export const AssistantGroupButton = ({
|
|||
<Radio.Button value="a">
|
||||
<CopyToClipboard text={content}></CopyToClipboard>
|
||||
</Radio.Button>
|
||||
{showLoudspeaker && (
|
||||
<Radio.Button value="b" onClick={handleRead}>
|
||||
<Tooltip title={t('chat.read')}>
|
||||
{isPlaying ? <PauseCircleOutlined /> : <SoundOutlined />}
|
||||
</Tooltip>
|
||||
<audio src="" ref={ref}></audio>
|
||||
</Radio.Button>
|
||||
)}
|
||||
{showLikeButton && (
|
||||
<>
|
||||
<Radio.Button value="c" onClick={handleLike}>
|
||||
<LikeOutlined />
|
||||
</Radio.Button>
|
||||
<Radio.Button value="d" onClick={showModal}>
|
||||
<DislikeOutlined />
|
||||
</Radio.Button>
|
||||
</>
|
||||
)}
|
||||
{prompt && (
|
||||
<Radio.Button value="e" onClick={showPromptModal}>
|
||||
<PromptIcon style={{ fontSize: '16px' }} />
|
||||
|
|
|
@ -2,7 +2,7 @@ import KnowledgeBaseItem from '@/components/knowledge-base-item';
|
|||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { Form, Input, message, Select, Switch, Upload } from 'antd';
|
||||
import { Form, Input, Select, Switch, Upload } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback } from 'react';
|
||||
import { ISegmentedContentProps } from '../interface';
|
||||
|
@ -17,7 +17,7 @@ const AssistantSetting = ({
|
|||
setHasError,
|
||||
}: ISegmentedContentProps) => {
|
||||
const { t } = useTranslate('chat');
|
||||
const { data } = useFetchTenantInfo(true);
|
||||
useFetchTenantInfo(true);
|
||||
|
||||
const handleChange = useCallback(() => {
|
||||
const kbIds = form.getFieldValue('kb_ids');
|
||||
|
@ -42,17 +42,6 @@ const AssistantSetting = ({
|
|||
return e?.fileList;
|
||||
};
|
||||
|
||||
const handleTtsChange = useCallback(
|
||||
(checked: boolean) => {
|
||||
if (checked && !data.tts_id) {
|
||||
message.error(`Please set TTS model firstly.
|
||||
Setting >> Model providers >> System model settings`);
|
||||
form.setFieldValue(['prompt_config', 'tts'], false);
|
||||
}
|
||||
},
|
||||
[data, form],
|
||||
);
|
||||
|
||||
const uploadButton = (
|
||||
<button style={{ border: 0, background: 'none' }} type="button">
|
||||
<PlusOutlined />
|
||||
|
@ -129,25 +118,6 @@ const AssistantSetting = ({
|
|||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
{/* <Form.Item
|
||||
label={t('keyword')}
|
||||
valuePropName="checked"
|
||||
name={['prompt_config', 'keyword']}
|
||||
tooltip={t('keywordTip')}
|
||||
initialValue={false}
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item> */}
|
||||
{/* <Form.Item
|
||||
label={t('tts')}
|
||||
valuePropName="checked"
|
||||
name={['prompt_config', 'tts']}
|
||||
tooltip={t('ttsTip')}
|
||||
initialValue={false}
|
||||
>
|
||||
<Switch onChange={handleTtsChange} />
|
||||
</Form.Item> */}
|
||||
{/* <TavilyItem></TavilyItem> */}
|
||||
<KnowledgeBaseItem
|
||||
required={false}
|
||||
onChange={handleChange}
|
||||
|
|
|
@ -103,7 +103,7 @@ const FishAudioModal = ({
|
|||
type: 'number',
|
||||
message: t('maxTokensInvalidMessage'),
|
||||
},
|
||||
({ getFieldValue }) => ({
|
||||
({}) => ({
|
||||
validator(_, value) {
|
||||
if (value < 0) {
|
||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||
|
|
|
@ -142,7 +142,7 @@ const SparkModal = ({
|
|||
type: 'number',
|
||||
message: t('maxTokensInvalidMessage'),
|
||||
},
|
||||
({ getFieldValue }) => ({
|
||||
({}) => ({
|
||||
validator(_, value) {
|
||||
if (value < 0) {
|
||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||
|
|
Loading…
Reference in New Issue