# ChatInteraction

**Kind:** Database Model

**Source:** [`atloria-monorepo/libs/database/prisma/schema.prisma`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/database/prisma/schema.prisma#L2122)

## Fields

| Field | Type | Required | Key |
|---|---|---|---|
| `id` | `String` | ✓ | PK |
| `projectId` | `String` | ✓ |  |
| `agentId` | `String` | ✓ |  |
| `docVersionId` | `String` | - |  |
| `sessionId` | `String` | - |  |
| `query` | `String` | ✓ |  |
| `response` | `String` | ✓ |  |
| `sourceDocs` | `String[]` | ✓ |  |
| `responseTimeMs` | `Int` | ✓ |  |
| `helpful` | `Boolean` | - |  |
| `escalated` | `Boolean` | - |  |
| `messagesCount` | `Int` | ✓ |  |
| `sessionEnded` | `DateTime` | - |  |
| `ipHash` | `String` | - |  |
| `createdAt` | `DateTime` | ✓ |  |

## Diagram

```mermaid
erDiagram
    ChatInteraction {
        id String [PK]
        projectId String
        agentId String
        docVersionId String?
        sessionId String?
        query String
        response String
        sourceDocs String[]
        responseTimeMs Int
        helpful Boolean?
        escalated Boolean?
        messagesCount Int
        sessionEnded DateTime?
        ipHash String?
        createdAt DateTime
    }
    ChatInteraction ||--|| Project : ""
    ChatInteraction ||--|| SupportAgentConfig : ""
    ChatInteraction ||--|| ChatSession : ""
```

## Relationships

- HAS_ONE → `Project`
- HAS_ONE → `SupportAgentConfig`
- HAS_ONE → `ChatSession`
