chore: download progress

This commit is contained in:
jialin
2025-02-27 18:03:28 +08:00
parent 8464e0ea3f
commit 295b4b3b72
14 changed files with 441 additions and 289 deletions
+5 -4
View File
@@ -1,11 +1,12 @@
import { OPENAI_COMPATIBLE } from '../apis';
import { GPUSTACK_API, OPENAI_COMPATIBLE } from '../apis';
import { fomatNodeJsParams, formatCurlArgs, formatPyParams } from './utils';
export const generateEmbeddingCode = ({
api,
api: url,
parameters
}: Record<string, any>) => {
const host = window.location.origin;
const api = url.replace(OPENAI_COMPATIBLE, GPUSTACK_API);
// ========================= Curl =========================
const curlCode = `
@@ -18,7 +19,7 @@ ${formatCurlArgs(parameters, false)}`.trim();
const pythonCode = `
from openai import OpenAI\n
client = OpenAI(
base_url="${host}/${OPENAI_COMPATIBLE}",
base_url="${host}/${GPUSTACK_API}",
api_key="YOUR_GPUSTACK_API_KEY"
)
@@ -35,7 +36,7 @@ const OpenAI = require("openai");
const openai = new OpenAI({
"apiKey": "YOUR_GPUSTACK_API_KEY",
"baseURL": "${host}/${OPENAI_COMPATIBLE}"
"baseURL": "${host}/${GPUSTACK_API}"
});
async function main() {