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