mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Merge dev: STT feature, git date fixes, and session improvements (#82)
* fix session last active * Feature/sst (#81) * Use CSS field-sizing for textarea auto-height and abort STT recording on clear * Fix invalid date display in git commits * Use Unix timestamps for git log dates
This commit is contained in:
1 parent
21010956f7
commit
cb1714a4e0
17 files changed
+2475
-76
No files matched your search
@@ -0,0 +1,65 @@
|
||||
import axios from 'axios'
|
||||
import { API_BASE_URL } from '@/config'
|
||||
|
||||
export interface STTModelsResponse {
|
||||
models: string[]
|
||||
cached: boolean
|
||||
}
|
||||
|
||||
export interface STTStatusResponse {
|
||||
enabled: boolean
|
||||
configured: boolean
|
||||
provider: 'external' | 'builtin'
|
||||
model: string
|
||||
}
|
||||
|
||||
export interface STTTranscribeResponse {
|
||||
text: string
|
||||
}
|
||||
|
||||
export interface STTErrorResponse {
|
||||
error: string
|
||||
details?: string
|
||||
}
|
||||
|
||||
export const sttApi = {
|
||||
getModels: async (userId = 'default', forceRefresh = false): Promise<STTModelsResponse> => {
|
||||
const { data } = await axios.get(`${API_BASE_URL}/api/stt/models`, {
|
||||
params: { userId, ...(forceRefresh && { refresh: 'true' }) },
|
||||
})
|
||||
return data
|
||||
},
|
||||
|
||||
getStatus: async (userId = 'default'): Promise<STTStatusResponse> => {
|
||||
const { data } = await axios.get(`${API_BASE_URL}/api/stt/status`, {
|
||||
params: { userId },
|
||||
})
|
||||
return data
|
||||
},
|
||||
|
||||
transcribe: async (
|
||||
audioBlob: Blob,
|
||||
userId = 'default',
|
||||
signal?: AbortSignal
|
||||
): Promise<STTTranscribeResponse> => {
|
||||
const formData = new FormData()
|
||||
|
||||
const extension = audioBlob.type.includes('webm') ? 'webm' :
|
||||
audioBlob.type.includes('ogg') ? 'ogg' :
|
||||
audioBlob.type.includes('mp4') ? 'm4a' : 'webm'
|
||||
formData.append('audio', audioBlob, `recording.${extension}`)
|
||||
|
||||
const { data } = await axios.post<STTTranscribeResponse>(
|
||||
`${API_BASE_URL}/api/stt/transcribe`,
|
||||
formData,
|
||||
{
|
||||
params: { userId },
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
signal,
|
||||
}
|
||||
)
|
||||
return data
|
||||
},
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
import {
|
||||
DEFAULT_TTS_CONFIG,
|
||||
DEFAULT_STT_CONFIG,
|
||||
DEFAULT_KEYBOARD_SHORTCUTS,
|
||||
DEFAULT_USER_PREFERENCES,
|
||||
DEFAULT_LEADER_KEY,
|
||||
type TTSConfig,
|
||||
type STTConfig,
|
||||
type OpenCodeConfigContent,
|
||||
} from '@opencode-manager/shared'
|
||||
|
||||
export type { TTSConfig, OpenCodeConfigContent }
|
||||
export { DEFAULT_TTS_CONFIG, DEFAULT_KEYBOARD_SHORTCUTS, DEFAULT_USER_PREFERENCES, DEFAULT_LEADER_KEY }
|
||||
export type { TTSConfig, STTConfig, OpenCodeConfigContent }
|
||||
export { DEFAULT_TTS_CONFIG, DEFAULT_STT_CONFIG, DEFAULT_KEYBOARD_SHORTCUTS, DEFAULT_USER_PREFERENCES, DEFAULT_LEADER_KEY }
|
||||
|
||||
export interface CustomCommand {
|
||||
name: string
|
||||
@@ -51,6 +53,7 @@ export interface UserPreferences {
|
||||
gitCredentials?: GitCredential[]
|
||||
gitIdentity?: GitIdentity
|
||||
tts?: TTSConfig
|
||||
stt?: STTConfig
|
||||
repoOrder?: number[]
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user