feat(dashboard): add corpus dashboard at /dashboard/
Full private corpus dashboard for tools.dobetternorge.no users — each SSO
account gets an auto-provisioned CaveauAI tenant (clients row, corpus) on
first visit. Includes upload (file/paste/URL), RAG chat with SSE streaming
and citation chips, document CRUD, FalkorDB graph relations tab, and
improved save-from-tool flow with tag/preview support.
- dashboard/{index,documents,document,upload,chat,settings}.php
- api/dashboard/{corpus-init,documents,upload,ingest-status,chat-stream,
save-from-tool,graph}.php
- includes/{CorpusProvision,layout_dashboard,layout_dashboard_footer}.php
- assets/css/dashboard.css assets/js/corpus-save.js (routing upgrade)
- includes/{bootstrap,layout}.php extended for dashboard provisioning
Migration 141 (clients.dbn_sso_uid + import_method enum) applied on chloe.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* GET /api/dashboard/corpus-init.php
|
||||
*
|
||||
* Idempotent: ensures the current session has a CaveauAI client tenant +
|
||||
* default corpus, lazy-creating both on first hit. Safe to call on every
|
||||
* dashboard page load (results are session-cached).
|
||||
*
|
||||
* Response:
|
||||
* {
|
||||
* "ok": true,
|
||||
* "client_id": 102,
|
||||
* "client_user_id": 257,
|
||||
* "corpus_id": 18,
|
||||
* "created": false
|
||||
* }
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 2) . '/includes/bootstrap.php';
|
||||
|
||||
dbnToolsRequireMethod('GET');
|
||||
dbnToolsRequireAuth();
|
||||
|
||||
try {
|
||||
$tenant = dbnToolsEnsureDashboardTenant();
|
||||
} catch (DbnToolsHttpException $e) {
|
||||
dbnToolsError($e->getMessage(), $e->status, $e->errorCode, $e->extra);
|
||||
}
|
||||
|
||||
dbnToolsRespond([
|
||||
'ok' => true,
|
||||
'client_id' => (int)$tenant['client_id'],
|
||||
'client_user_id' => (int)$tenant['client_user_id'],
|
||||
'corpus_id' => (int)$tenant['corpus_id'],
|
||||
'created' => (bool)($tenant['created'] ?? false),
|
||||
]);
|
||||
Reference in New Issue
Block a user