diff --git a/src/pages/_components/infinite-scroller/index.tsx b/src/pages/_components/infinite-scroller/index.tsx index 432c0f5c..de704a12 100644 --- a/src/pages/_components/infinite-scroller/index.tsx +++ b/src/pages/_components/infinite-scroller/index.tsx @@ -1,3 +1,6 @@ +import { DoubleRightOutlined } from '@ant-design/icons'; +import { useIntl } from '@umijs/max'; +import { Button } from 'antd'; import React from 'react'; import { @@ -9,13 +12,38 @@ const InfiniteScroller: React.FC< UseInfiniteScrollOptions & { children: React.ReactNode } > = (props) => { const { children, ...restProps } = props; - const { observerRef } = useInfiniteScroll(restProps); + const intl = useIntl(); + const { observerRef, throttledLoadMore } = useInfiniteScroll(restProps); return (
{children} -
- +
+ {restProps.current < restProps.total && ( +
+ +
+ )}
); diff --git a/src/pages/_components/infinite-scroller/use-infinite-scroll.ts b/src/pages/_components/infinite-scroller/use-infinite-scroll.ts index 985abd03..f249276e 100644 --- a/src/pages/_components/infinite-scroller/use-infinite-scroll.ts +++ b/src/pages/_components/infinite-scroller/use-infinite-scroll.ts @@ -45,5 +45,5 @@ export function useInfiniteScroll({ } }, [inView, throttledLoadMore]); - return { observerRef }; + return { observerRef, throttledLoadMore }; } diff --git a/src/pages/llmodels/apis/index.ts b/src/pages/llmodels/apis/index.ts index 985e71fc..c25b4824 100644 --- a/src/pages/llmodels/apis/index.ts +++ b/src/pages/llmodels/apis/index.ts @@ -1,4 +1,3 @@ -import { GPUSTACK_API_BASE_URL } from '@/config/settings'; import { ListItem as UserListItem } from '@/pages/users/config/types'; import { downloadFile, listFiles, listModels } from '@huggingface/hub'; import { PipelineType } from '@huggingface/tasks'; @@ -155,9 +154,9 @@ export async function queryModelInstanceLogs(id: number) { // ===================== call huggingface quicksearch api ===================== -const MODEL_SCOPE_LIST_MODEL_API = `https://www.modelscope.cn/api/${GPUSTACK_API_BASE_URL}/dolphin/models`; +const MODEL_SCOPE_LIST_MODEL_API = `https://www.modelscope.cn/api/v1/dolphin/models`; -const MODE_SCOPE_MODEL_FIELS_API = `https://modelscope.cn/api/${GPUSTACK_API_BASE_URL}/models/`; +const MODE_SCOPE_MODEL_FIELS_API = `https://modelscope.cn/api/v1/models/`; export async function queryHuggingfaceModelDetail( params: { repo: string }, diff --git a/src/pages/llmodels/catalog.tsx b/src/pages/llmodels/catalog.tsx index 3e380376..180a74da 100644 --- a/src/pages/llmodels/catalog.tsx +++ b/src/pages/llmodels/catalog.tsx @@ -206,31 +206,6 @@ const Catalog: React.FC = () => { } }, [dataSource.loadend]); - useEffect(() => { - const handleScroll = async () => { - // Determine the scrolling element - const scrollingElement = document.documentElement || document.body; - - // Calculate if the user has scrolled to the bottom - const isAtBottom = - scrollingElement.scrollTop + scrollingElement.clientHeight >= - scrollingElement.scrollHeight - 20; // Adding a small buffer for precision - - if (isAtBottom) { - fetchData({ - ...queryParams, - page: queryParams.page + 1 - }); - } - }; - - window.addEventListener('scroll', handleScroll); - - return () => { - window.removeEventListener('scroll', handleScroll); - }; - }, [fetchData]); - return ( { const navigate = useNavigate(); const { GenericProxyCommandCode, openProxyModal } = useGenericProxy(); - const getProxyEndPoint = useMemoizedFn((categories: string[]) => { - for (const [category, config] of Object.entries(API_MAP)) { - if (categories.includes(category)) { - return `${MODEL_PROXY}${config.api}`; - } - } - return `${window.location.origin}${MODEL_PROXY}/`; - }); - const endPoint = useMemo(() => { if (!data.generic_proxy) { return `${window.location.origin}/${OPENAI_COMPATIBLE}`;