ptpt

command module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

README

PTPT - Prompt To Plain Text

English | 简体中文

Quality Gate Status

Introduction

PTPT is an command-line tool that allows you to easily convert plain text files using pre-defined prompts with the help of ChatGPT. With PTPT, you can effortlessly create and share prompt formats, making collaboration and customization a breeze. Plus, by subscribing, you gain access to even more prompts to enhance your experience. If you're interested in prompt engineering, you can use PTPT to develop and share your prompts.

Features

If you don't have access to GPT-4 yet, you can try AIProxy.

  • Let ChatGPT handle plain text files for you!
  • Predefined prompts (currently with 18 prompts, contributions welcome!)
  • Convenient sharing and extension of prompts format
  • 🌟Get more prompts by subscribing
  • 🌟Develop and manage your prompts
  • Use via proxy
  • 🌟Lint your code with ChatGPT!
  • 🌟Chat with ChatGPT in your terminal!

List of Prompts currently supported:

  • 🧸Role-playing (for entertainment only) - role_play
  • 🧸Greeting (for entertainment only) - hello
  • 📝Translate Markdown - translate
  • 📝Translate csv to csv - translate
  • 📝Translate csv to GNU po (WIP)
  • 💻Code review - code_review
  • 💻Convert json to go struct - json_converter
  • 📝Generate prompt documentation - prompt_doc
  • 💻Generate gorm struct - sql
  • 💻Generate regular expression - regex
  • 💻Generate summarize and SEO keywords

Installation

go install github.com/leslieleung/ptpt@latest

Or download from Release

ChatGPT Lint
> ptpt lint <file-or-path>

As of v0.1.5 , you can use the diff feature to lint the changes in the git repository. This feature relies on git, make sure git is usable.

> ptpt lint -d # default to HEAD
> ptpt lint -d <other git diff params>
Generate Commit Message
# You still have to add files to stage manually
> git add .
# Let ptpt do the magic
> ptpt commit
Chat With ChatGPT
> ptpt chat

Usage

For first-time use, please configure api_key and proxy_url (optional) according to the wizard.

Set Temperature

Set the temperature of ChatGPT. The default value is 0.7.

> ptpt run lint <file> -t 0.8
Subscribe Prompts
> ptpt prompt subscribe https://raw.githubusercontent.com/LeslieLeung/pt-collection/main/awesome-chatgpt-prompts/awesome-chatgpt-prompts.yaml

This subscribes to all prompts from f/awesome-chatgpt-prompts.

More subscriptions will be updated in the future. Please follow pt-collection, which will automatically update upstream prompts every day at UTC 0.

Interactive

Several useful prompts have already been pre-installed, with more to come in future updates. Additional prompts can also be obtained through subscribing.

> ptpt run

CLI
ptpt run [prompt] [inFile] [outFile]

# Redirect
> ptpt run translate-markdown Hello.md > Hello_tranlsated.md
# Or write to file
> ptpt run translate-markdown Hello.md Hello_tranlsated.md
Create your own prompt
Interactively
> ptpt prompt create

The generated prompt yaml would be saved to ptpt/prompt directory.

Syntax
version: v0 # version of prompt yaml, currently v0
prompts: # your defined prompt
  - name: role-yoda # prompt name
    description: "Role Play as Yoda" # prompt description
    system: You are Yoda master from Star Wars, speak in his tongue you must. # system 指令
  - name: role-spock
    description: "Role Play as Spock"
    system: You are Spock from Star Trek, you must speak in his tongue.

By downloading and saving shared prompts to the ptpt/prompt directory, more prompts can be used.

Generating Prompt Documents
> ptpt run prompt-doc prompt.yaml > prompt.md

Configuration File

The default configuration file directory for ptpt is as follows, and is currently not customizable.

Windows: %APPDATA%\ptpt
macOS: $HOME/Library/Application Support/ptpt
Linux: $HOME/.config/ptpt

Roadmap

  • Support proxy configuration
  • Optimize user experience
  • Support ChatGPT parameter configuration
  • PromptHub - Share prompts through yaml files
  • Support more prompts
  • Support extra long texts

Credits

This project is inspired by sigoden/aichat. The original project was written in Rust, but due to my limited abilities, I wanted to create my own version using my familiar technology stack.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
cli
internal
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL