add:setting main chatbot

fix:chatbot ui
This commit is contained in:
2025-03-04 14:46:29 +07:00
parent 9ea7e96af1
commit 572b86299c
11 changed files with 606 additions and 118 deletions

View File

@@ -76,9 +76,29 @@ class ChatbotController extends Controller
return response()->json(['response' => ''], 500);
}
public function mainGenerateText(Request $request)
{
// Log hanya data yang relevan
info("Received prompt: " . $request->input('prompt'));
private function classifyContent(string $prompt) {
$classifyResponse = $this->openAIService->generateClassifyContent($prompt);
return $classifyResponse;
// Validasi input
$request->validate([
'prompt' => 'required|string',
]);
try {
// Panggil service untuk generate text
$response = $this->openAIService->mainGenerateText($request->input('prompt'));
return response()->json(['response' => $response]);
} catch (\Exception $e) {
// Tangani error dan log exception
\Log::error("Error generating text: " . $e->getMessage());
return response()->json([
'error' => ''
], 500);
}
}
}