ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: ручное назначение Voice Tasker

This commit is contained in:
DCCONSTRUCTIONS
2026-04-28 11:04:38 +03:00
parent 9243924f78
commit 02d79da6f9
8 changed files with 488 additions and 45 deletions
@@ -45,11 +45,30 @@ export class WorkspaceAIService extends APIService {
});
}
async retrieveVoiceTaskPreflight(workspaceSlug: string): Promise<TVoiceTaskPreflight> {
return this.get(`/api/workspaces/${workspaceSlug}/voice-task/preflight/`)
.then((response) => response?.data)
async retrieveVoiceTaskPreflight(workspaceSlug: string, projectId?: string | null): Promise<TVoiceTaskPreflight> {
const params = projectId ? `?project_id=${projectId}` : "";
return this.get(
`/api/workspaces/${workspaceSlug}/voice-task/preflight/${params}`,
{},
{ validateStatus: () => true }
)
.then((response) => {
if (response?.status === 200) return response?.data;
if (response?.status === 401 || response?.status === 403)
return {
available: false,
reason: "scope_denied",
max_audio_duration_seconds: 120,
accepted_mime_types: ["audio/webm", "audio/mp4", "audio/mpeg", "audio/wav"],
access_mode: "all_workspace_members",
enabled_project_ids: [],
enabled_member_ids: [],
} satisfies TVoiceTaskPreflight;
throw response?.data;
})
.catch((error) => {
throw error?.response?.data;
throw error?.response?.data ?? error;
});
}