mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 00:55:14 -07:00
chore(app): delete unused generated API client
app/src/lib/api/{core,models,schemas,services,index.ts} was
openapi-typescript-codegen output imported by nothing — the live
client is the hand-written client.ts/types.ts pair — and its types
had drifted (no engine, personality, or effects_chain on
GenerationRequest). Removes the generator with it: generate-api.sh,
the generate:api script, and the just recipe. Docs that described the
codegen workflow now describe updating the hand-written client.
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
||||||
import type { ApiResult } from './ApiResult';
|
|
||||||
|
|
||||||
export class ApiError extends Error {
|
|
||||||
public readonly url: string;
|
|
||||||
public readonly status: number;
|
|
||||||
public readonly statusText: string;
|
|
||||||
public readonly body: any;
|
|
||||||
public readonly request: ApiRequestOptions;
|
|
||||||
|
|
||||||
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
|
|
||||||
super(message);
|
|
||||||
|
|
||||||
this.name = 'ApiError';
|
|
||||||
this.url = response.url;
|
|
||||||
this.status = response.status;
|
|
||||||
this.statusText = response.statusText;
|
|
||||||
this.body = response.body;
|
|
||||||
this.request = request;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type ApiRequestOptions = {
|
|
||||||
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
||||||
readonly url: string;
|
|
||||||
readonly path?: Record<string, any>;
|
|
||||||
readonly cookies?: Record<string, any>;
|
|
||||||
readonly headers?: Record<string, any>;
|
|
||||||
readonly query?: Record<string, any>;
|
|
||||||
readonly formData?: Record<string, any>;
|
|
||||||
readonly body?: any;
|
|
||||||
readonly mediaType?: string;
|
|
||||||
readonly responseHeader?: string;
|
|
||||||
readonly errors?: Record<number, string>;
|
|
||||||
};
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type ApiResult = {
|
|
||||||
readonly url: string;
|
|
||||||
readonly ok: boolean;
|
|
||||||
readonly status: number;
|
|
||||||
readonly statusText: string;
|
|
||||||
readonly body: any;
|
|
||||||
};
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export class CancelError extends Error {
|
|
||||||
constructor(message: string) {
|
|
||||||
super(message);
|
|
||||||
this.name = 'CancelError';
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isCancelled(): boolean {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface OnCancel {
|
|
||||||
readonly isResolved: boolean;
|
|
||||||
readonly isRejected: boolean;
|
|
||||||
readonly isCancelled: boolean;
|
|
||||||
|
|
||||||
(cancelHandler: () => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CancelablePromise<T> implements Promise<T> {
|
|
||||||
#isResolved: boolean;
|
|
||||||
#isRejected: boolean;
|
|
||||||
#isCancelled: boolean;
|
|
||||||
readonly #cancelHandlers: (() => void)[];
|
|
||||||
readonly #promise: Promise<T>;
|
|
||||||
#resolve?: (value: T | PromiseLike<T>) => void;
|
|
||||||
#reject?: (reason?: any) => void;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
executor: (
|
|
||||||
resolve: (value: T | PromiseLike<T>) => void,
|
|
||||||
reject: (reason?: any) => void,
|
|
||||||
onCancel: OnCancel,
|
|
||||||
) => void,
|
|
||||||
) {
|
|
||||||
this.#isResolved = false;
|
|
||||||
this.#isRejected = false;
|
|
||||||
this.#isCancelled = false;
|
|
||||||
this.#cancelHandlers = [];
|
|
||||||
this.#promise = new Promise<T>((resolve, reject) => {
|
|
||||||
this.#resolve = resolve;
|
|
||||||
this.#reject = reject;
|
|
||||||
|
|
||||||
const onResolve = (value: T | PromiseLike<T>): void => {
|
|
||||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.#isResolved = true;
|
|
||||||
if (this.#resolve) this.#resolve(value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onReject = (reason?: any): void => {
|
|
||||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.#isRejected = true;
|
|
||||||
if (this.#reject) this.#reject(reason);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onCancel = (cancelHandler: () => void): void => {
|
|
||||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.#cancelHandlers.push(cancelHandler);
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.defineProperty(onCancel, 'isResolved', {
|
|
||||||
get: (): boolean => this.#isResolved,
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.defineProperty(onCancel, 'isRejected', {
|
|
||||||
get: (): boolean => this.#isRejected,
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.defineProperty(onCancel, 'isCancelled', {
|
|
||||||
get: (): boolean => this.#isCancelled,
|
|
||||||
});
|
|
||||||
|
|
||||||
return executor(onResolve, onReject, onCancel as OnCancel);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
get [Symbol.toStringTag]() {
|
|
||||||
return 'Cancellable Promise';
|
|
||||||
}
|
|
||||||
|
|
||||||
public then<TResult1 = T, TResult2 = never>(
|
|
||||||
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
|
||||||
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
|
|
||||||
): Promise<TResult1 | TResult2> {
|
|
||||||
return this.#promise.then(onFulfilled, onRejected);
|
|
||||||
}
|
|
||||||
|
|
||||||
public catch<TResult = never>(
|
|
||||||
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,
|
|
||||||
): Promise<T | TResult> {
|
|
||||||
return this.#promise.catch(onRejected);
|
|
||||||
}
|
|
||||||
|
|
||||||
public finally(onFinally?: (() => void) | null): Promise<T> {
|
|
||||||
return this.#promise.finally(onFinally);
|
|
||||||
}
|
|
||||||
|
|
||||||
public cancel(): void {
|
|
||||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.#isCancelled = true;
|
|
||||||
if (this.#cancelHandlers.length) {
|
|
||||||
try {
|
|
||||||
for (const cancelHandler of this.#cancelHandlers) {
|
|
||||||
cancelHandler();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.warn('Cancellation threw an error', error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.#cancelHandlers.length = 0;
|
|
||||||
if (this.#reject) this.#reject(new CancelError('Request aborted'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isCancelled(): boolean {
|
|
||||||
return this.#isCancelled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
||||||
|
|
||||||
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
||||||
type Headers = Record<string, string>;
|
|
||||||
|
|
||||||
export type OpenAPIConfig = {
|
|
||||||
BASE: string;
|
|
||||||
VERSION: string;
|
|
||||||
WITH_CREDENTIALS: boolean;
|
|
||||||
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
||||||
TOKEN?: string | Resolver<string> | undefined;
|
|
||||||
USERNAME?: string | Resolver<string> | undefined;
|
|
||||||
PASSWORD?: string | Resolver<string> | undefined;
|
|
||||||
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
||||||
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const OpenAPI: OpenAPIConfig = {
|
|
||||||
BASE: '',
|
|
||||||
VERSION: '0.1.0',
|
|
||||||
WITH_CREDENTIALS: false,
|
|
||||||
CREDENTIALS: 'include',
|
|
||||||
TOKEN: undefined,
|
|
||||||
USERNAME: undefined,
|
|
||||||
PASSWORD: undefined,
|
|
||||||
HEADERS: undefined,
|
|
||||||
ENCODE_PATH: undefined,
|
|
||||||
};
|
|
||||||
@@ -1,341 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import { ApiError } from './ApiError';
|
|
||||||
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
||||||
import type { ApiResult } from './ApiResult';
|
|
||||||
import { CancelablePromise } from './CancelablePromise';
|
|
||||||
import type { OnCancel } from './CancelablePromise';
|
|
||||||
import type { OpenAPIConfig } from './OpenAPI';
|
|
||||||
|
|
||||||
export const isDefined = <T>(
|
|
||||||
value: T | null | undefined,
|
|
||||||
): value is Exclude<T, null | undefined> => {
|
|
||||||
return value !== undefined && value !== null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const isString = (value: any): value is string => {
|
|
||||||
return typeof value === 'string';
|
|
||||||
};
|
|
||||||
|
|
||||||
export const isStringWithValue = (value: any): value is string => {
|
|
||||||
return isString(value) && value !== '';
|
|
||||||
};
|
|
||||||
|
|
||||||
export const isBlob = (value: any): value is Blob => {
|
|
||||||
return (
|
|
||||||
typeof value === 'object' &&
|
|
||||||
typeof value.type === 'string' &&
|
|
||||||
typeof value.stream === 'function' &&
|
|
||||||
typeof value.arrayBuffer === 'function' &&
|
|
||||||
typeof value.constructor === 'function' &&
|
|
||||||
typeof value.constructor.name === 'string' &&
|
|
||||||
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
||||||
/^(Blob|File)$/.test(value[Symbol.toStringTag])
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const isFormData = (value: any): value is FormData => {
|
|
||||||
return value instanceof FormData;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const base64 = (str: string): string => {
|
|
||||||
try {
|
|
||||||
return btoa(str);
|
|
||||||
} catch (err) {
|
|
||||||
// @ts-ignore
|
|
||||||
return Buffer.from(str).toString('base64');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getQueryString = (params: Record<string, any>): string => {
|
|
||||||
const qs: string[] = [];
|
|
||||||
|
|
||||||
const append = (key: string, value: any) => {
|
|
||||||
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const process = (key: string, value: any) => {
|
|
||||||
if (isDefined(value)) {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
value.forEach((v) => {
|
|
||||||
process(key, v);
|
|
||||||
});
|
|
||||||
} else if (typeof value === 'object') {
|
|
||||||
Object.entries(value).forEach(([k, v]) => {
|
|
||||||
process(`${key}[${k}]`, v);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
append(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.entries(params).forEach(([key, value]) => {
|
|
||||||
process(key, value);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (qs.length > 0) {
|
|
||||||
return `?${qs.join('&')}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
|
|
||||||
const encoder = config.ENCODE_PATH || encodeURI;
|
|
||||||
|
|
||||||
const path = options.url
|
|
||||||
.replace('{api-version}', config.VERSION)
|
|
||||||
.replace(/{(.*?)}/g, (substring: string, group: string) => {
|
|
||||||
if (options.path?.hasOwnProperty(group)) {
|
|
||||||
return encoder(String(options.path[group]));
|
|
||||||
}
|
|
||||||
return substring;
|
|
||||||
});
|
|
||||||
|
|
||||||
const url = `${config.BASE}${path}`;
|
|
||||||
if (options.query) {
|
|
||||||
return `${url}${getQueryString(options.query)}`;
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
|
|
||||||
if (options.formData) {
|
|
||||||
const formData = new FormData();
|
|
||||||
|
|
||||||
const process = (key: string, value: any) => {
|
|
||||||
if (isString(value) || isBlob(value)) {
|
|
||||||
formData.append(key, value);
|
|
||||||
} else {
|
|
||||||
formData.append(key, JSON.stringify(value));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.entries(options.formData)
|
|
||||||
.filter(([_, value]) => isDefined(value))
|
|
||||||
.forEach(([key, value]) => {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
value.forEach((v) => process(key, v));
|
|
||||||
} else {
|
|
||||||
process(key, value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return formData;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
||||||
|
|
||||||
export const resolve = async <T>(
|
|
||||||
options: ApiRequestOptions,
|
|
||||||
resolver?: T | Resolver<T>,
|
|
||||||
): Promise<T | undefined> => {
|
|
||||||
if (typeof resolver === 'function') {
|
|
||||||
return (resolver as Resolver<T>)(options);
|
|
||||||
}
|
|
||||||
return resolver;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getHeaders = async (
|
|
||||||
config: OpenAPIConfig,
|
|
||||||
options: ApiRequestOptions,
|
|
||||||
): Promise<Headers> => {
|
|
||||||
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
||||||
resolve(options, config.TOKEN),
|
|
||||||
resolve(options, config.USERNAME),
|
|
||||||
resolve(options, config.PASSWORD),
|
|
||||||
resolve(options, config.HEADERS),
|
|
||||||
]);
|
|
||||||
|
|
||||||
const headers = Object.entries({
|
|
||||||
Accept: 'application/json',
|
|
||||||
...additionalHeaders,
|
|
||||||
...options.headers,
|
|
||||||
})
|
|
||||||
.filter(([_, value]) => isDefined(value))
|
|
||||||
.reduce(
|
|
||||||
(headers, [key, value]) => ({
|
|
||||||
...headers,
|
|
||||||
[key]: String(value),
|
|
||||||
}),
|
|
||||||
{} as Record<string, string>,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isStringWithValue(token)) {
|
|
||||||
headers['Authorization'] = `Bearer ${token}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
||||||
const credentials = base64(`${username}:${password}`);
|
|
||||||
headers['Authorization'] = `Basic ${credentials}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.body !== undefined) {
|
|
||||||
if (options.mediaType) {
|
|
||||||
headers['Content-Type'] = options.mediaType;
|
|
||||||
} else if (isBlob(options.body)) {
|
|
||||||
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
||||||
} else if (isString(options.body)) {
|
|
||||||
headers['Content-Type'] = 'text/plain';
|
|
||||||
} else if (!isFormData(options.body)) {
|
|
||||||
headers['Content-Type'] = 'application/json';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Headers(headers);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getRequestBody = (options: ApiRequestOptions): any => {
|
|
||||||
if (options.body !== undefined) {
|
|
||||||
if (options.mediaType?.includes('/json')) {
|
|
||||||
return JSON.stringify(options.body);
|
|
||||||
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
||||||
return options.body;
|
|
||||||
} else {
|
|
||||||
return JSON.stringify(options.body);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const sendRequest = async (
|
|
||||||
config: OpenAPIConfig,
|
|
||||||
options: ApiRequestOptions,
|
|
||||||
url: string,
|
|
||||||
body: any,
|
|
||||||
formData: FormData | undefined,
|
|
||||||
headers: Headers,
|
|
||||||
onCancel: OnCancel,
|
|
||||||
): Promise<Response> => {
|
|
||||||
const controller = new AbortController();
|
|
||||||
|
|
||||||
const request: RequestInit = {
|
|
||||||
headers,
|
|
||||||
body: body ?? formData,
|
|
||||||
method: options.method,
|
|
||||||
signal: controller.signal,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (config.WITH_CREDENTIALS) {
|
|
||||||
request.credentials = config.CREDENTIALS;
|
|
||||||
}
|
|
||||||
|
|
||||||
onCancel(() => controller.abort());
|
|
||||||
|
|
||||||
return await fetch(url, request);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getResponseHeader = (
|
|
||||||
response: Response,
|
|
||||||
responseHeader?: string,
|
|
||||||
): string | undefined => {
|
|
||||||
if (responseHeader) {
|
|
||||||
const content = response.headers.get(responseHeader);
|
|
||||||
if (isString(content)) {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getResponseBody = async (response: Response): Promise<any> => {
|
|
||||||
if (response.status !== 204) {
|
|
||||||
try {
|
|
||||||
const contentType = response.headers.get('Content-Type');
|
|
||||||
if (contentType) {
|
|
||||||
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
||||||
const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
|
|
||||||
if (isJSON) {
|
|
||||||
return await response.json();
|
|
||||||
} else {
|
|
||||||
return await response.text();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
|
|
||||||
const errors: Record<number, string> = {
|
|
||||||
400: 'Bad Request',
|
|
||||||
401: 'Unauthorized',
|
|
||||||
403: 'Forbidden',
|
|
||||||
404: 'Not Found',
|
|
||||||
500: 'Internal Server Error',
|
|
||||||
502: 'Bad Gateway',
|
|
||||||
503: 'Service Unavailable',
|
|
||||||
...options.errors,
|
|
||||||
};
|
|
||||||
|
|
||||||
const error = errors[result.status];
|
|
||||||
if (error) {
|
|
||||||
throw new ApiError(options, result, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result.ok) {
|
|
||||||
const errorStatus = result.status ?? 'unknown';
|
|
||||||
const errorStatusText = result.statusText ?? 'unknown';
|
|
||||||
const errorBody = (() => {
|
|
||||||
try {
|
|
||||||
return JSON.stringify(result.body, null, 2);
|
|
||||||
} catch (e) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
throw new ApiError(
|
|
||||||
options,
|
|
||||||
result,
|
|
||||||
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Request method
|
|
||||||
* @param config The OpenAPI configuration object
|
|
||||||
* @param options The request options from the service
|
|
||||||
* @returns CancelablePromise<T>
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
export const request = <T>(
|
|
||||||
config: OpenAPIConfig,
|
|
||||||
options: ApiRequestOptions,
|
|
||||||
): CancelablePromise<T> => {
|
|
||||||
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
||||||
try {
|
|
||||||
const url = getUrl(config, options);
|
|
||||||
const formData = getFormData(options);
|
|
||||||
const body = getRequestBody(options);
|
|
||||||
const headers = await getHeaders(config, options);
|
|
||||||
|
|
||||||
if (!onCancel.isCancelled) {
|
|
||||||
const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
|
|
||||||
const responseBody = await getResponseBody(response);
|
|
||||||
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
||||||
|
|
||||||
const result: ApiResult = {
|
|
||||||
url,
|
|
||||||
ok: response.ok,
|
|
||||||
status: response.status,
|
|
||||||
statusText: response.statusText,
|
|
||||||
body: responseHeader ?? responseBody,
|
|
||||||
};
|
|
||||||
|
|
||||||
catchErrorCodes(options, result);
|
|
||||||
|
|
||||||
resolve(result.body);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export { ApiError } from './core/ApiError';
|
|
||||||
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
||||||
export { OpenAPI } from './core/OpenAPI';
|
|
||||||
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
||||||
|
|
||||||
export type { Body_add_profile_sample_profiles__profile_id__samples_post } from './models/Body_add_profile_sample_profiles__profile_id__samples_post';
|
|
||||||
export type { Body_transcribe_audio_transcribe_post } from './models/Body_transcribe_audio_transcribe_post';
|
|
||||||
export type { GenerationRequest } from './models/GenerationRequest';
|
|
||||||
export type { GenerationResponse } from './models/GenerationResponse';
|
|
||||||
export type { HealthResponse } from './models/HealthResponse';
|
|
||||||
export type { HistoryListResponse } from './models/HistoryListResponse';
|
|
||||||
export type { HistoryResponse } from './models/HistoryResponse';
|
|
||||||
export type { HTTPValidationError } from './models/HTTPValidationError';
|
|
||||||
export type { ModelDownloadRequest } from './models/ModelDownloadRequest';
|
|
||||||
export type { ModelStatus } from './models/ModelStatus';
|
|
||||||
export type { ModelStatusListResponse } from './models/ModelStatusListResponse';
|
|
||||||
export type { ProfileSampleResponse } from './models/ProfileSampleResponse';
|
|
||||||
export type { TranscriptionResponse } from './models/TranscriptionResponse';
|
|
||||||
export type { ValidationError } from './models/ValidationError';
|
|
||||||
export type { VoiceProfileCreate } from './models/VoiceProfileCreate';
|
|
||||||
export type { VoiceProfileResponse } from './models/VoiceProfileResponse';
|
|
||||||
|
|
||||||
export { $Body_add_profile_sample_profiles__profile_id__samples_post } from './schemas/$Body_add_profile_sample_profiles__profile_id__samples_post';
|
|
||||||
export { $Body_transcribe_audio_transcribe_post } from './schemas/$Body_transcribe_audio_transcribe_post';
|
|
||||||
export { $GenerationRequest } from './schemas/$GenerationRequest';
|
|
||||||
export { $GenerationResponse } from './schemas/$GenerationResponse';
|
|
||||||
export { $HealthResponse } from './schemas/$HealthResponse';
|
|
||||||
export { $HistoryListResponse } from './schemas/$HistoryListResponse';
|
|
||||||
export { $HistoryResponse } from './schemas/$HistoryResponse';
|
|
||||||
export { $HTTPValidationError } from './schemas/$HTTPValidationError';
|
|
||||||
export { $ModelDownloadRequest } from './schemas/$ModelDownloadRequest';
|
|
||||||
export { $ModelStatus } from './schemas/$ModelStatus';
|
|
||||||
export { $ModelStatusListResponse } from './schemas/$ModelStatusListResponse';
|
|
||||||
export { $ProfileSampleResponse } from './schemas/$ProfileSampleResponse';
|
|
||||||
export { $TranscriptionResponse } from './schemas/$TranscriptionResponse';
|
|
||||||
export { $ValidationError } from './schemas/$ValidationError';
|
|
||||||
export { $VoiceProfileCreate } from './schemas/$VoiceProfileCreate';
|
|
||||||
export { $VoiceProfileResponse } from './schemas/$VoiceProfileResponse';
|
|
||||||
|
|
||||||
export { DefaultService } from './services/DefaultService';
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type Body_add_profile_sample_profiles__profile_id__samples_post = {
|
|
||||||
file: Blob;
|
|
||||||
reference_text: string;
|
|
||||||
};
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type Body_transcribe_audio_transcribe_post = {
|
|
||||||
file: Blob;
|
|
||||||
language?: string | null;
|
|
||||||
};
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Request model for voice generation.
|
|
||||||
*/
|
|
||||||
export type GenerationRequest = {
|
|
||||||
profile_id: string;
|
|
||||||
text: string;
|
|
||||||
language?: string;
|
|
||||||
seed?: number | null;
|
|
||||||
model_size?: string | null;
|
|
||||||
instruct?: string | null;
|
|
||||||
};
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Response model for voice generation.
|
|
||||||
*/
|
|
||||||
export type GenerationResponse = {
|
|
||||||
id: string;
|
|
||||||
profile_id: string;
|
|
||||||
text: string;
|
|
||||||
language: string;
|
|
||||||
audio_path: string;
|
|
||||||
duration: number;
|
|
||||||
seed: number | null;
|
|
||||||
instruct: string | null;
|
|
||||||
created_at: string;
|
|
||||||
};
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { ValidationError } from './ValidationError';
|
|
||||||
export type HTTPValidationError = {
|
|
||||||
detail?: Array<ValidationError>;
|
|
||||||
};
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Response model for health check.
|
|
||||||
*/
|
|
||||||
export type HealthResponse = {
|
|
||||||
status: string;
|
|
||||||
model_loaded: boolean;
|
|
||||||
model_downloaded?: boolean | null;
|
|
||||||
model_size?: string | null;
|
|
||||||
gpu_available: boolean;
|
|
||||||
vram_used_mb?: number | null;
|
|
||||||
};
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { HistoryResponse } from './HistoryResponse';
|
|
||||||
/**
|
|
||||||
* Response model for history list.
|
|
||||||
*/
|
|
||||||
export type HistoryListResponse = {
|
|
||||||
items: Array<HistoryResponse>;
|
|
||||||
total: number;
|
|
||||||
};
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Response model for history entry (includes profile name).
|
|
||||||
*/
|
|
||||||
export type HistoryResponse = {
|
|
||||||
id: string;
|
|
||||||
profile_id: string;
|
|
||||||
profile_name: string;
|
|
||||||
text: string;
|
|
||||||
language: string;
|
|
||||||
audio_path: string;
|
|
||||||
duration: number;
|
|
||||||
seed: number | null;
|
|
||||||
instruct: string | null;
|
|
||||||
created_at: string;
|
|
||||||
};
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Request model for triggering model download.
|
|
||||||
*/
|
|
||||||
export type ModelDownloadRequest = {
|
|
||||||
model_name: string;
|
|
||||||
};
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Response model for model status.
|
|
||||||
*/
|
|
||||||
export type ModelStatus = {
|
|
||||||
model_name: string;
|
|
||||||
display_name: string;
|
|
||||||
downloaded: boolean;
|
|
||||||
downloading?: boolean; // True if download is in progress
|
|
||||||
size_mb?: number | null;
|
|
||||||
loaded?: boolean;
|
|
||||||
};
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { ModelStatus } from './ModelStatus';
|
|
||||||
/**
|
|
||||||
* Response model for model status list.
|
|
||||||
*/
|
|
||||||
export type ModelStatusListResponse = {
|
|
||||||
models: Array<ModelStatus>;
|
|
||||||
};
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Response model for profile sample.
|
|
||||||
*/
|
|
||||||
export type ProfileSampleResponse = {
|
|
||||||
id: string;
|
|
||||||
profile_id: string;
|
|
||||||
audio_path: string;
|
|
||||||
reference_text: string;
|
|
||||||
};
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Response model for transcription.
|
|
||||||
*/
|
|
||||||
export type TranscriptionResponse = {
|
|
||||||
text: string;
|
|
||||||
duration: number;
|
|
||||||
};
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export type ValidationError = {
|
|
||||||
loc: Array<string | number>;
|
|
||||||
msg: string;
|
|
||||||
type: string;
|
|
||||||
};
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Request model for creating a voice profile.
|
|
||||||
*/
|
|
||||||
export type VoiceProfileCreate = {
|
|
||||||
name: string;
|
|
||||||
description?: string | null;
|
|
||||||
language?: string;
|
|
||||||
};
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Response model for voice profile.
|
|
||||||
*/
|
|
||||||
export type VoiceProfileResponse = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
description: string | null;
|
|
||||||
language: string;
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
};
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $Body_add_profile_sample_profiles__profile_id__samples_post = {
|
|
||||||
properties: {
|
|
||||||
file: {
|
|
||||||
type: 'binary',
|
|
||||||
isRequired: true,
|
|
||||||
format: 'binary',
|
|
||||||
},
|
|
||||||
reference_text: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $Body_transcribe_audio_transcribe_post = {
|
|
||||||
properties: {
|
|
||||||
file: {
|
|
||||||
type: 'binary',
|
|
||||||
isRequired: true,
|
|
||||||
format: 'binary',
|
|
||||||
},
|
|
||||||
language: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $GenerationRequest = {
|
|
||||||
description: `Request model for voice generation.`,
|
|
||||||
properties: {
|
|
||||||
profile_id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
maxLength: 5000,
|
|
||||||
minLength: 1,
|
|
||||||
},
|
|
||||||
language: {
|
|
||||||
type: 'string',
|
|
||||||
pattern: '^(en|zh)$',
|
|
||||||
},
|
|
||||||
seed: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
model_size: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
pattern: '^(1\\.7B|0\\.6B)$',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $GenerationResponse = {
|
|
||||||
description: `Response model for voice generation.`,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
profile_id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
language: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
audio_path: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
duration: {
|
|
||||||
type: 'number',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
seed: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
created_at: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $HTTPValidationError = {
|
|
||||||
properties: {
|
|
||||||
detail: {
|
|
||||||
type: 'array',
|
|
||||||
contains: {
|
|
||||||
type: 'ValidationError',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $HealthResponse = {
|
|
||||||
description: `Response model for health check.`,
|
|
||||||
properties: {
|
|
||||||
status: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
model_loaded: {
|
|
||||||
type: 'boolean',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
model_downloaded: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'boolean',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
model_size: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
gpu_available: {
|
|
||||||
type: 'boolean',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
vram_used_mb: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $HistoryListResponse = {
|
|
||||||
description: `Response model for history list.`,
|
|
||||||
properties: {
|
|
||||||
items: {
|
|
||||||
type: 'array',
|
|
||||||
contains: {
|
|
||||||
type: 'HistoryResponse',
|
|
||||||
},
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
total: {
|
|
||||||
type: 'number',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $HistoryResponse = {
|
|
||||||
description: `Response model for history entry (includes profile name).`,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
profile_id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
profile_name: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
language: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
audio_path: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
duration: {
|
|
||||||
type: 'number',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
seed: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
created_at: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $ModelDownloadRequest = {
|
|
||||||
description: `Request model for triggering model download.`,
|
|
||||||
properties: {
|
|
||||||
model_name: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $ModelStatus = {
|
|
||||||
description: `Response model for model status.`,
|
|
||||||
properties: {
|
|
||||||
model_name: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
display_name: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
downloaded: {
|
|
||||||
type: 'boolean',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
size_mb: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
loaded: {
|
|
||||||
type: 'boolean',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $ModelStatusListResponse = {
|
|
||||||
description: `Response model for model status list.`,
|
|
||||||
properties: {
|
|
||||||
models: {
|
|
||||||
type: 'array',
|
|
||||||
contains: {
|
|
||||||
type: 'ModelStatus',
|
|
||||||
},
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $ProfileSampleResponse = {
|
|
||||||
description: `Response model for profile sample.`,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
profile_id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
audio_path: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
reference_text: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $TranscriptionResponse = {
|
|
||||||
description: `Response model for transcription.`,
|
|
||||||
properties: {
|
|
||||||
text: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
duration: {
|
|
||||||
type: 'number',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $ValidationError = {
|
|
||||||
properties: {
|
|
||||||
loc: {
|
|
||||||
type: 'array',
|
|
||||||
contains: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
msg: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $VoiceProfileCreate = {
|
|
||||||
description: `Request model for creating a voice profile.`,
|
|
||||||
properties: {
|
|
||||||
name: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
maxLength: 100,
|
|
||||||
minLength: 1,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
maxLength: 500,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
language: {
|
|
||||||
type: 'string',
|
|
||||||
pattern: '^(en|zh)$',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
export const $VoiceProfileResponse = {
|
|
||||||
description: `Response model for voice profile.`,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: 'any-of',
|
|
||||||
contains: [
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'null',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
language: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
},
|
|
||||||
created_at: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
updated_at: {
|
|
||||||
type: 'string',
|
|
||||||
isRequired: true,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
@@ -1,459 +0,0 @@
|
|||||||
/* generated using openapi-typescript-codegen -- do not edit */
|
|
||||||
/* istanbul ignore file */
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
import type { Body_add_profile_sample_profiles__profile_id__samples_post } from '../models/Body_add_profile_sample_profiles__profile_id__samples_post';
|
|
||||||
import type { Body_transcribe_audio_transcribe_post } from '../models/Body_transcribe_audio_transcribe_post';
|
|
||||||
import type { GenerationRequest } from '../models/GenerationRequest';
|
|
||||||
import type { GenerationResponse } from '../models/GenerationResponse';
|
|
||||||
import type { HealthResponse } from '../models/HealthResponse';
|
|
||||||
import type { HistoryListResponse } from '../models/HistoryListResponse';
|
|
||||||
import type { HistoryResponse } from '../models/HistoryResponse';
|
|
||||||
import type { ModelDownloadRequest } from '../models/ModelDownloadRequest';
|
|
||||||
import type { ModelStatusListResponse } from '../models/ModelStatusListResponse';
|
|
||||||
import type { ProfileSampleResponse } from '../models/ProfileSampleResponse';
|
|
||||||
import type { TranscriptionResponse } from '../models/TranscriptionResponse';
|
|
||||||
import type { VoiceProfileCreate } from '../models/VoiceProfileCreate';
|
|
||||||
import type { VoiceProfileResponse } from '../models/VoiceProfileResponse';
|
|
||||||
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
||||||
import { OpenAPI } from '../core/OpenAPI';
|
|
||||||
import { request as __request } from '../core/request';
|
|
||||||
export class DefaultService {
|
|
||||||
/**
|
|
||||||
* Root
|
|
||||||
* Root endpoint.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static rootGet(): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Health
|
|
||||||
* Health check endpoint.
|
|
||||||
* @returns HealthResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static healthHealthGet(): CancelablePromise<HealthResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/health',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* List Profiles
|
|
||||||
* List all voice profiles.
|
|
||||||
* @returns VoiceProfileResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static listProfilesProfilesGet(): CancelablePromise<Array<VoiceProfileResponse>> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/profiles',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Create Profile
|
|
||||||
* Create a new voice profile.
|
|
||||||
* @returns VoiceProfileResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static createProfileProfilesPost({
|
|
||||||
requestBody,
|
|
||||||
}: {
|
|
||||||
requestBody: VoiceProfileCreate;
|
|
||||||
}): CancelablePromise<VoiceProfileResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/profiles',
|
|
||||||
body: requestBody,
|
|
||||||
mediaType: 'application/json',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get Profile
|
|
||||||
* Get a voice profile by ID.
|
|
||||||
* @returns VoiceProfileResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getProfileProfilesProfileIdGet({
|
|
||||||
profileId,
|
|
||||||
}: {
|
|
||||||
profileId: string;
|
|
||||||
}): CancelablePromise<VoiceProfileResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/profiles/{profile_id}',
|
|
||||||
path: {
|
|
||||||
profile_id: profileId,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Update Profile
|
|
||||||
* Update a voice profile.
|
|
||||||
* @returns VoiceProfileResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static updateProfileProfilesProfileIdPut({
|
|
||||||
profileId,
|
|
||||||
requestBody,
|
|
||||||
}: {
|
|
||||||
profileId: string;
|
|
||||||
requestBody: VoiceProfileCreate;
|
|
||||||
}): CancelablePromise<VoiceProfileResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'PUT',
|
|
||||||
url: '/profiles/{profile_id}',
|
|
||||||
path: {
|
|
||||||
profile_id: profileId,
|
|
||||||
},
|
|
||||||
body: requestBody,
|
|
||||||
mediaType: 'application/json',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Delete Profile
|
|
||||||
* Delete a voice profile.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static deleteProfileProfilesProfileIdDelete({
|
|
||||||
profileId,
|
|
||||||
}: {
|
|
||||||
profileId: string;
|
|
||||||
}): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'DELETE',
|
|
||||||
url: '/profiles/{profile_id}',
|
|
||||||
path: {
|
|
||||||
profile_id: profileId,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Add Profile Sample
|
|
||||||
* Add a sample to a voice profile.
|
|
||||||
* @returns ProfileSampleResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static addProfileSampleProfilesProfileIdSamplesPost({
|
|
||||||
profileId,
|
|
||||||
formData,
|
|
||||||
}: {
|
|
||||||
profileId: string;
|
|
||||||
formData: Body_add_profile_sample_profiles__profile_id__samples_post;
|
|
||||||
}): CancelablePromise<ProfileSampleResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/profiles/{profile_id}/samples',
|
|
||||||
path: {
|
|
||||||
profile_id: profileId,
|
|
||||||
},
|
|
||||||
formData: formData,
|
|
||||||
mediaType: 'multipart/form-data',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get Profile Samples
|
|
||||||
* Get all samples for a profile.
|
|
||||||
* @returns ProfileSampleResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getProfileSamplesProfilesProfileIdSamplesGet({
|
|
||||||
profileId,
|
|
||||||
}: {
|
|
||||||
profileId: string;
|
|
||||||
}): CancelablePromise<Array<ProfileSampleResponse>> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/profiles/{profile_id}/samples',
|
|
||||||
path: {
|
|
||||||
profile_id: profileId,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Delete Profile Sample
|
|
||||||
* Delete a profile sample.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static deleteProfileSampleProfilesSamplesSampleIdDelete({
|
|
||||||
sampleId,
|
|
||||||
}: {
|
|
||||||
sampleId: string;
|
|
||||||
}): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'DELETE',
|
|
||||||
url: '/profiles/samples/{sample_id}',
|
|
||||||
path: {
|
|
||||||
sample_id: sampleId,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Generate Speech
|
|
||||||
* Generate speech from text using a voice profile.
|
|
||||||
* @returns GenerationResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static generateSpeechGeneratePost({
|
|
||||||
requestBody,
|
|
||||||
}: {
|
|
||||||
requestBody: GenerationRequest;
|
|
||||||
}): CancelablePromise<GenerationResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/generate',
|
|
||||||
body: requestBody,
|
|
||||||
mediaType: 'application/json',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* List History
|
|
||||||
* List generation history with optional filters.
|
|
||||||
* @returns HistoryListResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static listHistoryHistoryGet({
|
|
||||||
profileId,
|
|
||||||
search,
|
|
||||||
limit = 50,
|
|
||||||
offset,
|
|
||||||
}: {
|
|
||||||
profileId?: string | null;
|
|
||||||
search?: string | null;
|
|
||||||
limit?: number;
|
|
||||||
offset?: number;
|
|
||||||
}): CancelablePromise<HistoryListResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/history',
|
|
||||||
query: {
|
|
||||||
profile_id: profileId,
|
|
||||||
search: search,
|
|
||||||
limit: limit,
|
|
||||||
offset: offset,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get Generation
|
|
||||||
* Get a generation by ID.
|
|
||||||
* @returns HistoryResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getGenerationHistoryGenerationIdGet({
|
|
||||||
generationId,
|
|
||||||
}: {
|
|
||||||
generationId: string;
|
|
||||||
}): CancelablePromise<HistoryResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/history/{generation_id}',
|
|
||||||
path: {
|
|
||||||
generation_id: generationId,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Delete Generation
|
|
||||||
* Delete a generation.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static deleteGenerationHistoryGenerationIdDelete({
|
|
||||||
generationId,
|
|
||||||
}: {
|
|
||||||
generationId: string;
|
|
||||||
}): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'DELETE',
|
|
||||||
url: '/history/{generation_id}',
|
|
||||||
path: {
|
|
||||||
generation_id: generationId,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get Stats
|
|
||||||
* Get generation statistics.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getStatsHistoryStatsGet(): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/history/stats',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Transcribe Audio
|
|
||||||
* Transcribe audio file to text.
|
|
||||||
* @returns TranscriptionResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static transcribeAudioTranscribePost({
|
|
||||||
formData,
|
|
||||||
}: {
|
|
||||||
formData: Body_transcribe_audio_transcribe_post;
|
|
||||||
}): CancelablePromise<TranscriptionResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/transcribe',
|
|
||||||
formData: formData,
|
|
||||||
mediaType: 'multipart/form-data',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get Audio
|
|
||||||
* Serve generated audio file.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getAudioAudioGenerationIdGet({
|
|
||||||
generationId,
|
|
||||||
}: {
|
|
||||||
generationId: string;
|
|
||||||
}): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/audio/{generation_id}',
|
|
||||||
path: {
|
|
||||||
generation_id: generationId,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Load Model
|
|
||||||
* Manually load TTS model.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static loadModelModelsLoadPost({
|
|
||||||
modelSize = '1.7B',
|
|
||||||
}: {
|
|
||||||
modelSize?: string;
|
|
||||||
}): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/models/load',
|
|
||||||
query: {
|
|
||||||
model_size: modelSize,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Unload Model
|
|
||||||
* Unload TTS model to free memory.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static unloadModelModelsUnloadPost(): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/models/unload',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get Model Progress
|
|
||||||
* Get model download progress via Server-Sent Events.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getModelProgressModelsProgressModelNameGet({
|
|
||||||
modelName,
|
|
||||||
}: {
|
|
||||||
modelName: string;
|
|
||||||
}): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/models/progress/{model_name}',
|
|
||||||
path: {
|
|
||||||
model_name: modelName,
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get Model Status
|
|
||||||
* Get status of all available models.
|
|
||||||
* @returns ModelStatusListResponse Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static getModelStatusModelsStatusGet(): CancelablePromise<ModelStatusListResponse> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/models/status',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Trigger Model Download
|
|
||||||
* Trigger download of a specific model.
|
|
||||||
* @returns any Successful Response
|
|
||||||
* @throws ApiError
|
|
||||||
*/
|
|
||||||
public static triggerModelDownloadModelsDownloadPost({
|
|
||||||
requestBody,
|
|
||||||
}: {
|
|
||||||
requestBody: ModelDownloadRequest;
|
|
||||||
}): CancelablePromise<any> {
|
|
||||||
return __request(OpenAPI, {
|
|
||||||
method: 'POST',
|
|
||||||
url: '/models/download',
|
|
||||||
body: requestBody,
|
|
||||||
mediaType: 'application/json',
|
|
||||||
errors: {
|
|
||||||
422: `Validation Error`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -348,15 +348,6 @@ db-reset:
|
|||||||
|
|
||||||
# ─── Utilities ────────────────────────────────────────────────────────
|
# ─── Utilities ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
# Generate TypeScript API client (backend must be running)
|
|
||||||
[unix]
|
|
||||||
generate-api:
|
|
||||||
./scripts/generate-api.sh
|
|
||||||
|
|
||||||
[windows]
|
|
||||||
generate-api:
|
|
||||||
bash scripts/generate-api.sh
|
|
||||||
|
|
||||||
# Open API docs in browser
|
# Open API docs in browser
|
||||||
[unix]
|
[unix]
|
||||||
docs:
|
docs:
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"build:web": "cd web && bun run build",
|
"build:web": "cd web && bun run build",
|
||||||
"build:landing": "cd landing && bun run build",
|
"build:landing": "cd landing && bun run build",
|
||||||
"build:release": "./scripts/prepare-release.sh",
|
"build:release": "./scripts/prepare-release.sh",
|
||||||
"generate:api": "./scripts/generate-api.sh",
|
|
||||||
"generate:keys": "cd tauri && bun tauri signer generate -w ~/.tauri/voicebox.key",
|
"generate:keys": "cd tauri && bun tauri signer generate -w ~/.tauri/voicebox.key",
|
||||||
"build:server": "./scripts/build-server.sh",
|
"build:server": "./scripts/build-server.sh",
|
||||||
"update:icons": "./scripts/update-icons.sh",
|
"update:icons": "./scripts/update-icons.sh",
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Generate OpenAPI TypeScript client from FastAPI schema
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Generating OpenAPI client..."
|
|
||||||
|
|
||||||
# Check if backend is running
|
|
||||||
if ! curl -s http://localhost:17493/openapi.json > /dev/null 2>&1; then
|
|
||||||
echo "Backend not running. Starting backend..."
|
|
||||||
cd backend
|
|
||||||
|
|
||||||
# Check if virtual environment exists
|
|
||||||
if [ ! -d "venv" ]; then
|
|
||||||
echo "Creating virtual environment..."
|
|
||||||
python -m venv venv
|
|
||||||
fi
|
|
||||||
|
|
||||||
source venv/bin/activate 2>/dev/null || source venv/Scripts/activate 2>/dev/null
|
|
||||||
|
|
||||||
# Install dependencies if needed
|
|
||||||
if ! python -c "import fastapi" 2>/dev/null; then
|
|
||||||
echo "Installing backend dependencies..."
|
|
||||||
pip install -r requirements.txt
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start backend in background
|
|
||||||
echo "Starting backend server..."
|
|
||||||
uvicorn main:app --port 17493 & # Keep the generator on the app's documented local backend port.
|
|
||||||
BACKEND_PID=$!
|
|
||||||
|
|
||||||
# Wait for server to be ready
|
|
||||||
echo "Waiting for server to start..."
|
|
||||||
for _ in {1..30}; do
|
|
||||||
if curl -s http://localhost:17493/openapi.json > /dev/null 2>&1; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! curl -s http://localhost:17493/openapi.json > /dev/null 2>&1; then
|
|
||||||
echo "Error: Backend failed to start"
|
|
||||||
kill $BACKEND_PID 2>/dev/null || true
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Backend started (PID: $BACKEND_PID)"
|
|
||||||
STARTED_BACKEND=true
|
|
||||||
else
|
|
||||||
STARTED_BACKEND=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download OpenAPI schema
|
|
||||||
echo "Downloading OpenAPI schema..."
|
|
||||||
curl -s http://localhost:17493/openapi.json > app/openapi.json
|
|
||||||
|
|
||||||
# Check if openapi-typescript-codegen is installed
|
|
||||||
if ! bunx --bun openapi-typescript-codegen --version > /dev/null 2>&1; then
|
|
||||||
echo "Installing openapi-typescript-codegen..."
|
|
||||||
bun add -d openapi-typescript-codegen
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate TypeScript client
|
|
||||||
echo "Generating TypeScript client..."
|
|
||||||
cd app
|
|
||||||
bunx --bun openapi-typescript-codegen \
|
|
||||||
--input openapi.json \
|
|
||||||
--output src/lib/api \
|
|
||||||
--client fetch \
|
|
||||||
--useOptions \
|
|
||||||
--exportSchemas true
|
|
||||||
|
|
||||||
echo "API client generated in app/src/lib/api"
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
if [ "$STARTED_BACKEND" = true ]; then
|
|
||||||
echo "Stopping backend server..."
|
|
||||||
kill $BACKEND_PID 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Done!"
|
|
||||||
Reference in New Issue
Block a user