Skip to content

Commit b423e26

Browse files
committed
chore: 完善文档,更新依赖
1 parent f52c194 commit b423e26

File tree

6 files changed

+26
-9
lines changed

6 files changed

+26
-9
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ WechatEveryDay.memory-card.json
44
test.js
55
package-lock.json
66
yarn.lock
7-
7+
Chromium.app

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88

99
`简单``好用``2分钟(4 个步骤)` 就能玩起来了。🌸 如果对您有所帮助,请点个 Star ⭐️ 支持一下。
1010

11-
## 12.12 更新
11+
## 近期的改动
12+
13+
### 12.13 更新
14+
15+
不少人今天运行不了,参考这条 [issue](https://github.com/wangrongding/wechat-bot/issues/54#issuecomment-1347880291) ,暂时这样处理下,有好的方案大家可以提出来,谢谢~
16+
17+
### 12.12 更新
1218

1319
- `OpenAI Chatgpt` 因为一些原因,对接口访问添加了一系列的限制。具体可以看这里:[问题详情](https://github.com/transitive-bullshit/chatgpt-api#update-december-11-2022),所以我改用官方自己的了,目前机器人可用。
1420

RECORD.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,15 @@ OpenAI ChatGPT 模型使用了大量的语料数据进行预训练,并通过
1616

1717
总的来说,OpenAI ChatGPT 是一个非常强大的语言模型,可以用于实现多种 NLP 应用程序,以提高对话和聊天的自然语言处理能力。
1818

19-
## 什么是 Wechaty
19+
## 什么是 Wechaty
20+
21+
## 一些相关链接
22+
23+
- [OpenAI ChatGPT](https://openai.com/blog/chatting/)
24+
- [Wechaty](https://wechaty.js.org/)
25+
- [Wechaty Chatbot](https://wechaty.js.org/docs/examples/chatbot/)
26+
- [Wechaty Chatbot Tutorial](https://wechaty.js.org/docs/tutorials/chatbot-tutorial/)
27+
28+
- https://openai.com/blog/chatgpt/
29+
- https://download-chromium.appspot.com/?platform=Mac_Arm&type=snapshots
30+
- https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots/Mac_Arm/

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"author": "rongding",
1111
"license": "ISC",
1212
"dependencies": {
13-
"chatgpt": "^2.1.1",
13+
"chatgpt": "^2.3.0",
1414
"dotenv": "^16.0.3",
1515
"openai": "^3.1.0",
1616
"p-timeout": "^6.0.0",

src/openai/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function getOpenAiReply(prompt) {
1414
const response = await openai.createCompletion({
1515
model: 'text-davinci-003',
1616
prompt: prompt,
17-
temperature: 0.9,
17+
temperature: 0.9, // 每次返回的答案的相似度0-1(0:每次都一样,1:每次都不一样)
1818
max_tokens: 4000,
1919
top_p: 1,
2020
frequency_penalty: 0.0,

src/wechaty/sendMessage.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// import { getChatGPTReply } from '../chatgpt/index.js'
2-
import { getOpenAiReply } from '../openai/index.js'
1+
// import { getChatGPTReply as getReply } from '../chatgpt/index.js'
2+
import { getOpenAiReply as getReply } from '../openai/index.js'
33
import { botName, roomWhiteList, aliasWhiteList } from '../../config.js'
44

55
/**
@@ -26,12 +26,12 @@ export async function defaultMessage(msg, bot) {
2626
try {
2727
// 区分群聊和私聊
2828
if (isRoom && room) {
29-
await room.say(await getOpenAiReply(content.replace(`${botName}`, '')))
29+
await room.say(await getReply(content.replace(`${botName}`, '')))
3030
return
3131
}
3232
// 私人聊天,白名单内的直接发送
3333
if (isAlias && !room) {
34-
await contact.say(await getOpenAiReply(content))
34+
await contact.say(await getReply(content))
3535
}
3636
} catch (e) {
3737
console.error(e)

0 commit comments

Comments
 (0)