Skip to content

Commit 5e9d6fb

Browse files
committed
Get custom questions based on different data profile
1 parent 2c45009 commit 5e9d6fb

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

report-front-end/src/components/chatbot/custom-questions.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Button } from "@aws-amplify/ui-react";
44
import styles from "./chat.module.scss";
55
import { ChatInputState } from "./types";
66
import { BACKEND_URL } from "../../tools/const";
7+
import { useSelector } from "react-redux";
8+
import { UserState } from "@/types/StoreTypes";
79

810
export interface RecommendQuestionsProps {
911
setTextValue: Dispatch<SetStateAction<ChatInputState>>;
@@ -14,8 +16,10 @@ export default function CustomQuestions(props: RecommendQuestionsProps) {
1416
const [showMoreQuestions, setShowMoreQuestions] = useState(true);
1517
const [questions, setQuestions] = useState<string[]>([]);
1618

17-
const getRecommendQuestions = async () => {
18-
const url = `${BACKEND_URL}qa/get_custom_question?data_profile=shopping-demo`;
19+
const userInfo = useSelector<UserState>((state) => state) as UserState;
20+
21+
const getRecommendQuestions = async (data_profile: string) => {
22+
const url = `${BACKEND_URL}qa/get_custom_question?data_profile=${data_profile}`;
1923
try {
2024
const response = await fetch(url, {
2125
method: "GET",
@@ -33,8 +37,11 @@ export default function CustomQuestions(props: RecommendQuestionsProps) {
3337
}
3438

3539
useEffect(() => {
36-
getRecommendQuestions().then();
37-
}, []);
40+
const data_profile = userInfo.queryConfig.selectedDataPro;
41+
if (data_profile) {
42+
getRecommendQuestions(data_profile).then();
43+
}
44+
}, [userInfo]);
3845

3946
return (
4047
<div>

report-front-end/src/components/top-navigation/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const CustomTopNavigation = () => {
66
<TopNavigation
77
identity={{
88
href: "#",
9-
title: "GenBI App",
9+
title: "Guidance for Generative BI on Amazon Web Services",
1010
logo: {
1111
src: "/Amazoncom-yellow-arrow.png",
12-
alt: "GenBI App",
12+
alt: "amazon icon",
1313
},
1414
}}
1515
/>

0 commit comments

Comments
 (0)