fix: add worker token do not update

This commit is contained in:
jialin
2025-11-20 10:31:27 +08:00
parent 2687fb187d
commit 5d383ec39b
11 changed files with 197 additions and 19 deletions
+4 -2
View File
@@ -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 = `
+4 -2
View File
@@ -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 = `
+4 -2
View File
@@ -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 = `
+4 -2
View File
@@ -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 = `
+3 -1
View File
@@ -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();