chore: audio page keepalive
This commit is contained in:
@@ -186,6 +186,7 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
|
||||
[intl]
|
||||
);
|
||||
const renderFields = useMemo(() => {
|
||||
console.log('paramsConfig++++++++++++');
|
||||
if (!paramsConfig?.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
};
|
||||
|
||||
const joinMessage = (chunk: any) => {
|
||||
console.log('chunk:', chunk);
|
||||
setTokenResult({
|
||||
...(chunk?.usage ?? {})
|
||||
});
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { setRouteCache } from '@/atoms/route-cache';
|
||||
import AlertInfo from '@/components/alert-info';
|
||||
import AudioAnimation from '@/components/audio-animation';
|
||||
import AudioPlayer from '@/components/audio-player';
|
||||
import CopyButton from '@/components/copy-button';
|
||||
import IconFont from '@/components/icon-font';
|
||||
import UploadAudio from '@/components/upload-audio';
|
||||
import routeCachekey from '@/config/route-cachekey';
|
||||
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
||||
import { useCancelToken } from '@/hooks/use-request-token';
|
||||
import { readAudioFile } from '@/utils/load-audio-file';
|
||||
@@ -116,6 +118,8 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
|
||||
cancelRequest();
|
||||
updateCancelToken();
|
||||
|
||||
setRouteCache(routeCachekey['/playground/speech'], true);
|
||||
const params = {
|
||||
...parameters,
|
||||
file: new File([audioData.data], audioData.name, {
|
||||
@@ -169,6 +173,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
setIsRecording(false);
|
||||
setRouteCache(routeCachekey['/playground/speech'], false);
|
||||
}
|
||||
};
|
||||
const handleClear = () => {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { setRouteCache } from '@/atoms/route-cache';
|
||||
import AlertInfo from '@/components/alert-info';
|
||||
import IconFont from '@/components/icon-font';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import SpeechContent from '@/components/speech-content';
|
||||
import routeCachekey from '@/config/route-cachekey';
|
||||
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
||||
import { SendOutlined } from '@ant-design/icons';
|
||||
import { getLocale, useIntl, useSearchParams } from '@umijs/max';
|
||||
@@ -157,6 +159,8 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
setCurrentPrompt(current?.content || '');
|
||||
setMessageList([]);
|
||||
|
||||
setRouteCache(routeCachekey['/playground/speech'], true);
|
||||
|
||||
controllerRef.current?.abort?.();
|
||||
controllerRef.current = new AbortController();
|
||||
const signal = controllerRef.current.signal;
|
||||
@@ -214,6 +218,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
setRouteCache(routeCachekey['/playground/speech'], false);
|
||||
}
|
||||
};
|
||||
const handleClear = () => {
|
||||
|
||||
@@ -643,7 +643,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
type="icon-upload_image"
|
||||
className="font-size-24"
|
||||
></IconFont>
|
||||
<h3>Click or drag image to this area to upload</h3>
|
||||
<h3>{intl.formatMessage({ id: 'playground.image.edit.tips' })}</h3>
|
||||
</div>
|
||||
</UploadImg>
|
||||
);
|
||||
|
||||
@@ -102,13 +102,15 @@ const Playground: React.FC = () => {
|
||||
const getTextToSpeechModels = async () => {
|
||||
try {
|
||||
const params = {
|
||||
categories: 'text_to_speech'
|
||||
categories: 'text_to_speech',
|
||||
with_meta: true
|
||||
};
|
||||
const res = await queryModelsList(params);
|
||||
const list = _.map(res.data || [], (item: any) => {
|
||||
return {
|
||||
value: item.id,
|
||||
label: item.id
|
||||
label: item.id,
|
||||
meta: item.meta
|
||||
};
|
||||
}) as Global.BaseOption<string>[];
|
||||
return list;
|
||||
@@ -120,13 +122,15 @@ const Playground: React.FC = () => {
|
||||
const getSpeechToText = async () => {
|
||||
try {
|
||||
const params = {
|
||||
categories: 'speech_to_text'
|
||||
categories: 'speech_to_text',
|
||||
with_meta: true
|
||||
};
|
||||
const res = await queryModelsList(params);
|
||||
const list = _.map(res.data || [], (item: any) => {
|
||||
return {
|
||||
value: item.id,
|
||||
label: item.id
|
||||
label: item.id,
|
||||
meta: item.meta
|
||||
};
|
||||
}) as Global.BaseOption<string>[];
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user