feat: v3.0 — CIS PDF chunker, DOCX professional, RAG complete, progress bar, code cleanup
- CIS PDF chunker: segments by recommendation (54/54 complete with desc+rationale+rem), 7000 chars target, 500 overlap - RAG: 60s timeout + retry, direct SQL fetch by recommendationNumber, concatenate all chunks - Auto-detect embedding dimension from DDL (empty tables), auto-detect model per dimension - DOCX: camo strip (Pillow), A4 centered cover, code blocks (Consolas), lists with hanging indent - Compliance report: progress bar (RAG X/35 percentage), Audit/Verification bold - Code cleanup: removed redundant imports (io, base64, time, Response, HTMLResponse), duplicate DB query - EmbeddingsPage: auto-select ADB config fix - ReportsPage: removed DOCX preview (docx-preview lib) - README updated to v3.0 with all new features
This commit is contained in:
230
README.md
230
README.md
@@ -9,7 +9,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-2.8-C74634?style=flat-square" alt="Version">
|
||||
<img src="https://img.shields.io/badge/version-3.0-C74634?style=flat-square" alt="Version">
|
||||
<img src="https://img.shields.io/badge/python-3.12-3776AB?style=flat-square" alt="Python">
|
||||
<img src="https://img.shields.io/badge/FastAPI-0.115-009688?style=flat-square" alt="FastAPI">
|
||||
<img src="https://img.shields.io/badge/OCI-GenAI-C74634?style=flat-square" alt="OCI">
|
||||
@@ -29,67 +29,57 @@ The platform combines security compliance scanning, AI-powered chat with **RAG (
|
||||
|
||||
## Features
|
||||
|
||||
### 🤖 AI Chat Agent with RAG + MCP Tool Use
|
||||
### AI Chat Agent with RAG + MCP Tool Use
|
||||
- **OCI Generative AI** integration via official SDK (`oci.generative_ai_inference`)
|
||||
- **RAG (Retrieval-Augmented Generation)**: automatically queries ADB vector store for relevant context before generating responses — single ADB connection per search, smart table skip (only queries relevant tables based on question topic), CIS recommendation text filter for exact matching, follow-up context enrichment for short questions
|
||||
- **RAG (Retrieval-Augmented Generation)**: queries ADB vector store for relevant context before generating responses — single ADB connection per search, smart table skip, CIS recommendation text filter for exact matching, follow-up context enrichment
|
||||
- **Source hierarchy**: findings tables > cisrecom (official remediation) > engineerknowledgebase (complementary) — temporal awareness with extract dates, tenancy isolation via JSON_VALUE filter
|
||||
- **MCP Tool Use (Function Calling)**: GenAI models can call tools from registered MCP servers during chat — supports both Cohere and Generic (OpenAI-style) function calling formats with automatic tool execution loop (max 5 iterations)
|
||||
- **Chat Memory Compaction**: automatic summarization of older messages when conversation exceeds ~6000 tokens — keeps 20 recent messages (10 interactions) intact and generates an LLM-based summary of older context
|
||||
- **Chat Sidebar**: collapsible right-side panel with model parameters (temperature, max_tokens, top_p, top_k, penalties) for quick adjustment during conversation
|
||||
- **Multimodal Chat**: upload images (PNG/JPG/GIF/WebP), PDFs, and text files directly in the chat for AI analysis — supports up to 5 files per message via OCI GenAI `ImageContent` and `DocumentContent`
|
||||
- **Async Background Processing**: chat requests return immediately, GenAI + MCP tools process in background via dedicated thread pool (10 threads), frontend polls for results — eliminates 504 timeouts on long-running scans
|
||||
- **Thinking Indicator**: button disables and shows spinner + "Pensando..." while waiting for GenAI response, with message timestamps
|
||||
- **MCP Tool Use (Function Calling)**: GenAI models call tools from registered MCP servers during chat — supports Cohere and Generic (OpenAI-style) function calling with automatic tool execution loop (max 5 iterations)
|
||||
- **Chat Memory Compaction**: automatic summarization of older messages when conversation exceeds ~6000 tokens — keeps 20 recent messages intact
|
||||
- **Chat Sidebar**: collapsible panel with model parameters (temperature, max_tokens, top_p, top_k, penalties)
|
||||
- **Multimodal Chat**: upload images (PNG/JPG/GIF/WebP), PDFs, and text files for AI analysis — up to 5 files per message via OCI GenAI `ImageContent` and `DocumentContent`
|
||||
- **Async Background Processing**: chat requests return immediately, GenAI + MCP tools process in background via dedicated thread pool (10 threads), frontend polls for results
|
||||
- 16 chat models + 3 embedding models across 5 providers: **Meta** (Llama 4), **Google** (Gemini 2.5), **OpenAI** (GPT-5.2/5.1/5 Mini/4.1/4o, o3/o4-mini), **xAI** (Grok 4/3)
|
||||
- OCID-based model resolution: catalog maps model IDs to OCI resource IDs per region for reliable API calls
|
||||
- OCID-based model resolution: catalog maps model IDs to OCI resource IDs per region
|
||||
- 16 OCI regions supported with auto-generated endpoints
|
||||
- **Provider parameter matrix**: automatic parameter segmentation per model — reasoning models (o3/o4-mini) only get `max_completion_tokens` + `reasoning_effort`, OpenAI GPT-4.x gets freq/pres penalties, Google/Meta get `top_k`, xAI gets basic params. Unsupported parameters are explicitly nulled to prevent SDK serialization errors
|
||||
- Full parameter control: temperature, max_tokens, top_p, top_k, frequency/presence penalty (when supported by model)
|
||||
- **Provider parameter matrix**: automatic parameter segmentation per model — reasoning models (o3/o4-mini) only get `max_completion_tokens` + `reasoning_effort`, OpenAI GPT-4.x gets freq/pres penalties, Google/Meta get `top_k`
|
||||
- Full parameter control: temperature, max_tokens, top_p, top_k, frequency/presence penalty (when supported)
|
||||
- Toggle MCP tools on/off per chat session
|
||||
- Conversation history with session management
|
||||
- On-Demand and Dedicated serving modes
|
||||
|
||||
### 🏗️ Terraform Agent (IaC)
|
||||
### Terraform Agent (IaC)
|
||||
- **AI-powered Terraform code generation** for OCI infrastructure provisioning
|
||||
- Dedicated chat interface with OCI Terraform provider context
|
||||
- **Workspace management**: create, plan, apply, destroy Terraform workspaces
|
||||
- **Compartment-aware**: browse and select target compartment for provisioning, with existing OCI resources injected as context
|
||||
- **Compartment-aware**: browse and select target compartment, with existing OCI resources injected as context
|
||||
- **Plan/Apply/Destroy lifecycle**: full Terraform workflow with real-time output tracking
|
||||
- **File management**: view generated `.tf` files, copy, download individually or as bundle
|
||||
- **Confirmation modal**: type "DESTROY" to confirm resource destruction
|
||||
- **Inline file editor**: click any generated `.tf` file to edit in-place with monospace editor, Tab support, and save — auto-syncs with workspace code
|
||||
- **Split-panel terminal**: real-time Plan/Apply/Destroy output in a dark terminal panel alongside files/plan/resources (always visible)
|
||||
- **Inline file editor**: click any `.tf` file to edit in-place with monospace editor, Tab support, and save
|
||||
- **Split-panel terminal**: real-time Plan/Apply/Destroy output in a dark terminal panel alongside files/plan/resources
|
||||
- **Multi-file generation**: AI generates separate `.tf` files via `// filename:` markers (main.tf, variables.tf, outputs.tf, etc.)
|
||||
- **Smart file correction**: when fixing errors, model generates only changed files — frontend merges with existing workspace, preserving untouched files. Existing files, plan output, and apply errors are injected as context automatically
|
||||
- **14-point validation checklist**: system prompt enforces cross-references, CIDRs, security lists, route tables, DRG attachments, RPC peering, HCL block syntax, resource type validation, and variable declarations
|
||||
- **Auto-split pipeline (3 layers)**: frontend + backend auto-split of monolithic HCL files into categorized files (networking.tf, compute.tf, etc.) + backend deduplication to prevent duplicate resource errors
|
||||
- **HCL syntax fix**: automatic expansion of single-line blocks with multiple arguments into valid multi-line HCL format
|
||||
- **Resource type validation**: SQLite-based validation of ~937 OCI resource types with `difflib.get_close_matches` suggestions for invalid types — warnings appended automatically to model responses
|
||||
- **Smart file correction**: when fixing errors, model generates only changed files — frontend merges with existing workspace, preserving untouched files
|
||||
- **14-point validation checklist**: system prompt enforces cross-references, CIDRs, security lists, route tables, DRG attachments, RPC peering, HCL syntax, resource type validation, and variable declarations
|
||||
- **Auto-split pipeline (3 layers)**: frontend + backend auto-split of monolithic HCL files into categorized files + backend deduplication
|
||||
- **HCL syntax fix**: automatic expansion of single-line blocks into valid multi-line HCL format
|
||||
- **Resource type validation**: SQLite-based validation of ~937 OCI resource types with `difflib.get_close_matches` suggestions
|
||||
- **Chat history**: ChatGPT-style session history with rename/delete, shared between Chat Agent and Terraform Agent
|
||||
- **Resizable split view**: chat on top (50%), files/plan/resources + terminal on bottom (50%) with drag-to-resize
|
||||
- Terraform CLI installed in container (v1.14.7)
|
||||
- **Terraform Resource Reference**: auto-generated OCI provider resource catalog (~937 resources) injected into system prompt — built from `terraform providers schema -json` at container startup, stored in SQLite, refreshable via menu button
|
||||
- **Official Resource Docs Injection**: on-demand fetch of Example Usage + Argument Reference from the official OCI Terraform provider docs (registry.terraform.io) — cached in SQLite, injected into model context based on detected resource types
|
||||
- **Smart variable resolution**: auto-generates `terraform.tfvars` by scanning declared variables and mapping them to OCI config values (`tenancy_ocid`, `user_ocid`, `fingerprint`, `compartment_id`, `ssh_public_key`) — region is never forced, respecting variable defaults
|
||||
- **Multi-region provider management**: auto-detects provider aliases and region variables in generated code, generates `provider.tf` with credentials and correct region references (`var.region` instead of hardcoded values)
|
||||
- **Region safety guard**: plan is blocked if the model does not declare `variable "region"` — prevents accidental provisioning in the wrong region by never falling back to hardcoded defaults
|
||||
- **Rollback button**: when `terraform apply` fails, a Rollback button appears allowing manual `terraform destroy` to clean up partially created resources (requires typing "ROLLBACK" to confirm)
|
||||
- **System prompt sync**: Terraform system prompt in code is automatically synced to DB on every restart — single source of truth
|
||||
- **Terraform Resource Reference**: auto-generated OCI provider resource catalog (~937 resources) injected into system prompt — built from `terraform providers schema -json`, stored in SQLite, refreshable via UI
|
||||
- **Official Resource Docs Injection**: on-demand fetch of Example Usage + Argument Reference from the official OCI Terraform provider docs — cached in SQLite
|
||||
- **Smart variable resolution**: auto-generates `terraform.tfvars` by scanning declared variables and mapping them to OCI config values
|
||||
- **Multi-region provider management**: auto-detects provider aliases and region variables, generates `provider.tf` with correct region references
|
||||
- **Region safety guard**: plan is blocked if the model does not declare `variable "region"` — prevents accidental provisioning in the wrong region
|
||||
- **Rollback button**: when `terraform apply` fails, a Rollback button appears for `terraform destroy` with confirmation
|
||||
- **Prompt Generator**: dedicated sub-menu for AI-powered prompt generation — curated models, same knowledge pipeline as Terraform Agent, official docs injection, copy & send to Terraform Agent
|
||||
- **Prompt Editor**: inline system prompt editor with auto-save (800ms debounce)
|
||||
- Compact system prompt optimized for OCI Terraform provider best practices (100K max_tokens)
|
||||
- **Flat workspace enforcement**: system prompt prohibits `module` blocks (workspace has no subdirectories) and enforces single-file variable declarations (`variables.tf` only)
|
||||
|
||||
### 📝 Terraform Prompt Generator
|
||||
- **AI-powered prompt generation** for OCI infrastructure — generates structured, optimized prompts to feed into the Terraform Agent
|
||||
- Dedicated chat interface (sub-menu under Terraform) matching Terraform Agent layout
|
||||
- **Curated model selection**: only 7 recommended models (GPT-4.1, o3, o4-mini, GPT-5.1, GPT-5.2, Gemini 2.5 Pro, Gemini 2.5 Flash), grouped by provider
|
||||
- **Same knowledge pipeline as Terraform Agent**: compact resource reference + auto-detected resource types + official docs from GitHub (cached in SQLite)
|
||||
- **Official Terraform docs injection**: detects resource types from user message (keywords + explicit `oci_*` mentions), fetches Example Usage + Argument Reference from GitHub, cached in `tf_resource_docs` table
|
||||
- **Conversation history**: persistent sessions (agent_type `tf-prompt`) with sidebar history panel, rename/delete, session restore
|
||||
- **Contextual follow-up**: conversation history sent to GenAI for iterative prompt refinement
|
||||
- **Copy & Send**: action buttons on assistant messages to copy the prompt or send directly to the Terraform Agent input
|
||||
- Robust system prompt with OCI Provider constraints, inference rules, architecture templates, and workspace restrictions
|
||||
- Example prompts as clickable buttons for quick start
|
||||
### OCI Services
|
||||
- **Service Status tab**: auto-detect 6 security services (VSS, Data Safe, Cloud Guard, Bastion, Security Zones, Vault) per tenancy via OCI API with user overrides
|
||||
- **OCI Health tab**: real-time Oracle service health from ocistatus.oraclecloud.com — 49 regions, search, geographic filters
|
||||
|
||||
### ⚡ OCI Resource Actions
|
||||
### OCI Resource Actions
|
||||
- **Start/Stop Compute Instances** directly from OCI Account Explorer with one click
|
||||
- **Start/Stop Autonomous Databases** from Explorer with confirmation prompt
|
||||
- **Start/Stop DB Systems, MySQL, Container Instances** — 5 resource types with operational control
|
||||
@@ -99,8 +89,8 @@ The platform combines security compliance scanning, AI-powered chat with **RAG (
|
||||
- Lifecycle state badges (RUNNING/STOPPED/AVAILABLE) with color indicators
|
||||
- Actions audited in the audit log
|
||||
|
||||
### 🔍 OCI Account Explorer
|
||||
- **KPI stats bar**: real-time resource counts per category with tooltip breakdown, cached in SQLite for instant loading
|
||||
### OCI Account Explorer
|
||||
- **KPI stats bar**: real-time resource counts per category with tooltip breakdown, cached in SQLite
|
||||
- **Tree-view navigation** with resizable side panel (280px default) and drag handle
|
||||
- **36 resource types** across 9 categories:
|
||||
- **Compute**: Instances, Boot Volumes, Instance Pools
|
||||
@@ -118,128 +108,124 @@ The platform combines security compliance scanning, AI-powered chat with **RAG (
|
||||
- **Dead state filtering**: automatically hides TERMINATED/DELETED/DELETING resources
|
||||
- **Background count refresh**: counts cached in SQLite, refreshed on compartment access without blocking UI
|
||||
- **Security list detail**: view ingress/egress rules directly in the explorer
|
||||
- Select which OCI connection to explore
|
||||
- Real-time API calls via OCI Python SDK
|
||||
|
||||
### 📊 CIS Compliance Reports (Oracle Official Engine)
|
||||
### CIS Compliance Reports (Oracle Official Engine)
|
||||
- Powered by Oracle's official `cis_reports.py` (6660 lines, 48 CIS + 11 OBP checks)
|
||||
- **Granular execution parameters**: CIS Level (1/2), OCI Best Practices, Raw Data, OCID Redaction
|
||||
- **Level 1**: Essential security controls that can be implemented with minimal impact on operations. Recommended as baseline for all organizations.
|
||||
- **Level 2**: Advanced security controls that may restrict functionality or require more effort to implement. Recommended for high-security environments.
|
||||
- **Multiple output formats**: HTML summary, CSV per section/finding, JSON summary, optional XLSX
|
||||
- **Report history**: full execution history with status, tenancy filter, and download actions (HTML/JSON) in the Reports tab
|
||||
- **Delete reports**: remove completed reports and their associated files from the system
|
||||
- **File browser**: files grouped by section (Summary, CIS Findings, OBP, Raw Data, etc.) within the Reports page, with per-section embedding
|
||||
- **Embed individual files**: embed any report file (CSV, TXT, JSON, PDF) directly into the ADB vector store for RAG enrichment
|
||||
- **Report history**: full execution history with status, tenancy filter, and download actions
|
||||
- **Delete reports**: remove completed reports and their associated files
|
||||
- **File browser**: files grouped by section within the Reports page, with per-section embedding
|
||||
- **Embed individual files**: embed any report file (CSV, TXT, JSON, PDF) into the ADB vector store for RAG enrichment
|
||||
- Region filtering with multi-select
|
||||
- Real-time progress tracking with phase-based progress bar
|
||||
- **CIS Engine auto-update**: check for new versions of `cis_reports.py` from Oracle's GitHub repository and update with one click (admin only). Custom patches are automatically reapplied after update
|
||||
- **CIS Engine auto-update**: check for new versions from Oracle's GitHub and update with one click (admin only)
|
||||
|
||||
### 📋 LAD A-Team CIS Compliance Report
|
||||
### LAD A-Team CIS Compliance Report
|
||||
- **Professional compliance report** following Oracle Cloud Security Assessment format (cover page, purpose statement, disclaimer, copyright)
|
||||
- **Table of Contents** with links to each section and recommendation
|
||||
- **Security Overview**: 7 Oracle security pillars (Customer Isolation, Data Encryption, Data Management, etc.)
|
||||
- **OCI Services section**: summary table of 6 security services per tenancy + detailed descriptions + Cloud Guard recommendations table
|
||||
- **CIS Assessment Summary**: table with Domains / Total Controls / Failed / Passed per section
|
||||
- **CIS Benchmark Recommendation Summary**: full table with Item / Description / Status (OK/FAILED)
|
||||
- **Detailed findings**: per-recommendation cards with compliance percentage bar, result description, and remediation steps
|
||||
- **RAG-powered remediation**: enriched remediation steps fetched from ADB vector store (`CISRECOM` table) using cosine similarity search — filters by exact recommendation number, extracts only remediation section from matched chunks
|
||||
- **Affected resources CSV links**: non-compliant findings show a clickable link to download the CSV with affected resource details (authenticated via JWT token)
|
||||
- **Download PDF**: `window.print()` with CSS `@page A4` formatting for professional PDF output
|
||||
- **Caching**: generated HTML cached to disk, subsequent views are instant; "Regenerar" button clears cache and re-generates
|
||||
- **RAG-powered remediation**: enriched remediation steps from ADB vector store (`CISRECOM` table) using cosine similarity — filters by exact recommendation number
|
||||
- **Affected resources CSV links**: non-compliant findings show a clickable link to download the CSV with affected resource details (JWT auth)
|
||||
- **Back page**: Connect with us + copyright
|
||||
- **Download PDF**: `window.print()` with CSS `@page A4` formatting
|
||||
- **Download DOCX**: standalone DOCX export with Pillow camouflage strip, green header tables, result boxes, code blocks, A4 format
|
||||
- **compliance_data.json**: shared data source between HTML and DOCX (identical content)
|
||||
- **Progress bar during generation**: shows RAG progress (X/35), percentage, and current recommendation
|
||||
- **ADB connection pre-check**: fail fast with 503 if ADB is unreachable before starting generation
|
||||
- **Caching**: generated HTML cached to disk; "Regenerar" button clears cache and re-generates
|
||||
- **Collapsible sections**: HTML report and compliance report start minimized, expandable on demand
|
||||
|
||||
### 🛡️ Built-in CIS MCP Server (Granular Per-Section)
|
||||
### Built-in CIS MCP Server (Granular Per-Section)
|
||||
- **Auto-registered** CIS Compliance Scanner MCP server — available out of the box
|
||||
- **12 granular tools** instead of monolithic full-tenancy scan:
|
||||
- `cis_scan_iam` — IAM checks (CIS 1.1–1.17): users, policies, groups, MFA, API keys
|
||||
- `cis_scan_networking` — Network checks (CIS 2.1–2.8): security lists, NSGs, VCNs
|
||||
- `cis_scan_compute` — Compute checks (CIS 3.1–3.3): instance metadata, monitoring
|
||||
- `cis_scan_logging_monitoring` — Logging/Monitoring checks (CIS 4.1–4.17): audit, alarms, events
|
||||
- `cis_scan_storage` — Storage checks (CIS 5.1–5.3): buckets, block volumes, file systems
|
||||
- `cis_scan_asset_management` — Asset checks (CIS 6.1–6.2): compartments, tagging
|
||||
- `cis_scan_iam` — IAM checks (CIS 1.1-1.17): users, policies, groups, MFA, API keys
|
||||
- `cis_scan_networking` — Network checks (CIS 2.1-2.8): security lists, NSGs, VCNs
|
||||
- `cis_scan_compute` — Compute checks (CIS 3.1-3.3): instance metadata, monitoring
|
||||
- `cis_scan_logging_monitoring` — Logging/Monitoring checks (CIS 4.1-4.17): audit, alarms, events
|
||||
- `cis_scan_storage` — Storage checks (CIS 5.1-5.3): buckets, block volumes, file systems
|
||||
- `cis_scan_asset_management` — Asset checks (CIS 6.1-6.2): compartments, tagging
|
||||
- `cis_list_configs` / `cis_list_checks` — list available OCI configs and CIS checks
|
||||
- `cis_get_check` / `cis_get_remediation` — detailed findings and remediation guidance
|
||||
- `cis_get_scan_status` / `cis_invalidate_cache` — session status and cache management
|
||||
- **Per-section data collection**: each scan tool collects only the OCI data needed for that section, avoiding unnecessary API calls
|
||||
- **Region-specific scanning**: all scan tools accept optional `regions` parameter to target specific OCI regions (e.g., `["us-ashburn-1"]`) instead of scanning the entire tenancy
|
||||
- **Session caching**: collected data is cached per config+regions scope (2-hour TTL), so subsequent scans on different sections reuse shared prerequisites (compartments, identity domains)
|
||||
- **Compartment filtering**: scan results can be filtered by specific compartment, showing only relevant findings
|
||||
- **Collection error tracking**: errors during data collection are captured per section and reported to the caller
|
||||
- **Parallelized data collection**: base collectors and regional collectors run in parallel thread pools (up to 8 workers), with 30-minute timeout per tool call and 1 automatic retry on failure
|
||||
- Based on Oracle's official `cis_reports.py` (6660 lines, 48 CIS + 11 OBP checks)
|
||||
- **Per-section data collection**: each scan tool collects only the OCI data needed for that section
|
||||
- **Region-specific scanning**: all scan tools accept optional `regions` parameter to target specific OCI regions
|
||||
- **Session caching**: collected data cached per config+regions scope (2-hour TTL)
|
||||
- **Compartment filtering**: scan results can be filtered by specific compartment
|
||||
- **Parallelized data collection**: base and regional collectors run in parallel (up to 8 workers), 30-minute timeout with 1 automatic retry
|
||||
|
||||
### 🔌 MCP Server Registry + Tool Discovery
|
||||
### MCP Server Registry + Tool Discovery
|
||||
- Register multiple MCP servers (stdio, SSE, Python module)
|
||||
- **Automatic tool discovery**: connect to MCP servers and discover available tools with names, descriptions, and input schemas
|
||||
- **Manual tool definition**: add/edit tools with JSON Schema parameter definitions
|
||||
- **Chat Agent integration**: discovered tools are automatically available as GenAI function calls during chat
|
||||
- **Chat Agent integration**: discovered tools are automatically available as GenAI function calls
|
||||
- Upload `.py` scripts directly to servers
|
||||
- **Link MCP servers to ADB Vector** databases as tools
|
||||
- Activate/deactivate servers
|
||||
- Select which MCP server to use per report execution
|
||||
|
||||
### 🗄️ Autonomous Database Vector Storage
|
||||
### Autonomous Database Vector Storage
|
||||
- Oracle Autonomous Database connection with **mTLS Wallet** authentication
|
||||
- `python-oracledb` Thin mode (no Oracle Client needed)
|
||||
- Wallet ZIP upload and automatic extraction
|
||||
- Connection testing with **case-insensitive table validation** against ADB `user_tables`
|
||||
- **Multiple vector tables per ADB**: register, edit, toggle active/inactive — tables managed inside the edit connection card
|
||||
- **Multiple vector tables per ADB**: register, edit, toggle active/inactive
|
||||
- **Multi-table RAG search**: queries all active tables across all ADB configs, merges results by cosine distance
|
||||
- **Auto-resolve embedding config**: automatically uses existing OCI credentials for GenAI embeddings — no separate GenAI config required
|
||||
- **Case-insensitive table matching**: supports both uppercase and lowercase table names in Oracle ADB with quoted identifiers
|
||||
- **Auto-resolve embedding config**: automatically uses existing OCI credentials for GenAI embeddings
|
||||
- **Case-insensitive table matching**: supports both uppercase and lowercase table names with quoted identifiers
|
||||
|
||||
### 🧬 Embeddings & Knowledge Base
|
||||
- **Auto-embed CIS Reports**: one-click embedding of all report CSVs — each CSV automatically mapped to its ADB table (identityandaccess, networking, computeinstances, etc.)
|
||||
- **Per-section embedding**: embed individual sections (Identity, Networking, Compute, etc.) with dedicated button per section
|
||||
- **CIS Recommendation tagging**: each embedded document includes CIS recommendation number, section, and status in the content for precise search
|
||||
- **Auto-detect embedding dimension**: detects table dimension (1536/3072) and selects correct model automatically
|
||||
- **Purge before re-embed**: automatically deletes old data for same tenancy/date before inserting new embeddings
|
||||
### Embeddings & Knowledge Base
|
||||
- **Auto-embed CIS Reports**: one-click embedding of all report CSVs — each CSV automatically mapped to its ADB table
|
||||
- **Per-section embedding**: embed individual sections with dedicated button per section
|
||||
- **CIS Recommendation tagging**: each embedded document includes CIS recommendation number, section, and status
|
||||
- **Auto-detect embedding dimension**: detects table dimension (1536/3072) from DDL (even on empty tables) and selects correct model automatically (1536 = small, 3072 = large)
|
||||
- **Purge before re-embed**: automatically deletes old data for same tenancy/date before inserting
|
||||
- **Real-time progress**: progress bar with current section, global progress, queue of upcoming sections
|
||||
- **Background persistence**: embedding continues when navigating away, progress resumes on return
|
||||
- **Text chunking**: large CSV rows split into 8000-char chunks with context header (Tenancy, Resource, CIS Recommendation) repeated
|
||||
- **CIS Recommendations**: upload CIS PDF to populate the `cisrecom` vector table
|
||||
- **CIS PDF Chunker**: segments CIS PDF by recommendation number (X.X Ensure...), target 7000 chars with 500-char overlap, filters TOC/appendix/page headers — 54/54 recommendations with complete Description + Rationale + Remediation
|
||||
- **RAG timeout 60s + retry**: increased from 30s with no retry for improved reliability
|
||||
- **Direct SQL fetch**: retrieves chunks by metadata `recommendationNumber` for overlap resolution
|
||||
- **Knowledge Base**: upload documents (`.txt`, `.pdf`, `.csv`, `.json`, `.md`) or **import URLs** to populate `engineerknowledgebase`
|
||||
- **Consult Embeddings**: chat-like interface with tenancy selector — queries vector store with CIS number detection for exact matching, smart table skip, source citations
|
||||
- **OCI GenAI Embeddings**: uses OpenAI Text Embedding 3 Large/Small via OCI GenAI
|
||||
- 11 ADB vector tables supported (9 CIS report + 2 knowledge base)
|
||||
|
||||
### 📜 Configuration & Chat Logs
|
||||
### Configuration & Chat Logs
|
||||
- **Persistent activity log** per configuration tab (OCI, GenAI, ADB, MCP)
|
||||
- **Chat audit logs**: all chat interactions (user messages, AI responses, tool calls, errors) logged with session/message ID, severity, and source
|
||||
- **Chat audit logs**: all chat interactions logged with session/message ID, severity, and source
|
||||
- Logs all test, save, upload, report, and ingest operations with severity (success/error/info)
|
||||
- **Inline log panel** at the bottom of each config tab with severity filter
|
||||
- Auto-cleanup of logs older than 30 days
|
||||
- Admin can view all logs; users see only their own
|
||||
- API endpoints for listing and clearing logs
|
||||
|
||||
### 🔄 Export / Import Configuration
|
||||
### Export / Import Configuration
|
||||
- **Full config export** as JSON: OCI credentials (with private keys), GenAI configs, MCP servers, system prompts, app settings, ADB vector configs
|
||||
- **Import** from exported JSON with merge-by-ID (skips existing, prevents duplicates)
|
||||
- Private keys exported as base64 and restored to disk on import
|
||||
- Enables full environment migration between machines (Mac ↔ Windows ↔ Linux)
|
||||
- Enables full environment migration between machines
|
||||
|
||||
### 🎨 Theme System & UI
|
||||
### Theme System & UI
|
||||
- **Light/Dark mode toggle** in the sidebar footer
|
||||
- **Oracle Dark Premium** design: deep dark backgrounds (#0D0F12), dark cards (#1A1D24), Oracle Red accent (#C74634)
|
||||
- **Oracle-branded light mode**: warm light backgrounds (original theme)
|
||||
- Theme preference persisted in localStorage across sessions
|
||||
- All CSS driven by CSS custom properties — zero hardcoded colors
|
||||
- **SVG icon system**: 45+ Lucide-based inline SVG icons replace all emojis for cross-platform consistency (Windows/Mac/Linux)
|
||||
- **KPI Dashboard**: compliance score gauge (SVG semicircular arc with gradient), pass/fail/total KPI cards, donut chart (severity distribution), horizontal bar chart (findings by section) — powered by Recharts
|
||||
- **Animated UI**: staggered fade-in for cards/KPIs/tables, smooth theme transitions, hover effects with transforms, shimmer loading states, pulse alerts
|
||||
- **SVG icon system**: 45+ Lucide-based inline SVG icons for cross-platform consistency
|
||||
- **KPI Dashboard**: compliance score gauge (SVG semicircular arc with gradient), pass/fail/total KPI cards, donut chart, horizontal bar chart — powered by Recharts
|
||||
- **Animated UI**: staggered fade-in, smooth theme transitions, hover effects, shimmer loading states, pulse alerts
|
||||
|
||||
### ✏️ Terraform Prompt Editor
|
||||
- **Inline prompt editor** accessible from the Terraform menu (3-dot menu → Editar Prompt)
|
||||
- Edit the active Terraform system prompt name and content
|
||||
- **Auto-save with debounce** (800ms): changes saved to database automatically as you type
|
||||
- Visual "Salvando..." → "Salvo ✓" indicator
|
||||
|
||||
### 🔐 Security
|
||||
### Security
|
||||
- **JWT authentication** with configurable expiry
|
||||
- **TOTP MFA** (Google Authenticator / Authy compatible)
|
||||
- **RBAC** with 3 roles: Admin, User, Viewer
|
||||
- Audit logging for all operations
|
||||
- Encrypted credential storage
|
||||
- **Per-user timezone** setting (not global)
|
||||
|
||||
---
|
||||
|
||||
@@ -266,6 +252,7 @@ The platform combines security compliance scanning, AI-powered chat with **RAG (
|
||||
| | - GenAI --> LLM (16 models) | |
|
||||
| | - oracledb --> ADB Vector | |
|
||||
| | - Chromium --> PDF gen | |
|
||||
| | - Pillow --> DOCX gen | |
|
||||
| | - Terraform CLI 1.14.7 | |
|
||||
| | - SQLite (agent.db) | |
|
||||
| | | |
|
||||
@@ -325,7 +312,7 @@ Default credentials:
|
||||
- **Username:** `admin`
|
||||
- **Password:** `admin123`
|
||||
|
||||
> ⚠️ Change the default password immediately after first login.
|
||||
> Change the default password immediately after first login.
|
||||
|
||||
---
|
||||
|
||||
@@ -460,7 +447,7 @@ CREATE TABLE engineerknowledgebase (ID RAW(16), TEXT CLOB, METADATA JSON, EMBEDD
|
||||
|
||||
| Table Name | Purpose | How to populate |
|
||||
|-----------|---------|-----------------|
|
||||
| `cisrecom` | CIS Benchmark official recommendations — remediation steps, rationale, audit procedures per control | Upload CIS PDF in Embeddings tab |
|
||||
| `cisrecom` | CIS Benchmark official recommendations — remediation steps, rationale, audit procedures per control | Upload CIS PDF in Embeddings tab (auto-chunked by recommendation) |
|
||||
| `engineerknowledgebase` | General knowledge base — blogs, documentation, PDFs, URLs for complementary context | Upload files or import URLs in Embeddings tab |
|
||||
|
||||
> **How embedding works**: When you click **"Embed Report"** on a completed CIS report, the system automatically:
|
||||
@@ -506,19 +493,19 @@ Allow group <group-name> to read buckets in compartment <compartment-name>
|
||||
```
|
||||
oci-cis-agent/
|
||||
├── backend/
|
||||
│ ├── app.py # FastAPI application (~7700 lines)
|
||||
│ ├── app.py # FastAPI application (~9800 lines)
|
||||
│ ├── cis_reports.py # Oracle CIS Benchmark checker (6660 lines, report engine)
|
||||
│ ├── mcp_cis_server.py # MCP server with 12 granular CIS tools (~700 lines)
|
||||
│ ├── gen_tf_reference.py # OCI Terraform provider resource catalog generator
|
||||
│ ├── Dockerfile # Python 3.12 + OCI CLI + Terraform 1.14.7 + Chromium
|
||||
│ └── requirements.txt # Dependencies
|
||||
├── frontend-react/
|
||||
│ ├── src/ # React 19 SPA (TypeScript, 38 source files, ~15500 lines)
|
||||
│ │ ├── pages/ # 15 page components (Chat, Terraform, Explorer, Reports, Config, Admin)
|
||||
│ ├── src/ # React 19 SPA (TypeScript, 39 source files, ~15800 lines)
|
||||
│ │ ├── pages/ # 16 page components (Chat, Terraform, Explorer, OCI Services, Reports, Config, Admin)
|
||||
│ │ ├── api/ # API client + endpoint modules
|
||||
│ │ ├── stores/ # Zustand stores (app state persistence across navigation)
|
||||
│ │ ├── hooks/ # Custom hooks (theme, polling)
|
||||
│ │ └── i18n/ # Internationalization (pt/en, 700+ keys)
|
||||
│ │ └── i18n/ # Internationalization (pt/en, 703 keys)
|
||||
│ └── dist/ # Built SPA served at /
|
||||
├── nginx/
|
||||
│ └── default.conf # Reverse proxy (React SPA + API /api/)
|
||||
@@ -598,6 +585,14 @@ oci-cis-agent/
|
||||
| GET | `/api/oci/explore/{id}/counts` | Get cached resource counts (instant from SQLite) |
|
||||
| POST | `/api/oci/explore/{id}/counts/refresh` | Refresh all resource counts in background |
|
||||
|
||||
### OCI Services
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| GET | `/api/oci-services/{config_id}` | Get service status per tenancy |
|
||||
| PUT | `/api/oci-services/{config_id}` | Update service overrides |
|
||||
| GET | `/api/oci-health` | Oracle Cloud status proxy (49 regions) |
|
||||
|
||||
### OCI Resource Actions
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
@@ -704,7 +699,16 @@ oci-cis-agent/
|
||||
| GET | `/api/reports/{rid}/files/{fid}/download` | Download individual report file |
|
||||
| GET | `/api/reports/{rid}/compliance-report` | Serve cached LAD A-Team compliance report HTML |
|
||||
| POST | `/api/reports/{rid}/compliance-report/generate` | Generate compliance report (background, with RAG) |
|
||||
| GET | `/api/reports/{rid}/compliance-report/status` | Check if compliance report is ready |
|
||||
| GET | `/api/reports/{rid}/compliance-report/status` | Check compliance report status (returns progress: current, total, step, rec) |
|
||||
| GET | `/api/reports/{rid}/compliance-report/docx` | Download compliance report as DOCX |
|
||||
|
||||
### User Settings
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| GET | `/api/users/me/timezone` | Get user timezone |
|
||||
| PUT | `/api/users/me/timezone` | Set user timezone |
|
||||
| GET | `/api/settings/timezone/options` | List available timezone options |
|
||||
|
||||
### CIS Engine
|
||||
|
||||
@@ -785,6 +789,7 @@ All models include OCID mapping for `us-ashburn-1`. For other regions, use the "
|
||||
| OCI SDK | `oci` 2.133.0, `oci-cli` |
|
||||
| ADB | `python-oracledb` 2.4.1 (Thin mode) |
|
||||
| GenAI | `oci.generative_ai_inference` |
|
||||
| Image Processing | Pillow (DOCX report generation) |
|
||||
| Container | Docker Compose, Nginx reverse proxy |
|
||||
| MCP | Model Context Protocol SDK (stdio/SSE) with tool discovery + execution |
|
||||
| Terraform | Terraform CLI 1.14.7, OCI Provider |
|
||||
@@ -796,9 +801,10 @@ All models include OCID mapping for `us-ashburn-1`. For other regions, use the "
|
||||
|
||||
| Version | Date | Changes |
|
||||
|---------|------|---------|
|
||||
| **v3.0** | 2026-03 | **OCI Services page**: new menu item with Service Status tab (auto-detect 6 security services — VSS, Data Safe, Cloud Guard, Bastion, Security Zones, Vault — per tenancy via OCI API + user overrides) and OCI Health tab (real-time Oracle service health from ocistatus.oraclecloud.com, 49 regions, search, geo filters). **Compliance Report v3.0**: OCI Services section with summary table + detailed descriptions + Cloud Guard recommendations, back page (Connect with us + copyright), DOCX download (Pillow camouflage strip, green header tables, result boxes, code blocks, A4 format), compliance_data.json shared between HTML and DOCX, progress bar during RAG generation (X/35, percentage), ADB connection pre-check (fail fast 503). **CIS PDF Chunker**: segments CIS PDF by recommendation number (X.X Ensure...), target 7000 chars with 500-char overlap, filters TOC/appendix/page headers — 54/54 recommendations with complete Description + Rationale + Remediation. **Embedding improvements**: auto-detect dimension from DDL (even on empty tables), auto-detect model per dimension (1536=small, 3072=large), RAG timeout 60s + retry (was 30s), direct SQL fetch by metadata recommendationNumber for overlap chunks. **Per-user timezone** (not global). **New API endpoints**: OCI Health proxy, OCI Services status/overrides, user timezone CRUD, DOCX download, compliance progress details, timezone options. |
|
||||
| **v2.8** | 2026-03 | **Legacy frontend removed**: React SPA now served at root `/` (no more `/app/` prefix), legacy vanilla JS SPA removed. **Compliance Report ZIP download**: Chromium headless PDF generation (identical to browser print) + CSV findings bundled in ZIP. **Compliance generation state persisted server-side**: `.compliance_generating` marker file ensures generation status survives page navigation — spinner auto-resumes on return. **RAG remediation enriched**: extracts Description, Rationale, Audit, and Remediation sections from CIS vector chunks, combines up to 3 matched chunks. **Chat markdown styling**: full markdown rendering with syntax highlighting (Catppuccin Mocha theme via rehype-highlight), styled headings, lists, tables, blockquotes, inline/block code. **Default model auto-select**: Chat Agent auto-selects first GenAI config on page load. **Explorer silent polling**: no more flickering during start/stop resource actions. |
|
||||
| **v2.7** | 2026-03 | **LAD A-Team CIS Compliance Report**: professional Oracle-format compliance report with cover page, TOC, Security Overview (7 pillars), CIS Assessment Summary, detailed findings with compliance % bars, RAG-powered remediation from ADB vector store (`CISRECOM` table with strict recommendation number filtering), affected resources CSV download links per non-compliant finding (JWT auth via query param). **React SPA**: 15-page React 19 frontend (TypeScript, Vite, Zustand, 38 source files). **i18n**: full internationalization with 625 keys (pt/en), language switcher persisted in localStorage. **Report management**: delete reports endpoint, embed individual report files (CSV/TXT/JSON/PDF) into vector store. **Terraform ZIP download**: replaced individual file downloads with client-side ZIP generation (pure JS, no external lib). **Explorer UX**: silent polling during start/stop actions eliminates flickering (resources update in-place without clearing the list). **Report sections collapsed by default**: HTML report and compliance report iframes start minimized. |
|
||||
| **v2.6** | 2026-03 | **Rename**: app renamed to "AI Agent — Infrastructure & Security Engineer". **Session Token Auth**: OCI session token authentication support (type selector API Key/Session Token, conditional form fields, collapsible credential form, type tags in credentials table, `SecurityTokenSigner` backend). **Terraform Workspaces submenu**: sidebar sub-tab listing all workspaces grouped by date with accordion UI, filtered by existing chat sessions (INNER JOIN), actions (plan/apply/destroy/delete/open). **Retry on failure**: "Reenviar" button on failed messages across Chat Agent, Terraform Agent, and Prompt Generator. **Terraform fixes**: `f2` undefined variable in dedup logic, `oci_core_services` false positive validation (data sources excluded), `S.tfCode` reconstruction from `S.tfFiles` for Re-plan, auto-fix button visible without pre-selected model, DRG attachment rules in system prompt. **Resilience**: stuck workspace recovery on container restart (planning/applying/destroying → reset + lock file cleanup). |
|
||||
| **v2.6** | 2026-03 | **Rename**: app renamed to "AI Agent — Infrastructure & Security Engineer". **Session Token Auth**: OCI session token authentication support (type selector API Key/Session Token, conditional form fields, collapsible credential form, type tags in credentials table, `SecurityTokenSigner` backend). **Terraform Workspaces submenu**: sidebar sub-tab listing all workspaces grouped by date with accordion UI, filtered by existing chat sessions (INNER JOIN), actions (plan/apply/destroy/delete/open). **Retry on failure**: "Reenviar" button on failed messages across Chat Agent, Terraform Agent, and Prompt Generator. **Terraform fixes**: `f2` undefined variable in dedup logic, `oci_core_services` false positive validation (data sources excluded), `S.tfCode` reconstruction from `S.tfFiles` for Re-plan, auto-fix button visible without pre-selected model, DRG attachment rules in system prompt. **Resilience**: stuck workspace recovery on container restart (planning/applying/destroying reset + lock file cleanup). |
|
||||
| **v2.5** | 2026-03 | **Explorer Expansion**: KPI stats bar with per-category resource counts (cached in SQLite `explorer_counts_cache`, background refresh on compartment access), enhanced views for VCNs/Subnets/Load Balancers/Buckets with expandable cards, start/stop for DB Systems + MySQL + Container Instances (5 resource types total), dead state filtering (`TERMINATED`/`DELETED`/`DELETING` hidden across all 36 endpoints), wider compartment tree (280px), IAM excluded from compartment totals. **Prompt Generator Intelligence**: same knowledge pipeline as Terraform Agent — auto-detects resource types from user message, fetches official docs (Example Usage + Arguments) from GitHub cached in SQLite, uses compact categorized resource reference. **Network Firewall fix**: `NetworkFirewallPolicySummaryCollection` not iterable — added `.items` accessor for collection objects. |
|
||||
| **v2.4** | 2026-03 | **Terraform Safety & UX**: region safety guard (plan blocked if model omits `variable "region"` — prevents wrong-region provisioning), rollback button on apply failure (manual `terraform destroy` with "ROLLBACK" confirmation), SSH public key field in OCI configs (auto-injected into `terraform.tfvars` for compute instances), reasoning_effort uppercase fix for OCI SDK, split-panel layout (terminal right 40%, files/plan/resources below chat 60%), plan button persists after destroy. **Terraform tfvars**: expanded `oci_var_map` with `ssh_public_key`/`ssh_authorized_keys` auto-mapping from OCI config |
|
||||
| **v2.3** | 2026-03 | **Consult Embeddings**: dedicated sub-menu with chat-like interface for natural language Q&A against vector store — queries all active tables via cosine similarity, returns contextual answers with source citations (works with or without GenAI config). **Knowledge Base & RAG Enhancements**: Knowledge Base (Base de Conhecimento) with file upload + URL import to `engineerknowledgebase` vector table, CIS Recommendations upload to `cisrecom` table, URL content extraction (HTML tag/script stripping, remote PDF parsing), auto-resolve embedding config from OCI credentials (no separate GenAI config required), `report_date` metadata tracking for embedding freshness, purge & re-embed flow for updated reports. **ADB Vector Improvements**: case-insensitive table matching with quoted identifiers for Oracle ADB, table validation endpoint against `user_tables`, tables section moved inside edit connection card, case-preserving table registration (removed forced uppercase). **Vector search fix**: FLOAT32 compatibility for VECTOR_DISTANCE queries, base64-decoded compartment_id for auto-resolved OCI configs. **Embeddings tab cleanup**: removed delete buttons, simplified to read-only view, updated descriptions. **Dependencies**: added PyPDF2 for PDF text extraction |
|
||||
@@ -813,7 +819,7 @@ All models include OCID mapping for `us-ashburn-1`. For other regions, use the "
|
||||
| **v1.4** | 2026-03 | In-place config editing, 69 chat + 11 embedding models with OCID resolution (OpenAI GPT-5.3/5.2/5.1/5/4.1/4o/Codex/Image/Audio, xAI, Google, Meta, ProtectAI), OpenAI Text Embedding 3, custom OCID support, wallet auto-parse with DSN extraction |
|
||||
| **v1.3** | 2026-03 | Persistent config logs per tab, GenAI auto-fill from OCI credentials, inline UX feedback with loading spinners, MCP type-switch fix, encrypted key passphrase support, Docker stdin hang fix |
|
||||
| **v1.2** | 2026-03 | RAG pipeline (OCI GenAI embeddings + ADB vector search), dedicated Embeddings tab, CIS report chunking, file upload embedding |
|
||||
| **v1.1** | 2025-02 | OCI SDK GenAI (exact pattern), OCI Account Explorer, MCP↔ADB linking, full chat parameters |
|
||||
| **v1.1** | 2025-02 | OCI SDK GenAI (exact pattern), OCI Account Explorer, MCP-ADB linking, full chat parameters |
|
||||
| **v1.0** | 2025-02 | Initial release: OCI theme, GenAI integration, MCP servers, ADB vector, JWT+MFA+RBAC |
|
||||
|
||||
---
|
||||
@@ -872,5 +878,5 @@ MIT
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
<sub>Built with ❤️ for Oracle Cloud Infrastructure security compliance</sub>
|
||||
<sub>Built for Oracle Cloud Infrastructure security compliance</sub>
|
||||
</p>
|
||||
834
backend/app.py
834
backend/app.py
File diff suppressed because it is too large
Load Diff
@@ -598,6 +598,7 @@ export default function ReportsPage() {
|
||||
const setShowCompliance = store.setRptShowCompliance;
|
||||
const [complianceReady, setComplianceReady] = useState(false);
|
||||
const [complianceGenerating, setComplianceGenerating] = useState(false);
|
||||
const [complianceProgress, setComplianceProgress] = useState<{ current: number; total: number; step: string; rec: string }>({ current: 0, total: 0, step: '', rec: '' });
|
||||
|
||||
/* ── Error ── */
|
||||
const [error, setError] = useState('');
|
||||
@@ -725,12 +726,16 @@ export default function ReportsPage() {
|
||||
async () => {
|
||||
if (!complianceGenerating || !selectedRid) return false;
|
||||
try {
|
||||
const s = await reportsApi.complianceReportStatus(selectedRid);
|
||||
const s = await reportsApi.complianceReportStatus(selectedRid) as { ready: boolean; generating: boolean; current?: number; total?: number; step?: string; rec?: string };
|
||||
if (s.ready) {
|
||||
setComplianceReady(true);
|
||||
setComplianceGenerating(false);
|
||||
setShowCompliance(true);
|
||||
return true; // stop polling
|
||||
setComplianceProgress({ current: 0, total: 0, step: '', rec: '' });
|
||||
return true;
|
||||
}
|
||||
if (s.generating && s.total) {
|
||||
setComplianceProgress({ current: s.current || 0, total: s.total || 0, step: s.step || '', rec: s.rec || '' });
|
||||
}
|
||||
} catch { /* keep polling */ }
|
||||
return false;
|
||||
@@ -756,6 +761,8 @@ export default function ReportsPage() {
|
||||
// polling is already running via usePolling above
|
||||
}, [selectedRid, complianceGenerating]);
|
||||
|
||||
|
||||
|
||||
/* ── Handlers ── */
|
||||
const handleRun = async () => {
|
||||
if (!ociVal) {
|
||||
@@ -1431,8 +1438,10 @@ export default function ReportsPage() {
|
||||
src={reportsApi.complianceReportUrl(selectedRid)}
|
||||
className="w-full border-0"
|
||||
style={{ height: 700, background: '#fff' }}
|
||||
title="LAD A-Team CIS Compliance Report"
|
||||
title="CIS Compliance Report"
|
||||
/>
|
||||
|
||||
{/* Action buttons */}
|
||||
<div className="px-5 py-2 flex justify-end gap-2" style={{ borderTop: '1px solid var(--bd)' }}>
|
||||
<a
|
||||
href={reportsApi.complianceReportZipUrl(selectedRid)}
|
||||
@@ -1458,10 +1467,30 @@ export default function ReportsPage() {
|
||||
</div>
|
||||
</div>
|
||||
) : complianceGenerating ? (
|
||||
<div className="flex flex-col items-center justify-center py-16 gap-3">
|
||||
<Loader2 size={32} className="animate-spin" style={{ color: 'var(--gn)' }} />
|
||||
<div className="flex flex-col items-center justify-center py-12 gap-4">
|
||||
<Loader2 size={28} className="animate-spin" style={{ color: 'var(--gn)' }} />
|
||||
<p className="text-[.82rem] font-medium" style={{ color: 'var(--t2)' }}>{t('rpt.complianceGenerating')}</p>
|
||||
{complianceProgress.total > 0 && (
|
||||
<div className="w-full max-w-md space-y-2">
|
||||
<div className="flex justify-between text-[.68rem]" style={{ color: 'var(--t3)' }}>
|
||||
<span>{complianceProgress.step} {complianceProgress.rec}</span>
|
||||
<span>{complianceProgress.current}/{complianceProgress.total}</span>
|
||||
</div>
|
||||
<div className="w-full rounded-full overflow-hidden" style={{ height: 6, background: 'var(--bg3)' }}>
|
||||
<div className="rounded-full transition-all" style={{
|
||||
width: `${Math.round((complianceProgress.current / complianceProgress.total) * 100)}%`,
|
||||
height: '100%',
|
||||
background: 'var(--gn)',
|
||||
}} />
|
||||
</div>
|
||||
<p className="text-[.65rem] text-center" style={{ color: 'var(--t4)' }}>
|
||||
{Math.round((complianceProgress.current / complianceProgress.total) * 100)}% — Buscando remediações na base de conhecimento
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{!complianceProgress.total && (
|
||||
<p className="text-[.7rem]" style={{ color: 'var(--t4)' }}>{t('rpt.complianceFetchingKB')}</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center py-12 gap-3">
|
||||
|
||||
@@ -58,6 +58,17 @@ export default function EmbeddingsPage() {
|
||||
const [kbUrlUploading, setKbUrlUploading] = useState(false);
|
||||
const [kbMsg, setKbMsg] = useState<MsgState>(null);
|
||||
|
||||
// Auto-select ADB config when data loads (fixes empty dropdown after navigation)
|
||||
useEffect(() => {
|
||||
const defaultId = adbCfg.find((c) => c.is_active)?.id || adbCfg[0]?.id || '';
|
||||
if (defaultId) {
|
||||
if (!selVid) setSelVid(defaultId);
|
||||
if (!cisVid) setCisVid(defaultId);
|
||||
if (!kbVid) setKbVid(defaultId);
|
||||
if (!purgeVid) setPurgeVid(defaultId);
|
||||
}
|
||||
}, [adbCfg]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// ── Purge section ──
|
||||
const [purgeVid, setPurgeVid] = useState(() => adbCfg.find((c) => c.is_active)?.id || adbCfg[0]?.id || '');
|
||||
const [purgeTable, setPurgeTable] = useState('');
|
||||
|
||||
Reference in New Issue
Block a user