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 CopyToClipboard from '@/components/copy-to-clipboard';
|
||||||
import { useSetModalState } from '@/hooks/common-hooks';
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
import { IRemoveMessageById } from '@/hooks/logic-hooks';
|
import { IRemoveMessageById } from '@/hooks/logic-hooks';
|
||||||
import {
|
import { DeleteOutlined, SyncOutlined } from '@ant-design/icons';
|
||||||
DeleteOutlined,
|
|
||||||
DislikeOutlined,
|
|
||||||
LikeOutlined,
|
|
||||||
PauseCircleOutlined,
|
|
||||||
SoundOutlined,
|
|
||||||
SyncOutlined,
|
|
||||||
} from '@ant-design/icons';
|
|
||||||
import { Radio, Tooltip } from 'antd';
|
import { Radio, Tooltip } from 'antd';
|
||||||
import { useCallback } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import FeedbackModal from './feedback-modal';
|
import FeedbackModal from './feedback-modal';
|
||||||
import { useRemoveMessage, useSendFeedback, useSpeech } from './hooks';
|
import { useRemoveMessage, useSendFeedback, useSpeech } from './hooks';
|
||||||
|
@ -31,22 +23,16 @@ export const AssistantGroupButton = ({
|
||||||
content,
|
content,
|
||||||
prompt,
|
prompt,
|
||||||
audioBinary,
|
audioBinary,
|
||||||
showLikeButton,
|
|
||||||
showLoudspeaker = true,
|
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const { visible, hideModal, showModal, onFeedbackOk, loading } =
|
const { visible, hideModal, onFeedbackOk, loading } =
|
||||||
useSendFeedback(messageId);
|
useSendFeedback(messageId);
|
||||||
const {
|
const {
|
||||||
visible: promptVisible,
|
visible: promptVisible,
|
||||||
hideModal: hidePromptModal,
|
hideModal: hidePromptModal,
|
||||||
showModal: showPromptModal,
|
showModal: showPromptModal,
|
||||||
} = useSetModalState();
|
} = useSetModalState();
|
||||||
const { t } = useTranslation();
|
useTranslation();
|
||||||
const { handleRead, ref, isPlaying } = useSpeech(content, audioBinary);
|
useSpeech(content, audioBinary);
|
||||||
|
|
||||||
const handleLike = useCallback(() => {
|
|
||||||
onFeedbackOk({ thumbup: true });
|
|
||||||
}, [onFeedbackOk]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -54,24 +40,6 @@ export const AssistantGroupButton = ({
|
||||||
<Radio.Button value="a">
|
<Radio.Button value="a">
|
||||||
<CopyToClipboard text={content}></CopyToClipboard>
|
<CopyToClipboard text={content}></CopyToClipboard>
|
||||||
</Radio.Button>
|
</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 && (
|
{prompt && (
|
||||||
<Radio.Button value="e" onClick={showPromptModal}>
|
<Radio.Button value="e" onClick={showPromptModal}>
|
||||||
<PromptIcon style={{ fontSize: '16px' }} />
|
<PromptIcon style={{ fontSize: '16px' }} />
|
||||||
|
|
|
@ -2,7 +2,7 @@ import KnowledgeBaseItem from '@/components/knowledge-base-item';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
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 classNames from 'classnames';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { ISegmentedContentProps } from '../interface';
|
import { ISegmentedContentProps } from '../interface';
|
||||||
|
@ -17,7 +17,7 @@ const AssistantSetting = ({
|
||||||
setHasError,
|
setHasError,
|
||||||
}: ISegmentedContentProps) => {
|
}: ISegmentedContentProps) => {
|
||||||
const { t } = useTranslate('chat');
|
const { t } = useTranslate('chat');
|
||||||
const { data } = useFetchTenantInfo(true);
|
useFetchTenantInfo(true);
|
||||||
|
|
||||||
const handleChange = useCallback(() => {
|
const handleChange = useCallback(() => {
|
||||||
const kbIds = form.getFieldValue('kb_ids');
|
const kbIds = form.getFieldValue('kb_ids');
|
||||||
|
@ -42,17 +42,6 @@ const AssistantSetting = ({
|
||||||
return e?.fileList;
|
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 = (
|
const uploadButton = (
|
||||||
<button style={{ border: 0, background: 'none' }} type="button">
|
<button style={{ border: 0, background: 'none' }} type="button">
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
|
@ -129,25 +118,6 @@ const AssistantSetting = ({
|
||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</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
|
<KnowledgeBaseItem
|
||||||
required={false}
|
required={false}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
|
|
@ -103,7 +103,7 @@ const FishAudioModal = ({
|
||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|
|
@ -142,7 +142,7 @@ const SparkModal = ({
|
||||||
type: 'number',
|
type: 'number',
|
||||||
message: t('maxTokensInvalidMessage'),
|
message: t('maxTokensInvalidMessage'),
|
||||||
},
|
},
|
||||||
({ getFieldValue }) => ({
|
({}) => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
return Promise.reject(new Error(t('maxTokensMinMessage')));
|
||||||
|
|
Loading…
Reference in New Issue