Build & Push Frontend Docker Image / build-and-push (push) Canceled after 0s
Build Validation / validate (push) Canceled after 6s
Build & Push Backend Docker Image / build-and-push (push) Failing after 10m10s
Build & Push Gateway Docker Image / build-and-push (push) Failing after 10m9s
A professional workspace for AI coding agents with: - Real-time streaming chat with SSE - Session management (fork, clone, tree navigation) - MCP tools browser & metadata panel - Skills browser (global, project, package sources) - Voice input & STT provider configuration - Integrated terminal & file explorer - Model selector with capability metadata - Keyboard-first UI with command palette - 8 languages (en, pt-BR, es, ja, zh-CN, ar, bn, hi) - Tauri 2 desktop app - React 19 + TypeScript + Vite 8 + Tailwind CSS 4 - Pi Agent extension runtime Originally forked from OpenCodeUI, now an independent project. License: GPL-3.0-only
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { piClient } from './piClient'
|
|
import { serverStore } from '../store/serverStore'
|
|
import type { SttSettings, SttTranscriptionResponse, UpdateSttSettingsRequest } from '../types/api/stt'
|
|
|
|
export async function getSttSettings(): Promise<SttSettings> {
|
|
return await piClient.get<SttSettings>('/api/settings/stt')
|
|
}
|
|
|
|
export async function updateSttSettings(settings: UpdateSttSettingsRequest): Promise<SttSettings> {
|
|
return await piClient.post<SttSettings>('/api/settings/stt', settings)
|
|
}
|
|
|
|
function buildUploadHeaders(): Record<string, string> {
|
|
const headers: Record<string, string> = {}
|
|
const token = serverStore.getActiveToken()
|
|
if (token) {
|
|
headers.Authorization = `Bearer ${token}`
|
|
return headers
|
|
}
|
|
|
|
const auth = serverStore.getActiveAuth?.()
|
|
if (auth?.password) {
|
|
headers.Authorization = 'Basic ' + btoa(`${auth.username}:${auth.password}`)
|
|
}
|
|
return headers
|
|
}
|
|
|
|
export async function transcribeAudio(file: Blob, filename = 'voice.webm'): Promise<SttTranscriptionResponse> {
|
|
const baseUrl = serverStore.getActiveBaseUrl()
|
|
const form = new FormData()
|
|
form.set('file', file, filename)
|
|
|
|
const response = await fetch(`${baseUrl}/api/stt/transcriptions`, {
|
|
method: 'POST',
|
|
headers: buildUploadHeaders(),
|
|
body: form,
|
|
})
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP Error ${response.status}: ${response.statusText}`)
|
|
}
|
|
|
|
return (await response.json()) as SttTranscriptionResponse
|
|
}
|