Fix TTS sanitization and message handling bugs

- Add duplicate config validation to backend
- Fix TTS button comparison using original text
- Track original vs sanitized text in TTS context
- Update toast import in message hooks
- Add type safety for error handling
This commit is contained in:
Chris Scott committed 2025-12-18 22:44:07 -05:00
1 parent 698ad7b020
commit 44240f0aab
9 files changed
+23 -10

No files matched your search

+3
View File
@@ -138,6 +138,9 @@ export function createSettingsRoutes(db: Database) {
if (error instanceof z.ZodError) {
return c.json({ error: 'Invalid config data', details: error.issues }, 400)
}
if (error instanceof Error && error.message.includes('already exists')) {
return c.json({ error: error.message }, 409)
}
return c.json({ error: 'Failed to create OpenCode config' }, 500)
}
})
+6
View File
@@ -156,6 +156,12 @@ export class SettingsService {
request: CreateOpenCodeConfigRequest,
userId: string = 'default'
): OpenCodeConfigWithRaw {
// Check for existing config with the same name
const existing = this.getOpenCodeConfigByName(request.name, userId)
if (existing) {
throw new Error(`Config with name '${request.name}' already exists`)
}
const rawContent = typeof request.content === 'string'
? request.content
: JSON.stringify(request.content, null, 2)