fix: add worker token do not update
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import { GPUSTACK_API, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { GPUSTACK_API, MODEL_PROXY, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { fomatNodeJsParams, formatCurlArgs, formatPyParams } from './utils';
|
||||
|
||||
export const generateSpeechToTextCurlCode = ({
|
||||
@@ -9,7 +9,9 @@ export const generateSpeechToTextCurlCode = ({
|
||||
}: Record<string, any>) => {
|
||||
const host = window.location.origin;
|
||||
// replace url OPENAI_COMPATIBLE with GPUSTACK
|
||||
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 = `
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GPUSTACK_API, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { GPUSTACK_API, MODEL_PROXY, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { fomatNodeJsParams, formatCurlArgs, formatPyParams } from './utils';
|
||||
|
||||
export const generateEmbeddingCurlCode = ({
|
||||
@@ -7,7 +7,9 @@ export const generateEmbeddingCurlCode = ({
|
||||
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 = `
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import { GPUSTACK_API, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { GPUSTACK_API, MODEL_PROXY, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { fomatNodeJsParams, formatCurlArgs, formatPyParams } from './utils';
|
||||
|
||||
export const generateImageCurlCode = ({
|
||||
@@ -10,7 +10,9 @@ export const generateImageCurlCode = ({
|
||||
edit = false
|
||||
}: 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 =========================
|
||||
let curlCode = `
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GPUSTACK_API, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { GPUSTACK_API, MODEL_PROXY, OPENAI_COMPATIBLE } from '../apis';
|
||||
import { fomatNodeJsParams, formatCurlArgs, formatPyParams } from './utils';
|
||||
|
||||
export const generateLLmCurlCode = ({
|
||||
@@ -7,7 +7,9 @@ export const generateLLmCurlCode = ({
|
||||
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 = `
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { MODEL_PROXY } from '../apis';
|
||||
import { formatCurlArgs } from './utils';
|
||||
|
||||
export const generateRerankCurlCode = ({
|
||||
@@ -6,10 +7,11 @@ export const generateRerankCurlCode = ({
|
||||
parameters
|
||||
}: Record<string, any>) => {
|
||||
const host = window.location.origin;
|
||||
const apiUrl = modelProxy ? `${MODEL_PROXY}/\${YOUR_API_PATH}` : api;
|
||||
|
||||
// ========================= Curl =========================
|
||||
const curlCode = `
|
||||
curl ${host}${api} \\
|
||||
curl ${host}${apiUrl} \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-H "Authorization: Bearer $\{YOUR_GPUSTACK_API_KEY}" \\${modelProxy ? `\n-H "X-GPUStack-Model: ${parameters.model}" \\` : ''}
|
||||
${formatCurlArgs(parameters, false)}`.trim();
|
||||
|
||||
Reference in New Issue
Block a user