CLAI is an Command Line Interface (CLI) application that integrates text and voice commands with AI-powered responses. It uses the Not Diamond API for generating responses and incorporates voice transcription capabilities.
- Text-based command input
- Voice command recording and transcription
- AI powered response generation using Not Diamond API
- Bash script generation and execution
- Voice-to-text transcription using Whisper
- User-friendly CLI interface using Ink and Ink UI components
Before you begin, ensure you have the following requirements:
- Node.js
- npm
- FFmpeg
-
Clone the repository:
git clone https://github.com/ayushh2k/clai.git cd clai
-
Install the dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add your Not Diamond API key:NOTDIAMOND_API_KEY=your_api_key_here
You can get the Not Diamond API key from here, add the API keys of the LLM models of your choice by reffering to the notdiamond page Eg .
GOOGLE_API_KEY=your_key
-
Download whisper model of choice
npx whisper-node download
-
Configure the LLM models you want to use in
source/components/common/NotDiamondRequest.tsx
Make sure you have make
and g++
compiler installed.
To start the CLAI application, run:
npm run build
node --no-warnings dist/cli.js
You can create an alias for node --no-warnings dist/cli.js
named clai
- Choose the "Text Command" option from the main menu.
- Type your query and press Enter.
- The AI will generate a response or a bash script based on your input.
- If a bash script is generated, you'll be prompted to review and execute it.
- Choose the "Voice Command" option from the main menu.
- Speak your query clearly and stop the recording.
- The application will transcribe your speech and process it as a text command.
@inkjs/ui
: UI components for the CLI interfaceink
: React for CLI applicationsnode-mic
: Audio recordingwhisper-node
: Speech-to-text transcriptionnotdiamond
: AI response generationdotenv
: Environment variable management
You can configure various aspects of the application by modifying the following files:
source/components/voice/VoiceRecorder.tsx
: Adjust recording duration, audio settingssource/components/common/NotDiamondRequest.tsx
: Modify AI prompt, dangerous patterns detection and the llm models used
- If you encounter issues with voice recording, ensure that your system's microphone is properly configured and that you have the necessary permissions.
- For transcription errors, check that FFmpeg is correctly installed and accessible from the command line.
- If you receive API errors, verify that your Not Diamond API key is correctly set in the
.env
file. - If you encounter issues with microphone or while transcripting, you can refer to the pages of node-mic and whisper-node.
Contributions to CLAI are welcome. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE
file for details.
If you have any questions or feedback, please open an issue in the GitHub repository.