diff --git a/components/chat_widget/src/components/ocs-chat/readme.md b/components/chat_widget/src/components/ocs-chat/readme.md
index 6e9e1f87bd..fd119fde38 100644
--- a/components/chat_widget/src/components/ocs-chat/readme.md
+++ b/components/chat_widget/src/components/ocs-chat/readme.md
@@ -21,6 +21,7 @@ For more information, see the [Open Chat Studio documentation](https://docs.open
| `headerText` | `header-text` | The text to place in the header. | `""` | `undefined` |
| `iconUrl` | `icon-url` | URL of the icon to display on the button. If not provided, uses the default OCS logo. | `string` | `undefined` |
| `language` | `language` | The language code for the widget UI (e.g., 'en', 'es', 'fr'). Defaults to en | `string` | `undefined` |
+| `maxCharLimit` | `max-char-limit` | Maximum number of characters allowed in a single message (derived from the model's token limit). When set, a live counter is shown and the send button is disabled when exceeded. | `number` | `undefined` |
| `mode` | `mode` | The operating mode of the widget. - 'standard': Default floating window with launcher button. - 'kiosk': Fills parent container, always visible, no header or launcher button. The parent element must establish a containing block (e.g. `position: relative`). | `"kiosk" \| "standard"` | `'standard'` |
| `newChatConfirmationMessage` | `new-chat-confirmation-message` | The message to display in the new chat confirmation dialog. | `string` | `undefined` |
| `pageContext` | `page-context` | Optional context object to send with each message. This provides page-specific context to the bot. | `{ [x: string]: any; }` | `undefined` |
diff --git a/components/chat_widget/src/services/chat-session-service.ts b/components/chat_widget/src/services/chat-session-service.ts
index da6abfdfcb..755bb6a0b9 100644
--- a/components/chat_widget/src/services/chat-session-service.ts
+++ b/components/chat_widget/src/services/chat-session-service.ts
@@ -125,7 +125,17 @@ export class ChatSessionService {
});
if (!response.ok) {
- throw new Error(`Failed to poll task: ${response.statusText}`);
+ let errorMessage = `Failed to poll task: ${response.statusText}`;
+ try {
+ const data = (await response.json()) as { error?: string };
+ if (data?.error) {
+ errorMessage = data.error;
+ }
+ } catch {
+ // non-JSON body; keep statusText fallback
+ }
+
+ throw new Error(errorMessage);
}
return response.json() as Promise