feat: playground video

This commit is contained in:
jialin
2026-01-12 20:30:24 +08:00
parent cd3b0607a5
commit 89fe8e68f4
21 changed files with 1143 additions and 13 deletions
+20
View File
@@ -5,6 +5,7 @@ import { request } from '@umijs/max';
export { GPUSTACK_API_BASE_URL, OPENAI_COMPATIBLE };
export const CHAT_API = `/${OPENAI_COMPATIBLE}/chat/completions`;
export const CREATE_VIDEO_API = `/${OPENAI_COMPATIBLE}/videos`;
export const CREAT_IMAGE_API = `/${OPENAI_COMPATIBLE}/images/generations`;
export const EDIT_IMAGE_API = `/${OPENAI_COMPATIBLE}/images/edits`;
@@ -128,6 +129,25 @@ export const createImage = async (params: {
return response.json();
};
export const createVideo = async (params: {
data?: any;
signal?: AbortSignal;
}) => {
const response = await fetch(CREATE_VIDEO_API, {
method: 'POST',
body: JSON.stringify(params.data),
signal: params.signal,
headers: {
'Content-Type': 'application/json'
}
});
if (!response.ok) {
return await errorHandler(response);
}
return response.json();
};
// ============ audio ============
export const textToSpeech = async (params: any, options?: any) => {
const res = await fetch(AUDIO_TEXT_TO_SPEECH_API, {