Skip to content

Commit

Permalink
新增支持gpt-4o-mini
Browse files Browse the repository at this point in the history
  • Loading branch information
b3nguang committed Jul 30, 2024
1 parent 07b883e commit 3d71a27
Show file tree
Hide file tree
Showing 12 changed files with 332 additions and 75 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ width="800" height="3">

## 前言

本项目可以助你将 GPT 机器人集成到钉钉群聊当中。当前默认模型为`gpt-3.5`,支持`gpt-4`。同时支持 Azure-OpenAI。
本项目可以助你将 GPT 机器人集成到钉钉群聊当中。当前默认模型为`gpt-3.5`,支持`gpt-4`以及`gpt-4o-mini`。同时支持 Azure-OpenAI。

> - `📢 注意`:当下部署以及配置流程都已非常成熟,文档和 issue 中基本都覆盖到了,因此不再回答任何项目安装部署与配置使用上的问题,如果完全不懂,可考虑通过 **[邮箱](mailto:[email protected])** 联系我进行付费的技术支持。
>
Expand Down Expand Up @@ -304,7 +304,7 @@ $ tail -f run.log

### 支持 gpt-4

如果你的账号通过了官方的白名单,那么可以将模型配置为:`gpt-4-0314``gpt-4`,目前 gpt-4 的余额查询以及图片生成功能暂不可用,可能是接口限制,也可能是其他原因,等我有条件的时候,会对这些功能进行测试验证。
如果你的账号通过了官方的白名单,那么可以将模型配置为:`gpt-4-0314``gpt-4``gpt-4o-mini`,目前 gpt-4 的余额查询以及图片生成功能暂不可用,可能是接口限制,也可能是其他原因,等我有条件的时候,会对这些功能进行测试验证。

> 以下是 gpt-3.5 与 gpt-4 对数学计算方面的区别。
Expand Down
2 changes: 1 addition & 1 deletion config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run_mode: "stream"
api_key: "xxxxxxxxx"
# 如果你使用官方的接口地址 https://api.openai.com,则留空即可,如果你想指定请求url的地址,可通过这个参数进行配置,注意需要带上 http 协议,如果你是用的是azure,则该配置项可以留空或者直接忽略
base_url: ""
# 指定模型,默认为 gpt-3.5-turbo , 可选参数有:"gpt-4-32k-0613", "gpt-4-32k-0314", "gpt-4-32k", "gpt-4-0613", "gpt-4-0314", "gpt-4-turbo-preview", "gpt-4-vision-preview", "gpt-4", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613", "gpt-3.5-turbo",如果使用gpt-4,请确认自己是否有接口调用白名单,如果你是用的是azure,则该配置项可以留空或者直接忽略
# 指定模型,默认为 gpt-3.5-turbo , 可选参数有:"gpt-4-32k-0613", "gpt-4-32k-0314", "gpt-4-32k", "gpt-4-0613", "gpt-4-0314", "gpt-4-turbo-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4o-mini", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613", "gpt-3.5-turbo",如果使用gpt-4,请确认自己是否有接口调用白名单,如果你是用的是azure,则该配置项可以留空或者直接忽略
model: "gpt-3.5-turbo"
# 指定绘画模型,默认为 dall-e-2 , 可选参数有:"dall-e-2", "dall-e-3"
image_model: "dall-e-2"
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sync"
"time"

"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"

"github.com/eryajf/chatgpt-dingtalk/pkg/logger"
)
Expand Down
2 changes: 1 addition & 1 deletion config/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io/ioutil"

Check failure on line 4 in config/prompt.go

View workflow job for this annotation

GitHub Actions / golint

SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
"log"

"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)

type Prompt struct {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
APIKEY: xxxxxx # 你的 api_key
RUN_MODE: "stream" # 运行模式,http 或者 stream ,强烈建议你使用stream模式,通过此链接了解:https://open.dingtalk.com/document/isvapp/stream
BASE_URL: "" # 如果你使用官方的接口地址 https://api.openai.com,则留空即可,如果你想指定请求url的地址,可通过这个参数进行配置,注意需要带上 http 协议
MODEL: "gpt-3.5-turbo" # 指定模型,默认为 gpt-3.5-turbo , 可选参数有: "gpt-4-32k-0613", "gpt-4-32k-0314", "gpt-4-32k", "gpt-4-0613", "gpt-4-0314", "gpt-4", "gpt-3.5-turbo-16k-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-0301", "gpt-3.5-turbo",如果使用gpt-4,请确认自己是否有接口调用白名单,如果你是用的是azure,则该配置项可以留空或者直接忽略
MODEL: "gpt-3.5-turbo" # 指定模型,默认为 gpt-3.5-turbo , 可选参数有: "gpt-4-32k-0613", "gpt-4-32k-0314", "gpt-4-32k", "gpt-4-0613", "gpt-4-0314", "gpt-4", "gpt-4o-mini", "gpt-3.5-turbo-16k-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-0301", "gpt-3.5-turbo",如果使用gpt-4,请确认自己是否有接口调用白名单,如果你是用的是azure,则该配置项可以留空或者直接忽略
IMAGE_MODEL: "dall-e-2" # 指定绘画模型,默认为 dall-e-2 , 可选参数有:"dall-e-2", "dall-e-3"
SESSION_TIMEOUT: 600 # 会话超时时间,默认600秒,在会话时间内所有发送给机器人的信息会作为上下文
MAX_QUESTION_LEN: 2048 # 最大问题长度,默认4096 token,正常情况默认值即可,如果使用gpt4-8k或gpt4-32k,可根据模型token上限修改。
Expand Down
91 changes: 48 additions & 43 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,71 +1,76 @@
module github.com/eryajf/chatgpt-dingtalk

go 1.18
go 1.22

require (
github.com/charmbracelet/log v0.2.1
github.com/gin-gonic/gin v1.9.0
github.com/glebarez/sqlite v1.7.0
github.com/go-resty/resty/v2 v2.7.0
github.com/open-dingtalk/dingtalk-stream-sdk-go v0.0.4
github.com/charmbracelet/log v0.4.0
github.com/glebarez/sqlite v1.11.0
github.com/go-resty/resty/v2 v2.13.1
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/sashabaranov/go-openai v1.17.6
github.com/solywsh/chatgpt v0.0.14
gopkg.in/yaml.v2 v2.4.0
gorm.io/gorm v1.24.6
github.com/sashabaranov/go-openai v1.27.1
gopkg.in/yaml.v3 v3.0.1
gorm.io/gorm v1.25.11
)

require (
github.com/avast/retry-go v3.0.0+incompatible // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/bytedance/sonic v1.8.0 // indirect
github.com/charmbracelet/lipgloss v0.7.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/dlclark/regexp2 v1.9.0 // indirect
github.com/dop251/goja v0.0.0-20230402114112-623f9dda9079 // indirect
github.com/dop251/goja_nodejs v0.0.0-20230322100729-2550c7b6c124 // indirect
github.com/bytedance/sonic v1.12.0 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/charmbracelet/lipgloss v0.12.1 // indirect
github.com/charmbracelet/x/ansi v0.1.4 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/dlclark/regexp2 v1.11.2 // indirect
github.com/dop251/goja v0.0.0-20240707163329-b1681fb2a2f5 // indirect
github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/glebarez/go-sqlite v1.20.3 // indirect
github.com/gin-gonic/gin v1.10.0 // indirect
github.com/glebarez/go-sqlite v1.22.0 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/google/pprof v0.0.0-20230406165453-00490a63f317 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/go-playground/validator/v10 v10.22.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/open-dingtalk/dingtalk-stream-sdk-go v0.9.0 // indirect
github.com/pandodao/tokenizer-go v0.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/solywsh/chatgpt v0.0.14 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.22.3 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/sqlite v1.20.4 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
modernc.org/libc v1.55.6 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.31.1 // indirect
)

replace github.com/solywsh/chatgpt => ./pkg/chatgpt
Loading

0 comments on commit 3d71a27

Please sign in to comment.