Skip to content

AI Text Converter: A versatile CLI tool for processing text using OpenAI's GPT model, featuring customizable prompts, user-friendly input, and seamless result handling.

YanniHu1996/ai-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Converter

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.

Table of Contents

Features

  • 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

Installation

  1. Install Go if you haven't already.

  2. Run go install

go install github.com/YanniHu1996/ai-converter

Usage

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.

Configuration

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.

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch with a descriptive name.
  3. Make your changes and commit them with clear and concise commit messages.
  4. Push your changes to your fork.
  5. 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.

License

AI-Converter is licensed under the MIT License. See LICENSE for more information.

About

AI Text Converter: A versatile CLI tool for processing text using OpenAI's GPT model, featuring customizable prompts, user-friendly input, and seamless result handling.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages