fix: backend updateable when local path
This commit is contained in:
@@ -41,8 +41,14 @@ const LogsList: React.FC<LogsListProps> = forwardRef((props, ref) => {
|
||||
updateScrollerPosition(0);
|
||||
}, [updateScrollerPosition]);
|
||||
|
||||
const debounceResetStopScroll = _.debounce(() => {
|
||||
stopScroll.current = false;
|
||||
}, 30000);
|
||||
|
||||
const scrollToTop = useCallback(() => {
|
||||
stopScroll.current = true;
|
||||
updateScrollerPositionToTop();
|
||||
debounceResetStopScroll();
|
||||
}, [updateScrollerPositionToTop]);
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
@@ -50,10 +56,6 @@ const LogsList: React.FC<LogsListProps> = forwardRef((props, ref) => {
|
||||
scrollToTop
|
||||
}));
|
||||
|
||||
const debounceResetStopScroll = _.debounce(() => {
|
||||
stopScroll.current = false;
|
||||
}, 30000);
|
||||
|
||||
const handleOnWheel = useCallback(
|
||||
(e: any) => {
|
||||
const scrollTop = scrollEventElement?.scrollTop;
|
||||
|
||||
@@ -13,7 +13,7 @@ interface LogsPaginationProps {
|
||||
}
|
||||
|
||||
const LogsPagination: React.FC<LogsPaginationProps> = (props) => {
|
||||
const { page, total, pageSize, onNext, onPrev } = props;
|
||||
const { page, total, pageSize, onWheel, onNext, onPrev } = props;
|
||||
const intl = useIntl();
|
||||
|
||||
const handleOnPrev = () => {
|
||||
|
||||
@@ -181,6 +181,18 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
|
||||
[loading, isLoadend, logs.length, pageSize]
|
||||
);
|
||||
|
||||
const debouncedScroll = useCallback(
|
||||
_.debounce(() => {
|
||||
if (scrollPos[0] === 'top') {
|
||||
logListRef.current?.scrollToTop();
|
||||
}
|
||||
if (scrollPos[0] === 'bottom') {
|
||||
logListRef.current?.scrollToBottom();
|
||||
}
|
||||
}, 150),
|
||||
[scrollPos]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
createChunkConnection();
|
||||
return () => {
|
||||
@@ -189,12 +201,7 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
|
||||
}, [url, props.params]);
|
||||
|
||||
useEffect(() => {
|
||||
if (scrollPos[0] === 'top') {
|
||||
logListRef.current?.scrollToTop();
|
||||
}
|
||||
if (scrollPos[0] === 'bottom') {
|
||||
logListRef.current?.scrollToBottom();
|
||||
}
|
||||
debouncedScroll();
|
||||
}, [scrollPos]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -17,7 +17,11 @@ import {
|
||||
} from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { backendOptionsMap, placementStrategyOptions } from '../config';
|
||||
import {
|
||||
backendOptionsMap,
|
||||
modelSourceMap,
|
||||
placementStrategyOptions
|
||||
} from '../config';
|
||||
import llamaConfig from '../config/llama-config';
|
||||
import { FormData } from '../config/types';
|
||||
import vllmConfig from '../config/vllm-config';
|
||||
@@ -29,10 +33,11 @@ interface AdvanceConfigProps {
|
||||
form: FormInstance;
|
||||
gpuOptions: Array<any>;
|
||||
action: PageActionType;
|
||||
source: string;
|
||||
}
|
||||
|
||||
const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
const { form, gpuOptions, isGGUF, action } = props;
|
||||
const { form, gpuOptions, isGGUF, action, source } = props;
|
||||
|
||||
const intl = useIntl();
|
||||
const wokerSelector = Form.useWatch('worker_selector', form);
|
||||
@@ -239,15 +244,20 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
{
|
||||
label: `llama-box(llama.cpp)`,
|
||||
value: backendOptionsMap.llamaBox,
|
||||
disabled: !isGGUF
|
||||
disabled:
|
||||
source === modelSourceMap.local_path_value ? false : !isGGUF
|
||||
},
|
||||
{
|
||||
label: 'vLLM',
|
||||
value: backendOptionsMap.vllm,
|
||||
disabled: isGGUF
|
||||
disabled:
|
||||
source === modelSourceMap.local_path_value ? false : isGGUF
|
||||
}
|
||||
]}
|
||||
disabled={action === PageAction.EDIT}
|
||||
disabled={
|
||||
action === PageAction.EDIT &&
|
||||
source !== modelSourceMap.local_path_value
|
||||
}
|
||||
></SealSelect>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData> name="backend_parameters">
|
||||
|
||||
@@ -446,6 +446,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
gpuOptions={gpuOptions}
|
||||
isGGUF={isGGUF}
|
||||
action={action}
|
||||
source={props.source}
|
||||
></AdvanceConfig>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -461,7 +461,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
return `${modelSourceMap.huggingface}/${record.huggingface_repo_id}`;
|
||||
}
|
||||
if (record.source === modelSourceMap.local_path_value) {
|
||||
return `${modelSourceMap.local_path} ${record.local_path}`;
|
||||
return `${modelSourceMap.local_path}${record.local_path}`;
|
||||
}
|
||||
if (record.source === modelSourceMap.ollama_library_value) {
|
||||
return `${modelSourceMap.ollama_library}/${record.ollama_library_model_name}`;
|
||||
|
||||
@@ -424,6 +424,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
form={form}
|
||||
gpuOptions={gpuOptions}
|
||||
action={PageAction.EDIT}
|
||||
source={props.data?.source || ''}
|
||||
isGGUF={props.data?.backend === backendOptionsMap.llamaBox}
|
||||
></AdvanceConfig>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user