{"id":21301387,"url":"https://github.com/yafatek/ai-coding-assitant","last_synced_at":"2026-05-08T09:33:51.374Z","repository":{"id":262839869,"uuid":"888517700","full_name":"yafatek/ai-coding-assitant","owner":"yafatek","description":"Development AI Coding Assistant, this is a Code that leverages the power of Google Gemini APIs to Build a Coding Buddy where it helps developers code and maintain high quality code, fix bus, and debug.","archived":false,"fork":false,"pushed_at":"2024-11-15T07:09:07.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T17:44:13.101Z","etag":null,"topics":["ai","docker","gemini","google","python","python3","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","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/yafatek.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":"FerasAlawadi","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-11-14T14:36:24.000Z","updated_at":"2024-11-15T07:09:10.000Z","dependencies_parsed_at":"2024-11-14T15:42:01.635Z","dependency_job_id":"a94b55ee-f547-4a77-82e5-37aeda741c63","html_url":"https://github.com/yafatek/ai-coding-assitant","commit_stats":null,"previous_names":["yafatek/ai-coding-assitant"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yafatek/ai-coding-assitant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yafatek%2Fai-coding-assitant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yafatek%2Fai-coding-assitant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yafatek%2Fai-coding-assitant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yafatek%2Fai-coding-assitant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yafatek","download_url":"https://codeload.github.com/yafatek/ai-coding-assitant/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yafatek%2Fai-coding-assitant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32774972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","docker","gemini","google","python","python3","redis"],"created_at":"2024-11-21T15:45:40.780Z","updated_at":"2026-05-08T09:33:51.348Z","avatar_url":"https://github.com/yafatek.png","language":"Python","funding_links":["https://patreon.com/FerasAlawadi"],"categories":[],"sub_categories":[],"readme":"# WebSocket Chat with Coding Agent\n\nThis project is a WebSocket-based chat application using **FastAPI** to provide real-time chat functionality. It integrates with a custom **CodingAgent** class to interact with the **Gemini API** for generating code responses based on user input. The project includes robust chat history storage and retrieval using **Redis** as an in-memory data store. It also includes safety filters for content moderation and custom tools for enhanced interactions.\n\n## Features\n\n- **WebSocket Chat Interface**: Enables real-time bi-directional communication with users.\n- **Code Generation with Gemini API**: Uses the Gemini API to generate code responses based on user prompts.\n- **Chat History Storage**: Stores chat messages and responses in Redis for session persistence.\n- **Safety Filters**: Implements customizable safety settings for handling potentially harmful content.\n- **Custom Tool Integrations**: Adds functionality with `search_custom_engine` and `scrape_website` tools.\n\n## Project Structure\n\n- **main.py**: Contains the main application code with the WebSocket endpoint and FastAPI setup.\n- **CodingAgent Class**:\n  - Manages interactions with the Gemini API.\n  - Retrieves chat history from Redis and stores interactions.\n  - Configures safety settings for content moderation.\n- **Logger**: A custom logger that logs important application events and information, enhancing debugging and traceability.\n- **RedisMemory**: Manages conversation history storage using Redis for efficient access.\n\n## How It Works\n\n1. **WebSocket Connection**: When a client connects to `/chat`, a WebSocket connection is established, and a new chat session is created with a unique `chat_id`.\n2. **User Message Handling**: When a message is received, it’s stored in Redis and passed to the `CodingAgent`.\n3. **AI Response Generation**: The `CodingAgent` sends the user message to the Gemini API to generate a response, which is then sent back to the user.\n4. **Memory Management**: The chat history is maintained in Redis for the current session and loaded when required.\n\n## Dependencies\n\n- **FastAPI**: For building the WebSocket server and managing routes.\n- **Uvicorn**: ASGI server to run FastAPI applications.\n- **Google Generative AI**: For generating AI responses (Gemini API).\n- **Redis**: Used for storing chat history and session management.\n\n## Installation\n\n1. Clone the repository:\n```bash\n   git clone https://github.com/yafatek/ai-coding-assitant.git\n```\n```bash\n cd ai-coding-assitant\n```\nInstall the required dependencies:\n### Docker:\nyou need a Docker Desktop to run a Redis Instance\n```bash\ndocker run -d -p 6379:6379 -p 8001:8001 redis/redis-stack:latest\n```\n```bash\npip install -r requirements.txt\n```\n```bash\npip install 'uvicorn[standard]'   \n```\nConfigure environment variables, including the Gemini API key and Redis connection details.\n\nRun the application:\n\n```bash \nuvicorn main:app --host 0.0.0.0 --port 11203\n```\n\n### Docker compose\n```dockerfile\nversion: '3'\nservices:\n  redis:\n    image: redis/redis-stack:latest\n    ports:\n      - \"6379:6379\"\n      - \"8001:8001\"\n    networks:\n      - fullstack_network\n\n  backend:\n    image: yafaorg/ai-assistant-backend:latest\n    ports:\n      - \"11203:11203\"\n    environment:\n      - GEMINI_API_KEY=your_gemini_api_key_here\n      - SEARCH_ENGIN_ID=your_search_engine_id_here\n      - GOOGLE_SEARCH_API_KEY=your_google_search_api_key_here\n      - REDIS_HOST=redis://redis:6379  # Connects to the Redis service\n    networks:\n      - fullstack_network\n    depends_on:\n      - redis\n\n  frontend:\n    image: yafaorg/ai-assistant-ui:latest\n    ports:\n      - \"3000:3000\"\n    networks:\n      - fullstack_network\n\nnetworks:\n  fullstack_network:\n    driver: bridge\n```\n## Usage\nStart the server.\nConnect to the WebSocket endpoint at /chat.\nSend a text message, and the application will respond with AI-generated code from the Gemini API.\n\n## Contributing\nContributions are welcome! Please fork the repository and create a pull request with your changes.\n\n## License\nMIT License\n\nCopyright (c) 2024 YAFATEK Solutions\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyafatek%2Fai-coding-assitant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyafatek%2Fai-coding-assitant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyafatek%2Fai-coding-assitant/lists"}