# NC-RAG UI Guide

## Overview

The NC-RAG (Retrieval-Augmented Generation) page provides tools for document matching, product search, and AI-powered querying using vector embeddings.

## Page Layout

### Control Row

- **Link icon** - Opens the document path in file explorer (click to open)
- **Document path** - Path to folder containing product documents
- **File type** - Filter files by extension (PDF, TXT, Markdown, or all)
- **Max depth** - Directory traversal depth for document scanning
- **Start match** - Begin product matching process

### Filter Row

- **Search** - Filter results in current grid
- **Show preview** - Toggle document preview in results

## Tabs

### Product Match Tab

Product matching using vector embeddings:

1. Configure document path and filters
2. Click "Start match" to scan documents
3. View results in rag_result grid
4. See directory statistics in dir_tree_info grid

**Status row** shows progress and results (file count, match count)

### RAG Query Tab

Ask questions about matched documents:

1. Enter question in "Question" textarea (75% width)
2. Answer appears in "Answer" textarea (25% width)
3. Click "Send" to query the AI

**Note**: Documents must be matched first using Product Match tab

### Document List Tab

View all documents found during matching.

### Product List Tab

View all products with match information.

## Grid Interactions

- **Click column header** - Sort by column
- **Double-click row** - Open item details
- **Scroll** - Navigate through results

## Workflow Example

1. Set document path to your product documentation folder
2. Select file types (e.g., PDF files)
3. Set max depth (e.g., 5 levels for nested folders)
4. Click "Start match" to scan and index documents
5. View results in Product Match tab
6. Switch to RAG Query tab
7. Ask questions about your products
8. Review AI answers based on your documents

## Height Calculations

Grids use responsive `calc(100vh - Xem)` for automatic sizing:

- Product Match main grid: `calc(100vh - 22em)`
- Directory tree info: `calc(100vh - 44em)`
- Document/Product List: `calc(100vh - 18em)`
