diff --git a/src/components/audio-player/raw-audio-player.tsx b/src/components/audio-player/raw-audio-player.tsx index b27e3a36..10fea230 100644 --- a/src/components/audio-player/raw-audio-player.tsx +++ b/src/components/audio-player/raw-audio-player.tsx @@ -66,8 +66,10 @@ const RawAudioPlayer: React.FC = forwardRef((props, ref) => { audioRef.current.addEventListener('loadeddata', () => { initEnvents(); - initAudioContext(); - generateVisualData(); + if (!audioContext.current) { + initAudioContext(); + generateVisualData(); + } props.onLoadedData?.(); }); @@ -107,12 +109,6 @@ const RawAudioPlayer: React.FC = forwardRef((props, ref) => { }); }; - const handleAudioOnPlay = () => { - audioRef.current?.play(); - }; - - const handleLoadedMetadata = () => {}; - useImperativeHandle(ref, () => ({ play: () => { audioRef.current?.play(); @@ -124,6 +120,8 @@ const RawAudioPlayer: React.FC = forwardRef((props, ref) => { useEffect(() => { if (audioRef.current) { + console.log('audioRef.current', audioRef.current, props.url); + initEnvents(); } return () => { if (audioContext.current) { @@ -150,12 +148,15 @@ const RawAudioPlayer: React.FC = forwardRef((props, ref) => { return ( ); diff --git a/src/components/drop-down-buttons/index.less b/src/components/drop-down-buttons/index.less new file mode 100644 index 00000000..fdefa3d3 --- /dev/null +++ b/src/components/drop-down-buttons/index.less @@ -0,0 +1,4 @@ +.dropdown-button.middle { + height: 28px; + width: 28px; +} diff --git a/src/components/drop-down-buttons/index.tsx b/src/components/drop-down-buttons/index.tsx index df6ac226..7cd08b44 100644 --- a/src/components/drop-down-buttons/index.tsx +++ b/src/components/drop-down-buttons/index.tsx @@ -1,8 +1,10 @@ import { MoreOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; import { Button, Dropdown, Tooltip, type MenuProps } from 'antd'; +import classNames from 'classnames'; import _ from 'lodash'; import { memo } from 'react'; +import './index.less'; interface DropdownButtonsProps { items: MenuProps['items']; @@ -12,7 +14,7 @@ interface DropdownButtonsProps { const DropdownButtons: React.FC = ({ items, - size = 'small', + size = 'middle', onSelect }) => { const intl = useIntl(); @@ -81,12 +83,18 @@ const DropdownButtons: React.FC = ({ key="leftButton" > , - + ]} > )} diff --git a/src/components/seal-table/components/table-row.tsx b/src/components/seal-table/components/table-row.tsx index 474005c3..fdb30e84 100644 --- a/src/components/seal-table/components/table-row.tsx +++ b/src/components/seal-table/components/table-row.tsx @@ -62,14 +62,6 @@ const TableRow: React.FC< } }, [rowSelection]); - // useEffect(() => { - // if (expandedRowKeys?.includes(record[rowKey])) { - // setExpanded(true); - // } else { - // setExpanded(false); - // } - // }, [expandedRowKeys]); - useEffect(() => { return () => { if (pollTimer.current) { @@ -160,8 +152,6 @@ const TableRow: React.FC< pollTimer.current = setInterval(() => { handlePolling(); }, 1000); - } else { - handleLoadChildren(); } }; @@ -179,6 +169,20 @@ const TableRow: React.FC< } }; + useEffect(() => { + if (expandedRowKeys?.includes(record[rowKey])) { + setExpanded(true); + } else { + setExpanded(false); + } + }, [expandedRowKeys]); + + useEffect(() => { + if (expanded) { + handleLoadChildren(); + } + }, [expanded]); + useEffect(() => { if (!firstLoad && expanded) { cacheDataListRef.current = childrenData; diff --git a/src/components/speech-content/speech-item.tsx b/src/components/speech-content/speech-item.tsx index f8b59ee5..ca264d98 100644 --- a/src/components/speech-content/speech-item.tsx +++ b/src/components/speech-content/speech-item.tsx @@ -64,6 +64,7 @@ const SpeechItem: React.FC = (props) => { }, [ref.current]); const handleOnAnalyse = useCallback((data: any, analyser: any) => { + console.log('data+++++++++++++++++=:', data); setAudioChunks((pre: any) => { return { data: data, @@ -88,6 +89,7 @@ const SpeechItem: React.FC = (props) => { const handleOnAudioprocess = useCallback( (current: number) => { + console.log('current:', current); throttleUpdateCurrentTime(current); }, [throttleUpdateCurrentTime] @@ -119,7 +121,7 @@ const SpeechItem: React.FC = (props) => { }; const handleReady = useCallback((duration: number) => { - console.log('duration:', duration); + console.log('ready+++++++++++++++', duration); setDuration(duration); }, []); @@ -159,6 +161,17 @@ const SpeechItem: React.FC = (props) => { onAudioprocess={handleOnAudioprocess} ref={ref} > + {/* */} {isPlay && ( { + setExpandedRowKeys(keys); + }; + + const removeExpandedRowKey = (keys: React.Key[]) => { // remove expanded row keys that are in the deleted keys const newExpandedRowKeys = expandedRowKeys.filter( (key) => !keys.includes(key) @@ -30,6 +34,7 @@ export default function useExpandedRowKeys() { expandedRowKeys, clearExpandedRowKeys, updateExpandedRowKeys, + removeExpandedRowKey, handleExpandChange }; } diff --git a/src/pages/llmodels/components/advance-config.tsx b/src/pages/llmodels/components/advance-config.tsx index 5ffdd69c..865bbf8b 100644 --- a/src/pages/llmodels/components/advance-config.tsx +++ b/src/pages/llmodels/components/advance-config.tsx @@ -36,7 +36,6 @@ interface AdvanceConfigProps { gpuOptions: Array; action: PageActionType; source: string; - modelTask: Record; } const AdvanceConfig: React.FC = (props) => { diff --git a/src/pages/llmodels/components/data-form.tsx b/src/pages/llmodels/components/data-form.tsx index 110a468d..8574b6b2 100644 --- a/src/pages/llmodels/components/data-form.tsx +++ b/src/pages/llmodels/components/data-form.tsx @@ -291,7 +291,7 @@ const DataForm: React.FC = forwardRef((props, ref) => { = forwardRef((props, ref) => { form={form} gpuOptions={gpuOptions} isGGUF={isGGUF} - modelTask={modelTask} action={action} source={props.source} > diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 080a465c..278949eb 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -82,8 +82,12 @@ const Models: React.FC = ({ const intl = useIntl(); const navigate = useNavigate(); const rowSelection = useTableRowSelection(); - const { handleExpandChange, updateExpandedRowKeys, expandedRowKeys } = - useExpandedRowKeys(); + const { + handleExpandChange, + updateExpandedRowKeys, + removeExpandedRowKey, + expandedRowKeys + } = useExpandedRowKeys(); const { sortOrder, setSortOrder } = useTableSort({ defaultSortOrder: 'descend' }); @@ -152,6 +156,20 @@ const Models: React.FC = ({ enabled: !openAddModal && !openDeployModal.show && !openLogModal } ); + useHotkeys( + HotKeys.NEW4.join(','), + () => { + setOpenDeployModal({ + show: true, + width: 600, + source: modelSourceMap.local_path_value + }); + }, + { + preventDefault: true, + enabled: !openAddModal && !openDeployModal.show && !openLogModal + } + ); const sourceOptions = [ { @@ -299,16 +317,20 @@ const Models: React.FC = ({ const result = getSourceRepoConfigValue(openDeployModal.source, data); - await createModel({ + const modelData = await createModel({ data: { ...result.values, ..._.omit(data, result.omits) } }); + console.log('modelData:', modelData); setOpenDeployModal({ ...openDeployModal, show: false }); + setTimeout(() => { + updateExpandedRowKeys([modelData.id]); + }, 300); message.success(intl.formatMessage({ id: 'common.message.success' })); } catch (error) {} }, @@ -324,7 +346,7 @@ const Models: React.FC = ({ name: row.name, async onOk() { await deleteModel(row.id); - updateExpandedRowKeys([row.id]); + removeExpandedRowKey([row.id]); rowSelection.removeSelectedKey(row.id); } }); @@ -336,7 +358,7 @@ const Models: React.FC = ({ async onOk() { await handleBatchRequest(rowSelection.selectedRowKeys, deleteModel); rowSelection.clearSelections(); - updateExpandedRowKeys(rowSelection.selectedRowKeys); + removeExpandedRowKey(rowSelection.selectedRowKeys); } }); }; @@ -386,7 +408,7 @@ const Models: React.FC = ({ async onOk() { await deleteModelInstance(row.id); if (list.length === 1) { - updateExpandedRowKeys([row.model_id]); + removeExpandedRowKey([row.model_id]); } } }); diff --git a/src/pages/llmodels/components/update-modal.tsx b/src/pages/llmodels/components/update-modal.tsx index 51550115..86afb0e4 100644 --- a/src/pages/llmodels/components/update-modal.tsx +++ b/src/pages/llmodels/components/update-modal.tsx @@ -1,3 +1,4 @@ +import IconFont from '@/components/icon-font'; import ModalFooter from '@/components/modal-footer'; import SealAutoComplete from '@/components/seal-form/auto-complete'; import SealInput from '@/components/seal-form/seal-input'; @@ -5,7 +6,7 @@ import SealSelect from '@/components/seal-form/seal-select'; import { PageAction } from '@/config'; import { PageActionType } from '@/config/types'; import { useIntl } from '@umijs/max'; -import { Form, Modal } from 'antd'; +import { Form, Modal, Tooltip, Typography } from 'antd'; import _ from 'lodash'; import React, { memo, useEffect, useMemo, useState } from 'react'; import SimpleBar from 'simplebar-react'; @@ -14,6 +15,7 @@ import { queryGPUList } from '../apis'; import { backendOptionsMap, modelSourceMap, + ollamaModelOptions, setSourceRepoConfigValue } from '../config'; import { FormData, GPUListItem, ListItem } from '../config/types'; @@ -119,7 +121,7 @@ const UpdateModal: React.FC = (props) => { {isGGUF && ( @@ -137,14 +139,12 @@ const UpdateModal: React.FC = (props) => { } ]} > - + disabled={false} + > )} @@ -196,12 +196,31 @@ const UpdateModal: React.FC = (props) => { } ]} > - + + + + + } required - > + > ); @@ -226,7 +245,7 @@ const UpdateModal: React.FC = (props) => { ]} >