mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 09:05:17 -07:00
format
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import { ConnectionForm } from '@/components/ServerSettings/ConnectionForm';
|
import { ConnectionForm } from '@/components/ServerSettings/ConnectionForm';
|
||||||
import { DataFolders } from '@/components/ServerSettings/DataFolders';
|
import { DataFolders } from '@/components/ServerSettings/DataFolders';
|
||||||
|
import { ProviderSettings } from '@/components/ServerSettings/ProviderSettings';
|
||||||
import { ServerStatus } from '@/components/ServerSettings/ServerStatus';
|
import { ServerStatus } from '@/components/ServerSettings/ServerStatus';
|
||||||
import { UpdateStatus } from '@/components/ServerSettings/UpdateStatus';
|
import { UpdateStatus } from '@/components/ServerSettings/UpdateStatus';
|
||||||
import { ProviderSettings } from '@/components/ServerSettings/ProviderSettings';
|
|
||||||
import { usePlatform } from '@/platform/PlatformContext';
|
import { usePlatform } from '@/platform/PlatformContext';
|
||||||
|
|
||||||
export function ServerTab() {
|
export function ServerTab() {
|
||||||
|
|||||||
+50
-34
@@ -1,30 +1,30 @@
|
|||||||
import { useServerStore } from '@/stores/serverStore';
|
|
||||||
import type { LanguageCode } from '@/lib/constants/languages';
|
import type { LanguageCode } from '@/lib/constants/languages';
|
||||||
|
import { useServerStore } from '@/stores/serverStore';
|
||||||
import type {
|
import type {
|
||||||
VoiceProfileCreate,
|
|
||||||
VoiceProfileResponse,
|
|
||||||
ProfileSampleResponse,
|
|
||||||
GenerationRequest,
|
|
||||||
GenerationResponse,
|
|
||||||
HistoryQuery,
|
|
||||||
HistoryListResponse,
|
|
||||||
HistoryResponse,
|
|
||||||
TranscriptionResponse,
|
|
||||||
HealthResponse,
|
|
||||||
ModelStatusListResponse,
|
|
||||||
ModelDownloadRequest,
|
|
||||||
ActiveTasksResponse,
|
ActiveTasksResponse,
|
||||||
FolderPathsResponse,
|
FolderPathsResponse,
|
||||||
|
GenerationRequest,
|
||||||
|
GenerationResponse,
|
||||||
|
HealthResponse,
|
||||||
|
HistoryListResponse,
|
||||||
|
HistoryQuery,
|
||||||
|
HistoryResponse,
|
||||||
|
ModelDownloadRequest,
|
||||||
|
ModelStatusListResponse,
|
||||||
|
ProfileSampleResponse,
|
||||||
StoryCreate,
|
StoryCreate,
|
||||||
StoryResponse,
|
|
||||||
StoryDetailResponse,
|
StoryDetailResponse,
|
||||||
|
StoryItemBatchUpdate,
|
||||||
StoryItemCreate,
|
StoryItemCreate,
|
||||||
StoryItemDetail,
|
StoryItemDetail,
|
||||||
StoryItemBatchUpdate,
|
|
||||||
StoryItemReorder,
|
|
||||||
StoryItemMove,
|
StoryItemMove,
|
||||||
StoryItemTrim,
|
StoryItemReorder,
|
||||||
StoryItemSplit,
|
StoryItemSplit,
|
||||||
|
StoryItemTrim,
|
||||||
|
StoryResponse,
|
||||||
|
TranscriptionResponse,
|
||||||
|
VoiceProfileCreate,
|
||||||
|
VoiceProfileResponse,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
class ApiClient {
|
class ApiClient {
|
||||||
@@ -328,7 +328,15 @@ class ApiClient {
|
|||||||
return response.blob();
|
return response.blob();
|
||||||
}
|
}
|
||||||
|
|
||||||
async importGeneration(file: File): Promise<{ id: string; profile_id: string; profile_name: string; text: string; message: string }> {
|
async importGeneration(
|
||||||
|
file: File,
|
||||||
|
): Promise<{
|
||||||
|
id: string;
|
||||||
|
profile_id: string;
|
||||||
|
profile_name: string;
|
||||||
|
text: string;
|
||||||
|
message: string;
|
||||||
|
}> {
|
||||||
const url = `${this.getBaseUrl()}/history/import`;
|
const url = `${this.getBaseUrl()}/history/import`;
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
@@ -387,7 +395,12 @@ class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async triggerModelDownload(modelName: string): Promise<{ message: string }> {
|
async triggerModelDownload(modelName: string): Promise<{ message: string }> {
|
||||||
console.log('[API] triggerModelDownload called for:', modelName, 'at', new Date().toISOString());
|
console.log(
|
||||||
|
'[API] triggerModelDownload called for:',
|
||||||
|
modelName,
|
||||||
|
'at',
|
||||||
|
new Date().toISOString(),
|
||||||
|
);
|
||||||
const result = await this.request<{ message: string }>('/models/download', {
|
const result = await this.request<{ message: string }>('/models/download', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ model_name: modelName } as ModelDownloadRequest),
|
body: JSON.stringify({ model_name: modelName } as ModelDownloadRequest),
|
||||||
@@ -420,10 +433,7 @@ class ApiClient {
|
|||||||
return this.request('/channels');
|
return this.request('/channels');
|
||||||
}
|
}
|
||||||
|
|
||||||
async createChannel(data: {
|
async createChannel(data: { name: string; device_ids: string[] }): Promise<{
|
||||||
name: string;
|
|
||||||
device_ids: string[];
|
|
||||||
}): Promise<{
|
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
is_default: boolean;
|
is_default: boolean;
|
||||||
@@ -465,10 +475,7 @@ class ApiClient {
|
|||||||
return this.request(`/channels/${channelId}/voices`);
|
return this.request(`/channels/${channelId}/voices`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setChannelVoices(
|
async setChannelVoices(channelId: string, profileIds: string[]): Promise<{ message: string }> {
|
||||||
channelId: string,
|
|
||||||
profileIds: string[],
|
|
||||||
): Promise<{ message: string }> {
|
|
||||||
return this.request(`/channels/${channelId}/voices`, {
|
return this.request(`/channels/${channelId}/voices`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify({ profile_ids: profileIds }),
|
body: JSON.stringify({ profile_ids: profileIds }),
|
||||||
@@ -479,10 +486,7 @@ class ApiClient {
|
|||||||
return this.request(`/profiles/${profileId}/channels`);
|
return this.request(`/profiles/${profileId}/channels`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setProfileChannels(
|
async setProfileChannels(profileId: string, channelIds: string[]): Promise<{ message: string }> {
|
||||||
profileId: string,
|
|
||||||
channelIds: string[],
|
|
||||||
): Promise<{ message: string }> {
|
|
||||||
return this.request(`/profiles/${profileId}/channels`, {
|
return this.request(`/profiles/${profileId}/channels`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify({ channel_ids: channelIds }),
|
body: JSON.stringify({ channel_ids: channelIds }),
|
||||||
@@ -545,21 +549,33 @@ class ApiClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async moveStoryItem(storyId: string, itemId: string, data: StoryItemMove): Promise<StoryItemDetail> {
|
async moveStoryItem(
|
||||||
|
storyId: string,
|
||||||
|
itemId: string,
|
||||||
|
data: StoryItemMove,
|
||||||
|
): Promise<StoryItemDetail> {
|
||||||
return this.request<StoryItemDetail>(`/stories/${storyId}/items/${itemId}/move`, {
|
return this.request<StoryItemDetail>(`/stories/${storyId}/items/${itemId}/move`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async trimStoryItem(storyId: string, itemId: string, data: StoryItemTrim): Promise<StoryItemDetail> {
|
async trimStoryItem(
|
||||||
|
storyId: string,
|
||||||
|
itemId: string,
|
||||||
|
data: StoryItemTrim,
|
||||||
|
): Promise<StoryItemDetail> {
|
||||||
return this.request<StoryItemDetail>(`/stories/${storyId}/items/${itemId}/trim`, {
|
return this.request<StoryItemDetail>(`/stories/${storyId}/items/${itemId}/trim`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async splitStoryItem(storyId: string, itemId: string, data: StoryItemSplit): Promise<StoryItemDetail[]> {
|
async splitStoryItem(
|
||||||
|
storyId: string,
|
||||||
|
itemId: string,
|
||||||
|
data: StoryItemSplit,
|
||||||
|
): Promise<StoryItemDetail[]> {
|
||||||
return this.request<StoryItemDetail[]>(`/stories/${storyId}/items/${itemId}/split`, {
|
return this.request<StoryItemDetail[]>(`/stories/${storyId}/items/${itemId}/split`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PlatformFilesystem, FileFilter } from '@/platform/types';
|
import type { FileFilter, PlatformFilesystem } from '@/platform/types';
|
||||||
|
|
||||||
export const tauriFilesystem: PlatformFilesystem = {
|
export const tauriFilesystem: PlatformFilesystem = {
|
||||||
async saveFile(filename: string, blob: Blob, filters?: FileFilter[]) {
|
async saveFile(filename: string, blob: Blob, filters?: FileFilter[]) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PlatformFilesystem, FileFilter } from '@/platform/types';
|
import type { FileFilter, PlatformFilesystem } from '@/platform/types';
|
||||||
|
|
||||||
export const webFilesystem: PlatformFilesystem = {
|
export const webFilesystem: PlatformFilesystem = {
|
||||||
async saveFile(filename: string, blob: Blob, _filters?: FileFilter[]) {
|
async saveFile(filename: string, blob: Blob, _filters?: FileFilter[]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user