ai-code-writer
v3.1.0
Published
An AI code writer application using OpenAI APIs for audio transcription and chat completion.
Downloads
4
Maintainers
Readme
AI Code Writer
Description
An AI code writer application using OpenAI APIs for audio transcription and chat completion.
Important Notice
When running this application, the files and directories in the current working directory will be sent to OpenAI for processing. See more in the filters section to know which files are involved.
Filters
The application uses the following filters for file collection and monitoring, which can be configured via environment variables:
- Include Patterns:
INCLUDE_PATTERNS
(default:*.ts,*.json,*.yml,*.yaml,*.md,*.js,.env.dist
) - Exclude Directories:
EXCLUDE_DIRS
(default:node_modules,build,dist,.git
) - Exclude Files:
EXCLUDE_FILES
(default:package-lock.json,.*
)
Optional Environment Variables
In addition to the mandatory OPENAI_API_KEY
, the application supports several optional environment variables:
- OPENAI_API_ORG: Your OpenAI organization ID (if applicable).
- OPENAI_AUDIO_TEMPERATURE: The temperature setting for audio transformations (default:
0.1
). - OPENAI_CHAT_TEMPERATURE: The temperature setting for chat completions (default:
0.75
). - INCLUDE_PATTERNS: Patterns for files to include in processing (
default:
*.ts,*.json,*.yml,*.yaml,*.md,*.js,.env.dist
). - EXCLUDE_DIRS: Directories to exclude from processing (default:
node_modules,build,dist,.git
). - EXCLUDE_FILES: Files to exclude from processing (default:
package-lock.json,.?*
). - DEBUG_TO_FILE: If set to
true
, logs the conversation to a file (default:false
). - OPENAI_CHAT_MODEL: The model to be used for chat completions (default:
gpt-4o-2024-08-06
). - MAX_TOKENS: Limitation of output tokens (default:
16383
). - MAGIC_WORD: Word to wakeup from suspend mode (default:
computer
).
Prerequisites
- SOX (Sound eXchange): This application requires SOX for audio recording. Install SOX via your package manager:
- macOS:
brew install sox
- Windows: Download the installer from the official website
- Linux: Use your distribution's package manager, e.g.,
apt-get install sox
- macOS:
Usage
npx ai-code-writer
User Guide
Starting the Application:
- Ensure that the environment variable
OPENAI_API_KEY
is set. - Optionally, set the filter environment variables as described in the "Optional Environment Variables" section.
- Start the application with the command
npx ai-code-writer
.
- Ensure that the environment variable
Interaction:
- After starting the application, a welcome message will be played: "The AI Code Writer is ready."
- Speak your input into the microphone. The application will record your speech and convert it to text.
- You can control microphone suspending, input pause or exiting the programm just by telling it the AI.
Conversation:
- The transcribed input will be sent to the OpenAI API to get a response.
- The AI's response will be read out loud and displayed on the console.
- If the response contains file tasks (e.g., create, move, delete files), these will be executed automatically.
File Monitoring:
- Changes to the monitored files will be detected and recorded in the conversation history.
- These changes can influence the AI's responses.
Ending the Application:
- The application runs in an infinite loop waiting for user input.
- To end the application, use the usual methods to stop a Node.js process (e.g.,
Ctrl+C
in the console).
License
MIT - LICENSE
Author
Endre Bock