# Enabling Orin

Before users can use Apteco's AI tool Orin on-premises, a system administrator must complete the following installation and configuration steps:

1. [Installing Chat API](<#installing-chat-api>)
2. [Migrating the Orbit API configuration](<#migrating-the-orbit-api-configuration>)
3. [Configuring Chat API](<#configuring-chat-api>)
4. [Enabling web sockets in the API](<#enabling-web-sockets-in-the-api>)
5. [Repairing the Orbit UI](<#repairing-the-orbit-ui>)
6. [Enabling as a preview feature](<#enabling-as-a-preview-feature>)

## Installing Chat API

Before you can access Orin, you must use the Orbit Updater to download the Chat API functionality.

To install the Chat API:

1. Run `OrbitUpdaterConfigurator.exe` as Administrator from:

   Text Only

   ```text
   C:\Program Files (x86)\Apteco\FastStats Orbit Updater\
   ```
2. Select the **Chat API** tab.
3. Copy the **Base URL** from the **API** tab and paste it into the **Base URL** field on the **Chat API** tab.
4. Change the **Base URL** in the **Chat API** tab to refer to `ChatAPI` instead of `OrbitAPI`.

   > **Note**
   >
   > For a multi-API system, you also need to:
   >
   > - Change the virtual path to `{your_system_folder}/ChatApi`
   > - Change the application pool name from `AspNetCoreChat` to `AspNetCore{your_system_name}Chat` (no spaces)
5. Restart the **FastStats Orbit Updater** service.

You can monitor the updater progress in **Applications and Services Logs** \> **FastStatsOrbitUpdaterLog** in Windows Event Viewer.

## Migrating the Orbit API configuration

### Before you begin

You need:

- Access to your FastStats configuration database
- A connection string for a user with table creation rights (only if the `OrbitConfigurations` table doesn't exist)

### Migrate the configuration

To migrate your Orbit API configuration:

1. In the Orbit Updater, select the **API** tab.
2. Select **Open API Configurator**.
3. In the **FastStats config database** tab, enter your connection string in the **Connection string** field. Your configuration database is typically named `FS_Config`, but may have a different name.
4. Select **Test** to verify the connection.
5. Select **Store Orbit Configuration in Database**. This enables the **Configuration Name** field (default value: `Orbit`) and displays Chat API options.

   > **Note**
   >
   > Only change the **Configuration Name** value if you have multiple Orbit installations using the same configuration database.
6. Select **File** \> **Save**.

   If the `OrbitConfigurations` table doesn't exist, the tool attempts to create it automatically. If your user lacks the required permissions, enter a connection string for a user with table creation rights when prompted. Select **Edit** to modify connection string values.
7. Close the API configuration tool.

## Configuring Chat API

To configure the Chat API:

1. In the Orbit Updater, select the **Chat API** tab.
2. Select **Open Chat API Configurator**.
3. In the **FastStats config database** tab, enter the same connection string you used in the Orbit API configuration tool.
4. Select **Test** to verify the connection.
5. Confirm you've selected **Store Orbit Configuration in Database**, and that **Configuration Name** matches the value from the Orbit API configuration tool.
6. Select **File** \> **Save**. The settings save immediately because the database is already configured.
7. Close the tool.

For future configuration changes, use the Orbit API Configuration tool unless you are moving the FastStats configuration database.

### Update Chat API options

To configure the Chat API URL:

1. Open the **Orbit API Configuration** tool.
2. In **Chat API options**, verify the **URL** field contains the correct Orbit API URL. This is typically the same URL configured in the **API** tab of the Orbit Updater (for example: `https://[your-server]/OrbitAPI`).
3. Select **File** \> **Save**.
4. Restart the Chat API process to apply the changes: in IIS Manager, stop and start the App Pool associated with the Chat API.

## Enabling web sockets in the API

In the **Orbit API Configurator**, confirm you've ticked the **Enable Web Sockets** box under **Orbit options**.

If it's not ticked, tick it, then save and close the API Configurator.

## Repairing the Orbit UI

You must repair the Orbit UI so that the `config.json` file within the assets folders has the correct `chatApiURL` defined.

In the following example, the file at `C:\inetpub\wwwroot\Orbit\en\assets\config.json` is still referring to `localhost`:

Completing a **Repair** on the UI populates `chatApiURL` with the required value.

To repair the Orbit UI:

1. Run `UpdaterConfigurator.exe` from within:

   Text Only

   ```text
   C:\Program Files (x86)\Apteco\FastStats Orbit Updater\
   ```
2. Select the **Summary** tab.
3. Select **Repair** next to the **Orbit UI** entry.
4. Select **Yes** when prompted.
5. The **Repair** button changes to **Repairing...**
6. Select **OK** when the process has finished.

## Enabling as a preview feature

To access Orin in Orbit, you must enable it as a preview feature.

1. Log into Orbit as an **Administrator**.
2. Select the **Preview Features** tab.
3. Toggle on the **Apteco AI Chatbot** setting.
4. Log out and log back into Orbit. Orin now appears in the bottom left-hand corner of the Orbit UI.
