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