fix: api info example
This commit is contained in:
@@ -264,5 +264,6 @@ export default {
|
|||||||
'common.help.default': 'Default: {content}',
|
'common.help.default': 'Default: {content}',
|
||||||
'common.filter.status': 'Filter by status',
|
'common.filter.status': 'Filter by status',
|
||||||
'common.form.rule.selectInput': 'Please select or enter a {name}',
|
'common.form.rule.selectInput': 'Please select or enter a {name}',
|
||||||
'common.tag.experimental': 'Experimental'
|
'common.tag.experimental': 'Experimental',
|
||||||
|
'common.title.example': 'Example'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -264,7 +264,8 @@ export default {
|
|||||||
'common.help.default': 'Default: {content}',
|
'common.help.default': 'Default: {content}',
|
||||||
'common.filter.status': 'Filter by status',
|
'common.filter.status': 'Filter by status',
|
||||||
'common.form.rule.selectInput': 'Please select or enter a {name}',
|
'common.form.rule.selectInput': 'Please select or enter a {name}',
|
||||||
'common.tag.experimental': 'Experimental'
|
'common.tag.experimental': 'Experimental',
|
||||||
|
'common.title.example': 'Example'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
@@ -295,4 +296,5 @@ export default {
|
|||||||
// 25. 'common.filter.status': 'Filter by status'
|
// 25. 'common.filter.status': 'Filter by status'
|
||||||
// 26. 'common.form.rule.selectInput': 'Please select or enter a {name}',
|
// 26. 'common.form.rule.selectInput': 'Please select or enter a {name}',
|
||||||
// 27. 'common.tag.experimental': 'Experimental',
|
// 27. 'common.tag.experimental': 'Experimental',
|
||||||
|
// 28. 'common.title.example': 'Example'
|
||||||
// ========== End of To-Do List ==========
|
// ========== End of To-Do List ==========
|
||||||
|
|||||||
@@ -263,11 +263,13 @@ export default {
|
|||||||
'common.help.default': 'По умолчанию: {content}',
|
'common.help.default': 'По умолчанию: {content}',
|
||||||
'common.filter.status': 'Filter by status',
|
'common.filter.status': 'Filter by status',
|
||||||
'common.form.rule.selectInput': 'Please select or enter a {name}',
|
'common.form.rule.selectInput': 'Please select or enter a {name}',
|
||||||
'common.tag.experimental': 'Experimental'
|
'common.tag.experimental': 'Experimental',
|
||||||
|
'common.title.example': 'Example'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
// 1. 'common.filter.status': 'Filter by status'
|
// 1. 'common.filter.status': 'Filter by status'
|
||||||
// 2. 'common.form.rule.selectInput': 'Please select or enter a {name}',
|
// 2. 'common.form.rule.selectInput': 'Please select or enter a {name}',
|
||||||
// 3. 'common.tag.experimental': 'Experimental'
|
// 3. 'common.tag.experimental': 'Experimental',
|
||||||
|
// 4. 'common.title.example': 'Example'
|
||||||
// ========== End of To-Do List ==========
|
// ========== End of To-Do List ==========
|
||||||
|
|||||||
@@ -256,5 +256,6 @@ export default {
|
|||||||
'common.help.default': '默认: {content}',
|
'common.help.default': '默认: {content}',
|
||||||
'common.filter.status': '按状态筛选',
|
'common.filter.status': '按状态筛选',
|
||||||
'common.form.rule.selectInput': '请选择或输入{name}',
|
'common.form.rule.selectInput': '请选择或输入{name}',
|
||||||
'common.tag.experimental': '实验性'
|
'common.tag.experimental': '实验性',
|
||||||
|
'common.title.example': '示例'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
|||||||
if (!data.generic_proxy) {
|
if (!data.generic_proxy) {
|
||||||
return `${window.location.origin}/${GPUSTACK_API}`;
|
return `${window.location.origin}/${GPUSTACK_API}`;
|
||||||
}
|
}
|
||||||
return getProxyEndPoint(data.categories || []);
|
return `${window.location.origin}${MODEL_PROXY}/<YOUR_API_PATH>`;
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const isRanker = useMemo(() => {
|
const isRanker = useMemo(() => {
|
||||||
@@ -164,11 +164,7 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
|||||||
></dd>
|
></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</Tips>
|
</Tips>
|
||||||
{data.generic_proxy && (
|
|
||||||
<div style={{ paddingLeft: 20, marginBottom: 12 }}>
|
|
||||||
{GenericProxyCommandCode}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<ApiAccessInfoWrapper>
|
<ApiAccessInfoWrapper>
|
||||||
<span className="label">
|
<span className="label">
|
||||||
{intl.formatMessage({ id: 'models.table.apiAccessInfo.endpoint' })}
|
{intl.formatMessage({ id: 'models.table.apiAccessInfo.endpoint' })}
|
||||||
@@ -224,6 +220,11 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
|||||||
</CreateButton>
|
</CreateButton>
|
||||||
</span>
|
</span>
|
||||||
</ApiAccessInfoWrapper>
|
</ApiAccessInfoWrapper>
|
||||||
|
{data.generic_proxy && (
|
||||||
|
<div style={{ paddingLeft: 20, marginTop: 12 }}>
|
||||||
|
{GenericProxyCommandCode}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</ScrollerModal>
|
</ScrollerModal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { generateEmbeddingCurlCode } from '@/pages/playground/view-code/embeddin
|
|||||||
import { generateImageCurlCode } from '@/pages/playground/view-code/image';
|
import { generateImageCurlCode } from '@/pages/playground/view-code/image';
|
||||||
import { generateLLmCurlCode } from '@/pages/playground/view-code/llm';
|
import { generateLLmCurlCode } from '@/pages/playground/view-code/llm';
|
||||||
import { generateRerankCurlCode } from '@/pages/playground/view-code/rerank';
|
import { generateRerankCurlCode } from '@/pages/playground/view-code/rerank';
|
||||||
|
import { useIntl } from '@umijs/max';
|
||||||
import { useMemoizedFn } from 'ahooks';
|
import { useMemoizedFn } from 'ahooks';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { modelCategoriesMap } from '../config';
|
import { modelCategoriesMap } from '../config';
|
||||||
@@ -72,12 +73,15 @@ const API_MAP: Record<
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const langOptions = [{ label: 'Curl', value: 'bash' }];
|
|
||||||
|
|
||||||
const useGenericProxy = () => {
|
const useGenericProxy = () => {
|
||||||
const [modalStatus, setModalStatus] = useState<{
|
const [modalStatus, setModalStatus] = useState<{
|
||||||
codeValue: string;
|
codeValue: string;
|
||||||
}>({ codeValue: '' });
|
}>({ codeValue: '' });
|
||||||
|
const intl = useIntl();
|
||||||
|
|
||||||
|
const langOptions = [
|
||||||
|
{ label: intl.formatMessage({ id: 'common.title.example' }), value: 'bash' }
|
||||||
|
];
|
||||||
|
|
||||||
const getModelCategory = (categories: string[]) => {
|
const getModelCategory = (categories: string[]) => {
|
||||||
for (const [category, config] of Object.entries(API_MAP)) {
|
for (const [category, config] of Object.entries(API_MAP)) {
|
||||||
|
|||||||
@@ -92,7 +92,9 @@ export const generateTextToSpeechCurlCode = ({
|
|||||||
parameters
|
parameters
|
||||||
}: Record<string, any>) => {
|
}: Record<string, any>) => {
|
||||||
const host = window.location.origin;
|
const host = window.location.origin;
|
||||||
const api = url.replace(OPENAI_COMPATIBLE, GPUSTACK_API);
|
const api = modelProxy
|
||||||
|
? `${MODEL_PROXY}/\${YOUR_API_PATH}`
|
||||||
|
: url.replace(OPENAI_COMPATIBLE, GPUSTACK_API);
|
||||||
|
|
||||||
// ========================= Curl =========================
|
// ========================= Curl =========================
|
||||||
const curlCode = `
|
const curlCode = `
|
||||||
|
|||||||
Reference in New Issue
Block a user