Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
1 line
9.3 KiB
JSON
1 line
9.3 KiB
JSON
{"repo": "abdelmonem-dev/ai-chatbot", "files": {"app/Http/Controllers/AIChatbotController.php": {"1173ca724245b7308b8075ae987195578094ad1e": {"t": 1785746155.8322701, "n": 2346, "h": "7bb227e9820d796b", "c": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse GuzzleHttp\\Client;\nuse Illuminate\\Support\\Facades\\Log;\n\nclass AIChatbotController extends Controller\n{\n protected $client;\n protected $apiKey;\n\n public function __construct()\n {\n $this->client = new Client();\n $this->apiKey = config('services.ai.api_key');\n }\n\n public function chat(Request $request)\n {\n $userMessage = $request->input('message');\n\n // If the API key is not set, send a default response\n if (!$this->apiKey) {\n return $this->sendFallbackResponse('Hello'); // Return fallback response directly\n }\n\n try {\n // Make a request to the AI API (e.g., DeepSeek or OpenAI)\n $response = $this->client->post('https://api.deepseek.com', [\n 'headers' => [\n 'Authorization' => 'Bearer ' . $this->apiKey,\n 'Content-Type' => 'application/json',\n ],\n 'json' => [\n 'model' => 'deepseek-chat', // Replace with the correct model name\n 'messages' => [ // Corrected 'message' key to 'messages'\n ['role' => 'user', 'content' => $userMessage], // Send the user's message\n ],\n ],\n ]);\n\n $responseData = json_decode($response->getBody(), true);\n\n // Return the AI's response\n return response()->json([\n 'response' => $responseData['choices'][0]['message']['content'],\n ]);\n } catch (\\Exception $e) {\n // Log the error for debugging purposes\n Log::error('AI API request failed: ' . $e->getMessage());\n\n // Fallback message when API fails\n return $this->sendFallbackResponse('Hello'); // Default fallback message\n }\n }\n\n // Helper method to return a fallback response\n private function sendFallbackResponse($message)\n {\n $responseData = [\n 'candidates' => [\n [\n 'content' => [\n 'parts' => [\n ['text' => $message]\n ]\n ]\n ]\n ]\n ];\n\n return response()->json($responseData);\n }\n}\n"}, "517deb942f4bd6603ffa34cbc3c29b64d9d26fb2": {"t": 1785760258.755598, "n": 2346, "h": "7bb227e9820d796b", "c": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse GuzzleHttp\\Client;\nuse Illuminate\\Support\\Facades\\Log;\n\nclass AIChatbotController extends Controller\n{\n protected $client;\n protected $apiKey;\n\n public function __construct()\n {\n $this->client = new Client();\n $this->apiKey = config('services.ai.api_key');\n }\n\n public function chat(Request $request)\n {\n $userMessage = $request->input('message');\n\n // If the API key is not set, send a default response\n if (!$this->apiKey) {\n return $this->sendFallbackResponse('Hello'); // Return fallback response directly\n }\n\n try {\n // Make a request to the AI API (e.g., DeepSeek or OpenAI)\n $response = $this->client->post('https://api.deepseek.com', [\n 'headers' => [\n 'Authorization' => 'Bearer ' . $this->apiKey,\n 'Content-Type' => 'application/json',\n ],\n 'json' => [\n 'model' => 'deepseek-chat', // Replace with the correct model name\n 'messages' => [ // Corrected 'message' key to 'messages'\n ['role' => 'user', 'content' => $userMessage], // Send the user's message\n ],\n ],\n ]);\n\n $responseData = json_decode($response->getBody(), true);\n\n // Return the AI's response\n return response()->json([\n 'response' => $responseData['choices'][0]['message']['content'],\n ]);\n } catch (\\Exception $e) {\n // Log the error for debugging purposes\n Log::error('AI API request failed: ' . $e->getMessage());\n\n // Fallback message when API fails\n return $this->sendFallbackResponse('Hello'); // Default fallback message\n }\n }\n\n // Helper method to return a fallback response\n private function sendFallbackResponse($message)\n {\n $responseData = [\n 'candidates' => [\n [\n 'content' => [\n 'parts' => [\n ['text' => $message]\n ]\n ]\n ]\n ]\n ];\n\n return response()->json($responseData);\n }\n}\n"}}, "README.md": {"1173ca724245b7308b8075ae987195578094ad1e": {"t": 1786067734.6183357, "n": 3969, "h": "b089b29d45cd66ea", "c": "<h1 align=\"center\">🤖 AI Chatbot Web Application</h1>\n\n<p align=\"center\">\n A chatbot web application built with <strong>Laravel</strong> (backend) and <strong>JavaScript</strong> (frontend). The chatbot integrates with external AI APIs (e.g., OpenAI, DeepSeek) to provide real-time, intelligent responses. It supports features like <strong>file uploads</strong>, <strong>message history</strong>, and <strong>fallback responses</strong> for a seamless user experience.\n</p>\n\n---\n\n## ✨ Features\n\n<div style=\"display: flex; flex-wrap: wrap; gap: 10px;\">\n <div style=\"flex: 1; min-width: 200px; padding: 10px; border: 1px solid #ddd; border-radius: 8px;\">\n <h3>Real-time Chat</h3>\n <p>Instant messaging with AI-powered responses.</p>\n </div>\n <div style=\"flex: 1; min-width: 200px; padding: 10px; border: 1px solid #ddd; border-radius: 8px;\">\n <h3>File Upload</h3>\n <p>Upload images and other files during conversations.</p>\n </div>\n <div style=\"flex: 1; min-width: 200px; padding: 10px; border: 1px solid #ddd; border-radius: 8px;\">\n <h3>AI Integration</h3>\n <p>Connects with third-party AI services for intelligent responses.</p>\n </div>\n <div style=\"flex: 1; min-width: 200px; padding: 10px; border: 1px solid #ddd; border-radius: 8px;\">\n <h3>Fallback Responses</h3>\n <p>Default responses (\"Hello\") in case of API failure.</p>\n </div>\n <div style=\"flex: 1; min-width: 200px; padding: 10px; border: 1px solid #ddd; border-radius: 8px;\">\n <h3>Modern UI</h3>\n <p>Sleek and user-friendly chat interface.</p>\n </div>\n</div>\n\n---\n\n## 🛠️ Prerequisites\n\nBefore you begin, ensure you have the following installed:\n```\n- PHP 8.0 or higher\n- Composer\n- Node.js (for frontend dependencies)\n- vite\n- A valid AI API key (e.g., OpenAI, DeepSeek)\n```\n\n\n## 🚀 Installation\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/your-username/ai-chatbot.git\ncd ai-chatbot\nRun HTML\n2. Install Backend Dependencies\nInstall PHP dependencies using Composer:\n```\ncomposer install\n```\n4. Install Frontend Dependencies\nInstall Node.js dependencies:\n```\nnpm install\n```\n\n4. Configure Environment\nCopy the .env.example file to .env and update it with your API key and other settings:\ncp .env.example .env\nEdit the .env file:\n```\nAI_API_KEY=your-api-key-here\nAI_API_URL=https://api.deepseek.com/v1/chat/completions\n```\n6. Generate Application Key\nGenerate a unique application key:\n```\nphp artisan key:generate\n```\n8. Run Database Migrations \n```\nphp artisan migrate\n```\n\n9. Start the Application\n```\nphp artisan serve\n```\nVisit http://127.0.0.1:8000 in your browser to access the application.\n\n💡 Usage\nChatting with the Bot\nOpen the application in your browser.\n\nType your message in the chat input field and press Enter or click the Send button.\n\nThe bot will process your message and respond instantly.\n\nFile Upload\nYou can upload files (e.g., images) during the chat. The file will be sent to the backend for processing.\n\nAPI Integration\nThe backend uses Guzzle to interact with the AI API.\n```\nIf the API fails, the chatbot will return a fallback response (\"Hello\").\n```\n📂 Project Structure\nBackend (Laravel)\napp/Http/Controllers/AIChatbotController.php: Handles chatbot logic and API integration.\n\nroutes/web.php: Defines routes for the chatbot functionality.\n\n.env: Stores environment variables, including the AI API key.\n```\nFrontend (JavaScript/HTML/CSS)\nfor the front end, I used a depository for Patrik Persson\n\nPatrik Persson :<a href=\"https://github.com/patrik1970/ai-chatbot-html-css-javascript\"> ai-chatbot-html-css-javascript </a> \n```\n\n🤝 Contributing\nContributions are welcome! Please follow these steps:\n\nFork the repository.\n\nCreate a new branch (git checkout -b feature/YourFeatureName).\n\nCommit your changes (git commit -m 'Add some feature').\n\nPush to the branch (git push origin feature/YourFeatureName).\n\nOpen a pull request.\n\n📄 License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n\n"}}}} |