feat(07-05): frontend AI config client helpers + AdminAiConfigTab system section + Vitest tests

- Add getAiConfig/saveAiConfig/testAiConnection to frontend/src/api/client.js
- AdminAiConfigTab.vue: add System AI Providers section above existing per-user table
  - Per-provider accordion (10 providers from PROVIDER_DEFAULTS)
  - Write-only API key field (never pre-filled), base URL, model, context_chars inputs
  - Set Active (atomic flip), Save, Test Connection buttons with inline badges
  - Existing per-user ai-config table and saveConfig logic untouched (Pitfall 6)
- Create frontend/tests/api.spec.js: 4 Vitest tests for getAiConfig/saveAiConfig/testAiConnection
- All 127 frontend tests pass, build exits 0 (D-11 frontend coverage)
This commit is contained in:
curo1305
2026-06-04 23:22:08 +02:00
parent e678930b8d
commit 0db412d66c
3 changed files with 346 additions and 0 deletions
+21
View File
@@ -290,6 +290,27 @@ export function adminDeleteUser(id, adminPassword) {
})
}
// ── System AI Provider Configuration (D-08, D-15) ───────────────────────────
export function getAiConfig() {
return request('/api/admin/ai-config', { method: 'GET' })
}
export function saveAiConfig(body) {
return request('/api/admin/ai-config', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
})
}
export function testAiConnection(providerId) {
return request(
'/api/admin/ai-config/test-connection?provider_id=' + encodeURIComponent(providerId),
{ method: 'GET' }
)
}
// ── Folders ───────────────────────────────────────────────────────────────────
export function listFolders(parentId = null) {