You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@answer.apache.org by "lb1038678031 (via GitHub)" <gi...@apache.org> on 2026/08/29 03:42:19 UTC
[PR] feat(ai): TDesign React Chat UI, homepage chat entry, and admin-configurable assistant content [answer]
lb1038678031 opened a new pull request, #1599:
URL: https://github.com/apache/answer/pull/1599
For #1598
### What
Modernize the AI assistant chat UI with TDesign React Chat and make the assistant's opening content admin-configurable, as proposed in #1598. Two commits:
1. `feat: replace AI chat UI with TDesign React Chat and add homepage chat switches`
- New `AnswerChatBot` adapter wiring the TDesign `ChatBot` component to Answer's existing `/answer/api/v1/chat/completions` SSE contract: `delta.content` streams into a markdown block, `delta.reasoning_content` into a thinking block, with per-message voting, replay, and history rehydration when switching conversations.
- Chat completions moves to the unauthenticated router behind a guest gate: with the new `home_chat_guest_enabled` switch, logged-out visitors can chat; guest history stays client-side and voting is disabled.
- Optional floating chat entry on the homepage (`home_chat_enabled`), reusing the same component.
2. `feat(ai): admin-configurable welcome text, suggested questions and system prompt`
- Admin can set the assistant welcome text and a suggested-questions list (one per line). Both render inside a single welcome message as tappable chips (the TDesign reference layout); empty values fall back to built-in i18n suggestions.
- The existing `prompt_config` (zh/en system prompt) is now editable in the admin AI settings form, and saving always round-trips it — previously an omitted prompt_config silently reset stored prompts to the built-in defaults.
- Refreshed language packs now apply via `i18next.addResourceBundle` as soon as they are fetched instead of waiting for the next full page load.
### Why
We self-host Answer as a community FAQ and wanted a streaming chat experience with thinking blocks, markdown and suggestion chips, plus control over what the assistant says and which tools the prompt advertises. TDesign React Chat provides the chat primitives; this patch keeps Answer's own backend contract unchanged apart from the guest gate and the new site-info fields.
### Testing
- `go build ./...` and `go test ./internal/schema ./internal/controller`
- Manual smoke on Windows (embedded UI): logged-in and guest flows, thinking display, per-message votes, replay, new-chat reset (including from a loaded history conversation), suggestion chips, and admin round-trip of welcome text / suggestions / system prompt.
### Notes
- The installed `tdesign-web-components@1.3.0-alpha.2` does not implement suggestion `directSend`, so chip clicks are delivered through per-message `handleActions` and sent from the adapter. A one-line defensive guard for the component library's `setExportparts` is applied in our deployment build; standard flows work without it.
- Vision/image input is intentionally out of scope for this feature.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org