+ {workoutPlan.general_guidelines} +
+💡 {exercise.tips}
+ {/if} +${message.content}
+ ${ProfileCard(formatOnboardingDataToProfile(userOnboardingData))} +${message.content}
${ProfileCard(formatOnboardingDataToProfile(userOnboardingData))} @@ -113,6 +147,16 @@ try { const startIndex = message.content.indexOf('{'); const endIndex = message.content.lastIndexOf('}') + 1; + + // Extract the JSON string from the message + const workoutPlanJson = message.content.slice(startIndex, endIndex); + + // Parse the JSON to get the workoutPlan object + const workoutPlanData = JSON.parse(workoutPlanJson); + workoutplanData = workoutPlanData; + + // Return just the intro text, the component will be rendered separately + return `Here's your personalized workout plan based on your profile:
`; const workoutPlanJson = message.content.slice(startIndex, endIndex); const workoutPlan = JSON.parse(workoutPlanJson); @@ -127,6 +171,149 @@ return message.content; } } + return message.content; + } + + function WorkoutPlan({ workoutPlan }: { workoutPlan: WorkoutPlan }) { + function capitalize(str: string) { + return str + .split('_') + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) + .join(' '); + } + + return ` +${workoutPlan.general_guidelines}
+${message.content}
`; } @@ -297,6 +484,51 @@ } async function getBotResponse(message: string): Promise+ Allow camera access to scan nutrition labels +
+Processing label...
+