diff --git a/app/index.html b/app/index.html deleted file mode 100644 index 2a155139..00000000 --- a/app/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - voicebox - - - -
- - - diff --git a/app/package.json b/app/package.json index 56bf162a..621155df 100644 --- a/app/package.json +++ b/app/package.json @@ -4,10 +4,7 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", - "build": "vite build", "typecheck": "tsc -p tsconfig.json --noEmit", - "preview": "vite preview", "lint": "biome lint src", "lint:fix": "biome lint --write src", "format": "biome format --write src", diff --git a/app/src/components/AudioTab/AudioTab.tsx b/app/src/components/AudioTab/AudioTab.tsx deleted file mode 100644 index 5f7549fb..00000000 --- a/app/src/components/AudioTab/AudioTab.tsx +++ /dev/null @@ -1,675 +0,0 @@ -import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; -import { Check, CheckCircle2, Edit, Plus, Speaker, Trash2 } from 'lucide-react'; -import { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Badge } from '@/components/ui/badge'; -import { Button } from '@/components/ui/button'; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from '@/components/ui/select'; -import { apiClient } from '@/lib/api/client'; -import { BOTTOM_SAFE_AREA_PADDING } from '@/lib/constants/ui'; -import { cn } from '@/lib/utils/cn'; -import { usePlatform } from '@/platform/PlatformContext'; -import { usePlayerStore } from '@/stores/playerStore'; - -interface AudioDevice { - id: string; - name: string; - is_default: boolean; -} - -export function AudioTab() { - const { t } = useTranslation(); - const platform = usePlatform(); - const [createDialogOpen, setCreateDialogOpen] = useState(false); - const [editingChannel, setEditingChannel] = useState(null); - const [selectedChannelId, setSelectedChannelId] = useState(null); - const queryClient = useQueryClient(); - const audioUrl = usePlayerStore((state) => state.audioUrl); - const isPlayerVisible = !!audioUrl; - - const { data: channels, isLoading: channelsLoading } = useQuery({ - queryKey: ['channels'], - queryFn: () => apiClient.listChannels(), - }); - - const { data: devices, isLoading: devicesLoading } = useQuery({ - queryKey: ['audio-devices'], - queryFn: async () => { - if (!platform.metadata.isTauri) { - return []; - } - try { - return await platform.audio.listOutputDevices(); - } catch (error) { - console.error('Failed to list audio devices:', error); - return []; - } - }, - enabled: platform.metadata.isTauri, - }); - - const { data: profiles } = useQuery({ - queryKey: ['profiles'], - queryFn: () => apiClient.listProfiles(), - }); - - const createChannel = useMutation({ - mutationFn: (data: { name: string; device_ids: string[] }) => apiClient.createChannel(data), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['channels'] }); - setCreateDialogOpen(false); - }, - }); - - const updateChannel = useMutation({ - mutationFn: ({ - channelId, - data, - }: { - channelId: string; - data: { name?: string; device_ids?: string[] }; - }) => apiClient.updateChannel(channelId, data), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['channels'] }); - queryClient.invalidateQueries({ queryKey: ['profile-channels'] }); - setEditingChannel(null); - }, - }); - - const deleteChannel = useMutation({ - mutationFn: (channelId: string) => apiClient.deleteChannel(channelId), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['channels'] }); - queryClient.invalidateQueries({ queryKey: ['profile-channels'] }); - }, - }); - - const { data: channelVoices } = useQuery({ - queryKey: ['channel-voices', editingChannel], - queryFn: async () => { - if (!editingChannel) return { profile_ids: [] }; - return apiClient.getChannelVoices(editingChannel); - }, - enabled: !!editingChannel, - }); - - const setChannelVoices = useMutation({ - mutationFn: ({ channelId, profileIds }: { channelId: string; profileIds: string[] }) => - apiClient.setChannelVoices(channelId, profileIds), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['channel-voices'] }); - queryClient.invalidateQueries({ queryKey: ['profile-channels'] }); - }, - }); - - if (channelsLoading || devicesLoading) { - return ( -
-
{t('audioChannels.loading')}
-
- ); - } - - const handleChannelDelete = async (e: React.MouseEvent, channelId: string) => { - e.stopPropagation(); - if (await confirm(t('audioChannels.confirmDelete'))) { - deleteChannel.mutate(channelId); - } - }; - - const allChannels = channels || []; - const allDevices = devices || []; - const selectedChannel = selectedChannelId - ? allChannels.find((c) => c.id === selectedChannelId) - : null; - - return ( -
-
-

{t('audioChannels.title')}

- -
- -
- {/* Left Column - Channels */} -
- {allChannels.length === 0 ? ( -
- -

{t('audioChannels.empty.message')}

- -
- ) : ( -
- {allChannels.map((channel) => { - const isSelected = selectedChannelId === channel.id; - return ( - - -
- )} -
- - ); - })} -
- )} -
- - {/* Right Column - Available Devices */} -
-
-

{t('audioChannels.devices.title')}

-

- {selectedChannelId - ? selectedChannel?.is_default - ? t('audioChannels.devices.defaultNote') - : t('audioChannels.devices.toggleHint') - : t('audioChannels.devices.selectHint')} -

-
- {allDevices.length > 0 ? ( -
- {allDevices.map((device) => { - const isConnected = - selectedChannelId && - selectedChannel && - (selectedChannel.device_ids.length === 0 - ? device.is_default - : selectedChannel.device_ids.includes(device.id)); - const canToggle = - selectedChannelId && selectedChannel && !selectedChannel.is_default; - - const handleDeviceClick = () => { - if (!canToggle || !selectedChannel) return; - - const currentDeviceIds = selectedChannel.device_ids; - const newDeviceIds = isConnected - ? currentDeviceIds.filter((id) => id !== device.id) - : [...currentDeviceIds, device.id]; - - updateChannel.mutate({ - channelId: selectedChannelId, - data: { device_ids: newDeviceIds }, - }); - }; - - return ( - - ); - })} -
- ) : ( -
- -

- {platform.metadata.isTauri - ? t('audioChannels.devices.empty') - : t('audioChannels.devices.requiresTauri')} -

-
- )} -
- - - {/* Create Channel Dialog */} - { - createChannel.mutate({ name, device_ids: deviceIds }); - }} - /> - - {/* Edit Channel Dialog */} - {editingChannel && - (() => { - const channel = channels?.find((c) => c.id === editingChannel); - return channel ? ( - !open && setEditingChannel(null)} - channel={channel} - devices={devices || []} - profiles={profiles || []} - channelVoices={channelVoices?.profile_ids || []} - onUpdate={(name, deviceIds) => { - updateChannel.mutate({ - channelId: editingChannel, - data: { name, device_ids: deviceIds }, - }); - }} - onSetVoices={(profileIds) => { - setChannelVoices.mutate({ - channelId: editingChannel, - profileIds, - }); - }} - /> - ) : null; - })()} - - ); -} - -function ChannelVoicesList({ channelId }: { channelId: string }) { - const { t } = useTranslation(); - const { data: voices } = useQuery({ - queryKey: ['channel-voices', channelId], - queryFn: () => apiClient.getChannelVoices(channelId), - }); - - const { data: profiles } = useQuery({ - queryKey: ['profiles'], - queryFn: () => apiClient.listProfiles(), - }); - - const voiceNames = - voices?.profile_ids.map((id) => profiles?.find((p) => p.id === id)?.name).filter(Boolean) || []; - - return ( -
- {voiceNames.length > 0 ? ( - voiceNames.map((name) => ( - - {name} - - )) - ) : ( - {t('audioChannels.noVoicesAssigned')} - )} -
- ); -} - -interface CreateChannelDialogProps { - open: boolean; - onOpenChange: (open: boolean) => void; - devices: AudioDevice[]; - onCreate: (name: string, deviceIds: string[]) => void; -} - -function CreateChannelDialog({ open, onOpenChange, devices, onCreate }: CreateChannelDialogProps) { - const { t } = useTranslation(); - const [name, setName] = useState(''); - const [selectedDevices, setSelectedDevices] = useState([]); - - const handleSubmit = () => { - if (name.trim()) { - onCreate(name.trim(), selectedDevices); - setName(''); - setSelectedDevices([]); - } - }; - - return ( - - - - {t('audioChannels.createDialog.title')} - {t('audioChannels.createDialog.description')} - -
-
- - setName(e.target.value)} - placeholder={t('audioChannels.fields.namePlaceholder')} - /> -
-
- - - {selectedDevices.length > 0 && ( -
- {selectedDevices.map((deviceId) => { - const device = devices.find((d) => d.id === deviceId); - return ( -
- {device?.name || deviceId} - -
- ); - })} -
- )} -
-
- - - - -
-
- ); -} - -interface EditChannelDialogProps { - open: boolean; - onOpenChange: (open: boolean) => void; - channel: { - id: string; - name: string; - device_ids: string[]; - }; - devices: AudioDevice[]; - profiles: Array<{ id: string; name: string }>; - channelVoices: string[]; - onUpdate: (name: string, deviceIds: string[]) => void; - onSetVoices: (profileIds: string[]) => void; -} - -function EditChannelDialog({ - open, - onOpenChange, - channel, - devices, - profiles, - channelVoices, - onUpdate, - onSetVoices, -}: EditChannelDialogProps) { - const { t } = useTranslation(); - const [name, setName] = useState(channel.name); - const [selectedDevices, setSelectedDevices] = useState(channel.device_ids); - const [selectedVoices, setSelectedVoices] = useState(channelVoices); - - const handleSubmit = () => { - if (name.trim()) { - onUpdate(name.trim(), selectedDevices); - onSetVoices(selectedVoices); - } - }; - - return ( - - - - {t('audioChannels.editDialog.title')} - {t('audioChannels.editDialog.description')} - -
-
- - setName(e.target.value)} /> -
-
- - - {selectedDevices.length > 0 && ( -
- {selectedDevices.map((deviceId) => { - const device = devices.find((d) => d.id === deviceId); - return ( -
- {device?.name || deviceId} - -
- ); - })} -
- )} -
-
- - - {selectedVoices.length > 0 && ( -
- {selectedVoices.map((profileId) => { - const profile = profiles.find((p) => p.id === profileId); - return ( -
- {profile?.name || profileId} - -
- ); - })} -
- )} -
-
- - - - -
-
- ); -} diff --git a/app/src/lib/api/core/ApiError.ts b/app/src/lib/api/core/ApiError.ts deleted file mode 100644 index 657a30a3..00000000 --- a/app/src/lib/api/core/ApiError.ts +++ /dev/null @@ -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; - } -} diff --git a/app/src/lib/api/core/ApiRequestOptions.ts b/app/src/lib/api/core/ApiRequestOptions.ts deleted file mode 100644 index 40aab6c0..00000000 --- a/app/src/lib/api/core/ApiRequestOptions.ts +++ /dev/null @@ -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; - readonly cookies?: Record; - readonly headers?: Record; - readonly query?: Record; - readonly formData?: Record; - readonly body?: any; - readonly mediaType?: string; - readonly responseHeader?: string; - readonly errors?: Record; -}; diff --git a/app/src/lib/api/core/ApiResult.ts b/app/src/lib/api/core/ApiResult.ts deleted file mode 100644 index 24c93fc1..00000000 --- a/app/src/lib/api/core/ApiResult.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/core/CancelablePromise.ts b/app/src/lib/api/core/CancelablePromise.ts deleted file mode 100644 index d94a263e..00000000 --- a/app/src/lib/api/core/CancelablePromise.ts +++ /dev/null @@ -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 implements Promise { - #isResolved: boolean; - #isRejected: boolean; - #isCancelled: boolean; - readonly #cancelHandlers: (() => void)[]; - readonly #promise: Promise; - #resolve?: (value: T | PromiseLike) => void; - #reject?: (reason?: any) => void; - - constructor( - executor: ( - resolve: (value: T | PromiseLike) => void, - reject: (reason?: any) => void, - onCancel: OnCancel, - ) => void, - ) { - this.#isResolved = false; - this.#isRejected = false; - this.#isCancelled = false; - this.#cancelHandlers = []; - this.#promise = new Promise((resolve, reject) => { - this.#resolve = resolve; - this.#reject = reject; - - const onResolve = (value: T | PromiseLike): 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( - onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onRejected?: ((reason: any) => TResult2 | PromiseLike) | null, - ): Promise { - return this.#promise.then(onFulfilled, onRejected); - } - - public catch( - onRejected?: ((reason: any) => TResult | PromiseLike) | null, - ): Promise { - return this.#promise.catch(onRejected); - } - - public finally(onFinally?: (() => void) | null): Promise { - 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; - } -} diff --git a/app/src/lib/api/core/OpenAPI.ts b/app/src/lib/api/core/OpenAPI.ts deleted file mode 100644 index a7242371..00000000 --- a/app/src/lib/api/core/OpenAPI.ts +++ /dev/null @@ -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 = (options: ApiRequestOptions) => Promise; -type Headers = Record; - -export type OpenAPIConfig = { - BASE: string; - VERSION: string; - WITH_CREDENTIALS: boolean; - CREDENTIALS: 'include' | 'omit' | 'same-origin'; - TOKEN?: string | Resolver | undefined; - USERNAME?: string | Resolver | undefined; - PASSWORD?: string | Resolver | undefined; - HEADERS?: Headers | Resolver | 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, -}; diff --git a/app/src/lib/api/core/request.ts b/app/src/lib/api/core/request.ts deleted file mode 100644 index ac97e19b..00000000 --- a/app/src/lib/api/core/request.ts +++ /dev/null @@ -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 = ( - value: T | null | undefined, -): value is Exclude => { - 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 => { - 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 = (options: ApiRequestOptions) => Promise; - -export const resolve = async ( - options: ApiRequestOptions, - resolver?: T | Resolver, -): Promise => { - if (typeof resolver === 'function') { - return (resolver as Resolver)(options); - } - return resolver; -}; - -export const getHeaders = async ( - config: OpenAPIConfig, - options: ApiRequestOptions, -): Promise => { - 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, - ); - - 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 => { - 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 => { - 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 = { - 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 - * @throws ApiError - */ -export const request = ( - config: OpenAPIConfig, - options: ApiRequestOptions, -): CancelablePromise => { - 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); - } - }); -}; diff --git a/app/src/lib/api/index.ts b/app/src/lib/api/index.ts deleted file mode 100644 index 58d71cd4..00000000 --- a/app/src/lib/api/index.ts +++ /dev/null @@ -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'; diff --git a/app/src/lib/api/models/Body_add_profile_sample_profiles__profile_id__samples_post.ts b/app/src/lib/api/models/Body_add_profile_sample_profiles__profile_id__samples_post.ts deleted file mode 100644 index 7229998b..00000000 --- a/app/src/lib/api/models/Body_add_profile_sample_profiles__profile_id__samples_post.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/Body_transcribe_audio_transcribe_post.ts b/app/src/lib/api/models/Body_transcribe_audio_transcribe_post.ts deleted file mode 100644 index b5851c86..00000000 --- a/app/src/lib/api/models/Body_transcribe_audio_transcribe_post.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/GenerationRequest.ts b/app/src/lib/api/models/GenerationRequest.ts deleted file mode 100644 index 9c0e8bb0..00000000 --- a/app/src/lib/api/models/GenerationRequest.ts +++ /dev/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; -}; diff --git a/app/src/lib/api/models/GenerationResponse.ts b/app/src/lib/api/models/GenerationResponse.ts deleted file mode 100644 index 55599ae5..00000000 --- a/app/src/lib/api/models/GenerationResponse.ts +++ /dev/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; -}; diff --git a/app/src/lib/api/models/HTTPValidationError.ts b/app/src/lib/api/models/HTTPValidationError.ts deleted file mode 100644 index ad8f623b..00000000 --- a/app/src/lib/api/models/HTTPValidationError.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/HealthResponse.ts b/app/src/lib/api/models/HealthResponse.ts deleted file mode 100644 index d8aaf9b2..00000000 --- a/app/src/lib/api/models/HealthResponse.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/HistoryListResponse.ts b/app/src/lib/api/models/HistoryListResponse.ts deleted file mode 100644 index 1bb92c24..00000000 --- a/app/src/lib/api/models/HistoryListResponse.ts +++ /dev/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; - total: number; -}; diff --git a/app/src/lib/api/models/HistoryResponse.ts b/app/src/lib/api/models/HistoryResponse.ts deleted file mode 100644 index cc1805ab..00000000 --- a/app/src/lib/api/models/HistoryResponse.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/ModelDownloadRequest.ts b/app/src/lib/api/models/ModelDownloadRequest.ts deleted file mode 100644 index 8722a24f..00000000 --- a/app/src/lib/api/models/ModelDownloadRequest.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/ModelStatus.ts b/app/src/lib/api/models/ModelStatus.ts deleted file mode 100644 index fdba4285..00000000 --- a/app/src/lib/api/models/ModelStatus.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/ModelStatusListResponse.ts b/app/src/lib/api/models/ModelStatusListResponse.ts deleted file mode 100644 index 67ed3f56..00000000 --- a/app/src/lib/api/models/ModelStatusListResponse.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/ProfileSampleResponse.ts b/app/src/lib/api/models/ProfileSampleResponse.ts deleted file mode 100644 index 4f95dc78..00000000 --- a/app/src/lib/api/models/ProfileSampleResponse.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/TranscriptionResponse.ts b/app/src/lib/api/models/TranscriptionResponse.ts deleted file mode 100644 index 13b76647..00000000 --- a/app/src/lib/api/models/TranscriptionResponse.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/ValidationError.ts b/app/src/lib/api/models/ValidationError.ts deleted file mode 100644 index aa015bfd..00000000 --- a/app/src/lib/api/models/ValidationError.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* generated using openapi-typescript-codegen -- do not edit */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export type ValidationError = { - loc: Array; - msg: string; - type: string; -}; diff --git a/app/src/lib/api/models/VoiceProfileCreate.ts b/app/src/lib/api/models/VoiceProfileCreate.ts deleted file mode 100644 index 2039ff81..00000000 --- a/app/src/lib/api/models/VoiceProfileCreate.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/models/VoiceProfileResponse.ts b/app/src/lib/api/models/VoiceProfileResponse.ts deleted file mode 100644 index a5983049..00000000 --- a/app/src/lib/api/models/VoiceProfileResponse.ts +++ /dev/null @@ -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; -}; diff --git a/app/src/lib/api/schemas/$Body_add_profile_sample_profiles__profile_id__samples_post.ts b/app/src/lib/api/schemas/$Body_add_profile_sample_profiles__profile_id__samples_post.ts deleted file mode 100644 index 42ae7824..00000000 --- a/app/src/lib/api/schemas/$Body_add_profile_sample_profiles__profile_id__samples_post.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$Body_transcribe_audio_transcribe_post.ts b/app/src/lib/api/schemas/$Body_transcribe_audio_transcribe_post.ts deleted file mode 100644 index 1d692b0f..00000000 --- a/app/src/lib/api/schemas/$Body_transcribe_audio_transcribe_post.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$GenerationRequest.ts b/app/src/lib/api/schemas/$GenerationRequest.ts deleted file mode 100644 index 9f308de8..00000000 --- a/app/src/lib/api/schemas/$GenerationRequest.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$GenerationResponse.ts b/app/src/lib/api/schemas/$GenerationResponse.ts deleted file mode 100644 index dc185ad0..00000000 --- a/app/src/lib/api/schemas/$GenerationResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$HTTPValidationError.ts b/app/src/lib/api/schemas/$HTTPValidationError.ts deleted file mode 100644 index 3e0176df..00000000 --- a/app/src/lib/api/schemas/$HTTPValidationError.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$HealthResponse.ts b/app/src/lib/api/schemas/$HealthResponse.ts deleted file mode 100644 index c957f0fe..00000000 --- a/app/src/lib/api/schemas/$HealthResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$HistoryListResponse.ts b/app/src/lib/api/schemas/$HistoryListResponse.ts deleted file mode 100644 index 23c4ca15..00000000 --- a/app/src/lib/api/schemas/$HistoryListResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$HistoryResponse.ts b/app/src/lib/api/schemas/$HistoryResponse.ts deleted file mode 100644 index 2f9ea284..00000000 --- a/app/src/lib/api/schemas/$HistoryResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$ModelDownloadRequest.ts b/app/src/lib/api/schemas/$ModelDownloadRequest.ts deleted file mode 100644 index aaabeaab..00000000 --- a/app/src/lib/api/schemas/$ModelDownloadRequest.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$ModelStatus.ts b/app/src/lib/api/schemas/$ModelStatus.ts deleted file mode 100644 index 765476f7..00000000 --- a/app/src/lib/api/schemas/$ModelStatus.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$ModelStatusListResponse.ts b/app/src/lib/api/schemas/$ModelStatusListResponse.ts deleted file mode 100644 index ddc76d79..00000000 --- a/app/src/lib/api/schemas/$ModelStatusListResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$ProfileSampleResponse.ts b/app/src/lib/api/schemas/$ProfileSampleResponse.ts deleted file mode 100644 index 5a15e989..00000000 --- a/app/src/lib/api/schemas/$ProfileSampleResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$TranscriptionResponse.ts b/app/src/lib/api/schemas/$TranscriptionResponse.ts deleted file mode 100644 index a85d524d..00000000 --- a/app/src/lib/api/schemas/$TranscriptionResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$ValidationError.ts b/app/src/lib/api/schemas/$ValidationError.ts deleted file mode 100644 index f3c6906e..00000000 --- a/app/src/lib/api/schemas/$ValidationError.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$VoiceProfileCreate.ts b/app/src/lib/api/schemas/$VoiceProfileCreate.ts deleted file mode 100644 index 6b8146e7..00000000 --- a/app/src/lib/api/schemas/$VoiceProfileCreate.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/schemas/$VoiceProfileResponse.ts b/app/src/lib/api/schemas/$VoiceProfileResponse.ts deleted file mode 100644 index 741cca8d..00000000 --- a/app/src/lib/api/schemas/$VoiceProfileResponse.ts +++ /dev/null @@ -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; diff --git a/app/src/lib/api/services/DefaultService.ts b/app/src/lib/api/services/DefaultService.ts deleted file mode 100644 index 640c8cbc..00000000 --- a/app/src/lib/api/services/DefaultService.ts +++ /dev/null @@ -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 { - return __request(OpenAPI, { - method: 'GET', - url: '/', - }); - } - /** - * Health - * Health check endpoint. - * @returns HealthResponse Successful Response - * @throws ApiError - */ - public static healthHealthGet(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/health', - }); - } - /** - * List Profiles - * List all voice profiles. - * @returns VoiceProfileResponse Successful Response - * @throws ApiError - */ - public static listProfilesProfilesGet(): CancelablePromise> { - 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 { - 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 { - 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 { - 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 { - 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 { - 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> { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - return __request(OpenAPI, { - method: 'POST', - url: '/models/download', - body: requestBody, - mediaType: 'application/json', - errors: { - 422: `Validation Error`, - }, - }); - } -} diff --git a/app/src/main.tsx b/app/src/main.tsx deleted file mode 100644 index 52dc9044..00000000 --- a/app/src/main.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { QueryClientProvider } from '@tanstack/react-query'; -// import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import App from './App'; -import './i18n'; -import './index.css'; -import { queryClient } from './lib/queryClient'; - -ReactDOM.createRoot(document.getElementById('root')!).render( - - - - {/* */} - - , -); diff --git a/app/src/router.tsx b/app/src/router.tsx index 940e7c52..13ba45d5 100644 --- a/app/src/router.tsx +++ b/app/src/router.tsx @@ -113,7 +113,7 @@ const voicesRoute = createRoute({ component: VoicesTab, }); -// Captures route (prototype — will replace AudioTab once the new flow is ready) +// Captures route const capturesRoute = createRoute({ getParentRoute: () => rootRoute, path: '/captures', @@ -199,8 +199,8 @@ const serverRedirectRoute = createRoute({ }, }); -// Route tree -const routeTree = rootRoute.addChildren([ +// Route tree — exported so tests can build routers over memory history +export const routeTree = rootRoute.addChildren([ indexRoute, storiesRoute, capturesRoute, diff --git a/app/vite.config.ts b/app/vite.config.ts deleted file mode 100644 index 36bc168b..00000000 --- a/app/vite.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import path from 'node:path'; -import tailwindcss from '@tailwindcss/vite'; -import react from '@vitejs/plugin-react'; -import { defineConfig } from 'vite'; -import { changelogPlugin } from './plugins/changelog'; - -export default defineConfig({ - plugins: [tailwindcss(), react(), changelogPlugin(path.resolve(__dirname, '..'))], - resolve: { - alias: { - '@': path.resolve(__dirname, './src'), - }, - }, -});