Closed vladtar closed 1 month ago
The changes introduced in this pull request enhance the functionality and configurability of the AIAssistant
and Chat
components. A new property showSuggestions
is added to control the display of suggestions, alongside modifications to the tools
array. The Chat
component is updated to handle suggestions through new props and conditional rendering. Additionally, CSS updates improve the visual presentation of chat suggestions. Overall, these changes facilitate user interaction by providing suggestions and enhancing the components' usability.
File | Change Summary |
---|---|
src/components/container/AIAssistant/AIAssistant.stories.tsx |
Added showSuggestions property in argTypes (default: true); updated tools array with new options; updated Default and Debug exports to include showSuggestions ; added new NoSuggestions export (showSuggestions: false). |
src/components/container/AIAssistant/AIAssistant.tsx |
Added optional showSuggestions property to AIAssistantProps ; introduced suggestions state; updated useEffect to manage suggestions; modified addUserMessage function and rendering logic for Chat component. |
src/components/presentational/Chat/Chat.css |
Added new styles for chat suggestions with classes .mdhui-chat-suggestions and .mdhui-chat-suggestion . |
src/components/presentational/Chat/Chat.tsx |
Updated ChatProps interface to include suggestions (string array) and onSuggestionSelected (function); added conditional rendering for suggestions in the component. |
src/helpers/AIAssistant/AIAssistant.ts |
Added a line to promptTemplate to enhance multilingual capabilities, allowing responses in the same language as the user's question. |
src/helpers/strings-de.ts |
Added multiple new string entries for health-related suggestions in German. |
src/helpers/strings-en.ts |
Added multiple new string entries for health-related suggestions in English. |
src/helpers/strings-es.ts |
Added multiple new string entries for health-related suggestions in Spanish. |
src/helpers/strings-fr.ts |
Added multiple new string entries for health-related suggestions in French. |
src/helpers/strings-it.ts |
Added multiple new string entries for health-related suggestions in Italian. |
src/helpers/strings-nl.ts |
Added multiple new string entries for health-related suggestions in Dutch. |
src/helpers/strings-pl.ts |
Added multiple new string entries for health-related suggestions in Polish. |
src/helpers/strings-pt.ts |
Added multiple new string entries for health-related suggestions in Portuguese. |
src/components/presentational/Chat/Chat.stories.tsx |
Added suggestions property in argTypes ; created new story Suggestions to demonstrate suggestion handling with an alert on selection. |
sequenceDiagram
participant User
participant AIAssistant
participant Chat
User->>AIAssistant: Send message
AIAssistant->>Chat: Add user message
Chat->>Chat: Clear suggestions
AIAssistant->>AIAssistant: Check showSuggestions
AIAssistant->>AIAssistant: Populate suggestions
AIAssistant->>Chat: Pass suggestions
User->>Chat: Click on suggestion
Chat->>AIAssistant: Trigger addUserMessage with suggestion
Added prompts suggesting to a user potential use cases they might be interested in.
Security
REMINDER: All file contents are public.
Describe briefly what security risks you considered, why they don't apply, or how they've been mitigated.
Checklist
Testing
Documentation
Consider "Squash and merge" as needed to keep the commit history reasonable on
main
.Reviewers
Assign to the appropriate reviewer(s). Minimally, a second set of eyes is needed ensure no non-public information is published. Consider also including:
Summary by CodeRabbit
New Features
showSuggestions
feature in the AIAssistant, allowing users to toggle the display of suggestions.NoSuggestions
story to demonstrate the assistant without suggestions.Enhancements
Style Updates