{"id":20764614,"url":"https://github.com/amliyanage/ai-problem-resolver","last_synced_at":"2025-04-30T08:50:44.783Z","repository":{"id":256204613,"uuid":"853364223","full_name":"amliyanage/Ai-Problem-Resolver","owner":"amliyanage","description":"React-based chat application utilizing AI, with features for chat history, message truncation, and starting new conversations.","archived":false,"fork":false,"pushed_at":"2024-09-10T05:51:49.000Z","size":6618,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-10T16:01:55.270Z","etag":null,"topics":["ai","chatbot","gemini","reactjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amliyanage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-06T14:06:01.000Z","updated_at":"2024-09-10T06:03:14.000Z","dependencies_parsed_at":"2024-09-09T16:08:09.629Z","dependency_job_id":null,"html_url":"https://github.com/amliyanage/Ai-Problem-Resolver","commit_stats":null,"previous_names":["amliyanage/ai-problem-resolver"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amliyanage%2FAi-Problem-Resolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amliyanage%2FAi-Problem-Resolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amliyanage%2FAi-Problem-Resolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amliyanage%2FAi-Problem-Resolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amliyanage","download_url":"https://codeload.github.com/amliyanage/Ai-Problem-Resolver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225028979,"owners_count":17409614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chatbot","gemini","reactjs"],"created_at":"2024-11-17T10:53:02.555Z","updated_at":"2024-11-17T10:53:03.271Z","avatar_url":"https://github.com/amliyanage.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ai Problem Resolver\n\nThis template provides a minimal setup for a chat application using React and Google Generative AI, integrated with Vite for fast builds and hot module replacement (HMR).\n\n[![Watch Video](src/assets/img/img_1.png)](src/assets/img/finalView.mp4)\n\n## Features\n\n- **Real-time Messaging**: Interact with Google Generative AI to receive responses.\n- **Chat History**: View and interact with past messages.\n- **Message Truncation**: Display truncated message titles if they exceed 10 characters.\n- **Clear Chat**: Start a new conversation and clear the current chat.\n\n## Technologies Used\n\n- **React**: For building the user interface.\n- **Google Generative AI**: For generating AI responses.\n- **Vite**: For fast builds and development.\n\n## Setup and Installation\n\n1. **Clone the Repository**\n\n    ```bash\n    git clone https://github.com/amliyanage/Ai-Problem-Resolver.git\n    cd Ai-Problem-Resolver\n    ```\n\n2. **Install Dependencies**\n\n   Ensure you have [Node.js](https://nodejs.org/) installed. Then, install the dependencies:\n\n    ```bash\n    npm install\n    ```\n\n3. **Configure API Key**\n\n   Replace the placeholder API key in `src/pages/HomePage.jsx` with your actual Google Generative AI API key:\n\n    ```javascript\n    const GEMINI_API_KEY = \"your-api-key-here\";\n    ```\n\n4. **Start the Development Server**\n\n    ```bash\n    npm run dev\n    ```\n\n   Navigate to `http://localhost:3000` in your browser to see the application.\n\n## Code Overview\n\n### `src/pages/HomePage.jsx`\n\nThis file contains the main chat interface component:\n\n- **State Management**:\n    - `sendMessage`: Stores sent messages.\n    - `receivedMessage`: Stores responses from the AI.\n    - `message`: Stores the current input message.\n    - `history`: Stores the chat history.\n\n- **Functions**:\n    - `generateMessage(msg)`: Sends a message to Google Generative AI and updates received messages.\n    - `handleSendMessage()`: Sends the current message and updates chat history.\n    - `handleNewChat()`: Clears the chat and resets the input field.\n    - `handleHistoryClick(msg)`: Resends a message from history when clicked.\n    - `truncateTitle(title)`: Truncates long message titles with an ellipsis.\n\n- **Rendering**:\n    - Renders a chat interface with message input and display.\n    - Shows chat history with clickable items for resending messages.\n\n### `src/util/Icons.jsx`\n\nContains the icon components used in the application. Ensure this file includes the necessary icons.\n\n### `src/assets/css/HomePage.css`\n\nCSS file for styling the chat interface. Customize as needed for your design.\n\n## Contributing\n\nContributions are welcome! Open an issue or submit a pull request for improvements or fixes. For major changes, please discuss them in an issue first.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgements\n\n- [Google Generative AI](https://cloud.google.com/generative-ai) for AI-powered responses.\n- [React](https://reactjs.org/) for the frontend framework.\n- [Vite](https://vitejs.dev/) for fast builds and development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famliyanage%2Fai-problem-resolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famliyanage%2Fai-problem-resolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famliyanage%2Fai-problem-resolver/lists"}