From 5d20cd6db4e6a8acba3e40cf849847f1e6cbc607 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 9 Dec 2022 15:53:57 +0900 Subject: [PATCH] add some readme --- .gitignore | 1 - README.md | 48 +++++++++++++++++++++++++++++++++++++++++------ local/.gitkeep | 0 openai/chatgpt.go | 2 +- 4 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 local/.gitkeep diff --git a/.gitignore b/.gitignore index 6819f6f..b0be41e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .idea local/config.yaml token.json -local \ No newline at end of file diff --git a/README.md b/README.md index b5d5de6..7e4943f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,52 @@ -# how to use - -## prepare runtime environment +Version + + License: MIT + + + Twitter: xiaomoinfo + +# 准备运行环境 ``` go mod tidy cp config/config.yaml.example local/config.yaml ``` -## add your openai token -open the [openai](https://beta.openai.com/account/api-keys) and register account, copy your token to config file +## 修改你的token +打开 [openai](https://beta.openai.com/account/api-keys) 并注册一个账号, 生成一个token并把token放到 -## run app +## 运行App ``` go run main.go ``` + +``` +ain.go #gosetup +go: downloading github.com/eatmoreapple/openwechat v1.2.1 +go: downloading github.com/sirupsen/logrus v1.6.0 +go: downloading github.com/spf13/afero v1.9.2 +go: downloading github.com/pelletier/go-toml/v2 v2.0.5 +go: downloading golang.org/x/sys v0.0.0-20220908164124-27713097b956 +/private/var/folders/8t/0nvj_2kn4dl517vhbc4rmb9h0000gn/T/GoLand/___go_build_main_go +访问下面网址扫描二维码登录 +https://login.weixin.qq.com/qrcode/QedkOe1I4w== +``` + +会自动打开默认浏览器,如果没有打开也可以打动点击上面的链接打开二维码扫微信 + +``` +2022/12/09 15:15:00 登录成功 +2022/12/09 15:15:01 RetCode:0 Selector:2 +2022/12/09 15:15:04 RetCode:0 Selector:2 +INFO[0099] 0 +INFO[0099] 1 +INFO[0099] 2 +INFO[0099] 3 +``` +登陆成功后会拉取微信的好友和群组 + +## 如何使用 +默认为`chatgpt`,如果想设置其他的触发方式可以修改`local/config.yaml`的keyword。此时在`微信同步助手中`发送消息后,`chatgpt`就会回复你 + + + diff --git a/local/.gitkeep b/local/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/openai/chatgpt.go b/openai/chatgpt.go index 9cf4a9a..efbbcb2 100644 --- a/openai/chatgpt.go +++ b/openai/chatgpt.go @@ -58,7 +58,7 @@ func Completions(msg string, token string) (*string, error) { Model: "text-davinci-003", Prompt: msg, MaxTokens: 4000, - Temperature: 1, + Temperature: 0.7, TopP: 1, FrequencyPenalty: 0, PresencePenalty: 0,