pediatric-ai-scribe-v3/public/js
Daniel Onyejesi 936ad7e8a0 Add AI content generation to Learning Hub CMS
Backend (src/routes/learningAI.js):
- POST /api/admin/learning/ai-generate
  * Accepts: topic text, uploaded file (PDF/TXT/MD/HTML), or Nextcloud WebDAV path
  * Extracts text from PDFs via pdf-parse; plain text read directly
  * Fetches WebDAV files using stored Nextcloud credentials
  * Prompts AI to return structured JSON: title, subject, body (HTML), questions[]
  * Strips code fences, falls back to regex JSON extraction if needed
- POST /api/admin/learning/ai-refine — refine existing body with instructions
- GET  /api/admin/learning/webdav-browse — PROPFIND-based Nextcloud file browser
- POST /api/admin/learning/webdav-path — save user's default browse path

Frontend:
- AI Generate button in CMS editor header (gradient purple→blue)
- Panel with 3 source tabs: By Topic / Upload File / Nextcloud
- Drag-and-drop file dropzone with DataTransfer API support
- WebDAV file browser: navigate folders, select files, breadcrumb path
- Options: question count, content type (article/quiz/pearl), model selector, instructions
- Refine Current Body: prompt-driven AI rewrite of existing content
- Generated content auto-fills title, subject, type, Tiptap body, quiz questions

Settings:
- Nextcloud section: "Learning Hub Default Browse Path" field (shown when connected)
- Saves to webdav_learning_path column via /api/admin/learning/webdav-path

DB: ALTER TABLE users ADD COLUMN IF NOT EXISTS webdav_learning_path TEXT
2026-03-24 00:17:28 -04:00
..
admin.js Dedicated CMS page, responsive email templates, security fixes in auth 2026-03-23 20:13:22 -04:00
app.js Fix line breaks in AI output: use innerHTML instead of textContent 2026-03-23 21:17:50 -04:00
auth.js Fix Quill link tooltip positioning and registration flash 2026-03-23 23:09:21 -04:00
chartReview.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
encounters.js Fix: chart review New clears all fields/notes, date context for AI, Bedrock vendor model-only models 2026-03-23 18:12:07 +01:00
hospitalCourse.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
learningHub.js Add AI content generation to Learning Hub CMS 2026-03-24 00:17:28 -04:00
liveEncounter.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
memories.js Feat: admin CMS, save/resume encounters, user templates, SSHADESS, well visit notes, sick visit, ROS/PE checklists, ICD-10 diagnoses 2026-03-22 16:43:39 -04:00
milestones.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
milestonesData.js v3.0: Add multi-provider Bedrock models, newborn milestones, Converse API 2026-03-23 22:13:19 +01:00
nextcloud.js Add AI content generation to Learning Hub CMS 2026-03-24 00:17:28 -04:00
pediatricScheduleData.js Add growth velocity, feeding guidance, BMI classification to well visits 2026-03-23 23:11:24 +01:00
shadess.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
sickVisit.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
soap.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
voiceDictation.js Fix module init: defer all tab scripts until component HTML is loaded 2026-03-23 22:03:54 -04:00
wellVisit.js Fix vaccine/catchup tabs and serve Quill locally 2026-03-23 22:59:47 -04:00