其他的接口暂未支持通用
通过配置相关参数即可
将config.example.json中的配置
// type:azure则为azure云服务
"gptconfig": {
"type": "azure",
"url": "https://xxxx.openai.azure.com",
"apikey": "xxxxxxx"
},
// type:openai则为openai官网的api
"gptconfig": {
"type": "openai",
"url": "https://xxxx.openai.azure.com",
"apikey": "xxxxxxx"
},
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
https://github.com/swaggo/swag/blob/master/README_zh-CN.md
// 则运行
go install github.com/swaggo/swag/cmd/swag
// 修改完注释和配置要记得重新生成docs
swag init
// 生成接口文档
swag init
// 打包编译脚本
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
编译完后会生成一个geekdemo的go 文件,直接拷贝到服务器/usr/local/sunlight/go/course
如果拷贝不了
// 停止服务
systemctl stop geekdemo
// 再去拷贝文件
// 再开启服务
systemctl start geekdemo
// geek.service
[Unit]
Description=geekdemo
After=network-online.target
Wants=network-online.target
[Service]
# modify when deploy in prod env
Type=simple
#Environment="GIN_MODE=release"
ExecStart=/usr/local/sunlight/go/course/geekdemo
WorkingDirectory=/usr/local/sunlight/go/course
Restart=always
RestartSec=1
StartLimitInterval=0
[Install]
WantedBy=multi-user.target
// 设置开机启动
systemctl enable geekdemo.service
// 启动服务
systemctl start geekdemo.service
// 停止服务
systemctl stop geekdemo.service
// 重新加载配置文件
sytemctl daemon-reload
// 查看服务状态
systemctl status geekdemo.service
// 查看运行日志
journalctl -u geekdemo -f