aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio_22/CLAUDE.md
blob: 1b0767252db133d9a1a042cabfa1e054ada2cfd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is a Tango Portal Chat Web application - an ASP.NET Core 8.0 MVC application that provides an AI-powered chat interface for querying data from Azure Data Explorer (ADX/Kusto). The application integrates with OpenAI/Azure OpenAI for natural language processing and allows users to interact with telemetry, job status, and machine data through conversational queries.

## Architecture

The application follows standard ASP.NET Core MVC patterns with dependency injection:

- **Controllers**: `ChatController` handles API endpoints for chat interactions, `HomeController` serves the main UI
- **Services**: Core business logic including:
  - `LlmClient` - OpenAI/Azure OpenAI integration with assistants support
  - `KustoQueryService` - Azure Data Explorer connectivity and query execution
  - `SchemaRegistry` - Database schema management and validation
  - `KqlGuard` - Security layer for KQL query validation
- **Models**: Data contracts, options configuration, and JSON converters
- **Data**: Contains AI prompts, schema definitions, and sample data files
- **Utils**: Utility classes for data processing

## Key Technologies

- .NET 8.0 with C# nullable reference types enabled
- ASP.NET Core MVC
- Azure Data Explorer (Kusto) via `Microsoft.Azure.Kusto.Data` package
- OpenAI integration via custom HTTP client
- Azure Identity for authentication

## Development Commands

### Build and Run
```bash
# Build the solution
dotnet build

# Run the application (development)
dotnet run --project Tango.Portal.Chat.Web

# Run with specific configuration
dotnet run --project Tango.Portal.Chat.Web --configuration Release
```

### Testing
No test projects are currently configured in the solution.

### Database Operations
The application connects to Azure Data Explorer clusters. Key tables accessed:
- `JobRunsTable` - Job execution data
- `JobStatusTable` - Job status tracking
- `TelemetryTable` - System telemetry data  
- `MachinesTable` - Machine/device information

## Configuration

Configuration is managed through `appsettings.json` and `appsettings.Development.json`:

- **OpenAI Section**: API endpoints, keys, model settings, and assistant IDs
- **ADX Section**: Kusto cluster URI, database name, and Azure AD authentication settings
- **Logging**: Standard ASP.NET Core logging configuration

## Development Notes

- The project uses Azure Identity for ADX authentication with service principal credentials
- KQL queries are validated through the `KqlGuard` service before execution
- The application supports both OpenAI and Azure OpenAI endpoints
- AI prompts and schema definitions are stored as embedded content files in the Data directory
- The `Utils` directory contains helper classes for data processing operations