Add GitHub token validation and improve TTS configuration

- Add git token validation endpoint and UI validation
- Improve TTS endpoint normalization and discovery
- Move shared types to workspace package
- Add better error handling for TTS API calls
- Support composite voices for Kokoro-style TTS
- Auto-fetch TTS models and voices on config change
This commit is contained in:
Chris Scott committed 2025-12-15 14:43:03 -05:00
1 parent 406ff8fd4a
commit c7de65290a
11 files changed
+410 -154

No files matched your search

+5
View File
@@ -117,4 +117,9 @@ export const settingsApi = {
const { data } = await axios.put(`${API_BASE_URL}/api/settings/agents-md`, { content })
return data
},
validateGitToken: async (gitToken: string): Promise<{ valid: boolean; message: string }> => {
const { data } = await axios.post(`${API_BASE_URL}/api/settings/validate-git-token`, { gitToken })
return data
},
}
+10 -58
View File
@@ -1,35 +1,19 @@
import {
DEFAULT_TTS_CONFIG,
DEFAULT_KEYBOARD_SHORTCUTS,
DEFAULT_USER_PREFERENCES,
type TTSConfig,
} from '@opencode-manager/shared'
export type { TTSConfig }
export { DEFAULT_TTS_CONFIG, DEFAULT_KEYBOARD_SHORTCUTS, DEFAULT_USER_PREFERENCES }
export interface CustomCommand {
name: string
description: string
promptTemplate: string
}
export interface TTSConfig {
enabled: boolean
endpoint: string
apiKey: string
voice: string
model: string
speed: number
availableVoices?: string[]
availableModels?: string[]
lastVoicesFetch?: number
lastModelsFetch?: number
}
export const DEFAULT_TTS_CONFIG: TTSConfig = {
enabled: false,
endpoint: 'https://api.openai.com/v1/audio/speech',
apiKey: '',
voice: 'alloy',
model: 'tts-1',
speed: 1.0,
availableVoices: [],
availableModels: [],
lastVoicesFetch: 0,
lastModelsFetch: 0,
}
export interface CustomAgent {
name: string
description: string
@@ -86,35 +70,3 @@ export interface OpenCodeConfigResponse {
configs: OpenCodeConfig[]
defaultConfig: OpenCodeConfig | null
}
const isMac = typeof navigator !== 'undefined' && navigator.platform.toUpperCase().indexOf('MAC') >= 0
const CMD_KEY = isMac ? 'Cmd' : 'Ctrl'
export const DEFAULT_KEYBOARD_SHORTCUTS: Record<string, string> = {
submit: `${CMD_KEY}+Enter`,
abort: 'Escape',
toggleMode: 'Tab',
undo: `${CMD_KEY}+Z`,
redo: `${CMD_KEY}+Shift+Z`,
compact: `${CMD_KEY}+K`,
fork: `${CMD_KEY}+Shift+F`,
settings: `${CMD_KEY}+,`,
sessions: `${CMD_KEY}+S`,
newSession: `${CMD_KEY}+N`,
closeSession: `${CMD_KEY}+W`,
toggleSidebar: `${CMD_KEY}+B`,
selectModel: `${CMD_KEY}+M`,
}
export const DEFAULT_USER_PREFERENCES: UserPreferences = {
theme: 'dark',
mode: 'build',
autoScroll: true,
showReasoning: false,
expandToolCalls: false,
keyboardShortcuts: DEFAULT_KEYBOARD_SHORTCUTS,
customCommands: [],
customAgents: [],
gitToken: undefined,
tts: DEFAULT_TTS_CONFIG,
}