fix: audio uploader has cache issue
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
import { ClearOutlined, RightOutlined } from '@ant-design/icons';
|
import { RightOutlined } from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Checkbox, Tooltip } from 'antd';
|
import { Button, Checkbox } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
@@ -77,36 +77,12 @@ const HeaderPrefix: React.FC<HeaderPrefixProps> = (props) => {
|
|||||||
expandable
|
expandable
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
<Tooltip
|
<Checkbox
|
||||||
destroyTooltipOnHide
|
onChange={onSelectAll}
|
||||||
fresh={true}
|
indeterminate={indeterminate}
|
||||||
defaultOpen={false}
|
checked={selectAll}
|
||||||
title={
|
disabled={disabled}
|
||||||
indeterminate && (
|
></Checkbox>
|
||||||
<Button
|
|
||||||
size="small"
|
|
||||||
type="text"
|
|
||||||
variant="filled"
|
|
||||||
color="default"
|
|
||||||
icon={<ClearOutlined />}
|
|
||||||
onClick={handleUnCheckAll}
|
|
||||||
>
|
|
||||||
{intl.formatMessage({ id: 'common.button.clearSelection' })}
|
|
||||||
</Button>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
overlayClassName="light-downloading-tooltip"
|
|
||||||
overlayInnerStyle={{
|
|
||||||
backgroundColor: 'var(--color-spotlight-bg)'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Checkbox
|
|
||||||
onChange={onSelectAll}
|
|
||||||
indeterminate={indeterminate}
|
|
||||||
checked={selectAll}
|
|
||||||
disabled={disabled}
|
|
||||||
></Checkbox>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,10 @@ const UploadAudio: React.FC<UploadAudioProps> = (props) => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnChange = React.useCallback(
|
const handleOnChange = (data: { file: any; fileList: any }) => {
|
||||||
(data: { file: any; fileList: any }) => {
|
props.onChange?.(data);
|
||||||
props.onChange?.(data);
|
};
|
||||||
},
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
overlayInnerStyle={{ maxWidth: 290, width: 'max-content' }}
|
overlayInnerStyle={{ maxWidth: 290, width: 'max-content' }}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
iconSize: 16,
|
iconSize: 16,
|
||||||
iconMarginInlineEnd: 12,
|
iconMarginInlineEnd: 12,
|
||||||
itemBorderRadius: 4,
|
itemBorderRadius: 4,
|
||||||
itemHeight: 44,
|
itemHeight: 36,
|
||||||
itemSelectedColor: '#007BFF',
|
itemSelectedColor: '#007BFF',
|
||||||
darkItemSelectedBg: '#141414',
|
darkItemSelectedBg: '#141414',
|
||||||
darkItemHoverBg: 'rgba(255, 255, 255, 0.03)',
|
darkItemHoverBg: 'rgba(255, 255, 255, 0.03)',
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ export const colorPrimary = '#007BFF';
|
|||||||
export default {
|
export default {
|
||||||
light,
|
light,
|
||||||
dark,
|
dark,
|
||||||
colorPrimary: '#007BFF'
|
colorPrimary: colorPrimary
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export default {
|
|||||||
'common.button.addfile': 'Add File',
|
'common.button.addfile': 'Add File',
|
||||||
'common.logout.msg': 'Log out succeeded',
|
'common.logout.msg': 'Log out succeeded',
|
||||||
'common.button.logout': 'Log out',
|
'common.button.logout': 'Log out',
|
||||||
'common.form.rule.select': 'please select {name}',
|
'common.form.rule.select': 'Please select a {name}',
|
||||||
'common.form.rule.input': '{name} is required',
|
'common.form.rule.input': '{name} is required',
|
||||||
'common.form.key': 'the same key exists',
|
'common.form.key': 'the same key exists',
|
||||||
'common.date.utc': 'UTC time',
|
'common.date.utc': 'UTC time',
|
||||||
|
|||||||
@@ -152,5 +152,5 @@ export default {
|
|||||||
'1. After selection, no further masking can be drawn; therefore, you should draw the mask first and then check the option.\n 2. Once a mask image is uploaded, no further masks can be generated.',
|
'1. After selection, no further masking can be drawn; therefore, you should draw the mask first and then check the option.\n 2. Once a mask image is uploaded, no further masks can be generated.',
|
||||||
'playground.model.noavailable.tips2':
|
'playground.model.noavailable.tips2':
|
||||||
'If the expected model isn’t showing up, make sure it’s running and correctly categorized. If the category is incorrect, you can manually adjust it in the model’s settings.',
|
'If the expected model isn’t showing up, make sure it’s running and correctly categorized. If the category is incorrect, you can manually adjust it in the model’s settings.',
|
||||||
'playground.rerank.query.validate': 'Please enter something to search.'
|
'playground.rerank.query.validate': 'The query is required.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -155,9 +155,9 @@ export default {
|
|||||||
'1. 選択後は追加のマスクを描画できません。そのため、最初にマスクを描画してからオプションを選択してください。\n 2. マスク画像をアップロードすると、追加のマスクを生成することはできません。',
|
'1. 選択後は追加のマスクを描画できません。そのため、最初にマスクを描画してからオプションを選択してください。\n 2. マスク画像をアップロードすると、追加のマスクを生成することはできません。',
|
||||||
'playground.model.noavailable.tips2':
|
'playground.model.noavailable.tips2':
|
||||||
'期待するモデルが表示されない場合は、モデルが実行中で正しく分類されていることを確認してください。カテゴリが間違っている場合は、モデルの設定で手動で調整できます。',
|
'期待するモデルが表示されない場合は、モデルが実行中で正しく分類されていることを確認してください。カテゴリが間違っている場合は、モデルの設定で手動で調整できます。',
|
||||||
'playground.rerank.query.validate': 'Please enter something to search.'
|
'playground.rerank.query.validate': 'The query is required.'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
// 1. 'playground.rerank.query.validate': 'Please enter something to search.'
|
// 1. 'playground.rerank.query.validate': 'The query is required.'
|
||||||
// ========== End of To-Do List ==========
|
// ========== End of To-Do List ==========
|
||||||
|
|||||||
@@ -149,9 +149,9 @@ export default {
|
|||||||
'1. После выделения области создание маски станет недоступным; поэтому сначала нарисуйте маску, а затем активируйте опцию. \n 2. После загрузки изображения маски создание новых масок невозможно.',
|
'1. После выделения области создание маски станет недоступным; поэтому сначала нарисуйте маску, а затем активируйте опцию. \n 2. После загрузки изображения маски создание новых масок невозможно.',
|
||||||
'playground.model.noavailable.tips2':
|
'playground.model.noavailable.tips2':
|
||||||
'Если нужная модель не отображается, убедитесь, что она запущена и ей присвоена правильная категория. Если категория указана неверно, её можно изменить вручную в настройках модели.',
|
'Если нужная модель не отображается, убедитесь, что она запущена и ей присвоена правильная категория. Если категория указана неверно, её можно изменить вручную в настройках модели.',
|
||||||
'playground.rerank.query.validate': 'Please enter something to search.'
|
'playground.rerank.query.validate': 'The query is required.'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
// 1. 'playground.rerank.query.validate': 'Please enter something to search.'
|
// 1. 'playground.rerank.query.validate': 'The query is required.'
|
||||||
// ========== End of To-Do List ==========
|
// ========== End of To-Do List ==========
|
||||||
|
|||||||
@@ -146,5 +146,5 @@ export default {
|
|||||||
'1. 选择后,将不可再绘制遮罩;因此,你应该先绘制遮罩然后再勾选.\n 2. 当上传了遮罩图片,将不可再生成遮罩',
|
'1. 选择后,将不可再绘制遮罩;因此,你应该先绘制遮罩然后再勾选.\n 2. 当上传了遮罩图片,将不可再生成遮罩',
|
||||||
'playground.model.noavailable.tips2':
|
'playground.model.noavailable.tips2':
|
||||||
'若预期的模型未显示,请检查模型是否已正常运行并被正确分类。如分类不正确,请编辑模型并手动调整其类别。',
|
'若预期的模型未显示,请检查模型是否已正常运行并被正确分类。如分类不正确,请编辑模型并手动调整其类别。',
|
||||||
'playground.rerank.query.validate': '请输入搜索内容'
|
'playground.rerank.query.validate': '查询内容不能为空'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const submitMessage = async (query: string) => {
|
const submitMessage = async (query: string) => {
|
||||||
try {
|
try {
|
||||||
setIsEmptyQuery(!queryValue);
|
setIsEmptyQuery(!queryValue);
|
||||||
|
setTokenResult(null);
|
||||||
await formRef.current?.form.validateFields();
|
await formRef.current?.form.validateFields();
|
||||||
|
|
||||||
if (!parameters.model || !queryValue) return;
|
if (!parameters.model || !queryValue) return;
|
||||||
@@ -262,7 +263,7 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
setIsEmptyText(false);
|
setIsEmptyText(false);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setMessageId();
|
setMessageId();
|
||||||
setTokenResult(null);
|
|
||||||
requestToken.current?.cancel?.();
|
requestToken.current?.cancel?.();
|
||||||
requestToken.current = requestSource();
|
requestToken.current = requestSource();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Tooltip } from 'antd';
|
import { Button, Tooltip } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, { useCallback } from 'react';
|
import React from 'react';
|
||||||
import { Roles } from '../../config';
|
import { Roles } from '../../config';
|
||||||
import {
|
import {
|
||||||
AudioFormat,
|
AudioFormat,
|
||||||
@@ -43,18 +43,17 @@ const MessageActions: React.FC<MessageActionsProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const handleUpdateImgList = useCallback(
|
const handleUpdateImgList = (
|
||||||
(list: { uid: number | string; dataUrl: string }[]) => {
|
list: { uid: number | string; dataUrl: string }[]
|
||||||
updateMessage?.({
|
) => {
|
||||||
role: data.role,
|
updateMessage?.({
|
||||||
content: data.content,
|
role: data.role,
|
||||||
uid: data.uid,
|
content: data.content,
|
||||||
audio: data.audio || [],
|
uid: data.uid,
|
||||||
imgs: [...(data.imgs || []), ...list]
|
audio: data.audio || [],
|
||||||
});
|
imgs: [...(data.imgs || []), ...list]
|
||||||
},
|
});
|
||||||
[data, updateMessage]
|
};
|
||||||
);
|
|
||||||
|
|
||||||
const handleUploadAudioChange = async (audio: {
|
const handleUploadAudioChange = async (audio: {
|
||||||
file: any;
|
file: any;
|
||||||
|
|||||||
Reference in New Issue
Block a user