Git Product home page Git Product logo

chatgpt-wechat's Introduction

chatgpt-wechat

可在微信 安全使用(通过企业微信中转到微信,无封号风险) 的 ChatGPT 个人助手应用,

本项目开源免费,不开知识星球,没有付费环节,除了最后给我自己的公众号【积木成楼】打了广告, 未在 GitHub 以外的地方进行引流操作。请谨记,要求你付费的都是骗子!

升级指引(v1.0.0 目前还处开发期,稳定版本使用 v0.6.6)

  • 原始功能基本不受影响,但数据库切换到 pgsql 方便 向量化查询
  • 支持了 Google 的 Gemini-pro 每个 token 60/m 的调用还是很香
  • 支持了 web bot 设置,同时支持将 bot 发布到客服
  • web 项目地址 https://github.com/whyiyhw/agent-web 前端苦手,全靠 GPT4 配合写的页面
  • 支持了最新的企业微信客服协议
  • 企业微信api支持自定义域名
  • 项目小助手,有问题可以先问它哦 ➡️➡️➡️ img.png

主要能力(点击查看详情

  • 微信可用:基于企业微信中转,可在微信中安全使用
  • 客服消息:支持多渠道客服消息接入
  • 代理支持: http/sock5 代理 && 反向域名代理支持, 除了 openai 也兼容了 azure-openai
  • 会话:
    • 场景模式:支持动态修改 prompt,预定义了上百种 prompt 角色模板
    • 连续对话:自适应的上下文设计,让 LLM 🧠拥有更长时间的短期记忆,避免手动清理上下文
    • 会话切换:多会话支持,可切换聊天场景,不丢失对话内容,可导出会话
    • 极速响应:支持基于流式接口的分段消息响应
  • 消息:
    • 语音消息:支持多国语音消息,以及多语言文本输入
    • 图片消息:支持图片消息(答题场景)
  • 绘画:
    • 支持stable diffusion 1.5作图
    • 支持 openai 作图
  • 私有数据:milvus 私有化向量知识库支持
  • 插件机制:支持插件,点击查看
    • 目前已支持 shellsearchwikipedia
    • 各位也可按照规则自行开发接入其他能力(summary, 天气 ...)

完整安装步骤(点击查看详情

配置项详解(点击查看详情

进阶玩法

项目架构设计(点击查看)

system.png

版本更新日志 点击查看详情

已实现 - [x] 支持 gpt-4o ,支持 one-api 的自定义的模型名称 2024-05-14 - [x] 单服务-多应用支持 2023-03-05 - [x] 新增代理设置 2023-03-05 - [x] 支持最新的 gpt3.5 与模型可自行切换 - [x] 支持 prompt 自定义配置 - [x] 命令式动态调整对话参数 - [x] 系统设置&预定义模板 2023-03-17 - [x] 支持服务端直接对接企业微信,无需云函数中转 2023-03-18 - [x] 支持多渠道客服消息 2023-04-02 - [x] 支持中英文语音输入 2023-04-07 - [x] 支持分段极速响应 2023-04-08 - [x] 支持向量引擎查询,基于语料的上下文与智能推荐 2023-04-08 - [x] 独立的上下文环境,可任意切换聊天场景 2023-04-09 - [x] 自适应的上下文长度,不用再频繁手动清理上下文环境 2023-04-09 - [x] 基础插件功能 2023-04-15 - [x] 支持 stable diffusion 1.5作图 [服务配置](https://help.aliyun.com/practice_detail/611227) 2023-04-25 - [x] 加入搜索插件 2023-04-27 - [x] 支持 openai key 余额查询 2023-05-15 - [x] 支持 openai 作图 2023-05-27

feature 版本,考虑与执行中
  • 消息超长时如何处理?
  • 自适应上下文,需要加入省流模式
  • 作图支持 midjourney api
  • web 管理端
  • web 客户端&用户体系改版
  • 功能演示视频
  • 可选
    • 阿里云 5000 小时免费额度白嫖计划
    • 同声转译 so-vits-svc 支持
    • 支持 openapi 对话 token 累计功能, 余额不足时,支持 token 更换(可选)
    • 支持私有化知识库插件(可选)
    • 支持特定角色对话-如雅思口语练习(可选)
    • 支持web管理页面,配置入库方便修改(可选)
    • 支持 多 key 轮询,应对 openai 的限流机制(可选)
    • 长期记忆插件(规划中)
  • 十分期待您的需求,可以提issue...

FQA

配置完成,发送给 openai 的消息有响应,但是应用没有收到回复?

  • 请确认 5. 配置企业可信IP ,已配置
  • 如果还是没有响应,请通过 docker logs -f chat_web_1 进行查看,
    • 应用消息的 关键字为 应用消息-发送失败 err:
    • 客服消息的 关键字为 客服消息-发送失败 err:
  • 如果存在 Code 41001, Msg: "access token mising ... 等 access_token 异常的,请再次确认 安装流程中的对应参数CorpID ,agentSercret ,agentID 是否正确配置

服务器在国内,出现 connect: connection refused

  • 方法一 : 请自行 安装 proxy client 然后开启 监听 0.0.0.0:socket 模式 ,不要开启认证,之后在配置文件中,开启配置就OK,详情请见 v0.2.2
  • 方法二 : 把服务器移到 香港/海外 , 大陆地区将长期不能访问

修改 chat-api.yaml 配置后如何让其生效

  • 你可以通过 docker-compose restart web 重启 web 服务
  • 或者 docker-compose build && docker-compose up -d 重启整个服务

如何修改 redis 密码?

  • 首先修改 chat/service/chat/api/etc/chat-api.yaml
RedisCache:
    Pass: "xxxxxx"
  • 再修改 chat/build/redis/redis.conf
requirepass "xxxxx"
  • 最后 docker-compose down && docker-compose up -d 重启整个服务

更新后 redis 服务启动失败或者连不上redis?

请考虑删除 chat/build/redis/data/ 下的文件,可能是因为旧版本的 redis 存在残留文件导致的

  • 请先 docker-compose down 停止服务
  • 然后 删除redis 本地文件 chat/build/redis/data/ 下的文件
  • 最后 docker-compose up -d 重启服务

感谢以下朋友对于本项目的大力支持~

supprt01 supprt02 supprt03 supprt04

chatgpt-wechat's People

Contributors

hyzaw avatar laalaguer avatar markyfsun avatar whyiyhw avatar zchking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgpt-wechat's Issues

大佬,请教下如何避免以下报错

系统错误:error, This model's maximum context length is 4097 tokens. However, you requested 4140 tokens (2140 in the messages, 2000 in the completion). Please reduce the length of the messages or completion.

上下文需要怎么处理?

上下文需要怎么处理?
系统错误:error, This model's maximum context length is 4097 tokens. However, you requested 4459 tokens (2459 in the messages, 2000 in the completion). Please reduce the length of the messages or completion.

AI要经过二三十秒才会回答,这个速度正常么?

想了解下从问问题到AI回答这个时间多长是正常的,我试了阿里的香港VPS和甲骨文的美国VPS,从我提问到AI回答,这中间都要经过二三十秒的时间,这个时间正常么?或是有什么方法可以缩短这个时间?

微信客服api没有返回消息

incoming message: RxMessage { FromUserID: "", SendTime: 1680690201000000000, MsgType: "event", MsgID: 0, AgentID: 0, Event: "kf_msg_or_event", ChangeType: "", EventKey: "xxxxxxxxxxxx" }
客服消息 -------------------------------------
客服消息 Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx OpenKfID: xxxxxxxxxxxxxxxxxxxx
客服消息 获取body err: WorkwxClientError { Code: 41001, Msg: "access_token missing, hint: [1680690201303762058262870], from ip: xx.xx.xx.xx, more info at https://open.work.weixin.qq.com/devtool/query?e=41001" }

可以直接修改docker中的配置吗

我想修改chat-api.yaml配置中,OPENAI部份的host配置,换成一个新的反代。请问需要重新build吗,或是可以修改哪个docker中的文件?

请问要如何清除前面的上下文,开启一个新的对话?

想知道使用客服功能如何清除前面的上下文,开启一个新的对话,我给机器人发错了一个东西,看提示是回答超出了4K的限制,然后就没法用了,一直报错,看了DOCKER日志,发现是后面的对话会把前面的问题也带进去,导致那个会出错的问题也一直被提交。

发送消息后返回:系统错误

系统错误:error, You exceeded your current quota, please check your plan and billing details.
到网站上看了下还是可以正常对话的,通过应用就不行了,请问这个是啥情况呀

多应用时CorpSecret不是必填项

多应用场景下,所有应用的AgentID都被写入了MultipleApplication下,此时CorpSecret可以不填。

另外,CorpSecretAgentSecret容易混淆,建议把CorpSecret变量名改成DefaultAgentSecret之类。

企业微信Openapi回调失败是什么原因呢

返回
{"code":404,"msg":"请求资源不存在","data":{}}

日志
{"@timestamp":"2023-04-04T15:44:12.794+08:00","caller":"accesslog/accesslog.go:28","content":"","level":"info","request":{"url":"/","method":"GET","query":"echostr=0kxsfwgukCLx0uMLB1Aw8MMtRX%2BFHYoSD9pYtF7uNiJlTh5TA0sYs7R2B2CcCVBHcgTl6%2Bup%2Brch3vrz2Br2hw%3D%3D\u0026msg_signature=fdc1308eb78f94ae5e9da5f1026c9c50b291f6d8\u0026nonce=1679821968\u0026timestamp=1680594252","body":"","header":{"Accept":["/"],"Cache-Control":["no-cache"],"Pragma":["no-cache"],"User-Agent":["Mozilla/4.0"]},"const":-1},"span":"e899a2cc31ff24de","trace":"31090e22c3e4176a40f302cadb01742b"}
{"@timestamp":"2023-04-04T15:44:12.794+08:00","caller":"response/response.go:42","content":"【API-ERR】 : ErrCode:404,ErrMsg:请求资源不存在\n接口不存在\nmain.(*NotFoundHandler).ServeHTTP\n\t/build/service/chat/api/chat.go:75\ngithub.com/zeromicro/go-zero/rest/handler.LogHandler.func1\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/handler/loghandler.go:47\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/zeromicro/go-zero/rest/handler.TraceHandler.func1.1\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/handler/tracehandler.go:64\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/zeromicro/go-zero/rest.(*engine).notFoundHandler.func1\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/engine.go:221\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/zeromicro/go-zero/rest/router.(*patRouter).handleNotFound\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/router/patrouter.go:95\ngithub.com/zeromicro/go-zero/rest/router.(*patRouter).ServeHTTP\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/router/patrouter.go:73\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2947\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1991\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1594 ","level":"error","span":"e899a2cc31ff24de","trace":"31090e22c3e4176a40f302cadb01742b"}
{"@timestamp":"2023-04-04T15:44:12.794+08:00","caller":"response/response.go:63","content":"","level":"info","response":{"code":404,"msg":"请求资源不存在","data":{}},"span":"e899a2cc31ff24de","trace":"31090e22c3e4176a40f302cadb01742b"}
{"@timestamp":"2023-04-04T15:44:12.794+08:00","caller":"handler/loghandler.go:160","content":"[HTTP] 200 - GET /?msg_signature=fdc1308eb78f94ae5e9da5f1026c9c50b291f6d8\u0026timestamp=1680594252\u0026nonce=1679821968\u0026echostr=0kxsfwgukCLx0uMLB1Aw8MMtRX%2BFHYoSD9pYtF7uNiJlTh5TA0sYs7R2B2CcCVBHcgTl6%2Bup%2Brch3vrz2Br2hw%3D%3D - 175.27.32.31:26172 - Mozilla/4.0","duration":"0.2ms","level":"info","span":"e899a2cc31ff24de","trace":"31090e22c3e4176a40f302cadb01742b"}

系统错误

系统错误,请清理后重试: type:invalid_request_error code:invalid_api_key

想咨询一下微信客服功能的使用

感谢作者,已经能跑通基本的企业微信内容应用和chatgpt的对接
但是仔细翻看了本项目的说明文档后,还是不清楚”(视频号/公众号/小程序/微信/企微/app/web)支持多渠道客服消息接入”
的具体配置流程
希望能简单说明一下操作步骤?
微信客服也有api,创建的客服也有对应的配置,项目这侧看到
image
不太清楚每个地方具体怎么对接

在执行调用注册api的时候报错

curl: (7) Failed to connect to localhost port 8888: Connection refused

用的云函数那条路子,查了一下也没占用8888,chat-web-1容器无法启动,日志显示
Starting server at 0.0.0.0:8887...
{"@timestamp":"2023-04-13T03:52:00.347+08:00","caller":"rest/server.go:304","content":"listen tcp 0.0.0.0:8887: bind: address already in use","level":"error"}
panic: listen tcp 0.0.0.0:8887: bind: address already in use

goroutine 1 [running]:
github.com/zeromicro/go-zero/rest.handleError(...)
/go/pkg/mod/github.com/zeromicro/[email protected]/rest/server.go:305
github.com/zeromicro/go-zero/rest.(*Server).Start(0x11969c0?)
/go/pkg/mod/github.com/zeromicro/[email protected]/rest/server.go:116 +0xb3
main.main()
/build/service/chat/api/chat.go:76 +0x5a5

求教。。。

build的问题提问

1,修改了app Secret或者token,EncodingAESKey以后,是否需要重新build?
2,build的时候提示 Service 'web' failed to build : Build failed ,是什么问题?

微信客服docker log显示access_token missing

按照正文内容顺利完成了企微机器人的配置,能够正常得到回复。
尝试改为配置到微信客服后台时,按照类似的方式在chat-api.yaml文档中填入微信客服后台的secret key、token、encodingAESkey,调用测试也通过,但发送消息时收不到回复,查看docker logs如下图,请问是否缺少了什么配置?
屏幕截图 2023-04-03 173633

设置代理后仍然connection refused

科学上网已经部署好了,下面是终端命令

[root@VM-12-16-centos chat]# curl --proxy socks5h://127.0.0.1:7890 https://api.openai.com/v1/chat/completions
{
    "error": {
        "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}

但是机器人仍然是connection refused
日志

request :{"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"你是ChatGPT,一个由OpenAI训练的大型语言模型,你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。"},{"role":"user","content":"你好啊"}],"max_tokens":3000,"temperature":0.8,"frequency_penalty":0,"presence_penalty":0,"top_p":1,"stream":false,"stop":["#"]}
openai client req ing fail:Post "https://api.openai.com/v1/chat/completions": socks connect tcp 127.0.0.1:7890->api.openai.com:443: dial tcp 127.0.0.1:7890: connect: connection refused

请求的资源不存在

部署好后,发信息,没有任何回应,看容器错误:
{"@timestamp":"2023-03-18T16:50:24.936+08:00","caller":"response/response.go:42","content":"【API-ERR】 : ErrCode:404,ErrMsg:请求资源不存在\n接口不存在\nmain.(*NotFoundHandler).ServeHTTP\n\t/build/service/chat/api/chat.go:54\ngithub.com/zeromicro/go-zero/rest/handler.LogHandler.func1\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/handler/loghandler.go:47\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/zeromicro/go-zero/rest/handler.TraceHandler.func1.1\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/handler/tracehandler.go:64\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/zeromicro/go-zero/rest.(*engine).notFoundHandler.func1\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/engine.go:221\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/zeromicro/go-zero/rest/router.(*patRouter).handleNotFound\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/router/patrouter.go:95\ngithub.com/zeromicro/go-zero/rest/router.(*patRouter).ServeHTTP\n\t/go/pkg/mod/github.com/zeromicro/[email protected]/rest/router/patrouter.go:73\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2947\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1991\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1594 ","level":"error","span":"d5dce3b66da0f389","trace":"4b6096f8b4c2f401523bf8f385a1c7fd"}

到底是微信没连上,还是GPT没连上?

收不到信息

没有代理 设置反代 阿里fc与企业微信已连接 企业微信已信任公网ip (从企业微信发信息

查看日志chat_web_1

0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:29:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.8Mi, TotalAlloc=1861.0Mi, Sys=23.4Mi, NumGC=747","level":"stat"}
{"@timestamp":"2023-03-14T11:29:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:29:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:30:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.9Mi, TotalAlloc=1863.7Mi, Sys=23.4Mi, NumGC=748","level":"stat"}
{"@timestamp":"2023-03-14T11:30:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:30:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:31:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.9Mi, TotalAlloc=1866.3Mi, Sys=23.4Mi, NumGC=749","level":"stat"}
{"@timestamp":"2023-03-14T11:31:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:31:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:32:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.9Mi, TotalAlloc=1869.0Mi, Sys=23.4Mi, NumGC=750","level":"stat"}
{"@timestamp":"2023-03-14T11:32:06.815+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:32:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:33:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=3.0Mi, TotalAlloc=1871.6Mi, Sys=23.4Mi, NumGC=752","level":"stat"}
{"@timestamp":"2023-03-14T11:33:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:33:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:33:36.891+08:00","caller":"response/response.go:63","content":"",
"level":"info","response":{"code":200,"msg":"成 功 ","data":{"message":"ok"}},"span":"a23491558d
b1bac9","trace":"c9a2f8c68671fc0756d889677e2539d4"}
{"@timestamp":"2023-03-14T11:33:36.891+08:00","caller":"accesslog/accesslog.go:28","content":"
","level":"info","request":{"url":"/api/msg/push","method":"POST","query":"","body":"{"agent_
id":1000003,"channel":"wecom","user_id":"QuWeiKang","msg":"暂 不 支 持 , 文 本 以 外 的 消
息 "}","header":{"Accept":["application/json, text/plain, /"],"Accept-Encoding":["gzip, comp
ress, deflate, br"],"Authorization":["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3
MDQ2NDY4NzEsImlhdCI6MTY3ODcyNjg3MSwidXNlcklkIjoxfQ.2xyAMPinw1gVIwBhjSuTXE26RbMGKspu8-Lvte-46os
"],"Connection":["close"],"Content-Length":["105"],"Content-Type":["application/json"],"User-A
gent":["axios/1.3.4"]},"const":0},"span":"a23491558db1bac9","trace":"c9a2f8c68671fc0756d889677
e2539d4"}
{"@timestamp":"2023-03-14T11:33:36.892+08:00","caller":"handler/loghandler.go:160","content":"
[HTTP] 200 - POST /api/msg/push - 8.218.241.87:39792 - axios/1.3.4","duration":"0.3ms","level"
:"info","span":"a23491558db1bac9","trace":"c9a2f8c68671fc0756d889677e2539d4"}
{"@timestamp":"2023-03-14T11:33:41.195+08:00","caller":"response/response.go:63","content":"",
"level":"info","response":{"code":200,"msg":"成 功 ","data":{"message":"ok"}},"span":"8214ae326c
2b5390","trace":"79ffd4282c809540c3899ff0d6b51ef9"}
{"@timestamp":"2023-03-14T11:33:41.195+08:00","caller":"accesslog/accesslog.go:28","content":"
","level":"info","request":{"url":"/api/msg/push","method":"POST","query":"","body":"{"agent_
id":1000003,"channel":"wecom","user_id":"QuWeiKang","msg":"暂 不 支 持 , 文 本 以 外 的 消
息 "}","header":{"Accept":["application/json, text/plain, /"],"Accept-Encoding":["gzip, comp
ress, deflate, br"],"Authorization":["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3
MDQ2NDY4NzEsImlhdCI6MTY3ODcyNjg3MSwidXNlcklkIjoxfQ.2xyAMPinw1gVIwBhjSuTXE26RbMGKspu8-Lvte-46os
"],"Connection":["close"],"Content-Length":["105"],"Content-Type":["application/json"],"User-A
gent":["axios/1.3.4"]},"const":0},"span":"8214ae326c2b5390","trace":"79ffd4282c809540c3899ff0d
6b51ef9"}
{"@timestamp":"2023-03-14T11:33:41.195+08:00","caller":"handler/loghandler.go:160","content":"
[HTTP] 200 - POST /api/msg/push - 8.218.244.101:39794 - axios/1.3.4","duration":"0.3ms","level
":"info","span":"8214ae326c2b5390","trace":"79ffd4282c809540c3899ff0d6b51ef9"}
{"@timestamp":"2023-03-14T11:34:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=3.5Mi, TotalAlloc=1874.4Mi, Sys=23.4Mi, NumGC=753","level":"stat"}
{"@timestamp":"2023-03-14T11:34:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 2, pass: 2, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:34:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.3ms, 90th: 0.3ms, 99th: 0.3ms, 99.9th: 0.
3ms","level":"stat"}
{"@timestamp":"2023-03-14T11:34:49.256+08:00","caller":"response/response.go:63","content":"",
"level":"info","response":{"code":200,"msg":"成 功 ","data":{"message":"ok"}},"span":"9a6bd6db36
6ca672","trace":"1a42938b578e93e431971b8c019efe6c"}
{"@timestamp":"2023-03-14T11:34:49.256+08:00","caller":"accesslog/accesslog.go:28","content":"
","level":"info","request":{"url":"/api/msg/push","method":"POST","query":"","body":"{"agent_
id":1000003,"channel":"openai","user_id":"QuWeiKang","msg":"#help"}","header":{"A
ccept":["application/json, text/plain, /"],"Accept-Encoding":["gzip, compress, deflate, br"]
,"Authorization":["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDQ2NDY4NzEsImlhdCI
6MTY3ODcyNjg3MSwidXNlcklkIjoxfQ.2xyAMPinw1gVIwBhjSuTXE26RbMGKspu8-Lvte-46os"],"Connection":["c
lose"],"Content-Length":["75"],"Content-Type":["application/json"],"User-Agent":["axios/1.3.4"
]},"const":0},"span":"9a6bd6db366ca672","trace":"1a42938b578e93e431971b8c019efe6c"}
{"@timestamp":"2023-03-14T11:34:49.256+08:00","caller":"handler/loghandler.go:160","content":"
[HTTP] 200 - POST /api/msg/push - 8.218.191.29:39796 - axios/1.3.4","duration":"0.6ms","level"
:"info","span":"9a6bd6db366ca672","trace":"1a42938b578e93e431971b8c019efe6c"}
{"@timestamp":"2023-03-14T11:34:49.258+08:00","caller":"sqlx/stmt.go:132","content":"sql query
: SELECT id,user,agent_id,model,prompt,created_at,updated_at FROM chat_config
WHERE user = 'QuWeiKang' AND agent_id = 1000003 ORDER BY id","duration":"1.7ms","level":"info"
,"span":"4691ba6d72be8277","trace":"0a755d12366cd13056f1ce29ca173070"}
{"@timestamp":"2023-03-14T11:34:59.000+08:00","caller":"response/response.go:63","content":"",
"level":"info","response":{"code":200,"msg":"成 功 ","data":{"message":"ok"}},"span":"59dfa202c8
372f73","trace":"29eebd6a3ab6696f42805d5fcd9ef876"}
{"@timestamp":"2023-03-14T11:34:59.001+08:00","caller":"accesslog/accesslog.go:28","content":"
","level":"info","request":{"url":"/api/msg/push","method":"POST","query":"","body":"{"agent_
id":1000003,"channel":"openai","user_id":"QuWeiKang","msg":"#clear"}","header":{"
Accept":["application/json, text/plain, /"],"Accept-Encoding":["gzip, compress, deflate, br"
],"Authorization":["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDQ2NDY4NzEsImlhdC
I6MTY3ODcyNjg3MSwidXNlcklkIjoxfQ.2xyAMPinw1gVIwBhjSuTXE26RbMGKspu8-Lvte-46os"],"Connection":["
close"],"Content-Length":["76"],"Content-Type":["application/json"],"User-Agent":["axios/1.3.4
"]},"const":0},"span":"59dfa202c8372f73","trace":"29eebd6a3ab6696f42805d5fcd9ef876"}
{"@timestamp":"2023-03-14T11:34:59.001+08:00","caller":"handler/loghandler.go:160","content":"
[HTTP] 200 - POST /api/msg/push - 8.218.191.29:39798 - axios/1.3.4","duration":"0.3ms","level"
:"info","span":"59dfa202c8372f73","trace":"29eebd6a3ab6696f42805d5fcd9ef876"}
{"@timestamp":"2023-03-14T11:34:59.001+08:00","caller":"sqlx/stmt.go:132","content":"sql query
: SELECT id,user,agent_id,model,prompt,created_at,updated_at FROM chat_config
WHERE user = 'QuWeiKang' AND agent_id = 1000003 ORDER BY id","duration":"0.5ms","level":"info"
,"span":"a660556279ca0153","trace":"e31bdccec678fdbd4360476333966d11"}
{"@timestamp":"2023-03-14T11:34:59.002+08:00","caller":"sqlx/stmt.go:132","content":"sql query
: SELECT id,user,agent_id,req_content,res_content,created_at,updated_at FROM ch at WHERE user = 'QuWeiKang' AND agent_id = 1000003 ORDER BY id","duration":"0.5ms","level":"i
nfo","span":"374424d8438210a9","trace":"59427b72a25836316bacc3d620d6ec8c"}
{"@timestamp":"2023-03-14T11:35:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.4Mi, TotalAlloc=1877.3Mi, Sys=23.4Mi, NumGC=754","level":"stat"}
{"@timestamp":"2023-03-14T11:35:06.815+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 2, pass: 2, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:35:07.909+08:00","caller":"response/response.go:63","content":"",
"level":"info","response":{"code":200,"msg":"成 功 ","data":{"message":"ok"}},"span":"fed6d7d512
59bb5b","trace":"78d6dcb78c311e66fce4b7de121cef4e"}
{"@timestamp":"2023-03-14T11:35:07.909+08:00","caller":"accesslog/accesslog.go:28","content":"
","level":"info","request":{"url":"/api/msg/push","method":"POST","query":"","body":"{"agent_
id":1000003,"channel":"openai","user_id":"QuWeiKang","msg":"#help"}","header":{"A
ccept":["application/json, text/plain, /"],"Accept-Encoding":["gzip, compress, deflate, br"]
,"Authorization":["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDQ2NDY4NzEsImlhdCI
6MTY3ODcyNjg3MSwidXNlcklkIjoxfQ.2xyAMPinw1gVIwBhjSuTXE26RbMGKspu8-Lvte-46os"],"Connection":["c
lose"],"Content-Length":["75"],"Content-Type":["application/json"],"User-Agent":["axios/1.3.4"
]},"const":0},"span":"fed6d7d51259bb5b","trace":"78d6dcb78c311e66fce4b7de121cef4e"}
{"@timestamp":"2023-03-14T11:35:07.909+08:00","caller":"handler/loghandler.go:160","content":"
[HTTP] 200 - POST /api/msg/push - 8.218.240.102:39800 - axios/1.3.4","duration":"0.4ms","level
":"info","span":"fed6d7d51259bb5b","trace":"78d6dcb78c311e66fce4b7de121cef4e"}
{"@timestamp":"2023-03-14T11:35:07.910+08:00","caller":"sqlx/stmt.go:132","content":"sql query
: SELECT id,user,agent_id,model,prompt,created_at,updated_at FROM chat_config
WHERE user = 'QuWeiKang' AND agent_id = 1000003 ORDER BY id","duration":"0.7ms","level":"info"
,"span":"3324f6df4c09168c","trace":"c302cb51f8d09cad1cce41400c6be26c"}
{"@timestamp":"2023-03-14T11:35:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.1/s, drops: 0, avg time: 0.0ms, med: 0.5ms, 90th: 0.5ms, 99th: 0.5ms, 99.9th: 0.
5ms","level":"stat"}
{"@timestamp":"2023-03-14T11:36:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=2.7Mi, TotalAlloc=1880.0Mi, Sys=23.4Mi, NumGC=756","level":"stat"}
{"@timestamp":"2023-03-14T11:36:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 1, pass: 1, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:36:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:37:06.793+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=5.3Mi, TotalAlloc=1882.6Mi, Sys=23.4Mi, NumGC=756","level":"stat"}
{"@timestamp":"2023-03-14T11:37:06.815+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:37:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:38:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=5.2Mi, TotalAlloc=1885.2Mi, Sys=23.4Mi, NumGC=757","level":"stat"}
{"@timestamp":"2023-03-14T11:38:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:38:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:39:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=5.2Mi, TotalAlloc=1887.8Mi, Sys=23.4Mi, NumGC=758","level":"stat"}
{"@timestamp":"2023-03-14T11:39:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:39:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:39:28.955+08:00","caller":"response/response.go:63","content":"",
"level":"info","response":{"code":200,"msg":"成 功 ","data":{"message":"ok"}},"span":"e4a2f2848d
5fc0b5","trace":"fc613edc07dfaa1eea845793e1019352"}
{"@timestamp":"2023-03-14T11:39:28.956+08:00","caller":"accesslog/accesslog.go:28","content":"
","level":"info","request":{"url":"/api/msg/push","method":"POST","query":"","body":"{"agent_
id":1000003,"channel":"openai","user_id":"QuWeiKang","msg":"你 好 "}","header":{"Ac
cept":["application/json, text/plain, /"],"Accept-Encoding":["gzip, compress, deflate, br"],
"Authorization":["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDQ2NDY4NzEsImlhdCI6
MTY3ODcyNjg3MSwidXNlcklkIjoxfQ.2xyAMPinw1gVIwBhjSuTXE26RbMGKspu8-Lvte-46os"],"Connection":["cl
ose"],"Content-Length":["76"],"Content-Type":["application/json"],"User-Agent":["axios/1.3.4"]
},"const":0},"span":"e4a2f2848d5fc0b5","trace":"fc613edc07dfaa1eea845793e1019352"}
{"@timestamp":"2023-03-14T11:39:28.956+08:00","caller":"handler/loghandler.go:160","content":"
[HTTP] 200 - POST /api/msg/push - 8.218.244.101:39802 - axios/1.3.4","duration":"0.3ms","level
":"info","span":"e4a2f2848d5fc0b5","trace":"fc613edc07dfaa1eea845793e1019352"}
{"@timestamp":"2023-03-14T11:39:28.957+08:00","caller":"sqlx/stmt.go:132","content":"sql query
: SELECT id,user,agent_id,model,prompt,created_at,updated_at FROM chat_config
WHERE user = 'QuWeiKang' AND agent_id = 1000003 ORDER BY id","duration":"1.5ms","level":"info"
,"span":"e3ec79ae081d1456","trace":"e2f8acb67909ce5ea4bd35ecf426ca1a"}
{"@timestamp":"2023-03-14T11:39:28.958+08:00","caller":"sqlx/stmt.go:132","content":"sql query
: SELECT id,user,agent_id,req_content,res_content,created_at,updated_at FROM ch at WHERE user = 'QuWeiKang' AND agent_id = 1000003","duration":"0.5ms","level":"info","span":
"56fe323bea6cae63","trace":"fd819230a856c43045e2dd6f7413dc82"}
request :{"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"你 是 ChatGPT, 一 个 由
OpenAI 训 练 的 大 型 语 言 模 型 , 你 旨 在 回 答 并 解 决 人 们 的 任 何 问 题 , 并 且 可 以 使 用 多 种 语 言 与 人 交 流 。 \n"}
,{"role":"user","content":"你 好 "}],"max_tokens":1200,"temperature":0.8,"frequency_penalty":0,"
presence_penalty":0,"top_p":1,"stream":false,"stop":["#"]}
response: {"id":"chatcmpl-6tpnVEmKERmm0F7OEoNpkEWJQdWLa","object":"chat.completion","created":
1678765169,"model":"gpt-3.5-turbo-0301","usage":{"prompt_tokens":69,"completion_tokens":24,"to
tal_tokens":93},"choices":[{"message":{"role":"assistant","content":"你 好 , 有 什 么 我 可 以 帮 助 你
解 决 的 问 题 吗 ? "},"finish_reason":null,"index":0}]}

{"@timestamp":"2023-03-14T11:39:31.507+08:00","caller":"sqlx/stmt.go:132","content":"sql exec:
insert into chat (user,agent_id,req_content,res_content) values ('QuWeiKang', 10000
03, '你 好 ', '你 好 , 有 什 么 我 可 以 帮 助 你 解 决 的 问 题 吗 ? ')","duration":"2.0ms","level":"info","span
":"3c4e4e03039ab7f7","trace":"16e02f78b020c7a3a0463daffd2b190b"}
{"@timestamp":"2023-03-14T11:40:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.1Mi, TotalAlloc=1890.9Mi, Sys=23.4Mi, NumGC=760","level":"stat"}
{"@timestamp":"2023-03-14T11:40:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 1, pass: 1, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:40:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.2ms, 90th: 0.2ms, 99th: 0.2ms, 99.9th: 0.
2ms","level":"stat"}
{"@timestamp":"2023-03-14T11:41:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=3.9Mi, TotalAlloc=1893.6Mi, Sys=23.4Mi, NumGC=761","level":"stat"}
{"@timestamp":"2023-03-14T11:41:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:41:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:42:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.5Mi, TotalAlloc=1896.2Mi, Sys=23.4Mi, NumGC=762","level":"stat"}
{"@timestamp":"2023-03-14T11:42:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:42:14.563+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:43:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.5Mi, TotalAlloc=1898.8Mi, Sys=23.4Mi, NumGC=763","level":"stat"}
{"@timestamp":"2023-03-14T11:43:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:43:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:44:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=2.8Mi, TotalAlloc=1901.4Mi, Sys=23.4Mi, NumGC=765","level":"stat"}
{"@timestamp":"2023-03-14T11:44:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:44:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:45:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=3.6Mi, TotalAlloc=1904.1Mi, Sys=23.4Mi, NumGC=766","level":"stat"}
{"@timestamp":"2023-03-14T11:45:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:45:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:46:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=3.8Mi, TotalAlloc=1906.8Mi, Sys=23.4Mi, NumGC=767","level":"stat"}
{"@timestamp":"2023-03-14T11:46:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:46:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:47:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=4.5Mi, TotalAlloc=1909.4Mi, Sys=23.4Mi, NumGC=768","level":"stat"}
{"@timestamp":"2023-03-14T11:47:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:47:14.563+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:48:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=2.7Mi, TotalAlloc=1912.0Mi, Sys=23.4Mi, NumGC=770","level":"stat"}
{"@timestamp":"2023-03-14T11:48:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:48:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:49:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=2.7Mi, TotalAlloc=1914.7Mi, Sys=23.4Mi, NumGC=771","level":"stat"}
{"@timestamp":"2023-03-14T11:49:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:49:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-
api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.
0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:50:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m,
MEMORY: Alloc=3.6Mi, TotalAlloc=1917.4Mi, Sys=23.4Mi, NumGC=772","level":"stat"}
{"@timestamp":"2023-03-14T11:50:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(a
pi) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:50:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:50:40.092+08:00","caller":"response/response.go:63","content":"","level":"info","response":{"code":200,"msg":"成 功 ","data":{"message":"ok"}},"span":"768b238c92ddd9f2","trace":"3b3acf1ddebbd4264bab59a0172419a9"}
{"@timestamp":"2023-03-14T11:50:40.092+08:00","caller":"accesslog/accesslog.go:28","content":"","level":"info","request":{"url":"/api/msg/push","method":"POST","query":"","body":"{"agent_id":1000003,"channel":"openai","user_id":"QuWeiKang","msg":"#help"}","header":{"Accept":["application/json, text/plain, /"],"Accept-Encoding":["gzip, compress, deflate, br"],"Authorization":["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDQ2NDY4NzEsImlhdCI6MTY3ODcyNjg3MSwidXNlcklkIjoxfQ.2xyAMPinw1gVIwBhjSuTXE26RbMGKspu8-Lvte-46os"],"Connection":["close"],"Content-Length":["75"],"Content-Type":["application/json"],"User-Agent":["axios/1.3.4"]},"const":0},"span":"768b238c92ddd9f2","trace":"3b3acf1ddebbd4264bab59a0172419a9"}
{"@timestamp":"2023-03-14T11:50:40.092+08:00","caller":"handler/loghandler.go:160","content":"[HTTP] 200 - POST /api/msg/push - 8.218.241.87:35764 - axios/1.3.4","duration":"0.3ms","level":"info","span":"768b238c92ddd9f2","trace":"3b3acf1ddebbd4264bab59a0172419a9"}
{"@timestamp":"2023-03-14T11:50:40.094+08:00","caller":"sqlx/stmt.go:132","content":"sql query: SELECT id,user,agent_id,model,prompt,created_at,updated_at FROM chat_config WHERE user = 'QuWeiKang' AND agent_id = 1000003 ORDER BY id","duration":"1.5ms","level":"info","span":"2a2d98eca2de4a35","trace":"f75e32844d7dc97fe66ae17fbc753782"}
{"@timestamp":"2023-03-14T11:51:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m, MEMORY: Alloc=3.9Mi, TotalAlloc=1920.2Mi, Sys=23.4Mi, NumGC=773","level":"stat"}
{"@timestamp":"2023-03-14T11:51:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(api) shedding_stat [1m], cpu: 0, total: 1, pass: 1, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:51:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.3ms, 90th: 0.3ms, 99th: 0.3ms, 99.9th: 0.3ms","level":"stat"}
{"@timestamp":"2023-03-14T11:52:06.791+08:00","caller":"stat/usage.go:61","content":"CPU: 0m, MEMORY: Alloc=4.6Mi, TotalAlloc=1922.8Mi, Sys=23.4Mi, NumGC=774","level":"stat"}
{"@timestamp":"2023-03-14T11:52:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(api) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:52:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.0ms","level":"stat"}
{"@timestamp":"2023-03-14T11:53:06.792+08:00","caller":"stat/usage.go:61","content":"CPU: 0m, MEMORY: Alloc=4.5Mi, TotalAlloc=1925.4Mi, Sys=23.4Mi, NumGC=775","level":"stat"}
{"@timestamp":"2023-03-14T11:53:06.814+08:00","caller":"load/sheddingstat.go:61","content":"(api) shedding_stat [1m], cpu: 0, total: 0, pass: 0, drop: 0","level":"stat"}
{"@timestamp":"2023-03-14T11:53:14.564+08:00","caller":"stat/metrics.go:210","content":"(chat-api) - qps: 0.0/s, drops: 0, avg time: 0.0ms, med: 0.0ms, 90th: 0.0ms, 99th: 0.0ms, 99.9th: 0.0ms","level":"stat"}

反代地址 cloudflare 显示 未缓存

调用都成功,但是不返回消息

chat 表中也插入了数据,然后请求也返回了数据,但是没有推送给微信
2023-03-01 11:50:08 1-63fecb70-aac0782da657deacda41545b [verbose] {"agent_id":1000064,"channel":"openai","user_id":"20190001","msg":"mysq 索引优化l"}
2023-03-01 11:50:08 1-63fecb70-aac0782da657deacda41545b [verbose] reply ok: {"code":200,"msg":"成功","data":{"message":"ok"}}

Q: mysql 索引优化
A:
{"id":"cmpl-6p7rV7tg4mFIyM5RYBShQNmpwiGu3","object":"text_completion","created":1677642969,"model":"text-davinci-003","choices":[{"text":"为了优化MySQL索引,首先需要了解关于索引的概念及其使用。MySQL索引的核心特性包括:当MySQL查询所需的数据时,它可以快速查找所需的数据;索引可以加快数据库查询速度,增强性能;正确使用MySQL索引有助于避免资源紧张;MySQL索引也可以要求某一列中具有唯一性。MySQL索引优化可以提高查询性能,同时可以减少查询返回结果大小。可以使用EXPLAIN和EXPLAIN EXTENDED来查看MySQL的查询执行计划以及查询优化建议,以便更好地优化索引,最终提供更佳的查询性能。","index":0,"logprobs":null,"finish_reason":"stop"}],"usage":{"prompt_tokens":119,"completion_tokens":425,"total_tokens":544}}

关于企业微信的对接

现在企业微信需要与主体关联的域名才可以设置企业信任ip,这个有什么方法可以绕过?

chat-api.yaml启动会提示 Draw is not set

如果不设置draw参数,chat_web的容器拉不起来。
改完之后又碰到了编码的问题,
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 55 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 14 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 8 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 16 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 51 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 27 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 36 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 54 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 11 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 11 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 39 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 47 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 8 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 25 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 13 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 32 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 12 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 6 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1
Starting server at 0.0.0.0:8888...
panic: illegal base64 data at input byte 44

goroutine 41 [running]:
chat/common/wecom.XmlServe()
/build/common/wecom/wecom.go:254 +0x394
created by main.main
/build/service/chat/api/chat.go:64 +0x4b1

docker build报错如何解决

  • 执行:docker-compose build
  • 日志:
[+] Building 274.0s (7/18)                                                                                                                                              
 => [internal] load build definition from Dockerfile                                                                                                               0.0s
 => => transferring dockerfile: 1.21kB                                                                                                                             0.0s
 => [internal] load .dockerignore                                                                                                                                  0.1s
 => => transferring context: 2B                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/golang:1.19-alpine                                                                                              3.5s
 => [internal] load build context                                                                                                                                  0.2s
 => => transferring context: 41.61MB                                                                                                                               0.2s
 => [builder 1/9] FROM docker.io/library/golang:1.19-alpine@sha256:1a444aca58a76ddde335f566b80c31dab081dffd52f3c60367cc3744bd323079                               13.7s
 => => resolve docker.io/library/golang:1.19-alpine@sha256:1a444aca58a76ddde335f566b80c31dab081dffd52f3c60367cc3744bd323079                                        0.0s
 => => sha256:85791d961cd3578144eb3d64a9716fa35c198c4ae9202b07eb0f2de9127a7907 284.81kB / 284.81kB                                                                 0.8s
 => => sha256:39647feab07db90c27088e25bf6657b494826426f0647bf9366b6aef1b8f1eb1 122.39MB / 122.39MB                                                                 9.4s
 => => sha256:4375bc5d93b8cea280f2b2c978d22b7a7e69390b483c2d643a4f98303576e69d 155B / 155B                                                                         0.6s
 => => sha256:1a444aca58a76ddde335f566b80c31dab081dffd52f3c60367cc3744bd323079 1.65kB / 1.65kB                                                                     0.0s
 => => sha256:841c160ed35923d96c95c52403c4e6db5decd9cbce034aa851e412ade5d4b74f 1.16kB / 1.16kB                                                                     0.0s
 => => sha256:40edfa59737bff7dc21f60ee0b95ea6546516decfdd9f515b3326593468f2346 5.11kB / 5.11kB                                                                     0.0s
 => => sha256:f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09 3.37MB / 3.37MB                                                                     0.7s
 => => extracting sha256:f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09                                                                          0.1s
 => => extracting sha256:85791d961cd3578144eb3d64a9716fa35c198c4ae9202b07eb0f2de9127a7907                                                                          0.1s
 => => extracting sha256:39647feab07db90c27088e25bf6657b494826426f0647bf9366b6aef1b8f1eb1                                                                          3.9s
 => => extracting sha256:4375bc5d93b8cea280f2b2c978d22b7a7e69390b483c2d643a4f98303576e69d                                                                          0.0s
 => [builder 2/9] WORKDIR /build                                                                                                                                   2.0s
 => ERROR [builder 3/9] RUN  apk add tzdata                                                                                                                      254.8s
------                                                                     
 > [builder 3/9] RUN  apk add tzdata:                                                                                                                                   
#0 0.226 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz                                                                                  
#0 127.5 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.17/main: operation timed out                                                                                   
#0 127.5 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/main: No such file or directory                                                                  
#0 127.5 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz                                                                             
#0 254.7 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.17/community: operation timed out
#0 254.7 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/community: No such file or directory
#0 254.7 ERROR: unable to select packages:
#0 254.7   tzdata (no such package):
#0 254.7     required by: world[tzdata]
------
failed to solve: process "/bin/sh -c apk add tzdata" did not complete successfully: exit code: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.