@icanbwell/baileyai-chat-ui 1.0.28 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -399,11 +399,23 @@ By default the note only renders in the empty state, before the first message. P
399
399
 
400
400
  ## Collecting feedback
401
401
 
402
- `BaileyFeedbackButtons` renders thumbs up/down on an assistant message, with an inline form (reason chips and a comment) after a thumbs-down or an "Add a comment" click. It is opt-in and never calls an API itself: your app owns auth and networking and passes `onSubmit`/`onClear`. No extra install or subpath; it is part of the base entry.
402
+ `BaileyChatPanel` shows thumbs up/down on every completed assistant message by default, with an inline form (reason chips and a comment) after a thumbs-down or an "Add a comment" click. It works whenever `useBaileyChat` was given a `client` (the same `createBaileyClient` instance used for streaming and history): the hook exposes `chat.feedback` (`onSubmit`/`onClear`, bound to the client and the held conversation id) and the panel wires it up. Messages without a `serverMessageId` get no buttons. For the full list of options see [docs/configuration.md](docs/configuration.md#4-response-feedback).
403
+
404
+ ```tsx
405
+ const client = createBaileyClient({ baseUrl, getHeaders });
406
+ const chat = useBaileyChat({ transport: client, client, model, instructions });
407
+
408
+ <BaileyChatPanel chat={chat} /> {/* feedback on */}
409
+ <BaileyChatPanel chat={chat} feedback={false} /> {/* feedback off */}
410
+ <BaileyChatPanel chat={chat} feedback={{ reasonOptions: ['inaccurate', 'unhelpful'] }} />
411
+ ```
412
+
413
+ Hosts without a Bailey client (own networking) can render `BaileyFeedbackButtons` themselves through `renderMessageActions`, passing `onSubmit`/`onClear`. The panel detects a host-rendered `BaileyFeedbackButtons` for a message and hides its default for that message, so there is no duplicate and `feedback={false}` is not needed.
403
414
 
404
415
  ```tsx
405
416
  <BaileyChatPanel
406
417
  chat={chat}
418
+ feedback={false}
407
419
  renderMessageActions={(message) =>
408
420
  message.serverMessageId ? (
409
421
  <BaileyFeedbackButtons
@@ -432,7 +444,7 @@ Pass a stable function for `renderMessageActions`. The control renders nothing w
432
444
  - The comment is PHI-capable. It is passed to `onSubmit` only, never to the console, the trace panel or any other callback. Do not log it in your handler either.
433
445
  - Strings are overridable through the `labels` prop (`BaileyFeedbackLabels`), merged shallowly with English defaults, like `BaileyChatPanel`'s labels.
434
446
 
435
- Minimum backend: the assistant `message_id` on `response.completed` (and `X-Message-Id` for non-streaming responses) and the feedback routes from BAI-1231 (baileyai, BAI-1234). On a backend without them the buttons simply do not appear. A `503` from the feedback API means feedback is disabled for that environment; hide the control from your side for the session.
447
+ Minimum backend: the assistant `message_id` on `response.completed` (and `X-Message-Id` for non-streaming responses) and the feedback routes from BAI-1231 (baileyai, BAI-1234). On a backend without them the buttons simply do not appear. A `503` from the feedback API means feedback is disabled for that environment; with `chat.feedback` the panel then hides the buttons for the rest of that client's use. A host rendering its own `BaileyFeedbackButtons` should hide the control itself.
436
448
 
437
449
  ## Localization
438
450