fix: fixed the problem that the api will be called directly after selecting the chat assistant picture (#1034)

### What problem does this PR solve?

fix: fixed the problem that the api will be called directly after
selecting the chat assistant picture #1033

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-06-03 13:42:56 +08:00
committed by GitHub
parent cc064040a2
commit 9517a27844
3 changed files with 10 additions and 13 deletions

View File

@ -24,12 +24,10 @@ const AssistantSetting = ({ show }: ISegmentedContentProps) => {
const uploadButtion = (
<button style={{ border: 0, background: 'none' }} type="button">
<PlusOutlined />
<div style={{ marginTop: 8 }}>
{t('upload', { keyPrefix: 'common' })}
</div>
</button>
)
<PlusOutlined />
<div style={{ marginTop: 8 }}>{t('upload', { keyPrefix: 'common' })}</div>
</button>
);
return (
<section
@ -53,6 +51,7 @@ const AssistantSetting = ({ show }: ISegmentedContentProps) => {
<Upload
listType="picture-card"
maxCount={1}
beforeUpload={() => false}
showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
>
{show ? uploadButtion : null}

View File

@ -19,6 +19,7 @@ import ModelSetting from './model-setting';
import PromptEngine from './prompt-engine';
import { useTranslate } from '@/hooks/commonHooks';
import { getBase64FromUploadFileList } from '@/utils/fileUtil';
import styles from './index.less';
const layout = {
@ -82,12 +83,7 @@ const ChatConfigurationModal = ({
]);
const emptyResponse = nextValues.prompt_config?.empty_response ?? '';
const fileList = values.icon;
let icon;
if (Array.isArray(fileList) && fileList.length > 0) {
icon = fileList[0].thumbUrl;
}
const icon = await getBase64FromUploadFileList(values.icon);
const finalValues = {
dialog_id: initialDialog.id,