fix: modelscope api incorrect
This commit is contained in:
@@ -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 (
|
||||
<div>
|
||||
{children}
|
||||
<div ref={observerRef} style={{ height: 1 }}>
|
||||
<span></span>
|
||||
<div
|
||||
ref={observerRef}
|
||||
style={{
|
||||
height: 1
|
||||
}}
|
||||
>
|
||||
{restProps.current < restProps.total && (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
marginTop: 24
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
onClick={throttledLoadMore}
|
||||
type="text"
|
||||
size="small"
|
||||
disabled={restProps.loading}
|
||||
>
|
||||
{intl.formatMessage({ id: 'common.button.more' })}
|
||||
<DoubleRightOutlined rotate={90} />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -45,5 +45,5 @@ export function useInfiniteScroll({
|
||||
}
|
||||
}, [inView, throttledLoadMore]);
|
||||
|
||||
return { observerRef };
|
||||
return { observerRef, throttledLoadMore };
|
||||
}
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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 (
|
||||
<PageBox>
|
||||
<FilterBar
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
} from '@/pages/playground/apis';
|
||||
import { BulbOutlined } from '@ant-design/icons';
|
||||
import { useIntl, useNavigate } from '@umijs/max';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { Button, Tag } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
@@ -99,15 +98,6 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
||||
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}/<YOUR_API_PATH>`;
|
||||
});
|
||||
|
||||
const endPoint = useMemo(() => {
|
||||
if (!data.generic_proxy) {
|
||||
return `${window.location.origin}/${OPENAI_COMPATIBLE}`;
|
||||
|
||||
Reference in New Issue
Block a user