也写了一个 OpenAI ChatBot —— Bot 酱,基于微信测试号+客服消息

213 天前
 easychen

特色:

  1. 基于微信测试号,不容易被封,可以邀请 100 人使用,适合小团队使用(当然理论上你也可以用来对接公众号)
  2. 基于客服消息,不受 5 秒超时限制
  3. 支持用户通过命令设置 API KEY 、URL
  4. 支持设置触发词

详细说明和代码请移步 GitHub:https://github.com/easychen/botchan 欢迎 Star ⭐️

3522 次点击
所在节点    分享创造
37 条回复
babaohuang
213 天前
请问如何设置模型名称?
easychen
213 天前
@babaohuang 现在只能用 3.5 ,稍后我加个环境变量吧。
Alexsen
213 天前
刚在微博看到,正在配置,已 Star
Armor
213 天前
海外服务器 nginx 代理了官方的 api 接口,可以直接使用吗?试了下没反应
babaohuang
213 天前
@easychen 好的,谢谢大佬!
easychen
213 天前
@babaohuang 加上了,通过 DEFAULT_MODEL 指定,通过 setModel 命令设置,通过 LOCK_MODEL 锁定命令。

https://github.com/easychen/botchan#%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AE
sunnyguyu91
213 天前
不支持 arm 架构啊,难受了
anubu
213 天前
是否支持 Azure 的 OpenAI 服务接口?简单部署了一下,对接 Azure 的接口不成功。

Web server started on port 9000
remove cache
ai ret {
error: {
code: 'DeploymentNotFound',
message: 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'
}
}
Unhandled Rejection at: Promise {
<rejected> SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at llmReply (file:///app/index.js:349:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
} reason: SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at llmReply (file:///app/index.js:349:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
babaohuang
213 天前
@easychen 👍👍感谢!
easychen
213 天前
@sunnyguyu91 linux/amd64,linux/arm64,linux/arm/v7 都支持了。其他架构自己拉 dockerfile 编译一下就行。
easychen
213 天前
@anubu 应该是之前的默认 deployment 没有对应上。我更新了一下,你拉取最新镜像试试。

模型和 deployment 映射如下:

```
{
'gpt-3.5-turbo':'gpt-35-turbo',
'gpt-3.5-turbo-0301':'gpt-35-turbo-0301',
'gpt-3.5-turbo-0613':'gpt-35-turbo-0613',
'gpt-3.5-16k':'gpt-35-16k',
'gpt-3.5-16k-0613':'gpt-35-16k-0613',
'gpt-4':'gpt-4',
'text-embedding-ada-002':'text-embedding-ada-002',
}
```
babaohuang
213 天前
大佬,还有一些问题,就是这个可以支持连续对话吗?还有,支持自定义 system content 吗?
easychen
213 天前
@babaohuang

① 不支持连续对话,本来打算支持引用,但测试号里边引用不了,所以没做。
② 支持 system message ,文档里边有写
Armor
213 天前
大佬可以看下我的问题吗?
Darin726
213 天前
@Armor #4 我也是没反应,db.json 没有生成
easychen
213 天前
@Armor 只要和 openai 兼容的接口都能用,不能用可能是你配置填错了,可以在本地搭建下,用同样的参数,自己查一下报错信息。
easychen
213 天前
@Darin726

① 默认触发词是 方糖,不带触发词没有响应
② docker 需要对当前目录有写权限,或者你把 /data 挂接到其他地方去。
Armor
213 天前
@easychen #16 就在本地搭建的,我看映射了本机 data 目录是一个空的文件夹,是不是目录权限的问题
easychen
213 天前
@Armor 开了台腾讯云主机实测,没有发现问题。请仔细阅读文档进行配置,核对参数和限制。

另外可以查看 docker 日志,以确定问题。至于如何查看 docker 日志,可以问 GPT 。

Armor
213 天前
@easychen #19
```
2023-10-09 21:51:40 Web server started on port 9000
2023-10-09 22:01:56 remove cache
2023-10-09 22:02:01 ai ret {
2023-10-09 22:02:01 id: 'chatcmpl-xxxxxxxxxxxx',
2023-10-09 22:02:01 object: 'chat.completion',
2023-10-09 22:02:01 created: 1696860117,
2023-10-09 22:02:01 model: 'gpt-3.5-turbo-0613',
2023-10-09 22:02:01 choices: [ { index: 0, message: [Object], finish_reason: 'stop' } ],
2023-10-09 22:02:01 usage: { prompt_tokens: 9, completion_tokens: 18, total_tokens: 27 }
2023-10-09 22:02:01 }
2023-10-09 22:02:01 remove cache
2023-10-09 22:02:01 get access token failed
```

docker 看 log

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/980246

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX