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

# AI Chat Session

# AI Chat Session

Starts or continues an AI assistant chat session scoped to the current location. Use it to ask free-form questions about plans, products, bookings, and general portal guidance. The session is identified by a client-generated `sessionId` and can optionally include the user's geolocation to tailor suggestions to nearby locations.

Notes

* This endpoint is read-only and returns generated text.
* Pass the natural-language prompt as a query parameter.
* If latitude/longitude are provided, responses may be adjusted to the nearest location.

## Authentication

This endpoint requires an authenticated customer session (a logged-in customer of a location).

## Path Parameters

<ParamField path="sessionId" type="string" required>
  Client-generated unique session identifier (for example, a UUID) that keeps the context across requests in the same conversation.
</ParamField>

## Query Parameters

<ParamField query="prompt" type="string" required>
  The user's natural language question or instruction to the assistant.
</ParamField>

<ParamField query="latitude" type="number">
  Optional current latitude to personalize responses.
</ParamField>

<ParamField query="longitude" type="number">
  Optional current longitude to personalize responses.
</ParamField>

## Response

<ResponseField name="Response" type="string">
  AI-generated reply text. Can include markdown.
</ResponseField>

## Example Response

```json theme={null}
{
  "Response": "You can book a meeting room tomorrow afternoon. Would you like me to filter 8–10 people rooms with video conferencing?"
}
```

## Usage in Portal

This endpoint is used by the floating AI assistant available across the portal:

* Layouts
  * `src/layouts/DefaultLayout.tsx` (global assistant button)
  * `src/layouts/FullPageLayout.tsx` (global assistant button)
* Dock
  * `src/components/Dock/DockSection.tsx` (mobile dock integration)
* Chat manager
  * `src/components/ai/AiChatManager.tsx` (session handling and message flow)

## Related Endpoints

* `GET /api/public/ai/tariffs` – Plan suggestions by prompt
* `GET /api/public/ai/products` – Product suggestions by prompt
* `GET /api/public/ai/bookings` – Booking suggestion intent parsing

## Error Responses

<ResponseField name="401 Unauthorized" type="error">
  The user is not authenticated as a customer of a location.
</ResponseField>

<ResponseField name="400 Bad Request" type="error">
  Missing or invalid parameters (e.g., no prompt provided).
</ResponseField>
