feat: KB Accelerator — convert KB articles into interactive flows #104

Merged
chihlasm merged 20 commits from feat/kb-accelerator into main 2026-03-12 21:29:08 +00:00
Showing only changes of commit 92c86cab80 - Show all commits

View File

@@ -140,8 +140,14 @@ export default function KBAcceleratorPage() {
// Refresh quota
kbAcceleratorApi.getQuota().then(setQuota).catch(() => {})
} catch (err: unknown) {
const message = (err as { response?: { data?: { detail?: string } } })?.response?.data?.detail ?? 'Commit failed'
toast.error(message)
const detail = (err as { response?: { data?: { detail?: string | { message?: string; validation_errors?: string[] } } } })?.response?.data?.detail
if (typeof detail === 'object' && detail !== null) {
const msg = detail.message || 'Commit failed'
const errors = detail.validation_errors
toast.error(errors?.length ? `${msg}\n${errors.join('\n')}` : msg)
} else {
toast.error(typeof detail === 'string' ? detail : 'Commit failed')
}
} finally {
setLoading(false)
}