fix: api info example
This commit is contained in:
@@ -114,7 +114,7 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
||||
if (!data.generic_proxy) {
|
||||
return `${window.location.origin}/${GPUSTACK_API}`;
|
||||
}
|
||||
return getProxyEndPoint(data.categories || []);
|
||||
return `${window.location.origin}${MODEL_PROXY}/<YOUR_API_PATH>`;
|
||||
}, [data]);
|
||||
|
||||
const isRanker = useMemo(() => {
|
||||
@@ -164,11 +164,7 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
||||
></dd>
|
||||
</dl>
|
||||
</Tips>
|
||||
{data.generic_proxy && (
|
||||
<div style={{ paddingLeft: 20, marginBottom: 12 }}>
|
||||
{GenericProxyCommandCode}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<ApiAccessInfoWrapper>
|
||||
<span className="label">
|
||||
{intl.formatMessage({ id: 'models.table.apiAccessInfo.endpoint' })}
|
||||
@@ -224,6 +220,11 @@ const ApiAccessInfo = ({ open, data, onClose }: ApiAccessInfoProps) => {
|
||||
</CreateButton>
|
||||
</span>
|
||||
</ApiAccessInfoWrapper>
|
||||
{data.generic_proxy && (
|
||||
<div style={{ paddingLeft: 20, marginTop: 12 }}>
|
||||
{GenericProxyCommandCode}
|
||||
</div>
|
||||
)}
|
||||
</ScrollerModal>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@ import { generateEmbeddingCurlCode } from '@/pages/playground/view-code/embeddin
|
||||
import { generateImageCurlCode } from '@/pages/playground/view-code/image';
|
||||
import { generateLLmCurlCode } from '@/pages/playground/view-code/llm';
|
||||
import { generateRerankCurlCode } from '@/pages/playground/view-code/rerank';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { useState } from 'react';
|
||||
import { modelCategoriesMap } from '../config';
|
||||
@@ -72,12 +73,15 @@ const API_MAP: Record<
|
||||
}
|
||||
};
|
||||
|
||||
const langOptions = [{ label: 'Curl', value: 'bash' }];
|
||||
|
||||
const useGenericProxy = () => {
|
||||
const [modalStatus, setModalStatus] = useState<{
|
||||
codeValue: string;
|
||||
}>({ codeValue: '' });
|
||||
const intl = useIntl();
|
||||
|
||||
const langOptions = [
|
||||
{ label: intl.formatMessage({ id: 'common.title.example' }), value: 'bash' }
|
||||
];
|
||||
|
||||
const getModelCategory = (categories: string[]) => {
|
||||
for (const [category, config] of Object.entries(API_MAP)) {
|
||||
|
||||
@@ -92,7 +92,9 @@ export const generateTextToSpeechCurlCode = ({
|
||||
parameters
|
||||
}: Record<string, any>) => {
|
||||
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 =========================
|
||||
const curlCode = `
|
||||
|
||||
Reference in New Issue
Block a user