{"id":22432702,"url":"https://github.com/1999azzar/frea","last_synced_at":"2026-02-28T11:04:15.143Z","repository":{"id":223733920,"uuid":"760121182","full_name":"1999AZZAR/frea","owner":"1999AZZAR","description":"Frea is an interactive terminal-based chat application powered by Google's generative AI, designed to provide seamless user interactions with advanced natural language processing capabilities. This application offers a variety of features, including multi-line input, special commands, and a customizable loading animation.","archived":false,"fork":false,"pushed_at":"2025-04-19T04:06:12.000Z","size":62049,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T03:49:00.561Z","etag":null,"topics":["ai","chat-app","chatbot","chatgpt","chatgpt-api","gemini-api","gemini-pro","generative-ai","langchain","langchain-python","lewd-bot","openai","python","terminal","terminal-app","terminal-based","tui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1999AZZAR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-02-19T20:27:08.000Z","updated_at":"2025-04-19T04:06:15.000Z","dependencies_parsed_at":"2025-08-22T03:29:59.627Z","dependency_job_id":"b0bb1e8f-d9a1-4bfd-bdef-fc4afeddb918","html_url":"https://github.com/1999AZZAR/frea","commit_stats":null,"previous_names":["1999azzar/frea"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/1999AZZAR/frea","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Ffrea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Ffrea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Ffrea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Ffrea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1999AZZAR","download_url":"https://codeload.github.com/1999AZZAR/frea/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Ffrea/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29931158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T09:58:13.507Z","status":"ssl_error","status_checked_at":"2026-02-28T09:57:57.047Z","response_time":90,"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","chat-app","chatbot","chatgpt","chatgpt-api","gemini-api","gemini-pro","generative-ai","langchain","langchain-python","lewd-bot","openai","python","terminal","terminal-app","terminal-based","tui"],"created_at":"2024-12-05T22:12:36.718Z","updated_at":"2026-02-28T11:04:15.127Z","avatar_url":"https://github.com/1999AZZAR.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Frea - Freak Robotic Entity with Amusement\n\n## Table Of Content\n\n1. [Overview](#Overview)\n2. [Features](#Features)\n3. [Setup](#Setup)\n    - [Prerequisites](#Prerequisites)\n    - [Installation](#Installation)\n4. [Usage](#Usage)\n    - [Running the Application](#Running-the-Application)\n    - [Special Commands](#Special-Commands)\n    - [Example Interaction](#Example-Interaction)\n    - [Multi-Line Input](#Multi-Line-Input)\n    - [Running Subprocess Commands](#Running-Subprocess-Commands)\n5. [Configuration](#Configuration)\n    - [Initial Configuration](#Initial-Configuration)\n    - [Reconfiguration](#Reconfiguration)\n6. [Developer Notes](#Developer-Notes)\n    - [Code Structure](#Code-Structure)\n    - [Functions](#Functions)\n    - [Safety Settings](#Safety-Settings)\n7. [Flowchart](#Flowchart)\n8. [Demo](#Demo)\n\n## Overview\n\nFrea is an interactive terminal-based chat application powered by Google's generative AI, designed to provide seamless user interactions with advanced natural language processing capabilities. This application offers a variety of features, including multi-line input, special commands, and a customizable loading animation.\n\n## Features\n\n- **Interactive Chat Interface**: Engage in dynamic conversations with a generative AI model.\n- **Customization**: Configure API keys, loading styles, and instruction files via `config.ini`.\n- **Special Commands**: Use commands like `exit`, `clear`, `reset`, `print`, `reconfigure`, and `help`.\n- **Multi-Line Input**: Easily handle multi-line user inputs.\n- **Loading Animations**: Enjoy visually appealing loading animations while waiting for responses.\n- **Safety Settings**: Ensure content safety with predefined thresholds for harmful content categories.\n- **Conversation Log**: Save conversation logs to a file.\n- **Model Switching**: Easily switch between different AI models.\n\n## Setup\n\n### Prerequisites\n\n- Gemini API key\n- Python 3.8 or later\n- Required Python packages listed in `requirements.txt`\n\n### Installation\n\n1. **Clone the Repository**:\n    ```bash\n    git clone https://github.com/1999AZZAR/frea.git\n    cd frea\n    ```\n2. **Create a virtual env**:\n    ```bash\n    python3 -m venv .venv\n    ```\n3. **Activate the venv**:\n    ```bash\n    source .venv/bin/activate\n    ```\n\n4. **Install Dependencies**:\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n5. **Run the code**:\n    ```bash\n    cd code\n    python main.py\n    ```\n\n6. **Configuration**:\n    - On the first run, the application will prompt for the API key, loading style, and instruction file path.\n    - These settings will be saved in a `config.ini` file for future use.\n\n## Usage\n\n### Running the Application\n\nTo start the Frea application, run:\n\n```bash\ncd src\npython main.py\n```\n\n### Special Commands\n\n- **exit**: Exit the application.\n- **clear**: Clear the terminal screen.\n- **reset**: Reset the chat session.\n- **print**: Save the conversation log to a file.\n- **reconfigure**: Reconfigure the settings.\n- **help**: Display help information.\n- **model**: Switch between models and services.\n\n### Example Interaction\n\nUpon running the application, you will see a prompt to enter your message:\n\n```plaintext\n╭─ User\n╰─\u003e Hello, how are you?\n```\n\nThe application will respond after processing your input, showing a loading animation in the meantime.\n\n### Multi-Line Input\n\nTo enter multi-line messages, end each line with a backslash (`\\`):\n\n```plaintext\n╭─ User\n╰─\u003e This is a multi-line \\\ninput example.\n```\n\n### Running Subprocess Commands\n\nYou can run system commands by prefixing them with `run `:\n\n```plaintext\n╭─ User\n╰─\u003e run ls -la\n```\n\n## Configuration\n\n### Initial Configuration\n\nOn the first run, the application will guide you through creating a `config.ini` file:\n\n```plaintext\n╭─ Frea\n╰─\u003e No Configuration found. Creating configuration file.\nEnter the API key: your_api_key_here\nEnter the loading style (e.g., L1): L1\nEnter the path to the instruction file: /path/to/instruction_file.txt\nConfiguration saved successfully!\n```\n\nYou can get your own Gemini API key from [here](https://aistudio.google.com/app/apikey).\n\n### Reconfiguration\n\nTo update the configuration at any time, use the `reconfigure` command within the application.\n\n## Developer Notes\n\n### Code Structure\n\n- **Color**: Contains ANSI escape codes for terminal colors.\n- **GeminiChatConfig**: Handles configuration, API initialization, and command processing.\n- **GeminiChat**: Main class to run the chat application.\n\n### Functions\n\n- **cursor_hide()**: Hides the terminal cursor.\n- **cursor_show()**: Shows the terminal cursor.\n- **remove_emojis(text)**: Removes emojis from text.\n- **run_subprocess(command)**: Executes a system command.\n- **generate_chat()**: Main loop to handle user input and generate AI responses.\n\n### Safety Settings\n\nThe application includes predefined safety settings to block harmful content categories:\n\n- Harassment\n- Hate Speech\n- Sexually Explicit\n- Dangerous Content\n\nThese settings can be adjusted in the `gemini_safety_settings` method.\n\n## Flowchart\n\n```mermaid\n---\nconfig:\n  layout: elk\n---\nstateDiagram\n  direction LR\n  state HandleSpecialCommand {\n    direction TB\n    [*] --\u003e CheckCommandType\n    CheckCommandType --\u003e ExitCommand:\"exit\"\n    CheckCommandType --\u003e ResetCommand:\"reset\"\n    CheckCommandType --\u003e ClearCommand:\"clear\"\n    CheckCommandType --\u003e HelpCommand:\"help\"\n    CheckCommandType --\u003e ReconfigureCommand:\"recon\"\n    CheckCommandType --\u003e SaveCommand:\"save\"\n    CheckCommandType --\u003e PrintCommand:\"print\"\n    CheckCommandType --\u003e ModelCommand:\"model\"\n    ExitCommand --\u003e [*]\n    ResetCommand --\u003e [*]\n    ClearCommand --\u003e [*]\n    HelpCommand --\u003e [*]\n    ReconfigureCommand --\u003e [*]\n    SaveCommand --\u003e [*]\n    PrintCommand --\u003e [*]\n    ModelCommand --\u003e [*]\n    ExitCommand\n    ResetCommand\n    ClearCommand\n    HelpCommand\n    ReconfigureCommand\n    SaveCommand\n    PrintCommand\n    ModelCommand\n[*]    CheckCommandType\n[*]  }\n  state ProcessUserInput {\n    direction TB\n    SendMessageToAI --\u003e DisplayResponse:Receive AI response\n    [*] --\u003e SendMessageToAI\n    SendMessageToAI --\u003e DisplayResponse\n    DisplayResponse --\u003e [*]\n    SendMessageToAI\n    DisplayResponse\n[*][*]  }\n  [*] --\u003e Initialization\n  Initialization --\u003e ConfigurationLoaded:Load configuration\n  ConfigurationLoaded --\u003e ChatInitialized:Initialize chat session\n  ChatInitialized --\u003e WaitingForInput:Wait for user input\n  WaitingForInput --\u003e HandleSpecialCommand:User enters special command\n  WaitingForInput --\u003e HandleSubprocessCommand:User enters subprocess command\n  WaitingForInput --\u003e ProcessUserInput:User enters regular input\n  HandleSpecialCommand --\u003e ExitCommand:Command is \"exit\"\n  HandleSpecialCommand --\u003e ResetCommand:Command is \"reset\"\n  HandleSpecialCommand --\u003e ClearCommand:Command is \"clear\"\n  HandleSpecialCommand --\u003e HelpCommand:Command is \"help\"\n  HandleSpecialCommand --\u003e ReconfigureCommand:Command is \"recon\"\n  HandleSpecialCommand --\u003e SaveCommand:Command is \"save\"\n  HandleSpecialCommand --\u003e PrintCommand:Command is \"print\"\n  HandleSpecialCommand --\u003e ModelCommand:Command is \"model\"\n  ExitCommand --\u003e [*]:Exit application\n  ResetCommand --\u003e ChatInitialized:Reset chat session\n  ClearCommand --\u003e WaitingForInput:Clear terminal screen\n  HelpCommand --\u003e WaitingForInput:Display help information\n  ReconfigureCommand --\u003e ConfigurationLoaded:Reconfigure settings\n  SaveCommand --\u003e WaitingForInput:Save chat history\n  PrintCommand --\u003e WaitingForInput:Print chat history\n  ModelCommand --\u003e ChatInitialized:Change AI model\n  HandleSubprocessCommand --\u003e WaitingForInput:Execute subprocess command\n  ProcessUserInput --\u003e SendMessageToAI:Send user input to AI\n  DisplayResponse --\u003e WaitingForInput:Display response and wait for next input\n```\n\n## Demo\n\n[![asciicast](https://asciinema.org/a/663984.svg)](https://asciinema.org/a/663984)\n\n\u003e note:\n\u003e You can incorporate Frea into your bash terminal by following [this step](docs/alias.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999azzar%2Ffrea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1999azzar%2Ffrea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999azzar%2Ffrea/lists"}