Repository navigation
[Customer Portal][Web] Improve Novera Chat UX with Conversation History & Article Recommendations #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Rashmika998
merged 5 commits into
wso2-open-operations:customer-portal-milestone-1
from
dileepapeiris:feat/add-kb-articles-view
Mar 3, 2026
Merged
[Customer Portal][Web] Improve Novera Chat UX with Conversation History & Article Recommendations #292
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
830541c
Add recommendations to chat messages
dileepapeiris d0a0df0
Add RecommendationsCard for KB article suggestions
dileepapeiris d5b29d4
Render recommendations in ChatMessageBubble
dileepapeiris a047f0a
Support: resume chat and add conversation helpers
dileepapeiris 0e2ce47
Add ChatSkeleton, route param & minor UI fix
dileepapeiris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...ortal/webapp/src/components/support/novera-ai-assistant/novera-chat-page/ChatSkeleton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| import { Box, Skeleton } from "@wso2/oxygen-ui"; | ||
| import type { JSX } from "react"; | ||
|
|
||
| /** | ||
| * ChatSkeleton component displays loading skeletons for chat messages. | ||
| * | ||
| * @returns {JSX.Element} The rendered ChatSkeleton. | ||
| */ | ||
| export default function ChatSkeleton(): JSX.Element { | ||
| return ( | ||
| <Box | ||
| sx={{ | ||
| flex: 1, | ||
| overflowY: "auto", | ||
| p: 3, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: 3, | ||
| }} | ||
| > | ||
| {/* Bot message skeleton */} | ||
| <Box sx={{ display: "flex", justifyContent: "flex-start" }}> | ||
| <Box sx={{ maxWidth: "75%" }}> | ||
| <Skeleton variant="rounded" width={300} height={80} /> | ||
| <Skeleton variant="text" width={100} sx={{ mt: 0.5 }} /> | ||
| </Box> | ||
| </Box> | ||
|
|
||
| {/* User message skeleton */} | ||
| <Box sx={{ display: "flex", justifyContent: "flex-end" }}> | ||
| <Box sx={{ maxWidth: "75%" }}> | ||
| <Skeleton variant="rounded" width={250} height={60} /> | ||
| <Box sx={{ display: "flex", justifyContent: "flex-end" }}> | ||
| <Skeleton variant="text" width={100} sx={{ mt: 0.5 }} /> | ||
| </Box> | ||
| </Box> | ||
| </Box> | ||
|
|
||
| {/* Bot message skeleton */} | ||
| <Box sx={{ display: "flex", justifyContent: "flex-start" }}> | ||
| <Box sx={{ maxWidth: "75%" }}> | ||
| <Skeleton variant="rounded" width={320} height={100} /> | ||
| <Skeleton variant="text" width={100} sx={{ mt: 0.5 }} /> | ||
| </Box> | ||
| </Box> | ||
|
|
||
| {/* User message skeleton */} | ||
| <Box sx={{ display: "flex", justifyContent: "flex-end" }}> | ||
| <Box sx={{ maxWidth: "75%" }}> | ||
| <Skeleton variant="rounded" width={280} height={70} /> | ||
| <Box sx={{ display: "flex", justifyContent: "flex-end" }}> | ||
| <Skeleton variant="text" width={100} sx={{ mt: 0.5 }} /> | ||
| </Box> | ||
| </Box> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| } |
157 changes: 157 additions & 0 deletions
157
...ebapp/src/components/support/novera-ai-assistant/novera-chat-page/RecommendationsCard.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| // Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| import { | ||
| Box, | ||
| Card, | ||
| CardContent, | ||
| Typography, | ||
| alpha, | ||
| colors, | ||
| } from "@wso2/oxygen-ui"; | ||
| import { ArrowUpRight, FileText, Sparkles } from "@wso2/oxygen-ui-icons-react"; | ||
| import { type JSX } from "react"; | ||
| import type { Recommendation } from "@pages/NoveraChatPage"; | ||
|
|
||
| const KB_BASE_URL = "https://support.wso2.com/kb?id=kb_article_view&sys_kb_id="; | ||
|
|
||
| interface RecommendationsCardProps { | ||
| recommendations: Recommendation[]; | ||
| } | ||
|
|
||
| /** | ||
| * Displays knowledge base article recommendations from the Novera AI agent. | ||
| * Shown under the bot's chat bubble when recommendations are available. | ||
| * | ||
| * @param {RecommendationsCardProps} props - Contains the recommendations array. | ||
| * @returns {JSX.Element} The RecommendationsCard component. | ||
| */ | ||
| export default function RecommendationsCard({ | ||
| recommendations, | ||
| }: RecommendationsCardProps): JSX.Element { | ||
| if (!recommendations || recommendations.length === 0) { | ||
| return <></>; | ||
| } | ||
|
|
||
| const handleArticleClick = (articleId: string) => { | ||
| window.open(`${KB_BASE_URL}${articleId}`, "_blank", "noopener,noreferrer"); | ||
| }; | ||
|
|
||
| const orangeMain = colors.orange?.[600] ?? colors.purple[600]; | ||
|
|
||
| return ( | ||
| <Box sx={{ mt: 2, mb: 2 }}> | ||
| <Box | ||
| sx={{ | ||
| bgcolor: alpha(orangeMain, 0.08), | ||
| border: "1px solid", | ||
| borderColor: alpha(orangeMain, 0.2), | ||
| p: 2, | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", alignItems: "center", gap: 1, mb: 1.5 }}> | ||
| <Sparkles size={16} color={orangeMain} /> | ||
| <Typography variant="body2" sx={{ fontWeight: 500 }}> | ||
| Here are some articles that might help: | ||
| </Typography> | ||
| </Box> | ||
|
|
||
| <Box | ||
| sx={{ | ||
| display: "grid", | ||
| gridTemplateColumns: "repeat(2, 1fr)", | ||
| gap: 1.25, | ||
| }} | ||
| > | ||
| {recommendations.slice(0, 4).map((rec, index) => ( | ||
| <Card | ||
| key={rec.articleId || index} | ||
| onClick={() => handleArticleClick(rec.articleId)} | ||
| sx={{ | ||
| cursor: "pointer", | ||
| bgcolor: "background.paper", | ||
| border: "1px solid", | ||
| borderColor: "divider", | ||
| "&:hover": { | ||
| boxShadow: 4, | ||
| transform: "translateY(-2px)", | ||
| borderColor: alpha(orangeMain, 0.5), | ||
| }, | ||
| transition: "all 0.2s ease-in-out", | ||
| p: 1.5, | ||
| }} | ||
| > | ||
| <CardContent sx={{ p: 0, "&:last-child": { pb: 0 } }}> | ||
| <Box | ||
| sx={{ | ||
| display: "flex", | ||
| alignItems: "flex-start", | ||
| gap: 1, | ||
| mb: 1, | ||
| }} | ||
| > | ||
| <FileText | ||
| size={14} | ||
| style={{ | ||
| color: orangeMain, | ||
| flexShrink: 0, | ||
| marginTop: 2, | ||
| }} | ||
| /> | ||
| <Typography | ||
| variant="caption" | ||
| sx={{ | ||
| display: "-webkit-box", | ||
| WebkitLineClamp: 2, | ||
| WebkitBoxOrient: "vertical", | ||
| overflow: "hidden", | ||
| fontWeight: 500, | ||
| lineHeight: 1.4, | ||
| flex: 1, | ||
| }} | ||
| > | ||
| {rec.title} | ||
| </Typography> | ||
| </Box> | ||
| <Box | ||
| sx={{ | ||
| display: "flex", | ||
| alignItems: "center", | ||
| justifyContent: "flex-end", | ||
| gap: 0.5, | ||
| mt: 1, | ||
| }} | ||
| > | ||
| <Typography | ||
| variant="caption" | ||
| sx={{ | ||
| fontSize: "0.65rem", | ||
| color: orangeMain, | ||
| fontWeight: 600, | ||
| }} | ||
| > | ||
| Read | ||
| </Typography> | ||
| <ArrowUpRight size={12} color={orangeMain} /> | ||
| </Box> | ||
| </CardContent> | ||
| </Card> | ||
| ))} | ||
| </Box> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.