chat_gpt_ppt

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

chat-gpt-ppt

Use ChatGPT to generate PPT automatically, all in one single file.

Showcase

  1. Some topics for presentation named topic.txt:
what's OpenAI?
how OpenAI works?
what is the future of OpenAI?
  1. Save your openai token to token.txt.
  2. Generate a ppt in seconds:
./cgp

And you get one:

With multi languages support:

Or different render engine:

Usage

You can download prebuild binaries from release page.

  1. Download a executable binary
  2. Add your topics to topic.txt
  3. Add your token (official openai api key, with no extra white space, no empty line) to token.txt
  4. run ./cgp

Everything done. You can get some help about command line arguments with cgp --help.

$ ./cgp_macos --help
Usage of ./cgp_macos:
  -client string
        gpt client type (default "GPT35")
  -output string
        out path (default "./output.html")
  -renderer string
        renderer type (default "REMARK")
  -rendererBin string
        binary file for renderer
  -token string
        token file path (default "./token.txt")
  -topic string
        topic file path (default "./topic.txt")

Interactive mode

-i flag allows you checking and correcting generated contents one by one.

@williamfzc ➜ /workspaces/chat-gpt-ppt (main) $ ./cgp -i
start preparing ...
start generating ...
2023/03/18 08:17:23 topic what's OpenAI? done 
Here is your response, type any key to continue, type 'n' to edit 
# what's OpenAI?



- OpenAI is an artificial intelligence research lab.
- It was founded by a group of well-known tech industry figures in 2015 as a non-profit organization.
- OpenAI's mission is to ensure that AGI (Artificial General Intelligence) benefits all of humanity.
- Their research covers many areas of AI, such as reinforcement learning, natural language processing, computer vision, and robotics.
- OpenAI also develops and releases several powerful AI-based tools, including GPT-3, which has revolutionized natural language processing.

>>>  

Contribution

Thanks for your interest. This project is really simple to hack.

This project consists of two pluggable parts:

  • Client: Send topics to GPT and get their responses
  • Renderer: Build slides from these pairs

If you want to make some changes:

  • git clone
  • change code
  • run make to build a binary file (Go installation required)
  • check
  • push to repo and send a PR

Feel free to send us PR/issues.

Changelog

[2023-03-02] Rewrite with golang. All in one file.

[2023-01-13] https://github.com/williamfzc/chat-gpt-ppt/issues/2 OpenAI's services are not available in my country.

[2022-12-06] Currently, ChatGPT has no official API. I am waiting for it to make this repo a real production.

License

MIT

Documentation

Index

Constants

View Source
const (
	RendererMarp   = "MARP"
	RendererRemark = "REMARK"
)
View Source
const (
	ClientGpt35 = "GPT35"
)
View Source
const RemarkTemplate = `` /* 833-byte string literal not displayed */

Variables

This section is empty.

Functions

func GenAndRenderString added in v0.4.2

func GenAndRenderString(shellContext *ishell.Context, config ApiConfig) (string, error)

Types

type ApiConfig added in v0.4.2

type ApiConfig struct {
	Token        string       `json:"token"`
	Topics       []string     `json:"topics"`
	OutputFile   string       `json:"outputFile"`
	RendererType RendererType `json:"rendererType"`
	RendererBin  string       `json:"rendererBin"`
	ClientType   ClientType   `json:"clientType"`
	Interactive  bool         `json:"interactive"`
}

type ChatGPTClient added in v0.4.1

type ChatGPTClient struct {
	// contains filtered or unexported fields
}

func (*ChatGPTClient) FillTopic added in v0.4.1

func (c *ChatGPTClient) FillTopic(topic string) (*Topic, error)

func (*ChatGPTClient) Prepare added in v0.5.0

func (c *ChatGPTClient) Prepare(topics []string) error

func (*ChatGPTClient) SetToken added in v0.4.1

func (c *ChatGPTClient) SetToken(token string)

type Client

type Client interface {
	SetToken(token string)
	Prepare(topics []string) error
	FillTopic(topic string) (*Topic, error)
}

func GetClient added in v0.4.1

func GetClient(clientType ClientType) Client

func NewGpt35Client added in v0.4.1

func NewGpt35Client() Client

type ClientType added in v0.4.1

type ClientType = string

type MarpRenderer

type MarpRenderer struct {
	BinPath string
	Topics  []*Topic
}

func (*MarpRenderer) AddTopic

func (m *MarpRenderer) AddTopic(topic *Topic)

func (*MarpRenderer) RenderFile

func (m *MarpRenderer) RenderFile(outputPath string) error

func (*MarpRenderer) RenderString added in v0.4.2

func (m *MarpRenderer) RenderString() (string, error)

func (*MarpRenderer) SetBinPath added in v0.3.3

func (m *MarpRenderer) SetBinPath(path string)

type RemarkRenderer added in v0.4.0

type RemarkRenderer struct {
	Topics []*Topic
}

func (*RemarkRenderer) AddTopic added in v0.4.0

func (r *RemarkRenderer) AddTopic(topic *Topic)

func (*RemarkRenderer) RenderFile added in v0.4.0

func (r *RemarkRenderer) RenderFile(outputPath string) error

func (*RemarkRenderer) RenderString added in v0.4.2

func (r *RemarkRenderer) RenderString() (string, error)

func (*RemarkRenderer) SetBinPath added in v0.4.0

func (r *RemarkRenderer) SetBinPath(_ string)

type Renderer

type Renderer interface {
	AddTopic(*Topic)
	RenderString() (string, error)
	RenderFile(outputPath string) error
	SetBinPath(path string)
}

func GetRenderer added in v0.4.1

func GetRenderer(rendererType RendererType) Renderer

func NewMarpRenderer

func NewMarpRenderer() Renderer

func NewRemarkRenderer added in v0.4.0

func NewRemarkRenderer() Renderer

type RendererType added in v0.4.1

type RendererType = string

type Topic

type Topic struct {
	Title   string
	Content string
}

func (*Topic) ToMarkdown

func (t *Topic) ToMarkdown() string

Directories

Path Synopsis
cmd
cgp command

Jump to

Keyboard shortcuts

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