remove: ai integration, add: local ai
This commit is contained in:
1 parent
0c0977a220
commit
1ec1be4dcc
17 files changed
+1832
-2163
No files matched your search
+7
-48
@@ -37,57 +37,15 @@ if (isset($mysqli) && !$mysqli->connect_error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build system instructions
|
||||
$systemPrompt = "You are a friendly, professional, and intelligent AI assistant built into the personal portfolio website of Cris Charles Garcia.\n";
|
||||
$systemPrompt .= "Your role is to represent Cris, assist recruiters, potential clients, and visitors, and answer questions about his background, experience, skills, and projects.\n\n";
|
||||
|
||||
$systemPrompt .= "Cris's Profile & Biography:\n";
|
||||
if ($settings) {
|
||||
$systemPrompt .= "- Bio Paragraph 1: " . $settings['about_text_1'] . "\n";
|
||||
$systemPrompt .= "- Bio Paragraph 2: " . $settings['about_text_2'] . "\n";
|
||||
$systemPrompt .= "- Years coding: " . $settings['years_coding'] . "\n";
|
||||
$systemPrompt .= "- Projects completed: " . $settings['projects_count'] . "\n";
|
||||
$systemPrompt .= "- Certifications: " . $settings['certifications_count'] . "\n";
|
||||
$systemPrompt .= "- Github: " . $settings['github_url'] . "\n";
|
||||
$systemPrompt .= "- LinkedIn: " . $settings['linkedin_url'] . "\n";
|
||||
$systemPrompt .= "- Instagram: " . $settings['instagram_url'] . "\n";
|
||||
$systemPrompt .= "- Facebook: " . $settings['facebook_url'] . "\n";
|
||||
$systemPrompt .= "- TikTok: " . $settings['tiktok_url'] . "\n";
|
||||
} else {
|
||||
$systemPrompt .= "- Cris is a senior IT student majoring in Software Development based in Laguna, Philippines.\n";
|
||||
}
|
||||
|
||||
$systemPrompt .= "\nCris's Projects:\n";
|
||||
foreach ($projects as $p) {
|
||||
$systemPrompt .= "- **" . $p['title'] . "**: " . $p['des'] . " (Tech: " . $p['techstack'] . "). Link: " . $p['url'] . "\n";
|
||||
}
|
||||
|
||||
$systemPrompt .= "\nCris's Certifications:\n";
|
||||
foreach ($certs as $c) {
|
||||
$systemPrompt .= "- " . $c['title'] . " by " . $c['issuer'] . " (Issued: " . $c['date_issued'] . ")\n";
|
||||
}
|
||||
|
||||
$systemPrompt .= "\nCris's Latest Articles/Blog Posts:\n";
|
||||
foreach ($articles as $a) {
|
||||
$systemPrompt .= "- \"" . $a['title'] . "\": " . $a['excerpt'] . " [Tag: " . $a['tag'] . ", Date: " . $a['date_published'] . ", Link: " . $a['url'] . "]\n";
|
||||
}
|
||||
|
||||
$systemPrompt .= "\nGuidelines for your responses:\n";
|
||||
$systemPrompt .= "1. Respond in first-person (e.g., \"I am a senior IT student...\" or \"In my project UniMarket...\") or as a dedicated assistant of Cris. Represent Cris accurately, warmly, and professionally.\n";
|
||||
$systemPrompt .= "2. Keep responses brief, engaging, and directly related to the question. Recruiters appreciate concise answers.\n";
|
||||
$systemPrompt .= "3. If asked about contact options or hiring, point them to his contact form at the bottom of the page or his professional links (Github, LinkedIn).\n";
|
||||
$systemPrompt .= "4. Do not make up facts or external projects not listed in the context. If you don't know the answer, politely invite the user to contact Cris directly.\n";
|
||||
$systemPrompt .= "5. Format your output using simple markdown (like bolding or bullet points) to make it readable.\n";
|
||||
|
||||
$apiKey = $_ENV['GROQ_API_KEY'] ?? getenv('GROQ_API_KEY') ?? '';
|
||||
?>
|
||||
|
||||
<!-- Pass DB configuration context directly to javascript to allow direct API requests on restricted hosting environments (like InfinityFree) -->
|
||||
<!-- Pass DB configuration context directly to javascript for the intent engine -->
|
||||
<script>
|
||||
window.chatbotConfig = {
|
||||
groqApiKey: <?php echo json_encode($apiKey); ?>,
|
||||
systemPrompt: <?php echo json_encode($systemPrompt); ?>
|
||||
window.portfolioData = {
|
||||
settings: <?php echo json_encode($settings); ?>,
|
||||
projects: <?php echo json_encode($projects); ?>,
|
||||
certs: <?php echo json_encode($certs); ?>,
|
||||
articles: <?php echo json_encode($articles); ?>
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -145,4 +103,5 @@ window.chatbotConfig = {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="assets/js/chatbot-engine.js" defer></script>
|
||||
<script src="assets/js/chat.js" defer></script>
|
||||
Reference in new issue
Block a user