feat: document & audio corpus picker for all tools

- Add "Select from My Docs" button to all text tool forms; free-tier
  users see an upgrade modal, paid (CaveauAI) users get a searchable
  multi-select modal backed by /api/dashboard/documents.php
- Add "Select from My Audio" picker on Transcribe with single-select
  and a "Save to My Audio" button for persisting uploaded clips
- New PHP helpers in bootstrap.php: dbnToolsFetchDocChunks,
  dbnToolsClientIdFromSession, dbnToolsInjectDocContent
- timeline, ask, redact APIs prepend selected document content
  (fetched from client_chunks SQL) before the textarea text
- api/dashboard/audio-upload.php stores audio files on server and
  creates a client_documents row with source_type='audio'
- api/transcribe.php falls back to stored audio via audio_doc_id POST
  field when no file is uploaded
- api/dashboard/documents.php supports ?source_type= filter
- tools.js: doc_ids added to JSON payload; stored-audio transcribe path
- New assets/css/doc-picker.css, assets/js/doc-picker.js
- SQL migration: scripts/sql/audio_docs_column.sql

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 21:38:04 +02:00
parent 58e1d1dae1
commit f383ad5b74
14 changed files with 857 additions and 15 deletions
+9
View File
@@ -104,6 +104,15 @@ require_once __DIR__ . '/includes/layout.php';
</div>
</div>
<div id="audioPickerSection" class="doc-picker-section">
<button type="button" id="audioPickerBtn" class="doc-picker-btn" aria-haspopup="dialog">
<svg class="doc-picker-btn__icon" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="8" cy="8" r="6" stroke="currentColor" stroke-width="1.4"/><path d="M6 5.5v5l5-2.5-5-2.5z" fill="currentColor"/></svg>
<span data-i18n="audioPickerBtn">Select from My Audio</span>
</button>
<div id="audioPickerChips" class="doc-picker-chips" aria-label="Selected audio file"></div>
<input type="hidden" id="audioPickerDocId" name="audio_doc_id" value="">
</div>
<!-- Hidden stubs so tools.js refs don't crash on this page -->
<div class="is-hidden" id="languageControl" aria-hidden="true">
<input type="radio" name="language" value="en" checked>