> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ai_chat_turn table

> Contains AI Chatbot history - contains whole chat, not just what is sent to the chatbot. History is ready ordered by timestamp

## ai\_chat\_turn Table (461)

Contains AI Chatbot history - contains whole chat, not just what is sent to the chatbot. History is ready ordered by timestamp

## Fields

| Name               | Description                                                                                                          | Type                            | Nullable |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- | ------------------------------- | :------: |
| ai\_chat\_turn\_id | Primary key                                                                                                          | PK                              |    No    |
| associate\_id      | User id that is chatting with the bot                                                                                | FK [associate](./associate.mdx) |    No    |
| chat\_id           | The name of this chat topic - usually soproto + id (contact-123, sale-43, diary) but could also be an arbitrary name | String(40)                      |    No    |
| timestamp          | When the chat happened (UTC)                                                                                         | UtcDateTime                     |    No    |
| user\_prompt       | What the user typed                                                                                                  | Clob                            |    Yes   |
| user\_displaytext  | Display this text instead of the prompt (if set) - could be set by action                                            | Clob                            |    Yes   |
| bot\_response      | AI Bot response to user\_prompt - usually text                                                                       | Clob                            |    Yes   |
| bot\_actions       | Suggested actions (string dictionary) in JSON. NULL if not set                                                       | Clob                            |    Yes   |
| attachments        | JSON Array of bot - NULL if not set                                                                                  | Clob                            |    Yes   |

<img src="https://mintcdn.com/superofficeas/i6M2qZmvMNH7UTeu/media/loc/en/database/tables/ai_chat_turn.png?fit=max&auto=format&n=i6M2qZmvMNH7UTeu&q=85&s=4e53a1ad2bd76c688eb0de661ee5375f" alt="ai_chat_turn table relationship diagram" width="410" height="59" data-path="media/loc/en/database/tables/ai_chat_turn.png" />

## Indexes

| Fields                             | Types                       | Description |
| ---------------------------------- | --------------------------- | ----------- |
| associate\_id                      | FK                          | Index       |
| timestamp                          | UtcDateTime                 | Index       |
| associate\_id, chat\_id, timestamp | FK, String(40), UtcDateTime | Index       |

## Relationships

| Table                    | Description                                                        |
| ------------------------ | ------------------------------------------------------------------ |
| [associate](./associate) | Employees, resources and other users - except for External persons |

## Replication Flags

* None

## Security Flags

* No access control via user's Role.


## Related topics

- [What's new in version 10.3.9.718](/release-notes/database/changes-10.3.9.md)
- [What's new in version 10.5.1.1092](/release-notes/database/changes-10.5.1.md)
- [What's new in version 10.5.2.435](/release-notes/database/changes-10.5.2.md)
- [What's new in version 10.5.3.711](/release-notes/database/changes-10.5.3.md)
- [What's new in version 10.5.4.867](/release-notes/database/changes-10.5.4.md)
- [What's new in version 10.5.5.982](/release-notes/database/changes-10.5.5.md)
