| 1234567891011121314151617181920212223242526 |
- <?php
- $frage = isset($_POST['frage']) ? $_POST['frage'] : '';
- $kontext = isset($_POST['kontext']) ? $_POST['kontext'] : '';
- $prompt = "Du bist ein HR-Bot. Antworte ausschließlich basierend auf dem folgenden Kontext:\n\n" . $kontext . "\n\nFrage: " . $frage . "\nAntwort:";
- $payload = json_encode(array(
- "model" => "deepseek-r1",
- "prompt" => $prompt,
- "stream" => false
- ));
- $ch = curl_init('http://localhost:11434/api/generate');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
- curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
- $response = curl_exec($ch);
- curl_close($ch);
- $data = json_decode($response, true);
- $antwort = isset($data['response']) ? $data['response'] : 'Fehler bei DeepSeek';
- echo "<h3>Antwort vom HR-Bot:</h3><pre>" . htmlspecialchars($antwort) . "</pre>";
|