diff --git a/api/chat.php b/api/chat.php index 91d4724..62968b5 100644 --- a/api/chat.php +++ b/api/chat.php @@ -44,34 +44,19 @@ if ($_SESSION['question_index'] < count($questions)) { foreach ($_SESSION['answers'] as $index => $answer) { $formatted_answers[] = "Q: " . $questions[$index] . "\nA: " . $answer; } - $prompt = "You are a burnout analysis expert. A user has completed a burnout survey. The user answered on a scale of 1-5 where 1 is 'Never' and 5 is 'Always'. Analyze the following survey answers and provide a detailed analysis. Return the response as a JSON object with the following structure: -{ - \"scores\": { - \"Exhaustion\": , - \"Cynicism\": , - \"Inefficacy\": - }, - \"analysis\": { - \"overallSummary\": \"\", - \"exhaustionSummary\": \"\", - \"cynicismSummary\": \"\", - \"inefficacySummary\": \"\" - }, - \"recommendations\": [ - { - \"title\": \"\", - \"description\": \"\" - }, - ... (provide 3 to 5 detailed recommendations) - ], - \"nextSteps\": [ - \"\", - \"\" - ] -} + $prompt = <<<'EOD' +You are a burnout analysis expert. A user has completed a burnout survey. The user answered on a scale of 1-5 where 1 is 'Never' and 5 is 'Always'. Analyze the following survey answers and provide a detailed analysis. + +Return the response as a JSON object. The JSON object must have the following keys: "scores", "analysis", "recommendations", and "nextSteps". + +- "scores" should be an object with keys "Exhaustion", "Cynicism", and "Inefficacy", each with a numeric score from 0 to 5. +- "analysis" should be an object with keys "overallSummary", "exhaustionSummary", "cynicismSummary", and "inefficacySummary", each containing a string with the corresponding analysis. +- "recommendations" should be an array of objects, where each object has a "title" and a "description". +- "nextSteps" should be an array of strings. Answers: -" . implode("\n\n", $formatted_answers); +EOD; +$prompt .= implode("\n\n", $formatted_answers); $ai_response = LocalAIApi::createResponse([ 'input' => [ diff --git a/assets/pasted-20251118-104529-37f09ec1.png b/assets/pasted-20251118-104529-37f09ec1.png new file mode 100644 index 0000000..514cf6a Binary files /dev/null and b/assets/pasted-20251118-104529-37f09ec1.png differ