fixed chatbot careerSuggestions undefined
This commit is contained in:
parent
88842b5946
commit
ea78794196
@ -3,6 +3,7 @@ import axios from "axios";
|
||||
import "./Chatbot.css";
|
||||
|
||||
const Chatbot = ({ context }) => {
|
||||
|
||||
const [messages, setMessages] = useState([
|
||||
{
|
||||
role: "assistant",
|
||||
@ -22,11 +23,11 @@ const Chatbot = ({ context }) => {
|
||||
Your role is to not only provide career suggestions but to analyze them based on salary potential, job stability, education costs, and market trends.
|
||||
|
||||
Use the following user-specific data:
|
||||
- Career Suggestions: ${context.data.careerSuggestions?.map((c) => c.title).join(", ") || "No suggestions available."}
|
||||
- Selected Career: ${context.data.selectedCareer?.title || "None"}
|
||||
- Schools: ${context.data.schools?.map((s) => s["INSTNM"]).join(", ") || "No schools available."}
|
||||
- Career Suggestions: ${context.careerSuggestions?.map((c) => c.title).join(", ") || "No suggestions available."}
|
||||
- Selected Career: ${context.selectedCareer?.title || "None"}
|
||||
- Schools: ${context.schools?.map((s) => s["INSTNM"]).join(", ") || "No schools available."}
|
||||
- Median Salary: ${
|
||||
context.data.salaryData?.find((s) => s.percentile === "Median")?.value || "Unavailable"
|
||||
context.salaryData?.find((s) => s.percentile === "Median")?.value || "Unavailable"
|
||||
}
|
||||
- ROI (Return on Investment): If available, use education costs vs. salary potential to guide users.
|
||||
|
||||
|
@ -272,6 +272,20 @@ async (career) => {
|
||||
],
|
||||
};
|
||||
|
||||
console.log("Passing context to Chatbot:", {
|
||||
careerSuggestions,
|
||||
riaSecScores,
|
||||
selectedCareer,
|
||||
schools,
|
||||
salaryData,
|
||||
economicProjections,
|
||||
tuitionData,
|
||||
userState,
|
||||
areaTitle,
|
||||
userZipcode,
|
||||
results,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="dashboard">
|
||||
<div className="dashboard-content">
|
||||
@ -345,23 +359,27 @@ async (career) => {
|
||||
{memoizedPopoutPanel}
|
||||
|
||||
|
||||
{/* Pass context to Chatbot */}
|
||||
<div className="chatbot-widget">
|
||||
{/* Pass context to Chatbot */}
|
||||
<div className="chatbot-widget">
|
||||
{careerSuggestions.length > 0 ? (
|
||||
<Chatbot
|
||||
context={{
|
||||
careerSuggestions,
|
||||
riaSecScores,
|
||||
selectedCareer,
|
||||
schools,
|
||||
salaryData,
|
||||
economicProjections,
|
||||
tuitionData,
|
||||
userState,
|
||||
areaTitle,
|
||||
userZipcode,
|
||||
results, // Pass results to Chatbot
|
||||
careerSuggestions: careersWithJobZone || [],
|
||||
riaSecScores: riaSecScores || [],
|
||||
selectedCareer: selectedCareer || null,
|
||||
schools: schools || [],
|
||||
salaryData: salaryData || [],
|
||||
economicProjections: economicProjections || null,
|
||||
tuitionData: tuitionData || [],
|
||||
userState: userState || "",
|
||||
areaTitle: areaTitle || "",
|
||||
userZipcode: userZipcode || "",
|
||||
results: results || [],
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<p>Loading Chatbot...</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user