AI-Converter is a command-line utility that allows users to interact with OpenAI's GPT-3.5 Turbo model, generate text based on custom prompts, and save the generated results to a file and clipboard. Users can define and execute multiple custom commands based on pre-defined prompts.
- Interactive command-line interface
- Customizable commands with pre-defined prompts
- Input text using a Vim-like editor
- Automatically saves results to a file
- Copies results to the system clipboard
-
Install Go if you haven't already.
-
Run
go install
go install github.com/YanniHu1996/ai-converter
At first, please prepare your OpenAI key and set it as an environment variable OPENAI_API_KEY
.
export OPENAI_API_KEY=<you_openai_key>
To use AI-Converter, simply run the following command in your terminal:
ai-converter [command]
Replace [command]
with the name of the custom command you want to execute. The utility will prompt you to enter text, which it will send to the OpenAI API. The generated response will be saved to a file and copied to your clipboard.
To create custom commands, edit the commands.json
file in the ~/.ai-converter/
directory. Here's an example configuration:
[
{
"id": 1,
"name": "improver",
"prompt": "Correct and improve the following text"
},
{
"id": 2,
"name": "summarizer",
"prompt": "Summarize the following text"
}
]
Each command object should have an id
, name
, and prompt
. The name
is used to execute the command, while the prompt
is sent to the OpenAI API as part of the input.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch with a descriptive name.
- Make your changes and commit them with clear and concise commit messages.
- Push your changes to your fork.
- Open a pull request, describing the changes you made and their purpose.
Please ensure your code follows the project's style guidelines and passes all tests.
AI-Converter is licensed under the MIT License. See LICENSE
for more information.