chore: config base url
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { GPUStackVersionAtom, UpdateCheckAtom } from '@/atoms/user';
|
||||
import { setAtomStorage } from '@/atoms/utils';
|
||||
import { DEFAULT_ENTER_PAGE } from '@/config/settings';
|
||||
import { DEFAULT_ENTER_PAGE, GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { requestConfig } from '@/request-config';
|
||||
import {
|
||||
queryCurrentUserState,
|
||||
@@ -105,6 +105,6 @@ export async function getInitialState(): Promise<{
|
||||
}
|
||||
|
||||
export const request: RequestConfig = {
|
||||
baseURL: ' /v1',
|
||||
baseURL: `/${GPUSTACK_API_BASE_URL}`,
|
||||
...requestConfig
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { convertFileSize } from '@/utils';
|
||||
import { throttle } from 'lodash';
|
||||
import qs from 'query-string';
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
const GPUSTACK_API = GPUSTACK_API_BASE_URL;
|
||||
export interface HandlerOptions {
|
||||
isComplete?: boolean | null;
|
||||
percent?: number;
|
||||
@@ -168,7 +170,7 @@ const useSetChunkFetch = () => {
|
||||
axiosToken.current = new AbortController();
|
||||
try {
|
||||
const response = await fetch(
|
||||
`v1${url}?${qs.stringify({
|
||||
`${GPUSTACK_API}${url}?${qs.stringify({
|
||||
...params,
|
||||
watch: watch === undefined ? true : watch
|
||||
})}`,
|
||||
|
||||
@@ -2,6 +2,7 @@ import MindIELogo from '@/assets/logo/ascend.png';
|
||||
import SGLangLogo from '@/assets/logo/sglang.png';
|
||||
import vLLMLogo from '@/assets/logo/vllm.png';
|
||||
import icons from '@/components/icon-font/icons';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { backendOptionsMap } from '@/pages/llmodels/config/backend-parameters';
|
||||
import jsYaml from 'js-yaml';
|
||||
import { trim } from 'lodash';
|
||||
@@ -173,7 +174,7 @@ export const yamlTemplate = `# backend configuration template
|
||||
backend_name: my-backend-custom
|
||||
description: this is my-backend
|
||||
default_version: v0.5.1
|
||||
health_check_path: /v1/models
|
||||
health_check_path: /${GPUSTACK_API_BASE_URL}/models
|
||||
default_backend_param:
|
||||
- --host
|
||||
default_run_command: myBackend serve {{model_path}} --port {{port}}
|
||||
|
||||
@@ -2,6 +2,7 @@ import ListInput from '@/components/list-input';
|
||||
import SealInput from '@/components/seal-form/seal-input';
|
||||
import SealTextArea from '@/components/seal-form/seal-textarea';
|
||||
import { PageAction } from '@/config';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { PageActionType } from '@/config/types';
|
||||
import useAppUtils from '@/hooks/use-app-utils';
|
||||
import { useIntl } from '@umijs/max';
|
||||
@@ -47,7 +48,7 @@ const BasicForm: React.FC<AddModalProps> = ({ action, currentData }) => {
|
||||
trim
|
||||
placeholder={intl.formatMessage(
|
||||
{ id: 'common.help.default' },
|
||||
{ content: '/v1/models' }
|
||||
{ content: `/${GPUSTACK_API_BASE_URL}/models` }
|
||||
)}
|
||||
label={intl.formatMessage({ id: 'backend.form.healthCheckPath' })}
|
||||
></SealInput.Input>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import icons from '@/components/icon-font/icons';
|
||||
import { StatusMaps } from '@/config';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { StatusType } from '@/config/types';
|
||||
|
||||
export const ClusterStatusValueMap = {
|
||||
@@ -43,7 +44,7 @@ export const generateRegisterCommand = (params: {
|
||||
clusterId: number;
|
||||
registrationToken: string;
|
||||
}) => {
|
||||
return `curl -k -L '${params.server}/v1/clusters/${params.clusterId}/manifests' \\
|
||||
return `curl -k -L '${params.server}/${GPUSTACK_API_BASE_URL}/clusters/${params.clusterId}/manifests' \\
|
||||
--header 'Authorization: Bearer ${params.registrationToken}' | kubectl apply -f -`;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
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';
|
||||
@@ -154,10 +155,9 @@ export async function queryModelInstanceLogs(id: number) {
|
||||
|
||||
// ===================== call huggingface quicksearch api =====================
|
||||
|
||||
const MODEL_SCOPE_LIST_MODEL_API =
|
||||
'https://www.modelscope.cn/api/v1/dolphin/models';
|
||||
const MODEL_SCOPE_LIST_MODEL_API = `https://www.modelscope.cn/api/${GPUSTACK_API_BASE_URL}/dolphin/models`;
|
||||
|
||||
const MODE_SCOPE_MODEL_FIELS_API = 'https://modelscope.cn/api/v1/models/';
|
||||
const MODE_SCOPE_MODEL_FIELS_API = `https://modelscope.cn/api/${GPUSTACK_API_BASE_URL}/models/`;
|
||||
|
||||
export async function queryHuggingfaceModelDetail(
|
||||
params: { repo: string },
|
||||
|
||||
@@ -2,6 +2,7 @@ import AutoTooltip from '@/components/auto-tooltip';
|
||||
import CopyButton from '@/components/copy-button';
|
||||
import IconFont from '@/components/icon-font';
|
||||
import ScrollerModal from '@/components/scroller-modal';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { BulbOutlined } from '@ant-design/icons';
|
||||
import { useIntl, useNavigate } from '@umijs/max';
|
||||
import { Button, Tag } from 'antd';
|
||||
@@ -10,6 +11,8 @@ import { useMemo } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { modelCategoriesMap } from '../config';
|
||||
|
||||
const GPUSTACK_API = GPUSTACK_API_BASE_URL;
|
||||
|
||||
const ApiAccessInfoWrapper = styled.div`
|
||||
display: grid;
|
||||
padding-left: 20px;
|
||||
@@ -64,7 +67,7 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
||||
const intl = useIntl();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const endPoint = `${window.location.origin}/v1`;
|
||||
const endPoint = `${window.location.origin}/${GPUSTACK_API}`;
|
||||
|
||||
const isRanker = useMemo(() => {
|
||||
return _.includes(data.categories, modelCategoriesMap.reranker);
|
||||
|
||||
@@ -2,6 +2,7 @@ import IconFont from '@/components/icon-font';
|
||||
import MarkdownViewer from '@/components/markdown-viewer';
|
||||
import SimpleOverlay from '@/components/simple-overlay';
|
||||
import ThemeTag from '@/components/tags-wrapper/theme-tag';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import useRequestToken from '@/hooks/use-request-token';
|
||||
import {
|
||||
DownOutlined,
|
||||
@@ -277,7 +278,7 @@ const ModelCard: React.FC<{
|
||||
return '';
|
||||
}
|
||||
if (modelSource === modelSourceMap.modelscope_value) {
|
||||
return `https://modelscope.cn/api/v1/models/${modelData?.name}/repo?Revision=${modelData?.Revision}&View=true&FilePath=${imgSrc}`;
|
||||
return `https://modelscope.cn/api/${GPUSTACK_API_BASE_URL}/models/${modelData?.name}/repo?Revision=${modelData?.Revision}&View=true&FilePath=${imgSrc}`;
|
||||
}
|
||||
if (modelSource === modelSourceMap.huggingface_value) {
|
||||
return `https://huggingface.co/${modelData?.id}/resolve/main/${imgSrc}`;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SealInput from '@/components/seal-form/seal-input';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import { modelNameReg } from '@/config';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import useAppUtils from '@/hooks/use-app-utils';
|
||||
import {
|
||||
ClusterStatusLabelMap,
|
||||
@@ -149,7 +150,7 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
|
||||
required
|
||||
description={intl.formatMessage(
|
||||
{ id: 'models.form.replicas.tips' },
|
||||
{ api: `${window.location.origin}/v1` }
|
||||
{ api: `${window.location.origin}/${GPUSTACK_API_BASE_URL}` }
|
||||
)}
|
||||
min={0}
|
||||
></SealInput.Number>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import AutoTooltip from '@/components/auto-tooltip';
|
||||
import DropdownButtons from '@/components/drop-down-buttons';
|
||||
import { SealColumnProps } from '@/components/seal-table/types';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Tooltip } from 'antd';
|
||||
@@ -74,7 +75,7 @@ const useModelsColumns = ({
|
||||
<Tooltip
|
||||
title={intl.formatMessage(
|
||||
{ id: 'models.form.replicas.tips' },
|
||||
{ api: `${window.location.origin}/v1` }
|
||||
{ api: `${window.location.origin}/${GPUSTACK_API_BASE_URL}` }
|
||||
)}
|
||||
>
|
||||
<span style={{ fontWeight: 'var(--font-weight-medium)' }}>
|
||||
|
||||
@@ -140,25 +140,10 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
};
|
||||
|
||||
const generateParams = () => {
|
||||
// preview
|
||||
let stream_options: Record<string, any> = {
|
||||
chunk_size: 16 * 1024,
|
||||
chunk_results: true
|
||||
};
|
||||
|
||||
if (parameters.preview) {
|
||||
stream_options = {
|
||||
preview_faster: true
|
||||
};
|
||||
}
|
||||
|
||||
const params = {
|
||||
..._.omitBy(finalParameters, (value: string) => !value),
|
||||
seed: parameters.random_seed ? generateRandomNumber() : parameters.seed,
|
||||
stream: true,
|
||||
stream_options: {
|
||||
...stream_options
|
||||
},
|
||||
stream: false,
|
||||
prompt: currentPrompt
|
||||
};
|
||||
return params;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import AlertInfo from '@/components/alert-info';
|
||||
import SealInputNumber from '@/components/seal-form/input-number';
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
||||
import useRequestToken from '@/hooks/use-request-token';
|
||||
import {
|
||||
@@ -201,7 +202,7 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
|
||||
const viewCodeContent = useMemo(() => {
|
||||
return generateRerankCode({
|
||||
api: '/v1/rerank',
|
||||
api: `/${GPUSTACK_API_BASE_URL}/rerank`,
|
||||
parameters: {
|
||||
..._.pick(parameters, ['model', ..._.split(formFields, ',')]),
|
||||
query: queryValue,
|
||||
|
||||
@@ -165,23 +165,10 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
};
|
||||
|
||||
const generateParams = () => {
|
||||
// preview
|
||||
let stream_options: Record<string, any> = {
|
||||
stream_options_chunk_size: 16 * 1024,
|
||||
stream_options_chunk_result: true
|
||||
};
|
||||
|
||||
if (parameters.preview) {
|
||||
stream_options = {
|
||||
stream_options_preview_faster: true
|
||||
};
|
||||
}
|
||||
|
||||
const params = {
|
||||
..._.omitBy(finalParameters, (value: string) => !value),
|
||||
seed: parameters.random_seed ? generateRandomNumber() : parameters.seed,
|
||||
stream: true,
|
||||
...stream_options,
|
||||
stream: false,
|
||||
prompt: currentPrompt
|
||||
};
|
||||
return params;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import _ from 'lodash';
|
||||
import { CREAT_IMAGE_API } from '../apis';
|
||||
import { AudioData, MessageItem } from './types';
|
||||
@@ -118,7 +119,7 @@ export const OpenAIViewCode = {
|
||||
}
|
||||
},
|
||||
rerank: {
|
||||
api: '/v1/rerank',
|
||||
api: `/${GPUSTACK_API_BASE_URL}/rerank`,
|
||||
logcommand: {
|
||||
python: 'json()',
|
||||
node: 'data'
|
||||
|
||||
@@ -450,19 +450,6 @@ export const ImageAdvancedParamsConfig: ParamsSchema[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'Switch',
|
||||
name: 'preview',
|
||||
label: {
|
||||
text: 'Preview',
|
||||
isLocalized: false
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'InputNumber',
|
||||
name: 'seed',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||
import { downloadFile } from '@/utils/download-stream';
|
||||
import { request } from '@umijs/max';
|
||||
import { message } from 'antd';
|
||||
@@ -24,7 +25,9 @@ export async function downloadWorkerPrivateKey({
|
||||
name?: string;
|
||||
}) {
|
||||
try {
|
||||
const res = await fetch(`/v1${WORKERS_API}/${id}/privatekey`);
|
||||
const res = await fetch(
|
||||
`/${GPUSTACK_API_BASE_URL}${WORKERS_API}/${id}/privatekey`
|
||||
);
|
||||
// header
|
||||
const contentDispostion = res.headers.get('content-Disposition');
|
||||
const filename =
|
||||
|
||||
Reference in New Issue
Block a user