🎉 初始化项目

This commit is contained in:
2026-03-03 06:05:51 +08:00
commit e1c70fe218
241 changed files with 148285 additions and 0 deletions

32
.gitignore vendored Normal file
View File

@@ -0,0 +1,32 @@
### Go template
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
go.work.sum
# env file
.env
sillytavern
uploads
.idea
.claude
log
node_modules

1516
docs/TGbreak.json Normal file

File diff suppressed because it is too large Load Diff

31
server/Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
FROM golang:alpine as builder
WORKDIR /go/src/git.echol.cn/loser/ai_proxy/server
COPY . .
RUN go env -w GO111MODULE=on \
&& go env -w GOPROXY=https://goproxy.cn,direct \
&& go env -w CGO_ENABLED=0 \
&& go env \
&& go mod tidy \
&& go build -o server .
FROM alpine:latest
LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com"
# 设置时区
ENV TZ=Asia/Shanghai
RUN apk update && apk add --no-cache tzdata openntpd \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /go/src/git.echol.cn/loser/ai_proxy/server
COPY --from=0 /go/src/git.echol.cn/loser/ai_proxy/server/server ./
COPY --from=0 /go/src/git.echol.cn/loser/ai_proxy/server/resource ./resource/
COPY --from=0 /go/src/git.echol.cn/loser/ai_proxy/server/config.docker.yaml ./
# 挂载目录如果使用了sqlite数据库容器命令示例docker run -d -v /宿主机路径/gva.db:/go/src/git.echol.cn/loser/ai_proxy/server/gva.db -p 8888:8888 --name gva-server-v1 gva-server:1.0
# VOLUME ["/go/src/git.echol.cn/loser/ai_proxy/server"]
EXPOSE 8888
ENTRYPOINT ./server -c config.docker.yaml

54
server/README.md Normal file
View File

@@ -0,0 +1,54 @@
## server项目结构
```shell
├── api
│   └── v1
├── config
├── core
├── docs
├── global
├── initialize
│   └── internal
├── middleware
├── model
│   ├── request
│   └── response
├── packfile
├── resource
│   ├── excel
│   ├── page
│   └── template
├── router
├── service
├── source
└── utils
├── timer
└── upload
```
| 文件夹 | 说明 | 描述 |
| ------------ | ----------------------- | --------------------------- |
| `api` | api层 | api层 |
| `--v1` | v1版本接口 | v1版本接口 |
| `config` | 配置包 | config.yaml对应的配置结构体 |
| `core` | 核心文件 | 核心组件(zap, viper, server)的初始化 |
| `docs` | swagger文档目录 | swagger文档目录 |
| `global` | 全局对象 | 全局对象 |
| `initialize` | 初始化 | router,redis,gorm,validator, timer的初始化 |
| `--internal` | 初始化内部函数 | gorm 的 longger 自定义,在此文件夹的函数只能由 `initialize` 层进行调用 |
| `middleware` | 中间件层 | 用于存放 `gin` 中间件代码 |
| `model` | 模型层 | 模型对应数据表 |
| `--request` | 入参结构体 | 接收前端发送到后端的数据。 |
| `--response` | 出参结构体 | 返回给前端的数据结构体 |
| `packfile` | 静态文件打包 | 静态文件打包 |
| `resource` | 静态资源文件夹 | 负责存放静态文件 |
| `--excel` | excel导入导出默认路径 | excel导入导出默认路径 |
| `--page` | 表单生成器 | 表单生成器 打包后的dist |
| `--template` | 模板 | 模板文件夹,存放的是代码生成器的模板 |
| `router` | 路由层 | 路由层 |
| `service` | service层 | 存放业务逻辑问题 |
| `source` | source层 | 存放初始化数据的函数 |
| `utils` | 工具包 | 工具函数封装 |
| `--timer` | timer | 定时器接口封装 |
| `--upload` | oss | oss接口封装 |

View File

@@ -0,0 +1,232 @@
package app
import (
"strconv"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/model/app/request"
commonRequest "git.echol.cn/loser/ai_proxy/server/model/common/request"
"git.echol.cn/loser/ai_proxy/server/model/common/response"
"git.echol.cn/loser/ai_proxy/server/service"
"git.echol.cn/loser/ai_proxy/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type AiPresetApi struct{}
var aiPresetService = service.ServiceGroupApp.AppServiceGroup.AiPresetService
// CreateAiPreset 创建AI预设
// @Tags AiPreset
// @Summary 创建AI预设
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CreateAiPresetRequest true "预设信息"
// @Success 200 {object} response.Response{data=app.AiPreset,msg=string} "创建成功"
// @Router /app/preset [post]
func (a *AiPresetApi) CreateAiPreset(c *gin.Context) {
var req request.CreateAiPresetRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
// 尝试获取用户ID如果没有则使用0公开访问
userId := uint(0)
if id := utils.GetUserID(c); id > 0 {
userId = id
}
preset, err := aiPresetService.CreateAiPreset(userId, &req)
if err != nil {
global.GVA_LOG.Error("创建预设失败!", zap.Error(err))
response.FailWithMessage("创建预设失败", c)
return
}
response.OkWithData(preset, c)
}
// DeleteAiPreset 删除AI预设
// @Tags AiPreset
// @Summary 删除AI预设
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "预设ID"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /app/preset/:id [delete]
func (a *AiPresetApi) DeleteAiPreset(c *gin.Context) {
id, _ := strconv.ParseUint(c.Param("id"), 10, 32)
// 尝试获取用户ID如果没有则使用0公开访问
userId := uint(0)
if uid := utils.GetUserID(c); uid > 0 {
userId = uid
}
err := aiPresetService.DeleteAiPreset(uint(id), userId)
if err != nil {
global.GVA_LOG.Error("删除预设失败!", zap.Error(err))
response.FailWithMessage("删除预设失败", c)
return
}
response.OkWithMessage("删除成功", c)
}
// UpdateAiPreset 更新AI预设
// @Tags AiPreset
// @Summary 更新AI预设
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.UpdateAiPresetRequest true "预设信息"
// @Success 200 {object} response.Response{data=app.AiPreset,msg=string} "更新成功"
// @Router /app/preset [put]
func (a *AiPresetApi) UpdateAiPreset(c *gin.Context) {
var req request.UpdateAiPresetRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
// 尝试获取用户ID如果没有则使用0公开访问
userId := uint(0)
if id := utils.GetUserID(c); id > 0 {
userId = id
}
preset, err := aiPresetService.UpdateAiPreset(userId, &req)
if err != nil {
global.GVA_LOG.Error("更新预设失败!", zap.Error(err))
response.FailWithMessage("更新预设失败", c)
return
}
response.OkWithData(preset, c)
}
// GetAiPreset 获取AI预设详情
// @Tags AiPreset
// @Summary 获取AI预设详情
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "预设ID"
// @Success 200 {object} response.Response{data=app.AiPreset,msg=string} "获取成功"
// @Router /app/preset/:id [get]
func (a *AiPresetApi) GetAiPreset(c *gin.Context) {
id, _ := strconv.ParseUint(c.Param("id"), 10, 32)
// 尝试获取用户ID如果没有则使用0公开访问
userId := uint(0)
if uid := utils.GetUserID(c); uid > 0 {
userId = uid
}
preset, err := aiPresetService.GetAiPreset(uint(id), userId)
if err != nil {
global.GVA_LOG.Error("获取预设失败!", zap.Error(err))
response.FailWithMessage("获取预设失败", c)
return
}
response.OkWithData(preset, c)
}
// GetAiPresetList 获取AI预设列表
// @Tags AiPreset
// @Summary 获取AI预设列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.PageInfo true "分页信息"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
// @Router /app/preset/list [get]
func (a *AiPresetApi) GetAiPresetList(c *gin.Context) {
var pageInfo commonRequest.PageInfo
err := c.ShouldBindQuery(&pageInfo)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
// 尝试获取用户ID如果没有则使用0公开访问
userId := uint(0)
if id := utils.GetUserID(c); id > 0 {
userId = id
}
list, total, err := aiPresetService.GetAiPresetList(userId, pageInfo)
if err != nil {
global.GVA_LOG.Error("获取预设列表失败!", zap.Error(err))
response.FailWithMessage("获取预设列表失败", c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
// ImportAiPreset 导入AI预设支持SillyTavern格式
// @Tags AiPreset
// @Summary 导入AI预设
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.ImportAiPresetRequest true "导入数据"
// @Success 200 {object} response.Response{data=app.AiPreset,msg=string} "导入成功"
// @Router /app/preset/import [post]
func (a *AiPresetApi) ImportAiPreset(c *gin.Context) {
var req request.ImportAiPresetRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
// 尝试获取用户ID如果没有则使用0公开访问
userId := uint(0)
if id := utils.GetUserID(c); id > 0 {
userId = id
}
preset, err := aiPresetService.ImportAiPreset(userId, &req)
if err != nil {
global.GVA_LOG.Error("导入预设失败!", zap.Error(err))
response.FailWithMessage("导入预设失败", c)
return
}
response.OkWithData(preset, c)
}
// ExportAiPreset 导出AI预设
// @Tags AiPreset
// @Summary 导出AI预设
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "预设ID"
// @Success 200 {object} map[string]interface{} "导出数据"
// @Router /app/preset/:id/export [get]
func (a *AiPresetApi) ExportAiPreset(c *gin.Context) {
id, _ := strconv.ParseUint(c.Param("id"), 10, 32)
// 尝试获取用户ID如果没有则使用0公开访问
userId := uint(0)
if uid := utils.GetUserID(c); uid > 0 {
userId = uid
}
data, err := aiPresetService.ExportAiPreset(uint(id), userId)
if err != nil {
global.GVA_LOG.Error("导出预设失败!", zap.Error(err))
response.FailWithMessage("导出预设失败", c)
return
}
c.JSON(200, data)
}

View File

@@ -0,0 +1,131 @@
package app
import (
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/model/app/request"
"git.echol.cn/loser/ai_proxy/server/model/common/response"
"git.echol.cn/loser/ai_proxy/server/service"
"git.echol.cn/loser/ai_proxy/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type PresetBindingApi struct{}
var presetBindingService = service.ServiceGroupApp.AppServiceGroup.PresetBindingService
// CreateBinding 创建预设绑定
// @Tags App
// @Summary 创建预设绑定
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CreateBindingRequest true "绑定信息"
// @Success 200 {object} response.Response{msg=string} "创建成功"
// @Router /app/binding [post]
func (a *PresetBindingApi) CreateBinding(c *gin.Context) {
var req request.CreateBindingRequest
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err := presetBindingService.CreateBinding(&req)
if err != nil {
global.GVA_LOG.Error("创建绑定失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("创建成功", c)
}
// UpdateBinding 更新预设绑定
// @Tags App
// @Summary 更新预设绑定
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.UpdateBindingRequest true "绑定信息"
// @Success 200 {object} response.Response{msg=string} "更新成功"
// @Router /app/binding [put]
func (a *PresetBindingApi) UpdateBinding(c *gin.Context) {
var req request.UpdateBindingRequest
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err := presetBindingService.UpdateBinding(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("更新成功", c)
}
// DeleteBinding 删除预设绑定
// @Tags App
// @Summary 删除预设绑定
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "绑定ID"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /app/binding/:id [delete]
func (a *PresetBindingApi) DeleteBinding(c *gin.Context) {
id, err := utils.StringToUint(c.Param("id"))
if err != nil {
response.FailWithMessage("无效的ID", c)
return
}
err = presetBindingService.DeleteBinding(id)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
// GetBindingList 获取绑定列表
// @Tags App
// @Summary 获取绑定列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param page query int false "页码"
// @Param pageSize query int false "每页数量"
// @Param providerId query uint false "提供商ID"
// @Param presetId query uint false "预设ID"
// @Success 200 {object} response.Response{data=response.PageResult} "获取成功"
// @Router /app/binding/list [get]
func (a *PresetBindingApi) GetBindingList(c *gin.Context) {
var req request.GetBindingListRequest
if err := c.ShouldBindQuery(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if req.Page == 0 {
req.Page = 1
}
if req.PageSize == 0 {
req.PageSize = 10
}
list, total, err := presetBindingService.GetBindingList(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: req.Page,
PageSize: req.PageSize,
}, "获取成功", c)
}

View File

@@ -0,0 +1,185 @@
package app
import (
"strconv"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/model/app/request"
"git.echol.cn/loser/ai_proxy/server/model/common/response"
"git.echol.cn/loser/ai_proxy/server/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type AiProviderApi struct{}
var aiProviderService = service.ServiceGroupApp.AppServiceGroup.AiProviderService
// CreateAiProvider 创建AI提供商
// @Tags AiProvider
// @Summary 创建AI提供商
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CreateAiProviderRequest true "提供商信息"
// @Success 200 {object} response.Response{data=app.AiProvider,msg=string} "创建成功"
// @Router /app/provider [post]
func (a *AiProviderApi) CreateAiProvider(c *gin.Context) {
var req request.CreateAiProviderRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
provider, err := aiProviderService.CreateAiProvider(&req)
if err != nil {
global.GVA_LOG.Error("创建提供商失败!", zap.Error(err))
response.FailWithMessage("创建提供商失败", c)
return
}
response.OkWithData(provider, c)
}
// DeleteAiProvider 删除AI提供商
// @Tags AiProvider
// @Summary 删除AI提供商
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "提供商ID"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /app/provider/:id [delete]
func (a *AiProviderApi) DeleteAiProvider(c *gin.Context) {
id, _ := strconv.ParseUint(c.Param("id"), 10, 32)
err := aiProviderService.DeleteAiProvider(uint(id))
if err != nil {
global.GVA_LOG.Error("删除提供商失败!", zap.Error(err))
response.FailWithMessage("删除提供商失败", c)
return
}
response.OkWithMessage("删除成功", c)
}
// UpdateAiProvider 更新AI提供商
// @Tags AiProvider
// @Summary 更新AI提供商
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.UpdateAiProviderRequest true "提供商信息"
// @Success 200 {object} response.Response{data=app.AiProvider,msg=string} "更新成功"
// @Router /app/provider [put]
func (a *AiProviderApi) UpdateAiProvider(c *gin.Context) {
var req request.UpdateAiProviderRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
provider, err := aiProviderService.UpdateAiProvider(&req)
if err != nil {
global.GVA_LOG.Error("更新提供商失败!", zap.Error(err))
response.FailWithMessage("更新提供商失败", c)
return
}
response.OkWithData(provider, c)
}
// GetAiProvider 获取AI提供商详情
// @Tags AiProvider
// @Summary 获取AI提供商详情
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "提供商ID"
// @Success 200 {object} response.Response{data=app.AiProvider,msg=string} "获取成功"
// @Router /app/provider/:id [get]
func (a *AiProviderApi) GetAiProvider(c *gin.Context) {
id, _ := strconv.ParseUint(c.Param("id"), 10, 32)
provider, err := aiProviderService.GetAiProvider(uint(id))
if err != nil {
global.GVA_LOG.Error("获取提供商失败!", zap.Error(err))
response.FailWithMessage("获取提供商失败", c)
return
}
response.OkWithData(provider, c)
}
// GetAiProviderList 获取AI提供商列表
// @Tags AiProvider
// @Summary 获取AI提供商列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=[]app.AiProvider,msg=string} "获取成功"
// @Router /app/provider/list [get]
func (a *AiProviderApi) GetAiProviderList(c *gin.Context) {
list, err := aiProviderService.GetAiProviderList()
if err != nil {
global.GVA_LOG.Error("获取提供商列表失败!", zap.Error(err))
response.FailWithMessage("获取提供商列表失败", c)
return
}
response.OkWithData(list, c)
}
// TestConnection 测试连接
// @Tags AiProvider
// @Summary 测试AI提供商连接
// @accept application/json
// @Produce application/json
// @Param data body request.TestConnectionRequest true "连接信息"
// @Success 200 {object} response.Response{data=response.TestConnectionResponse,msg=string} "测试成功"
// @Router /app/provider/test [post]
func (a *AiProviderApi) TestConnection(c *gin.Context) {
var req request.TestConnectionRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
result, err := aiProviderService.TestConnection(&req)
if err != nil {
global.GVA_LOG.Error("测试连接失败!", zap.Error(err))
response.FailWithMessage("测试连接失败", c)
return
}
response.OkWithData(result, c)
}
// GetModels 获取模型列表
// @Tags AiProvider
// @Summary 获取AI提供商的模型列表
// @accept application/json
// @Produce application/json
// @Param data body request.GetModelsRequest true "提供商信息"
// @Success 200 {object} response.Response{data=[]response.ModelInfo,msg=string} "获取成功"
// @Router /app/provider/models [post]
func (a *AiProviderApi) GetModels(c *gin.Context) {
var req request.GetModelsRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
models, err := aiProviderService.GetModels(&req)
if err != nil {
global.GVA_LOG.Error("获取模型列表失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(models, c)
}

View File

@@ -0,0 +1,52 @@
package app
import (
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/model/app/request"
"git.echol.cn/loser/ai_proxy/server/model/common/response"
"git.echol.cn/loser/ai_proxy/server/service"
"git.echol.cn/loser/ai_proxy/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type AiProxyApi struct{}
var aiProxyService = service.ServiceGroupApp.AppServiceGroup.AiProxyService
// ChatCompletions OpenAI兼容的聊天补全接口
// @Tags AiProxy
// @Summary 聊天补全OpenAI兼容
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.ChatCompletionRequest true "聊天请求"
// @Success 200 {object} response.ChatCompletionResponse "聊天响应"
// @Router /v1/chat/completions [post]
func (a *AiProxyApi) ChatCompletions(c *gin.Context) {
var req request.ChatCompletionRequest
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
userId := utils.GetUserID(c)
// 处理流式响应
if req.Stream {
// TODO: 实现流式响应
response.FailWithMessage("流式响应暂未实现", c)
return
}
// 处理普通响应
resp, err := aiProxyService.ProcessChatCompletion(c.Request.Context(), userId, &req)
if err != nil {
global.GVA_LOG.Error("处理聊天请求失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
c.JSON(200, resp)
}

View File

@@ -0,0 +1,8 @@
package app
type ApiGroup struct {
AiPresetApi AiPresetApi
AiProviderApi AiProviderApi
AiProxyApi AiProxyApi
PresetBindingApi PresetBindingApi
}

13
server/api/v1/enter.go Normal file
View File

@@ -0,0 +1,13 @@
package v1
import (
"git.echol.cn/loser/ai_proxy/server/api/v1/app"
"git.echol.cn/loser/ai_proxy/server/api/v1/system"
)
var ApiGroupApp = new(ApiGroup)
type ApiGroup struct {
SystemApiGroup system.ApiGroup
AppApiGroup app.ApiGroup
}

View File

@@ -0,0 +1,6 @@
package system
type ApiGroup struct {
UserApi UserApi
ApiApi ApiApi
}

View File

@@ -0,0 +1,149 @@
package system
import (
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/model/common/response"
"git.echol.cn/loser/ai_proxy/server/model/system/request"
"git.echol.cn/loser/ai_proxy/server/service"
"git.echol.cn/loser/ai_proxy/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type ApiApi struct{}
var apiService = service.ServiceGroupApp.SystemServiceGroup.ApiService
// CreateApi 创建API
// @Tags System
// @Summary 创建API
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CreateApiRequest true "API信息"
// @Success 200 {object} response.Response{msg=string} "创建成功"
// @Router /v1/system/api [post]
func (a *ApiApi) CreateApi(c *gin.Context) {
var req request.CreateApiRequest
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err := apiService.CreateApi(&req)
if err != nil {
global.GVA_LOG.Error("创建API失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("创建成功", c)
}
// UpdateApi 更新API
// @Tags System
// @Summary 更新API
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.UpdateApiRequest true "API信息"
// @Success 200 {object} response.Response{msg=string} "更新成功"
// @Router /v1/system/api [put]
func (a *ApiApi) UpdateApi(c *gin.Context) {
var req request.UpdateApiRequest
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err := apiService.UpdateApi(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("更新成功", c)
}
// DeleteApi 删除API
// @Tags System
// @Summary 删除API
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "API ID"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /v1/system/api/:id [delete]
func (a *ApiApi) DeleteApi(c *gin.Context) {
id := utils.GetUintParam(c, "id")
err := apiService.DeleteApi(id)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
// GetApiList 获取API列表
// @Tags System
// @Summary 获取API列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param page query int false "页码"
// @Param pageSize query int false "每页数量"
// @Param path query string false "API路径"
// @Param apiGroup query string false "API分组"
// @Param method query string false "请求方法"
// @Success 200 {object} response.Response{data=response.PageResult} "获取成功"
// @Router /v1/system/api/list [get]
func (a *ApiApi) GetApiList(c *gin.Context) {
var req request.GetApiListRequest
if err := c.ShouldBindQuery(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
if req.Page == 0 {
req.Page = 1
}
if req.PageSize == 0 {
req.PageSize = 10
}
list, total, err := apiService.GetApiList(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: req.Page,
PageSize: req.PageSize,
}, "获取成功", c)
}
// GetApiById 根据ID获取API
// @Tags System
// @Summary 根据ID获取API
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "API ID"
// @Success 200 {object} response.Response{data=response.ApiInfo} "获取成功"
// @Router /v1/system/api/:id [get]
func (a *ApiApi) GetApiById(c *gin.Context) {
id := utils.GetUintParam(c, "id")
info, err := apiService.GetApiById(id)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(info, c)
}

View File

@@ -0,0 +1,199 @@
package system
import (
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/model/common/response"
"git.echol.cn/loser/ai_proxy/server/model/system/request"
"git.echol.cn/loser/ai_proxy/server/service"
"git.echol.cn/loser/ai_proxy/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type UserApi struct{}
var userService = service.ServiceGroupApp.SystemServiceGroup.UserService
// Login 用户登录
// @Tags System
// @Summary 用户登录
// @accept application/json
// @Produce application/json
// @Param data body request.LoginRequest true "用户名, 密码"
// @Success 200 {object} response.Response{data=response.LoginResponse} "登录成功"
// @Router /v1/system/user/login [post]
func (u *UserApi) Login(c *gin.Context) {
var req request.LoginRequest
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
resp, err := userService.Login(&req)
if err != nil {
global.GVA_LOG.Error("登录失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(resp, c)
}
// Register 用户注册
// @Tags System
// @Summary 用户注册
// @accept application/json
// @Produce application/json
// @Param data body request.RegisterRequest true "用户信息"
// @Success 200 {object} response.Response{msg=string} "注册成功"
// @Router /v1/system/user/register [post]
func (u *UserApi) Register(c *gin.Context) {
var req request.RegisterRequest
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
_, err := userService.Register(&req)
if err != nil {
global.GVA_LOG.Error("注册失败!", zap.Error(err))
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("注册成功", c)
}
// GetUserInfo 获取用户信息
// @Tags System
// @Summary 获取用户信息
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=response.UserInfo} "获取成功"
// @Router /v1/system/user/info [get]
func (u *UserApi) GetUserInfo(c *gin.Context) {
userID := utils.GetUserID(c)
info, err := userService.GetUserInfo(userID)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(info, c)
}
// GetUserList 获取用户列表
// @Tags System
// @Summary 获取用户列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param page query int false "页码"
// @Param pageSize query int false "每页数量"
// @Success 200 {object} response.Response{data=response.PageResult} "获取成功"
// @Router /v1/system/user/list [get]
func (u *UserApi) GetUserList(c *gin.Context) {
page := utils.GetIntQuery(c, "page", 1)
pageSize := utils.GetIntQuery(c, "pageSize", 10)
list, total, err := userService.GetUserList(page, pageSize)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: page,
PageSize: pageSize,
}, "获取成功", c)
}
// UpdateUser 更新用户
// @Tags System
// @Summary 更新用户
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.UpdateUserRequest true "用户信息"
// @Success 200 {object} response.Response{msg=string} "更新成功"
// @Router /v1/system/user [put]
func (u *UserApi) UpdateUser(c *gin.Context) {
var req request.UpdateUserRequest
if err := c.ShouldBindJSON(&req); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
err := userService.UpdateUser(&req)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("更新成功", c)
}
// DeleteUser 删除用户
// @Tags System
// @Summary 删除用户
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id path uint true "用户ID"
// @Success 200 {object} response.Response{msg=string} "删除成功"
// @Router /v1/system/user/:id [delete]
func (u *UserApi) DeleteUser(c *gin.Context) {
userID := utils.GetUintParam(c, "id")
err := userService.DeleteUser(userID)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
}
// GetAPIKey 获取API密钥
// @Tags System
// @Summary 获取API密钥
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=string} "获取成功"
// @Router /v1/system/user/apikey [get]
func (u *UserApi) GetAPIKey(c *gin.Context) {
userID := utils.GetUserID(c)
apiKey, err := userService.GetAPIKey(userID)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(gin.H{"apiKey": apiKey}, c)
}
// RegenerateAPIKey 重新生成API密钥
// @Tags System
// @Summary 重新生成API密钥
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {object} response.Response{data=string} "生成成功"
// @Router /v1/system/user/apikey/regenerate [post]
func (u *UserApi) RegenerateAPIKey(c *gin.Context) {
userID := utils.GetUserID(c)
apiKey, err := userService.RegenerateAPIKey(userID)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(gin.H{"apiKey": apiKey}, c)
}

285
server/config.docker.yaml Normal file
View File

@@ -0,0 +1,285 @@
# git.echol.cn/loser/ai_proxy/server Global Configuration
# jwt configuration
jwt:
signing-key: qmPlus
expires-time: 7d
buffer-time: 1d
issuer: qmPlus
# zap logger configuration
zap:
level: info
format: console
prefix: "[git.echol.cn/loser/ai_proxy/server]"
director: log
show-line: true
encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace
log-in-console: true
retention-day: -1
# redis configuration
redis:
#是否使用redis集群模式
useCluster: false
#使用集群模式addr和db默认无效
addr: 177.7.0.14:6379
password: ""
db: 0
clusterAddrs:
- "177.7.0.14:7000"
- "177.7.0.15:7001"
- "177.7.0.13:7002"
# redis-list configuration
redis-list:
- name: cache # 数据库的名称,注意: name 需要在 redis-list 中唯一
useCluster: false # 是否使用redis集群模式
addr: 177.7.0.14:6379 # 使用集群模式addr和db默认无效
password: ""
db: 0
clusterAddrs:
- "177.7.0.14:7000"
- "177.7.0.15:7001"
- "177.7.0.13:7002"
# mongo configuration
mongo:
coll: ''
options: ''
database: ''
username: ''
password: ''
auth-source: ''
min-pool-size: 0
max-pool-size: 100
socket-timeout-ms: 0
connect-timeout-ms: 0
is-zap: false
hosts:
- host: ''
port: ''
# email configuration
email:
to: xxx@qq.com
port: 465
from: xxx@163.com
host: smtp.163.com
is-ssl: true
secret: xxx
nickname: test
# system configuration
system:
env: local # 修改为public可以关闭路由日志输出
addr: 8888
db-type: mysql
oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
use-redis: false # 使用redis
use-mongo: false # 使用mongo
use-multipoint: false
# IP限制次数 一个小时15000次
iplimit-count: 15000
# IP限制一个小时
iplimit-time: 3600
# 路由全局前缀
router-prefix: ""
# 严格角色模式 打开后权限将会存在上下级关系
use-strict-auth: false
# captcha configuration
captcha:
key-long: 6
img-width: 240
img-height: 80
open-captcha: 0 # 0代表一直开启大于0代表限制次数
open-captcha-timeout: 3600 # open-captcha大于0时才生效
# mysql connect configuration
# 未初始化之前请勿手动修改数据库信息如果一定要手动初始化请看https://gin-vue-admin.com/docs/first_master
mysql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
# pgsql connect configuration
# 未初始化之前请勿手动修改数据库信息如果一定要手动初始化请看https://gin-vue-admin.com/docs/first_master
pgsql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
oracle:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
mssql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
sqlite:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
db-list:
- disable: true # 是否禁用
type: "" # 数据库的类型,目前支持mysql、pgsql、mssql、oracle
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
# local configuration
local:
path: uploads/file
store-path: uploads/file
# autocode configuration
autocode:
web: web/src
root: "" # root 自动适配项目根目录, 请不要手动配置,他会在项目加载的时候识别出根路径
server: server
module: 'git.echol.cn/loser/ai_proxy/server'
ai-path: "" # AI服务路径
# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址)
qiniu:
zone: ZoneHuaDong
bucket: ""
img-path: ""
use-https: false
access-key: ""
secret-key: ""
use-cdn-domains: false
# minio oss configuration
minio:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
use-ssl: false
base-path: ""
bucket-url: "http://host:9000/yourBucketName"
# aliyun oss configuration
aliyun-oss:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
bucket-url: yourBucketUrl
base-path: yourBasePath
# tencent cos configuration
tencent-cos:
bucket: xxxxx-10005608
region: ap-shanghai
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: git.echol.cn/loser/ai_proxy/server
# aws s3 configuration (minio compatible)
aws-s3:
bucket: xxxxx-10005608
region: ap-shanghai
endpoint: ""
s3-force-path-style: false
disable-ssl: false
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: git.echol.cn/loser/ai_proxy/server
# cloudflare r2 configuration
cloudflare-r2:
bucket: xxxx0bucket
base-url: https://gin.vue.admin.com
path: uploads
account-id: xxx_account_id
access-key-id: xxx_key_id
secret-access-key: xxx_secret_key
# huawei obs configuration
hua-wei-obs:
path: you-path
bucket: you-bucket
endpoint: you-endpoint
access-key: you-access-key
secret-key: you-secret-key
# excel configuration
excel:
dir: ./resource/excel/
# disk usage configuration
disk-list:
- mount-point: "/"
# 跨域配置
# 需要配合 server/initialize/router.go -> `Router.Use(middleware.CorsByRules())` 使用
cors:
mode: strict-whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝
whitelist:
- allow-origin: example1.com
allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id
allow-methods: POST, GET
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
- allow-origin: example2.com
allow-headers: content-type
allow-methods: GET, POST
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
mcp:
name: GVA_MCP
version: v1.0.0
sse_path: /sse
message_path: /message
url_prefix: ''
addr: 8889
separate: false

267
server/config.yaml Normal file
View File

@@ -0,0 +1,267 @@
aliyun-oss:
endpoint: oss-cn-hangzhou.aliyuncs.com
access-key-id: LTAI5tB3Mn5Y7mVo8h3zkf46
access-key-secret: FtuHdFy4NFdVItEiNBnTun3Ddi8BMK
bucket-name: lckt
bucket-url: https://lckt.oss-cn-hangzhou.aliyuncs.com
base-path: st
autocode:
web: web/src
root: /Users/en/GolandProjects/st
server: server
module: git.echol.cn/loser/ai_proxy/server
ai-path: ""
aws-s3:
bucket: xxxxx-10005608
region: ap-shanghai
endpoint: ""
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: git.echol.cn/loser/ai_proxy/server
s3-force-path-style: false
disable-ssl: false
captcha:
key-long: 4
img-width: 240
img-height: 80
open-captcha: 0
open-captcha-timeout: 3600
cloudflare-r2:
bucket: xxxx0bucket
base-url: https://gin.vue.admin.com
path: uploads
account-id: xxx_account_id
access-key-id: xxx_key_id
secret-access-key: xxx_secret_key
cors:
mode: strict-whitelist
whitelist:
- allow-origin: example1.com
allow-methods: POST, GET
allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true
- allow-origin: example2.com
allow-methods: GET, POST
allow-headers: content-type
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true
db-list:
- type: ""
alias-name: ""
prefix: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
path: ""
engine: ""
log-mode: ""
max-idle-conns: 10
max-open-conns: 100
singular: false
log-zap: false
disable: true
disk-list:
- mount-point: /
email:
to: xxx@qq.com
from: xxx@163.com
host: smtp.163.com
secret: xxx
nickname: test
port: 465
is-ssl: true
is-loginauth: false
excel:
dir: ./resource/excel/
hua-wei-obs:
path: you-path
bucket: you-bucket
endpoint: you-endpoint
access-key: you-access-key
secret-key: you-secret-key
use-ssl: false
jwt:
signing-key: 53d59b59-dba8-4f83-886e-e5bd1bf3cbda
expires-time: 7d
buffer-time: 1d
issuer: qmPlus
local:
path: http://localhost:8888/uploads/file
store-path: uploads/file
mcp:
name: GVA_MCP
version: v1.0.0
sse_path: /sse
message_path: /message
url_prefix: ""
addr: 8889
separate: false
minio:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
use-ssl: false
base-path: ""
bucket-url: http://host:9000/yourBucketName
mongo:
coll: ""
options: ""
database: ""
username: ""
password: ""
auth-source: ""
min-pool-size: 0
max-pool-size: 100
socket-timeout-ms: 0
connect-timeout-ms: 0
is-zap: false
hosts:
- host: ""
port: ""
mssql:
prefix: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
path: ""
engine: ""
log-mode: ""
max-idle-conns: 10
max-open-conns: 100
singular: false
log-zap: false
mysql:
prefix: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
path: ""
engine: ""
log-mode: ""
max-idle-conns: 10
max-open-conns: 100
singular: false
log-zap: false
oracle:
prefix: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
path: ""
engine: ""
log-mode: ""
max-idle-conns: 10
max-open-conns: 100
singular: false
log-zap: false
#pgsql:
# prefix: ""
# port: "5432"
# config: sslmode=disable TimeZone=Asia/Shanghai
# db-name: st_dev
# username: postgres
# password: loser765911.
# path: 149.88.74.188
# engine: ""
# log-mode: error
# max-idle-conns: 10
# max-open-conns: 100
# singular: false
# log-zap: false
pgsql:
prefix: ""
port: "5432"
config: sslmode=disable TimeZone=Asia/Shanghai
db-name: ai_proxy
username: postgres
password: e5zse3Adrja7PNfA
path: 219.152.55.29
engine: ""
log-mode: error
max-idle-conns: 10
max-open-conns: 100
singular: false
log-zap: true
qiniu:
zone: ZoneHuaDong
bucket: ""
img-path: ""
access-key: ""
secret-key: ""
use-https: false
use-cdn-domains: false
redis:
name: "sys-cache"
addr: 219.152.55.29:6379
password: "THBA@6688"
db: 7
useCluster: false
clusterAddrs:
- 172.21.0.3:7000
- 172.21.0.4:7001
- 172.21.0.2:7002
redis-list:
- name: app-cache
addr: 219.152.55.29:6379
password: "THBA@6688"
db: 6
useCluster: false
clusterAddrs:
- 172.21.0.3:7000
- 172.21.0.4:7001
- 172.21.0.2:7002
sqlite:
prefix: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
path: ""
engine: ""
log-mode: ""
max-idle-conns: 10
max-open-conns: 100
singular: false
log-zap: false
system:
db-type: pgsql
oss-type: aliyun-oss
router-prefix: ""
addr: 8889
iplimit-count: 15000
iplimit-time: 3600
use-multipoint: false
use-redis: true
use-mongo: false
use-strict-auth: false
disable-auto-migrate: false
data-dir: data
tencent-cos:
bucket: xxxxx-10005608
region: ap-shanghai
secret-id: your-secret-id
secret-key: your-secret-key
base-url: https://gin.vue.admin
path-prefix: git.echol.cn/loser/ai_proxy/server
zap:
level: info
prefix: '[git.echol.cn/loser/ai_proxy/server]'
format: console
director: log
encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace
show-line: true
log-in-console: true
retention-day: -1

View File

@@ -0,0 +1,22 @@
package config
import (
"path/filepath"
"strings"
)
type Autocode struct {
Web string `mapstructure:"web" json:"web" yaml:"web"`
Root string `mapstructure:"root" json:"root" yaml:"root"`
Server string `mapstructure:"server" json:"server" yaml:"server"`
Module string `mapstructure:"module" json:"module" yaml:"module"`
AiPath string `mapstructure:"ai-path" json:"ai-path" yaml:"ai-path"`
}
func (a *Autocode) WebRoot() string {
webs := strings.Split(a.Web, "/")
if len(webs) == 0 {
webs = strings.Split(a.Web, "\\")
}
return filepath.Join(webs...)
}

9
server/config/captcha.go Normal file
View File

@@ -0,0 +1,9 @@
package config
type Captcha struct {
KeyLong int `mapstructure:"key-long" json:"key-long" yaml:"key-long"` // 验证码长度
ImgWidth int `mapstructure:"img-width" json:"img-width" yaml:"img-width"` // 验证码宽度
ImgHeight int `mapstructure:"img-height" json:"img-height" yaml:"img-height"` // 验证码高度
OpenCaptcha int `mapstructure:"open-captcha" json:"open-captcha" yaml:"open-captcha"` // 防爆破验证码开启此数0代表每次登录都需要验证码其他数字代表错误密码次数如3代表错误三次后出现验证码
OpenCaptchaTimeOut int `mapstructure:"open-captcha-timeout" json:"open-captcha-timeout" yaml:"open-captcha-timeout"` // 防爆破验证码超时时间单位s(秒)
}

40
server/config/config.go Normal file
View File

@@ -0,0 +1,40 @@
package config
type Server struct {
JWT JWT `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
RedisList []Redis `mapstructure:"redis-list" json:"redis-list" yaml:"redis-list"`
Mongo Mongo `mapstructure:"mongo" json:"mongo" yaml:"mongo"`
Email Email `mapstructure:"email" json:"email" yaml:"email"`
System System `mapstructure:"system" json:"system" yaml:"system"`
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
// auto
AutoCode Autocode `mapstructure:"autocode" json:"autocode" yaml:"autocode"`
// gorm
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
Mssql Mssql `mapstructure:"mssql" json:"mssql" yaml:"mssql"`
Pgsql Pgsql `mapstructure:"pgsql" json:"pgsql" yaml:"pgsql"`
Oracle Oracle `mapstructure:"oracle" json:"oracle" yaml:"oracle"`
Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite" yaml:"sqlite"`
DBList []SpecializedDB `mapstructure:"db-list" json:"db-list" yaml:"db-list"`
// oss
Local Local `mapstructure:"local" json:"local" yaml:"local"`
Qiniu Qiniu `mapstructure:"qiniu" json:"qiniu" yaml:"qiniu"`
AliyunOSS AliyunOSS `mapstructure:"aliyun-oss" json:"aliyun-oss" yaml:"aliyun-oss"`
HuaWeiObs HuaWeiObs `mapstructure:"hua-wei-obs" json:"hua-wei-obs" yaml:"hua-wei-obs"`
TencentCOS TencentCOS `mapstructure:"tencent-cos" json:"tencent-cos" yaml:"tencent-cos"`
AwsS3 AwsS3 `mapstructure:"aws-s3" json:"aws-s3" yaml:"aws-s3"`
CloudflareR2 CloudflareR2 `mapstructure:"cloudflare-r2" json:"cloudflare-r2" yaml:"cloudflare-r2"`
Minio Minio `mapstructure:"minio" json:"minio" yaml:"minio"`
Excel Excel `mapstructure:"excel" json:"excel" yaml:"excel"`
DiskList []DiskList `mapstructure:"disk-list" json:"disk-list" yaml:"disk-list"`
// 跨域配置
Cors CORS `mapstructure:"cors" json:"cors" yaml:"cors"`
// MCP配置
MCP MCP `mapstructure:"mcp" json:"mcp" yaml:"mcp"`
}

14
server/config/cors.go Normal file
View File

@@ -0,0 +1,14 @@
package config
type CORS struct {
Mode string `mapstructure:"mode" json:"mode" yaml:"mode"`
Whitelist []CORSWhitelist `mapstructure:"whitelist" json:"whitelist" yaml:"whitelist"`
}
type CORSWhitelist struct {
AllowOrigin string `mapstructure:"allow-origin" json:"allow-origin" yaml:"allow-origin"`
AllowMethods string `mapstructure:"allow-methods" json:"allow-methods" yaml:"allow-methods"`
AllowHeaders string `mapstructure:"allow-headers" json:"allow-headers" yaml:"allow-headers"`
ExposeHeaders string `mapstructure:"expose-headers" json:"expose-headers" yaml:"expose-headers"`
AllowCredentials bool `mapstructure:"allow-credentials" json:"allow-credentials" yaml:"allow-credentials"`
}

53
server/config/db_list.go Normal file
View File

@@ -0,0 +1,53 @@
package config
import (
"strings"
"gorm.io/gorm/logger"
)
type DsnProvider interface {
Dsn() string
}
// Embeded 结构体可以压平到上一层,从而保持 config 文件的结构和原来一样
// 见 playground: https://go.dev/play/p/KIcuhqEoxmY
// GeneralDB 也被 Pgsql 和 Mysql 原样使用
type GeneralDB struct {
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` // 数据库前缀
Port string `mapstructure:"port" json:"port" yaml:"port"` // 数据库端口
Config string `mapstructure:"config" json:"config" yaml:"config"` // 高级配置
Dbname string `mapstructure:"db-name" json:"db-name" yaml:"db-name"` // 数据库名
Username string `mapstructure:"username" json:"username" yaml:"username"` // 数据库账号
Password string `mapstructure:"password" json:"password" yaml:"password"` // 数据库密码
Path string `mapstructure:"path" json:"path" yaml:"path"` // 数据库地址
Engine string `mapstructure:"engine" json:"engine" yaml:"engine" default:"InnoDB"` // 数据库引擎默认InnoDB
LogMode string `mapstructure:"log-mode" json:"log-mode" yaml:"log-mode"` // 是否开启Gorm全局日志
MaxIdleConns int `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns"` // 空闲中的最大连接数
MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns"` // 打开到数据库的最大连接数
Singular bool `mapstructure:"singular" json:"singular" yaml:"singular"` // 是否开启全局禁用复数true表示开启
LogZap bool `mapstructure:"log-zap" json:"log-zap" yaml:"log-zap"` // 是否通过zap写入日志文件
}
func (c GeneralDB) LogLevel() logger.LogLevel {
switch strings.ToLower(c.LogMode) {
case "silent":
return logger.Silent
case "error":
return logger.Error
case "warn":
return logger.Warn
case "info":
return logger.Info
default:
return logger.Info
}
}
type SpecializedDB struct {
Type string `mapstructure:"type" json:"type" yaml:"type"`
AliasName string `mapstructure:"alias-name" json:"alias-name" yaml:"alias-name"`
GeneralDB `yaml:",inline" mapstructure:",squash"`
Disable bool `mapstructure:"disable" json:"disable" yaml:"disable"`
}

9
server/config/disk.go Normal file
View File

@@ -0,0 +1,9 @@
package config
type Disk struct {
MountPoint string `mapstructure:"mount-point" json:"mount-point" yaml:"mount-point"`
}
type DiskList struct {
Disk `yaml:",inline" mapstructure:",squash"`
}

12
server/config/email.go Normal file
View File

@@ -0,0 +1,12 @@
package config
type Email struct {
To string `mapstructure:"to" json:"to" yaml:"to"` // 收件人:多个以英文逗号分隔 例a@qq.com b@qq.com 正式开发中请把此项目作为参数使用
From string `mapstructure:"from" json:"from" yaml:"from"` // 发件人 你自己要发邮件的邮箱
Host string `mapstructure:"host" json:"host" yaml:"host"` // 服务器地址 例如 smtp.qq.com 请前往QQ或者你要发邮件的邮箱查看其smtp协议
Secret string `mapstructure:"secret" json:"secret" yaml:"secret"` // 密钥 用于登录的密钥 最好不要用邮箱密码 去邮箱smtp申请一个用于登录的密钥
Nickname string `mapstructure:"nickname" json:"nickname" yaml:"nickname"` // 昵称 发件人昵称 通常为自己的邮箱
Port int `mapstructure:"port" json:"port" yaml:"port"` // 端口 请前往QQ或者你要发邮件的邮箱查看其smtp协议 大多为 465
IsSSL bool `mapstructure:"is-ssl" json:"is-ssl" yaml:"is-ssl"` // 是否SSL 是否开启SSL
IsLoginAuth bool `mapstructure:"is-loginauth" json:"is-loginauth" yaml:"is-loginauth"` // 是否LoginAuth 是否使用LoginAuth认证方式适用于IBM、微软邮箱服务器等
}

5
server/config/excel.go Normal file
View File

@@ -0,0 +1,5 @@
package config
type Excel struct {
Dir string `mapstructure:"dir" json:"dir" yaml:"dir"`
}

View File

@@ -0,0 +1,10 @@
package config
type Mssql struct {
GeneralDB `yaml:",inline" mapstructure:",squash"`
}
// Dsn "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
func (m *Mssql) Dsn() string {
return "sqlserver://" + m.Username + ":" + m.Password + "@" + m.Path + ":" + m.Port + "?database=" + m.Dbname + "&encrypt=disable"
}

View File

@@ -0,0 +1,9 @@
package config
type Mysql struct {
GeneralDB `yaml:",inline" mapstructure:",squash"`
}
func (m *Mysql) Dsn() string {
return m.Username + ":" + m.Password + "@tcp(" + m.Path + ":" + m.Port + ")/" + m.Dbname + "?" + m.Config
}

View File

@@ -0,0 +1,18 @@
package config
import (
"fmt"
"net"
"net/url"
)
type Oracle struct {
GeneralDB `yaml:",inline" mapstructure:",squash"`
}
func (m *Oracle) Dsn() string {
dsn := fmt.Sprintf("oracle://%s:%s@%s/%s?%s", url.PathEscape(m.Username), url.PathEscape(m.Password),
net.JoinHostPort(m.Path, m.Port), url.PathEscape(m.Dbname), m.Config)
return dsn
}

View File

@@ -0,0 +1,17 @@
package config
type Pgsql struct {
GeneralDB `yaml:",inline" mapstructure:",squash"`
}
// Dsn 基于配置文件获取 dsn
// Author [SliverHorn](https://github.com/SliverHorn)
func (p *Pgsql) Dsn() string {
return "host=" + p.Path + " user=" + p.Username + " password=" + p.Password + " dbname=" + p.Dbname + " port=" + p.Port + " " + p.Config
}
// LinkDsn 根据 dbname 生成 dsn
// Author [SliverHorn](https://github.com/SliverHorn)
func (p *Pgsql) LinkDsn(dbname string) string {
return "host=" + p.Path + " user=" + p.Username + " password=" + p.Password + " dbname=" + dbname + " port=" + p.Port + " " + p.Config
}

View File

@@ -0,0 +1,13 @@
package config
import (
"path/filepath"
)
type Sqlite struct {
GeneralDB `yaml:",inline" mapstructure:",squash"`
}
func (s *Sqlite) Dsn() string {
return filepath.Join(s.Path, s.Dbname+".db")
}

8
server/config/jwt.go Normal file
View File

@@ -0,0 +1,8 @@
package config
type JWT struct {
SigningKey string `mapstructure:"signing-key" json:"signing-key" yaml:"signing-key"` // jwt签名
ExpiresTime string `mapstructure:"expires-time" json:"expires-time" yaml:"expires-time"` // 过期时间
BufferTime string `mapstructure:"buffer-time" json:"buffer-time" yaml:"buffer-time"` // 缓冲时间
Issuer string `mapstructure:"issuer" json:"issuer" yaml:"issuer"` // 签发者
}

11
server/config/mcp.go Normal file
View File

@@ -0,0 +1,11 @@
package config
type MCP struct {
Name string `mapstructure:"name" json:"name" yaml:"name"` // MCP名称
Version string `mapstructure:"version" json:"version" yaml:"version"` // MCP版本
SSEPath string `mapstructure:"sse_path" json:"sse_path" yaml:"sse_path"` // SSE路径
MessagePath string `mapstructure:"message_path" json:"message_path" yaml:"message_path"` // 消息路径
UrlPrefix string `mapstructure:"url_prefix" json:"url_prefix" yaml:"url_prefix"` // URL前缀
Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` // 独立MCP服务端口
Separate bool `mapstructure:"separate" json:"separate" yaml:"separate"` // 是否独立运行MCP服务
}

41
server/config/mongo.go Normal file
View File

@@ -0,0 +1,41 @@
package config
import (
"fmt"
"strings"
)
type Mongo struct {
Coll string `json:"coll" yaml:"coll" mapstructure:"coll"` // collection name
Options string `json:"options" yaml:"options" mapstructure:"options"` // mongodb options
Database string `json:"database" yaml:"database" mapstructure:"database"` // database name
Username string `json:"username" yaml:"username" mapstructure:"username"` // 用户名
Password string `json:"password" yaml:"password" mapstructure:"password"` // 密码
AuthSource string `json:"auth-source" yaml:"auth-source" mapstructure:"auth-source"` // 验证数据库
MinPoolSize uint64 `json:"min-pool-size" yaml:"min-pool-size" mapstructure:"min-pool-size"` // 最小连接池
MaxPoolSize uint64 `json:"max-pool-size" yaml:"max-pool-size" mapstructure:"max-pool-size"` // 最大连接池
SocketTimeoutMs int64 `json:"socket-timeout-ms" yaml:"socket-timeout-ms" mapstructure:"socket-timeout-ms"` // socket超时时间
ConnectTimeoutMs int64 `json:"connect-timeout-ms" yaml:"connect-timeout-ms" mapstructure:"connect-timeout-ms"` // 连接超时时间
IsZap bool `json:"is-zap" yaml:"is-zap" mapstructure:"is-zap"` // 是否开启zap日志
Hosts []*MongoHost `json:"hosts" yaml:"hosts" mapstructure:"hosts"` // 主机列表
}
type MongoHost struct {
Host string `json:"host" yaml:"host" mapstructure:"host"` // ip地址
Port string `json:"port" yaml:"port" mapstructure:"port"` // 端口
}
// Uri .
func (x *Mongo) Uri() string {
length := len(x.Hosts)
hosts := make([]string, 0, length)
for i := 0; i < length; i++ {
if x.Hosts[i].Host != "" && x.Hosts[i].Port != "" {
hosts = append(hosts, x.Hosts[i].Host+":"+x.Hosts[i].Port)
}
}
if x.Options != "" {
return fmt.Sprintf("mongodb://%s/%s?%s", strings.Join(hosts, ","), x.Database, x.Options)
}
return fmt.Sprintf("mongodb://%s/%s", strings.Join(hosts, ","), x.Database)
}

View File

@@ -0,0 +1,10 @@
package config
type AliyunOSS struct {
Endpoint string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
AccessKeyId string `mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id"`
AccessKeySecret string `mapstructure:"access-key-secret" json:"access-key-secret" yaml:"access-key-secret"`
BucketName string `mapstructure:"bucket-name" json:"bucket-name" yaml:"bucket-name"`
BucketUrl string `mapstructure:"bucket-url" json:"bucket-url" yaml:"bucket-url"`
BasePath string `mapstructure:"base-path" json:"base-path" yaml:"base-path"`
}

13
server/config/oss_aws.go Normal file
View File

@@ -0,0 +1,13 @@
package config
type AwsS3 struct {
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
Region string `mapstructure:"region" json:"region" yaml:"region"`
Endpoint string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
SecretID string `mapstructure:"secret-id" json:"secret-id" yaml:"secret-id"`
SecretKey string `mapstructure:"secret-key" json:"secret-key" yaml:"secret-key"`
BaseURL string `mapstructure:"base-url" json:"base-url" yaml:"base-url"`
PathPrefix string `mapstructure:"path-prefix" json:"path-prefix" yaml:"path-prefix"`
S3ForcePathStyle bool `mapstructure:"s3-force-path-style" json:"s3-force-path-style" yaml:"s3-force-path-style"`
DisableSSL bool `mapstructure:"disable-ssl" json:"disable-ssl" yaml:"disable-ssl"`
}

View File

@@ -0,0 +1,10 @@
package config
type CloudflareR2 struct {
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
BaseURL string `mapstructure:"base-url" json:"base-url" yaml:"base-url"`
Path string `mapstructure:"path" json:"path" yaml:"path"`
AccountID string `mapstructure:"account-id" json:"account-id" yaml:"account-id"`
AccessKeyID string `mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id"`
SecretAccessKey string `mapstructure:"secret-access-key" json:"secret-access-key" yaml:"secret-access-key"`
}

View File

@@ -0,0 +1,9 @@
package config
type HuaWeiObs struct {
Path string `mapstructure:"path" json:"path" yaml:"path"`
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
Endpoint string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
AccessKey string `mapstructure:"access-key" json:"access-key" yaml:"access-key"`
SecretKey string `mapstructure:"secret-key" json:"secret-key" yaml:"secret-key"`
}

View File

@@ -0,0 +1,6 @@
package config
type Local struct {
Path string `mapstructure:"path" json:"path" yaml:"path"` // 本地文件访问路径
StorePath string `mapstructure:"store-path" json:"store-path" yaml:"store-path"` // 本地文件存储路径
}

View File

@@ -0,0 +1,11 @@
package config
type Minio struct {
Endpoint string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
AccessKeyId string `mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id"`
AccessKeySecret string `mapstructure:"access-key-secret" json:"access-key-secret" yaml:"access-key-secret"`
BucketName string `mapstructure:"bucket-name" json:"bucket-name" yaml:"bucket-name"`
UseSSL bool `mapstructure:"use-ssl" json:"use-ssl" yaml:"use-ssl"`
BasePath string `mapstructure:"base-path" json:"base-path" yaml:"base-path"`
BucketUrl string `mapstructure:"bucket-url" json:"bucket-url" yaml:"bucket-url"`
}

View File

@@ -0,0 +1,11 @@
package config
type Qiniu struct {
Zone string `mapstructure:"zone" json:"zone" yaml:"zone"` // 存储区域
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"` // 空间名称
ImgPath string `mapstructure:"img-path" json:"img-path" yaml:"img-path"` // CDN加速域名
AccessKey string `mapstructure:"access-key" json:"access-key" yaml:"access-key"` // 秘钥AK
SecretKey string `mapstructure:"secret-key" json:"secret-key" yaml:"secret-key"` // 秘钥SK
UseHTTPS bool `mapstructure:"use-https" json:"use-https" yaml:"use-https"` // 是否使用https
UseCdnDomains bool `mapstructure:"use-cdn-domains" json:"use-cdn-domains" yaml:"use-cdn-domains"` // 上传是否使用CDN上传加速
}

View File

@@ -0,0 +1,10 @@
package config
type TencentCOS struct {
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
Region string `mapstructure:"region" json:"region" yaml:"region"`
SecretID string `mapstructure:"secret-id" json:"secret-id" yaml:"secret-id"`
SecretKey string `mapstructure:"secret-key" json:"secret-key" yaml:"secret-key"`
BaseURL string `mapstructure:"base-url" json:"base-url" yaml:"base-url"`
PathPrefix string `mapstructure:"path-prefix" json:"path-prefix" yaml:"path-prefix"`
}

10
server/config/redis.go Normal file
View File

@@ -0,0 +1,10 @@
package config
type Redis struct {
Name string `mapstructure:"name" json:"name" yaml:"name"` // 代表当前实例的名字
Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` // 服务器地址:端口
Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码
DB int `mapstructure:"db" json:"db" yaml:"db"` // 单实例模式下redis的哪个数据库
UseCluster bool `mapstructure:"useCluster" json:"useCluster" yaml:"useCluster"` // 是否使用集群模式
ClusterAddrs []string `mapstructure:"clusterAddrs" json:"clusterAddrs" yaml:"clusterAddrs"` // 集群模式下的节点地址列表
}

16
server/config/system.go Normal file
View File

@@ -0,0 +1,16 @@
package config
type System struct {
DbType string `mapstructure:"db-type" json:"db-type" yaml:"db-type"` // 数据库类型:mysql(默认)|sqlite|sqlserver|postgresql
OssType string `mapstructure:"oss-type" json:"oss-type" yaml:"oss-type"` // Oss类型
RouterPrefix string `mapstructure:"router-prefix" json:"router-prefix" yaml:"router-prefix"`
Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` // 端口值
LimitCountIP int `mapstructure:"iplimit-count" json:"iplimit-count" yaml:"iplimit-count"`
LimitTimeIP int `mapstructure:"iplimit-time" json:"iplimit-time" yaml:"iplimit-time"`
UseMultipoint bool `mapstructure:"use-multipoint" json:"use-multipoint" yaml:"use-multipoint"` // 多点登录拦截
UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis"` // 使用redis
UseMongo bool `mapstructure:"use-mongo" json:"use-mongo" yaml:"use-mongo"` // 使用mongo
UseStrictAuth bool `mapstructure:"use-strict-auth" json:"use-strict-auth" yaml:"use-strict-auth"` // 使用树形角色分配模式
DisableAutoMigrate bool `mapstructure:"disable-auto-migrate" json:"disable-auto-migrate" yaml:"disable-auto-migrate"` // 自动迁移数据库表结构生产环境建议设为false手动迁移
DataDir string `mapstructure:"data-dir" json:"data-dir" yaml:"data-dir"` // 数据目录
}

72
server/config/zap.go Normal file
View File

@@ -0,0 +1,72 @@
package config
import (
"time"
"go.uber.org/zap/zapcore"
)
type Zap struct {
Level string `mapstructure:"level" json:"level" yaml:"level"` // 级别
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` // 日志前缀
Format string `mapstructure:"format" json:"format" yaml:"format"` // 输出
Director string `mapstructure:"director" json:"director" yaml:"director"` // 日志文件夹
EncodeLevel string `mapstructure:"encode-level" json:"encode-level" yaml:"encode-level"` // 编码级
StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // 栈名
ShowLine bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"` // 显示行
LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // 输出控制台
RetentionDay int `mapstructure:"retention-day" json:"retention-day" yaml:"retention-day"` // 日志保留天数
}
// Levels 根据字符串转化为 zapcore.Levels
func (c *Zap) Levels() []zapcore.Level {
levels := make([]zapcore.Level, 0, 7)
level, err := zapcore.ParseLevel(c.Level)
if err != nil {
level = zapcore.DebugLevel
}
for ; level <= zapcore.FatalLevel; level++ {
levels = append(levels, level)
}
return levels
}
func (c *Zap) Encoder() zapcore.Encoder {
config := zapcore.EncoderConfig{
TimeKey: "time",
NameKey: "name",
LevelKey: "level",
CallerKey: "caller",
MessageKey: "message",
StacktraceKey: c.StacktraceKey,
LineEnding: zapcore.DefaultLineEnding,
EncodeTime: func(t time.Time, encoder zapcore.PrimitiveArrayEncoder) {
encoder.AppendString(c.Prefix + t.Format("2006-01-02 15:04:05.000"))
},
EncodeLevel: c.LevelEncoder(),
EncodeCaller: zapcore.FullCallerEncoder,
EncodeDuration: zapcore.SecondsDurationEncoder,
}
if c.Format == "json" {
return zapcore.NewJSONEncoder(config)
}
return zapcore.NewConsoleEncoder(config)
}
// LevelEncoder 根据 EncodeLevel 返回 zapcore.LevelEncoder
// Author [SliverHorn](https://github.com/SliverHorn)
func (c *Zap) LevelEncoder() zapcore.LevelEncoder {
switch {
case c.EncodeLevel == "LowercaseLevelEncoder": // 小写编码器(默认)
return zapcore.LowercaseLevelEncoder
case c.EncodeLevel == "LowercaseColorLevelEncoder": // 小写编码器带颜色
return zapcore.LowercaseColorLevelEncoder
case c.EncodeLevel == "CapitalLevelEncoder": // 大写编码器
return zapcore.CapitalLevelEncoder
case c.EncodeLevel == "CapitalColorLevelEncoder": // 大写编码器带颜色
return zapcore.CapitalColorLevelEncoder
default:
return zapcore.LowercaseLevelEncoder
}
}

View File

@@ -0,0 +1,9 @@
package internal
const (
ConfigEnv = "GVA_CONFIG"
ConfigDefaultFile = "config.yaml"
ConfigTestFile = "config.test.yaml"
ConfigDebugFile = "config.debug.yaml"
ConfigReleaseFile = "config.release.yaml"
)

View File

@@ -0,0 +1,125 @@
package internal
import (
"fmt"
"os"
"path/filepath"
"sync"
"time"
)
// Cutter 实现 io.Writer 接口
// 用于日志切割, strings.Join([]string{director,layout, formats..., level+".log"}, os.PathSeparator)
type Cutter struct {
level string // 日志级别(debug, info, warn, error, dpanic, panic, fatal)
layout string // 时间格式 2006-01-02 15:04:05
formats []string // 自定义参数([]string{Director,"2006-01-02", "business"(此参数可不写), level+".log"}
director string // 日志文件夹
retentionDay int //日志保留天数
file *os.File // 文件句柄
mutex *sync.RWMutex // 读写锁
}
type CutterOption func(*Cutter)
// CutterWithLayout 时间格式
func CutterWithLayout(layout string) CutterOption {
return func(c *Cutter) {
c.layout = layout
}
}
// CutterWithFormats 格式化参数
func CutterWithFormats(format ...string) CutterOption {
return func(c *Cutter) {
if len(format) > 0 {
c.formats = format
}
}
}
func NewCutter(director string, level string, retentionDay int, options ...CutterOption) *Cutter {
rotate := &Cutter{
level: level,
director: director,
retentionDay: retentionDay,
mutex: new(sync.RWMutex),
}
for i := 0; i < len(options); i++ {
options[i](rotate)
}
return rotate
}
// Write satisfies the io.Writer interface. It writes to the
// appropriate file handle that is currently being used.
// If we have reached rotation time, the target file gets
// automatically rotated, and also purged if necessary.
func (c *Cutter) Write(bytes []byte) (n int, err error) {
c.mutex.Lock()
defer func() {
if c.file != nil {
_ = c.file.Close()
c.file = nil
}
c.mutex.Unlock()
}()
length := len(c.formats)
values := make([]string, 0, 3+length)
values = append(values, c.director)
if c.layout != "" {
values = append(values, time.Now().Format(c.layout))
}
for i := 0; i < length; i++ {
values = append(values, c.formats[i])
}
values = append(values, c.level+".log")
filename := filepath.Join(values...)
director := filepath.Dir(filename)
err = os.MkdirAll(director, os.ModePerm)
if err != nil {
return 0, err
}
defer func() {
err := removeNDaysFolders(c.director, c.retentionDay)
if err != nil {
fmt.Println("清理过期日志失败", err)
}
}()
c.file, err = os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
return 0, err
}
return c.file.Write(bytes)
}
func (c *Cutter) Sync() error {
c.mutex.Lock()
defer c.mutex.Unlock()
if c.file != nil {
return c.file.Sync()
}
return nil
}
// 增加日志目录文件清理 小于等于零的值默认忽略不再处理
func removeNDaysFolders(dir string, days int) error {
if days <= 0 {
return nil
}
cutoff := time.Now().AddDate(0, 0, -days)
return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if info.IsDir() && info.ModTime().Before(cutoff) && path != dir {
err = os.RemoveAll(path)
if err != nil {
return err
}
}
return nil
})
}

View File

@@ -0,0 +1,80 @@
package internal
import (
"os"
"strings"
"time"
"git.echol.cn/loser/ai_proxy/server/global"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
type ZapCore struct {
level zapcore.Level
zapcore.Core
}
func NewZapCore(level zapcore.Level) *ZapCore {
entity := &ZapCore{level: level}
syncer := entity.WriteSyncer()
levelEnabler := zap.LevelEnablerFunc(func(l zapcore.Level) bool {
return l == level
})
entity.Core = zapcore.NewCore(global.GVA_CONFIG.Zap.Encoder(), syncer, levelEnabler)
return entity
}
func (z *ZapCore) WriteSyncer(formats ...string) zapcore.WriteSyncer {
cutter := NewCutter(
global.GVA_CONFIG.Zap.Director,
z.level.String(),
global.GVA_CONFIG.Zap.RetentionDay,
CutterWithLayout(time.DateOnly),
CutterWithFormats(formats...),
)
if global.GVA_CONFIG.Zap.LogInConsole {
multiSyncer := zapcore.NewMultiWriteSyncer(os.Stdout, cutter)
return zapcore.AddSync(multiSyncer)
}
return zapcore.AddSync(cutter)
}
func (z *ZapCore) Enabled(level zapcore.Level) bool {
return z.level == level
}
func (z *ZapCore) With(fields []zapcore.Field) zapcore.Core {
return z.Core.With(fields)
}
func (z *ZapCore) Check(entry zapcore.Entry, check *zapcore.CheckedEntry) *zapcore.CheckedEntry {
if z.Enabled(entry.Level) {
return check.AddCore(entry, z)
}
return check
}
func (z *ZapCore) Write(entry zapcore.Entry, fields []zapcore.Field) error {
for i := 0; i < len(fields); i++ {
if fields[i].Key == "business" || fields[i].Key == "folder" || fields[i].Key == "directory" {
syncer := z.WriteSyncer(fields[i].String)
z.Core = zapcore.NewCore(global.GVA_CONFIG.Zap.Encoder(), syncer, z.level)
}
}
// 先写入原日志目标
err := z.Core.Write(entry, fields)
// 捕捉 Error 及以上级别日志(简化版本,仅记录到日志文件)
if entry.Level >= zapcore.ErrorLevel {
// 避免与 GORM zap 写入互相递归:跳过由 gorm logger writer 触发的日志
if strings.Contains(entry.Caller.File, "gorm_logger_writer.go") {
return err
}
}
return err
}
func (z *ZapCore) Sync() error {
return z.Core.Sync()
}

39
server/core/server.go Normal file
View File

@@ -0,0 +1,39 @@
package core
import (
"fmt"
"time"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize"
"go.uber.org/zap"
)
func RunServer() {
if global.GVA_CONFIG.System.UseRedis {
// 初始化redis服务
initialize.Redis()
if global.GVA_CONFIG.System.UseMultipoint {
initialize.RedisList()
}
}
if global.GVA_CONFIG.System.UseMongo {
err := initialize.Mongo.Initialization()
if err != nil {
zap.L().Error(fmt.Sprintf("%+v", err))
}
}
Router := initialize.Routers()
address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
fmt.Printf(`
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
默认MCP SSE地址:http://127.0.0.1%s%s
默认MCP Message地址:http://127.0.0.1%s%s
默认前端文件运行地址:http://127.0.0.1:8080
`, address, address, global.GVA_CONFIG.MCP.SSEPath, address, global.GVA_CONFIG.MCP.MessagePath)
initServer(address, Router, 10*time.Minute, 10*time.Minute)
}

60
server/core/server_run.go Normal file
View File

@@ -0,0 +1,60 @@
package core
import (
"context"
"fmt"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type server interface {
ListenAndServe() error
Shutdown(context.Context) error
}
// initServer 启动服务并实现优雅关闭
func initServer(address string, router *gin.Engine, readTimeout, writeTimeout time.Duration) {
// 创建服务
srv := &http.Server{
Addr: address,
Handler: router,
ReadTimeout: readTimeout,
WriteTimeout: writeTimeout,
MaxHeaderBytes: 1 << 20,
}
// 在goroutine中启动服务
go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
fmt.Printf("listen: %s\n", err)
zap.L().Error("server启动失败", zap.Error(err))
os.Exit(1)
}
}()
// 等待中断信号以优雅地关闭服务器
quit := make(chan os.Signal, 1)
// kill (无参数) 默认发送 syscall.SIGTERM
// kill -2 发送 syscall.SIGINT
// kill -9 发送 syscall.SIGKILL但是无法被捕获所以不需要添加
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
zap.L().Info("关闭WEB服务...")
// 设置5秒的超时时间
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := srv.Shutdown(ctx); err != nil {
zap.L().Fatal("WEB服务关闭异常", zap.Error(err))
}
zap.L().Info("WEB服务已关闭")
}

76
server/core/viper.go Normal file
View File

@@ -0,0 +1,76 @@
package core
import (
"flag"
"fmt"
"os"
"path/filepath"
"git.echol.cn/loser/ai_proxy/server/core/internal"
"git.echol.cn/loser/ai_proxy/server/global"
"github.com/fsnotify/fsnotify"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
)
// Viper 配置
func Viper() *viper.Viper {
config := getConfigPath()
v := viper.New()
v.SetConfigFile(config)
v.SetConfigType("yaml")
err := v.ReadInConfig()
if err != nil {
panic(fmt.Errorf("fatal error config file: %w", err))
}
v.WatchConfig()
v.OnConfigChange(func(e fsnotify.Event) {
fmt.Println("config file changed:", e.Name)
if err = v.Unmarshal(&global.GVA_CONFIG); err != nil {
fmt.Println(err)
}
})
if err = v.Unmarshal(&global.GVA_CONFIG); err != nil {
panic(fmt.Errorf("fatal error unmarshal config: %w", err))
}
// root 适配性 根据root位置去找到对应迁移位置,保证root路径有效
global.GVA_CONFIG.AutoCode.Root, _ = filepath.Abs("..")
return v
}
// getConfigPath 获取配置文件路径, 优先级: 命令行 > 环境变量 > 默认值
func getConfigPath() (config string) {
// `-c` flag parse
flag.StringVar(&config, "c", "", "choose config file.")
flag.Parse()
if config != "" { // 命令行参数不为空 将值赋值于config
fmt.Printf("您正在使用命令行的 '-c' 参数传递的值, config 的路径为 %s\n", config)
return
}
if env := os.Getenv(internal.ConfigEnv); env != "" { // 判断环境变量 GVA_CONFIG
config = env
fmt.Printf("您正在使用 %s 环境变量, config 的路径为 %s\n", internal.ConfigEnv, config)
return
}
switch gin.Mode() { // 根据 gin 模式文件名
case gin.DebugMode:
config = internal.ConfigDebugFile
case gin.ReleaseMode:
config = internal.ConfigReleaseFile
case gin.TestMode:
config = internal.ConfigTestFile
}
fmt.Printf("您正在使用 gin 的 %s 模式运行, config 的路径为 %s\n", gin.Mode(), config)
_, err := os.Stat(config)
if err != nil || os.IsNotExist(err) {
config = internal.ConfigDefaultFile
fmt.Printf("配置文件路径不存在, 使用默认配置文件路径: %s\n", config)
}
return
}

36
server/core/zap.go Normal file
View File

@@ -0,0 +1,36 @@
package core
import (
"fmt"
"git.echol.cn/loser/ai_proxy/server/core/internal"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/utils"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"os"
)
// Zap 获取 zap.Logger
// Author [SliverHorn](https://github.com/SliverHorn)
func Zap() (logger *zap.Logger) {
if ok, _ := utils.PathExists(global.GVA_CONFIG.Zap.Director); !ok { // 判断是否有Director文件夹
fmt.Printf("create %v directory\n", global.GVA_CONFIG.Zap.Director)
_ = os.Mkdir(global.GVA_CONFIG.Zap.Director, os.ModePerm)
}
levels := global.GVA_CONFIG.Zap.Levels()
length := len(levels)
cores := make([]zapcore.Core, 0, length)
for i := 0; i < length; i++ {
core := internal.NewZapCore(levels[i])
cores = append(cores, core)
}
// 构建基础 logger错误级别的入库逻辑已在自定义 ZapCore 中处理)
logger = zap.New(zapcore.NewTee(cores...))
// 启用 Error 及以上级别的堆栈捕捉,确保 entry.Stack 可用
opts := []zap.Option{zap.AddStacktrace(zapcore.ErrorLevel)}
if global.GVA_CONFIG.Zap.ShowLine {
opts = append(opts, zap.AddCaller())
}
logger = logger.WithOptions(opts...)
return logger
}

9314
server/docs/docs.go Normal file

File diff suppressed because it is too large Load Diff

9286
server/docs/swagger.json Normal file

File diff suppressed because it is too large Load Diff

5677
server/docs/swagger.yaml Normal file

File diff suppressed because it is too large Load Diff

69
server/global/global.go Normal file
View File

@@ -0,0 +1,69 @@
package global
import (
"fmt"
"sync"
"github.com/mark3labs/mcp-go/server"
"github.com/gin-gonic/gin"
"github.com/qiniu/qmgo"
"git.echol.cn/loser/ai_proxy/server/utils/timer"
"github.com/songzhibin97/gkit/cache/local_cache"
"golang.org/x/sync/singleflight"
"go.uber.org/zap"
"git.echol.cn/loser/ai_proxy/server/config"
"github.com/redis/go-redis/v9"
"github.com/spf13/viper"
"gorm.io/gorm"
)
var (
GVA_DB *gorm.DB
GVA_DBList map[string]*gorm.DB
GVA_REDIS redis.UniversalClient
GVA_REDISList map[string]redis.UniversalClient
GVA_MONGO *qmgo.QmgoClient
GVA_CONFIG config.Server
GVA_VP *viper.Viper
// GVA_LOG *oplogging.Logger
GVA_LOG *zap.Logger
GVA_Timer timer.Timer = timer.NewTimerTask()
GVA_Concurrency_Control = &singleflight.Group{}
GVA_ROUTERS gin.RoutesInfo
GVA_ACTIVE_DBNAME *string
GVA_MCP_SERVER *server.MCPServer
BlackCache local_cache.Cache
lock sync.RWMutex
)
// GetGlobalDBByDBName 通过名称获取db list中的db
func GetGlobalDBByDBName(dbname string) *gorm.DB {
lock.RLock()
defer lock.RUnlock()
return GVA_DBList[dbname]
}
// MustGetGlobalDBByDBName 通过名称获取db 如果不存在则panic
func MustGetGlobalDBByDBName(dbname string) *gorm.DB {
lock.RLock()
defer lock.RUnlock()
db, ok := GVA_DBList[dbname]
if !ok || db == nil {
panic("db no init")
}
return db
}
func GetRedis(name string) redis.UniversalClient {
redis, ok := GVA_REDISList[name]
if !ok || redis == nil {
panic(fmt.Sprintf("redis `%s` no init", name))
}
return redis
}

14
server/global/model.go Normal file
View File

@@ -0,0 +1,14 @@
package global
import (
"time"
"gorm.io/gorm"
)
type GVA_MODEL struct {
ID uint `gorm:"primarykey" json:"ID"` // 主键ID
CreatedAt time.Time // 创建时间
UpdatedAt time.Time // 更新时间
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
}

12
server/global/version.go Normal file
View File

@@ -0,0 +1,12 @@
package global
// Version 版本信息
// 目前只有Version正式使用 其余为预留
const (
// Version 当前版本号
Version = "v2.8.9"
// AppName 应用名称
AppName = "Gin-Vue-Admin"
// Description 应用描述
Description = "使用gin+vue进行极速开发的全栈开发基础平台"
)

156
server/go.mod Normal file
View File

@@ -0,0 +1,156 @@
module git.echol.cn/loser/ai_proxy/server
go 1.24.0
toolchain go1.24.2
require (
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/aws/aws-sdk-go v1.55.6
github.com/casbin/casbin/v2 v2.103.0
github.com/casbin/gorm-adapter/v3 v3.32.0
github.com/dzwvip/gorm-oracle v0.1.2
github.com/fsnotify/fsnotify v1.8.0
github.com/gin-gonic/gin v1.10.0
github.com/glebarez/sqlite v1.11.0
github.com/go-sql-driver/mysql v1.8.1
github.com/golang-jwt/jwt/v5 v5.2.2
github.com/google/uuid v1.6.0
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.24.9+incompatible
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
github.com/mark3labs/mcp-go v0.41.1
github.com/minio/minio-go/v7 v7.0.84
github.com/pkg/errors v0.9.1
github.com/qiniu/go-sdk/v7 v7.25.2
github.com/qiniu/qmgo v1.1.9
github.com/redis/go-redis/v9 v9.7.0
github.com/robfig/cron/v3 v3.0.1
github.com/shirou/gopsutil/v3 v3.24.5
github.com/songzhibin97/gkit v1.2.13
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.4
github.com/tencentyun/cos-go-sdk-v5 v0.7.60
github.com/unrolled/secure v1.17.0
go.mongodb.org/mongo-driver v1.17.2
go.uber.org/automaxprocs v1.6.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.37.0
golang.org/x/sync v0.13.0
golang.org/x/text v0.24.0
gorm.io/driver/mysql v1.5.7
gorm.io/driver/postgres v1.5.11
gorm.io/driver/sqlserver v1.5.4
gorm.io/gorm v1.25.12
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.8.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.12.7 // indirect
github.com/bytedance/sonic/loader v0.2.3 // indirect
github.com/casbin/govaluate v1.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/gammazero/toposort v0.1.1 // indirect
github.com/gin-contrib/sse v1.0.0 // indirect
github.com/glebarez/go-sqlite v1.22.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/spec v0.21.0 // indirect
github.com/go-openapi/swag v0.23.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.24.0 // indirect
github.com/goccy/go-json v0.10.4 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.2 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/microsoft/go-mssqldb v1.8.0 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/mozillazg/go-httpheader v0.4.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rs/xid v1.6.0 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sijms/go-ora/v2 v2.7.17 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/thoas/go-funk v0.7.0 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.9.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.13.0 // indirect
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
golang.org/x/net v0.37.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/tools v0.31.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/plugin/dbresolver v1.5.3 // indirect
modernc.org/fileutil v1.3.0 // indirect
modernc.org/libc v1.61.9 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.8.2 // indirect
modernc.org/sqlite v1.34.5 // indirect
)

571
server/go.sum Normal file
View File

@@ -0,0 +1,571 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 h1:U2rTu3Ef+7w9FHKIAXM6ZyqF3UOWJZ12zIm8zECAFfg=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 h1:jBQA3cKT4L2rWMpgE7Yt3Hwh2aUj8KXjIGLxjHeYNNo=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0/go.mod h1:4OG6tQ9EOP/MT0NMjDlRzWoVFxfu9rN9B2X+tlSVktg=
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.1 h1:MyVTgWR8qd/Jw1Le0NZebGBUCLbtak3bJ3z1OlqZBpw=
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.1/go.mod h1:GpPjLhVR9dnUoJMyHWSPy71xY9/lcmpzIPZXmF0FCVY=
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 h1:D3occbWoio4EBLkbkevetNMAVX197GkzbUMtqjGWn80=
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0/go.mod h1:bTSOgj05NGRuHHhQwAdPnYr9TOdNmKlZTgGLL6nyAdI=
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 h1:7dONQ3WNZ1zy960TmkxJPuwoolZwL7xKtpcM04MBnt4=
github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82/go.mod h1:nLnM0KdK1CmygvjpDUO6m1TjSsiQtL61juhNsvV/JVI=
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible h1:8psS8a+wKfiLt1iVDX79F7Y6wUM49Lcha2FMXt4UM8g=
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/aws/aws-sdk-go v1.55.6 h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk=
github.com/aws/aws-sdk-go v1.55.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/bmatcuk/doublestar/v4 v4.8.0 h1:DSXtrypQddoug1459viM9X9D3dp1Z7993fw36I2kNcQ=
github.com/bmatcuk/doublestar/v4 v4.8.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/bytedance/sonic v1.12.7 h1:CQU8pxOy9HToxhndH0Kx/S1qU/CuS9GnKYrGioDcU1Q=
github.com/bytedance/sonic v1.12.7/go.mod h1:tnbal4mxOMju17EGfknm2XyYcpyCnIROYOEYuemj13I=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.3 h1:yctD0Q3v2NOGfSWPLPvG2ggA2kV6TS6s4wioyEqssH0=
github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/casbin/casbin/v2 v2.103.0 h1:dHElatNXNrr8XcseUov0ZSiWjauwmZZE6YMV3eU1yic=
github.com/casbin/casbin/v2 v2.103.0/go.mod h1:Ee33aqGrmES+GNL17L0h9X28wXuo829wnNUnS0edAco=
github.com/casbin/gorm-adapter/v3 v3.32.0 h1:Au+IOILBIE9clox5BJhI2nA3p9t7Ep1ePlupdGbGfus=
github.com/casbin/gorm-adapter/v3 v3.32.0/go.mod h1:Zre/H8p17mpv5U3EaWgPoxLILLdXO3gHW5aoQQpUDZI=
github.com/casbin/govaluate v1.3.0 h1:VA0eSY0M2lA86dYd5kPPuNZMUD9QkWnOCnavGrw9myc=
github.com/casbin/govaluate v1.3.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/clbanning/mxj v1.8.4 h1:HuhwZtbyvyOw+3Z1AowPkU87JkJUSv751ELWaiTpj8I=
github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng=
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/dave/jennifer v1.6.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3RmGZc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dzwvip/gorm-oracle v0.1.2 h1:811aFDY7oDfKWHc0Z0lHdXzzr89EmKBSwc/jLJ8GU5g=
github.com/dzwvip/gorm-oracle v0.1.2/go.mod h1:TbF7idnO9UgGpJ0qJpDZby1/wGquzP5GYof88ScBITE=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/gammazero/toposort v0.1.1 h1:OivGxsWxF3U3+U80VoLJ+f50HcPU1MIqE1JlKzoJ2Eg=
github.com/gammazero/toposort v0.1.1/go.mod h1:H2cozTnNpMw0hg2VHAYsAxmkHXBYroNangj2NTBQDvw=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ=
github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc=
github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=
github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ=
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY=
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-playground/validator/v10 v10.7.0/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk=
github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE/HH+qdL2cBpCmg=
github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM=
github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E=
github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0=
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.24.9+incompatible h1:XQVXdk+WAJ4fSNB6mMRuYNvFWou7BZs6SZB925hPrnk=
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.24.9+incompatible/go.mod h1:l7VUhRbTKCzdOacdT4oWCwATKyvZqUOlOqr0Ous3k4s=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=
github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.2 h1:mLoDLV6sonKlvjIEsV56SkWNCnuNv531l94GaIzO+XI=
github.com/jackc/pgx/v5 v5.7.2/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM=
github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo=
github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg=
github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs=
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA=
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY=
github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 h1:7UMa6KCCMjZEMDtTVdcGu0B1GmmC7QJKiCCjyTAWQy0=
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k=
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mark3labs/mcp-go v0.41.1 h1:w78eWfiQam2i8ICL7AL0WFiq7KHNJQ6UB53ZVtH4KGA=
github.com/mark3labs/mcp-go v0.41.1/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA=
github.com/microsoft/go-mssqldb v1.8.0 h1:7cyZ/AT7ycDsEoWPIXibd+aVKFtteUNhDGf3aobP+tw=
github.com/microsoft/go-mssqldb v1.8.0/go.mod h1:6znkekS3T2vp0waiMhen4GPU1BiAsrP+iXHcE7a7rFo=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.84 h1:D1HVmAF8JF8Bpi6IU4V9vIEj+8pc+xU88EWMs2yed0E=
github.com/minio/minio-go/v7 v7.0.84/go.mod h1:57YXpvc5l3rjPdhqNrDsvVlY0qPI6UTk1bflAe+9doY=
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60=
github.com/mozillazg/go-httpheader v0.4.0 h1:aBn6aRXtFzyDLZ4VIRLsZbbJloagQfMnCiYgOq6hK4w=
github.com/mozillazg/go-httpheader v0.4.0/go.mod h1:PuT8h0pw6efvp8ZeUec1Rs7dwjK08bt6gKSReGMqtdA=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
github.com/qiniu/dyn v1.3.0/go.mod h1:E8oERcm8TtwJiZvkQPbcAh0RL8jO1G0VXJMW3FAWdkk=
github.com/qiniu/go-sdk/v7 v7.25.2 h1:URwgZpxySdiwu2yQpHk93X4LXWHyFRp1x3Vmlk/YWvo=
github.com/qiniu/go-sdk/v7 v7.25.2/go.mod h1:dmKtJ2ahhPWFVi9o1D5GemmWoh/ctuB9peqTowyTO8o=
github.com/qiniu/qmgo v1.1.9 h1:3G3h9RLyjIUW9YSAQEPP2WqqNnboZ2Z/zO3mugjVb3E=
github.com/qiniu/qmgo v1.1.9/go.mod h1:aba4tNSlMWrwUhe7RdILfwBRIgvBujt1y10X+T1YZSI=
github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs=
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
github.com/sijms/go-ora/v2 v2.7.17 h1:M/pYIqjaMUeBxyzOWp2oj4ntF6fHSBloJWGNH9vbmsU=
github.com/sijms/go-ora/v2 v2.7.17/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl4FWlH6xk=
github.com/songzhibin97/gkit v1.2.13 h1:paY0XJkdRuy9/8k9nTnbdrzo8pC22jIIFldUkOQv5nU=
github.com/songzhibin97/gkit v1.2.13/go.mod h1:38CreNR27eTGaG1UMGihrXqI4xc3nGfYxLVKKVx6Ngg=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.563/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563/go.mod h1:uom4Nvi9W+Qkom0exYiJ9VWJjXwyxtPYTkKkaLMlfE0=
github.com/tencentyun/cos-go-sdk-v5 v0.7.60 h1:/e/tmvRmfKexr/QQIBzWhOkZWsmY3EK72NrI6G/Tv0o=
github.com/tencentyun/cos-go-sdk-v5 v0.7.60/go.mod h1:8+hG+mQMuRP/OIS9d83syAvXvrMj9HhkND6Q1fLghw0=
github.com/thoas/go-funk v0.7.0 h1:GmirKrs6j6zJbhJIficOsz2aAI7700KsU/5YrdHRM1Y=
github.com/thoas/go-funk v0.7.0/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo=
github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/unrolled/secure v1.17.0 h1:Io7ifFgo99Bnh0J7+Q+qcMzWM6kaDPCA5FroFZEdbWU=
github.com/unrolled/secure v1.17.0/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
go.mongodb.org/mongo-driver v1.17.2 h1:gvZyk8352qSfzyZ2UMWcpDpMSGEr1eqE4T793SqyhzM=
go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/arch v0.13.0 h1:KCkqVVV1kGg0X87TFysjCJ8MxtZEIU4Ja/yXGeoECdA=
golang.org/x/arch v0.13.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
gorm.io/driver/postgres v1.5.11 h1:ubBVAfbKEUld/twyKZ0IYn9rSQh448EdelLYk9Mv314=
gorm.io/driver/postgres v1.5.11/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI=
gorm.io/driver/sqlserver v1.5.4 h1:xA+Y1KDNspv79q43bPyjDMUgHoYHLhXYmdFcYPobg8g=
gorm.io/driver/sqlserver v1.5.4/go.mod h1:+frZ/qYmuna11zHPlh5oc2O6ZA/lS88Keb0XSH1Zh/g=
gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8=
gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
gorm.io/plugin/dbresolver v1.5.3 h1:wFwINGZZmttuu9h7XpvbDHd8Lf9bb8GNzp/NpAMV2wU=
gorm.io/plugin/dbresolver v1.5.3/go.mod h1:TSrVhaUg2DZAWP3PrHlDlITEJmNOkL0tFTjvTEsQ4XE=
modernc.org/cc/v4 v4.24.4 h1:TFkx1s6dCkQpd6dKurBNmpo+G8Zl4Sq/ztJ+2+DEsh0=
modernc.org/cc/v4 v4.24.4/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
modernc.org/ccgo/v4 v4.23.13 h1:PFiaemQwE/jdwi8XEHyEV+qYWoIuikLP3T4rvDeJb00=
modernc.org/ccgo/v4 v4.23.13/go.mod h1:vdN4h2WR5aEoNondUx26K7G8X+nuBscYnAEWSRmN2/0=
modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8=
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
modernc.org/gc/v2 v2.6.1 h1:+Qf6xdG8l7B27TQ8D8lw/iFMUj1RXRBOuMUWziJOsk8=
modernc.org/gc/v2 v2.6.1/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
modernc.org/libc v1.61.9 h1:PLSBXVkifXGELtJ5BOnBUyAHr7lsatNwFU/RRo4kfJM=
modernc.org/libc v1.61.9/go.mod h1:61xrnzk/aR8gr5bR7Uj/lLFLuXu2/zMpIjcry63Eumk=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.8.2 h1:cL9L4bcoAObu4NkxOlKWBWtNHIsnnACGF/TbqQ6sbcI=
modernc.org/memory v1.8.2/go.mod h1:ZbjSvMO5NQ1A2i3bWeDiVMxIorXwdClKE/0SZ+BMotU=
modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
modernc.org/sqlite v1.34.5 h1:Bb6SR13/fjp15jt70CL4f18JIN7p7dnMExd+UFnF15g=
modernc.org/sqlite v1.34.5/go.mod h1:YLuNmX9NKs8wRNK2ko1LW1NGYcc9FkBO69JOt1AR9JE=
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=

View File

@@ -0,0 +1,36 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"gorm.io/gorm"
)
const sys = "system"
func DBList() {
dbMap := make(map[string]*gorm.DB)
for _, info := range global.GVA_CONFIG.DBList {
if info.Disable {
continue
}
switch info.Type {
case "mysql":
dbMap[info.AliasName] = GormMysqlByConfig(config.Mysql{GeneralDB: info.GeneralDB})
case "mssql":
dbMap[info.AliasName] = GormMssqlByConfig(config.Mssql{GeneralDB: info.GeneralDB})
case "pgsql":
dbMap[info.AliasName] = GormPgSqlByConfig(config.Pgsql{GeneralDB: info.GeneralDB})
case "oracle":
dbMap[info.AliasName] = GormOracleByConfig(config.Oracle{GeneralDB: info.GeneralDB})
default:
continue
}
}
// 做特殊判断,是否有迁移
// 适配低版本迁移多数据库版本
if sysDB, ok := dbMap[sys]; ok {
global.GVA_DB = sysDB
}
global.GVA_DBList = dbMap
}

112
server/initialize/gorm.go Normal file
View File

@@ -0,0 +1,112 @@
package initialize
import (
"os"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/model/app"
"git.echol.cn/loser/ai_proxy/server/model/system"
"go.uber.org/zap"
"golang.org/x/crypto/bcrypt"
"gorm.io/gorm"
)
func Gorm() *gorm.DB {
switch global.GVA_CONFIG.System.DbType {
case "mysql":
global.GVA_ACTIVE_DBNAME = &global.GVA_CONFIG.Mysql.Dbname
return GormMysql()
case "pgsql":
global.GVA_ACTIVE_DBNAME = &global.GVA_CONFIG.Pgsql.Dbname
return GormPgSql()
case "oracle":
global.GVA_ACTIVE_DBNAME = &global.GVA_CONFIG.Oracle.Dbname
return GormOracle()
case "mssql":
global.GVA_ACTIVE_DBNAME = &global.GVA_CONFIG.Mssql.Dbname
return GormMssql()
case "sqlite":
global.GVA_ACTIVE_DBNAME = &global.GVA_CONFIG.Sqlite.Dbname
return GormSqlite()
default:
global.GVA_ACTIVE_DBNAME = &global.GVA_CONFIG.Mysql.Dbname
return GormMysql()
}
}
func RegisterTables() {
if global.GVA_CONFIG.System.DisableAutoMigrate {
global.GVA_LOG.Info("auto-migrate is disabled, skipping table registration")
return
}
db := global.GVA_DB
err := db.AutoMigrate(
// System tables (管理后台表)
system.SysApi{},
system.SysUser{},
// App tables (前台应用表)
app.AiPreset{},
app.AiProvider{},
app.AiPresetBinding{},
app.AiRequestLog{},
)
if err != nil {
global.GVA_LOG.Error("register table failed", zap.Error(err))
os.Exit(0)
}
err = bizModel()
if err != nil {
global.GVA_LOG.Error("register biz_table failed", zap.Error(err))
os.Exit(0)
}
global.GVA_LOG.Info("register table success")
// 初始化默认管理员账号
initDefaultAdmin()
}
// initDefaultAdmin 初始化默认管理员账号
func initDefaultAdmin() {
var count int64
err := global.GVA_DB.Model(&system.SysUser{}).Where("username = ?", "root").Count(&count).Error
if err != nil {
global.GVA_LOG.Error("check admin user failed", zap.Error(err))
return
}
// 如果已存在 root 用户,则跳过
if count > 0 {
global.GVA_LOG.Info("default admin user already exists, skip initialization")
return
}
// 加密密码
hashedPassword, err := bcrypt.GenerateFromPassword([]byte("root123"), bcrypt.DefaultCost)
if err != nil {
global.GVA_LOG.Error("hash password failed", zap.Error(err))
return
}
// 创建默认管理员账号
adminUser := system.SysUser{
Username: "root",
Password: string(hashedPassword),
Nickname: "超级管理员",
Email: "admin@example.com",
Role: "admin",
Status: "active",
}
if err := global.GVA_DB.Create(&adminUser).Error; err != nil {
global.GVA_LOG.Error("create default admin user failed", zap.Error(err))
return
}
global.GVA_LOG.Info("default admin user created successfully (username: root, password: root123)")
}

View File

@@ -0,0 +1,14 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/global"
)
func bizModel() error {
db := global.GVA_DB
err := db.AutoMigrate()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,64 @@
package initialize
/*
* @Author: 逆光飞翔 191180776@qq.com
* @Date: 2022-12-08 17:25:49
* @LastEditors: 逆光飞翔 191180776@qq.com
* @LastEditTime: 2022-12-08 18:00:00
* @FilePath: \server\initialize\gorm_mssql.go
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import (
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize/internal"
"gorm.io/driver/sqlserver"
"gorm.io/gorm"
)
// GormMssql 初始化Mssql数据库
// Author [LouisZhang](191180776@qq.com)
func GormMssql() *gorm.DB {
m := global.GVA_CONFIG.Mssql
if m.Dbname == "" {
return nil
}
mssqlConfig := sqlserver.Config{
DSN: m.Dsn(), // DSN data source name
DefaultStringSize: 191, // string 类型字段的默认长度
}
// 数据库配置
general := m.GeneralDB
if db, err := gorm.Open(sqlserver.New(mssqlConfig), internal.Gorm.Config(general)); err != nil {
return nil
} else {
db.InstanceSet("gorm:table_options", "ENGINE="+m.Engine)
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(m.MaxIdleConns)
sqlDB.SetMaxOpenConns(m.MaxOpenConns)
return db
}
}
// GormMssqlByConfig 初始化Mysql数据库用过传入配置
func GormMssqlByConfig(m config.Mssql) *gorm.DB {
if m.Dbname == "" {
return nil
}
mssqlConfig := sqlserver.Config{
DSN: m.Dsn(), // DSN data source name
DefaultStringSize: 191, // string 类型字段的默认长度
}
// 数据库配置
general := m.GeneralDB
if db, err := gorm.Open(sqlserver.New(mssqlConfig), internal.Gorm.Config(general)); err != nil {
panic(err)
} else {
db.InstanceSet("gorm:table_options", "ENGINE=InnoDB")
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(m.MaxIdleConns)
sqlDB.SetMaxOpenConns(m.MaxOpenConns)
return db
}
}

View File

@@ -0,0 +1,48 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize/internal"
_ "github.com/go-sql-driver/mysql"
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
// GormMysql 初始化Mysql数据库
// Author [piexlmax](https://github.com/piexlmax)
// Author [SliverHorn](https://github.com/SliverHorn)
// Author [ByteZhou-2018](https://github.com/ByteZhou-2018)
func GormMysql() *gorm.DB {
m := global.GVA_CONFIG.Mysql
return initMysqlDatabase(m)
}
// GormMysqlByConfig 通过传入配置初始化Mysql数据库
func GormMysqlByConfig(m config.Mysql) *gorm.DB {
return initMysqlDatabase(m)
}
// initMysqlDatabase 初始化Mysql数据库的辅助函数
func initMysqlDatabase(m config.Mysql) *gorm.DB {
if m.Dbname == "" {
return nil
}
mysqlConfig := mysql.Config{
DSN: m.Dsn(), // DSN data source name
DefaultStringSize: 191, // string 类型字段的默认长度
SkipInitializeWithVersion: false, // 根据版本自动配置
}
// 数据库配置
general := m.GeneralDB
if db, err := gorm.Open(mysql.New(mysqlConfig), internal.Gorm.Config(general)); err != nil {
panic(err)
} else {
db.InstanceSet("gorm:table_options", "ENGINE="+m.Engine)
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(m.MaxIdleConns)
sqlDB.SetMaxOpenConns(m.MaxOpenConns)
return db
}
}

View File

@@ -0,0 +1,37 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize/internal"
oracle "github.com/dzwvip/gorm-oracle"
"gorm.io/gorm"
)
// GormOracle 初始化oracle数据库
func GormOracle() *gorm.DB {
m := global.GVA_CONFIG.Oracle
return initOracleDatabase(m)
}
// GormOracleByConfig 初始化Oracle数据库用过传入配置
func GormOracleByConfig(m config.Oracle) *gorm.DB {
return initOracleDatabase(m)
}
// initOracleDatabase 初始化Oracle数据库的辅助函数
func initOracleDatabase(m config.Oracle) *gorm.DB {
if m.Dbname == "" {
return nil
}
// 数据库配置
general := m.GeneralDB
if db, err := gorm.Open(oracle.Open(m.Dsn()), internal.Gorm.Config(general)); err != nil {
panic(err)
} else {
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(m.MaxIdleConns)
sqlDB.SetMaxOpenConns(m.MaxOpenConns)
return db
}
}

View File

@@ -0,0 +1,43 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize/internal"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
// GormPgSql 初始化 Postgresql 数据库
// Author [piexlmax](https://github.com/piexlmax)
// Author [SliverHorn](https://github.com/SliverHorn)
func GormPgSql() *gorm.DB {
p := global.GVA_CONFIG.Pgsql
return initPgSqlDatabase(p)
}
// GormPgSqlByConfig 初始化 Postgresql 数据库 通过指定参数
func GormPgSqlByConfig(p config.Pgsql) *gorm.DB {
return initPgSqlDatabase(p)
}
// initPgSqlDatabase 初始化 Postgresql 数据库的辅助函数
func initPgSqlDatabase(p config.Pgsql) *gorm.DB {
if p.Dbname == "" {
return nil
}
pgsqlConfig := postgres.Config{
DSN: p.Dsn(), // DSN data source name
PreferSimpleProtocol: false,
}
// 数据库配置
general := p.GeneralDB
if db, err := gorm.Open(postgres.New(pgsqlConfig), internal.Gorm.Config(general)); err != nil {
panic(err)
} else {
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(p.MaxIdleConns)
sqlDB.SetMaxOpenConns(p.MaxOpenConns)
return db
}
}

View File

@@ -0,0 +1,38 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize/internal"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
// GormSqlite 初始化Sqlite数据库
func GormSqlite() *gorm.DB {
s := global.GVA_CONFIG.Sqlite
return initSqliteDatabase(s)
}
// GormSqliteByConfig 初始化Sqlite数据库用过传入配置
func GormSqliteByConfig(s config.Sqlite) *gorm.DB {
return initSqliteDatabase(s)
}
// initSqliteDatabase 初始化Sqlite数据库辅助函数
func initSqliteDatabase(s config.Sqlite) *gorm.DB {
if s.Dbname == "" {
return nil
}
// 数据库配置
general := s.GeneralDB
if db, err := gorm.Open(sqlite.Open(s.Dsn()), internal.Gorm.Config(general)); err != nil {
panic(err)
} else {
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(s.MaxIdleConns)
sqlDB.SetMaxOpenConns(s.MaxOpenConns)
return db
}
}

15
server/initialize/init.go Normal file
View File

@@ -0,0 +1,15 @@
// 假设这是初始化逻辑的一部分
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/utils"
)
// 初始化全局函数
func SetupHandlers() {
// 注册系统重载处理函数
utils.GlobalSystemEvents.RegisterReloadHandler(func() error {
return Reload()
})
}

View File

@@ -0,0 +1,31 @@
package internal
import (
"time"
"git.echol.cn/loser/ai_proxy/server/config"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"gorm.io/gorm/schema"
)
var Gorm = new(_gorm)
type _gorm struct{}
// Config gorm 自定义配置
// Author [SliverHorn](https://github.com/SliverHorn)
func (g *_gorm) Config(general config.GeneralDB) *gorm.Config {
return &gorm.Config{
Logger: logger.New(NewWriter(general), logger.Config{
SlowThreshold: 200 * time.Millisecond,
LogLevel: general.LogLevel(),
Colorful: true,
}),
NamingStrategy: schema.NamingStrategy{
TablePrefix: general.Prefix,
SingularTable: general.Singular,
},
DisableForeignKeyConstraintWhenMigrating: true,
}
}

View File

@@ -0,0 +1,42 @@
package internal
import (
"fmt"
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"gorm.io/gorm/logger"
)
type Writer struct {
config config.GeneralDB
writer logger.Writer
}
func NewWriter(config config.GeneralDB) *Writer {
return &Writer{config: config}
}
// Printf 格式化打印日志
func (c *Writer) Printf(message string, data ...any) {
// 当有日志时候均需要输出到控制台
fmt.Printf(message, data...)
// 当开启了zap的情况会打印到日志记录
if c.config.LogZap {
switch c.config.LogLevel() {
case logger.Silent:
global.GVA_LOG.Debug(fmt.Sprintf(message, data...))
case logger.Error:
global.GVA_LOG.Error(fmt.Sprintf(message, data...))
case logger.Warn:
global.GVA_LOG.Warn(fmt.Sprintf(message, data...))
case logger.Info:
global.GVA_LOG.Info(fmt.Sprintf(message, data...))
default:
global.GVA_LOG.Info(fmt.Sprintf(message, data...))
}
return
}
}

View File

@@ -0,0 +1,30 @@
package internal
import (
"context"
"fmt"
"github.com/qiniu/qmgo/options"
"go.mongodb.org/mongo-driver/event"
opt "go.mongodb.org/mongo-driver/mongo/options"
"go.uber.org/zap"
)
var Mongo = new(mongo)
type mongo struct{}
func (m *mongo) GetClientOptions() []options.ClientOptions {
cmdMonitor := &event.CommandMonitor{
Started: func(ctx context.Context, event *event.CommandStartedEvent) {
zap.L().Info(fmt.Sprintf("[MongoDB][RequestID:%d][database:%s] %s\n", event.RequestID, event.DatabaseName, event.Command), zap.String("business", "mongo"))
},
Succeeded: func(ctx context.Context, event *event.CommandSucceededEvent) {
zap.L().Info(fmt.Sprintf("[MongoDB][RequestID:%d] [%s] %s\n", event.RequestID, event.Duration.String(), event.Reply), zap.String("business", "mongo"))
},
Failed: func(ctx context.Context, event *event.CommandFailedEvent) {
zap.L().Error(fmt.Sprintf("[MongoDB][RequestID:%d] [%s] %s\n", event.RequestID, event.Duration.String(), event.Failure), zap.String("business", "mongo"))
},
}
return []options.ClientOptions{{ClientOptions: &opt.ClientOptions{Monitor: cmdMonitor}}}
}

156
server/initialize/mongo.go Normal file
View File

@@ -0,0 +1,156 @@
package initialize
import (
"context"
"fmt"
"sort"
"strings"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize/internal"
"git.echol.cn/loser/ai_proxy/server/utils"
"github.com/pkg/errors"
"github.com/qiniu/qmgo"
"github.com/qiniu/qmgo/options"
"go.mongodb.org/mongo-driver/bson"
option "go.mongodb.org/mongo-driver/mongo/options"
)
var Mongo = new(mongo)
type (
mongo struct{}
Index struct {
V any `bson:"v"`
Ns any `bson:"ns"`
Key []bson.E `bson:"key"`
Name string `bson:"name"`
}
)
func (m *mongo) Indexes(ctx context.Context) error {
// 表名:索引列表 列: "表名": [][]string{{"index1", "index2"}}
indexMap := map[string][][]string{}
for collection, indexes := range indexMap {
err := m.CreateIndexes(ctx, collection, indexes)
if err != nil {
return err
}
}
return nil
}
func (m *mongo) Initialization() error {
var opts []options.ClientOptions
if global.GVA_CONFIG.Mongo.IsZap {
opts = internal.Mongo.GetClientOptions()
}
ctx := context.Background()
config := &qmgo.Config{
Uri: global.GVA_CONFIG.Mongo.Uri(),
Coll: global.GVA_CONFIG.Mongo.Coll,
Database: global.GVA_CONFIG.Mongo.Database,
MinPoolSize: &global.GVA_CONFIG.Mongo.MinPoolSize,
MaxPoolSize: &global.GVA_CONFIG.Mongo.MaxPoolSize,
SocketTimeoutMS: &global.GVA_CONFIG.Mongo.SocketTimeoutMs,
ConnectTimeoutMS: &global.GVA_CONFIG.Mongo.ConnectTimeoutMs,
}
if global.GVA_CONFIG.Mongo.Username != "" && global.GVA_CONFIG.Mongo.Password != "" {
config.Auth = &qmgo.Credential{
Username: global.GVA_CONFIG.Mongo.Username,
Password: global.GVA_CONFIG.Mongo.Password,
AuthSource: global.GVA_CONFIG.Mongo.AuthSource,
}
}
client, err := qmgo.Open(ctx, config, opts...)
if err != nil {
return errors.Wrap(err, "链接mongodb数据库失败!")
}
global.GVA_MONGO = client
err = m.Indexes(ctx)
if err != nil {
return err
}
return nil
}
func (m *mongo) CreateIndexes(ctx context.Context, name string, indexes [][]string) error {
collection, err := global.GVA_MONGO.Database.Collection(name).CloneCollection()
if err != nil {
return errors.Wrapf(err, "获取[%s]的表对象失败!", name)
}
list, err := collection.Indexes().List(ctx)
if err != nil {
return errors.Wrapf(err, "获取[%s]的索引对象失败!", name)
}
var entities []Index
err = list.All(ctx, &entities)
if err != nil {
return errors.Wrapf(err, "获取[%s]的索引列表失败!", name)
}
length := len(indexes)
indexMap1 := make(map[string][]string, length)
for i := 0; i < length; i++ {
sort.Strings(indexes[i]) // 对索引key进行排序, 在使用bson.M搜索时, bson会自动按照key的字母顺序进行排序
length1 := len(indexes[i])
keys := make([]string, 0, length1)
for j := 0; j < length1; j++ {
if indexes[i][i][0] == '-' {
keys = append(keys, indexes[i][j], "-1")
continue
}
keys = append(keys, indexes[i][j], "1")
}
key := strings.Join(keys, "_")
_, o1 := indexMap1[key]
if o1 {
return errors.Errorf("索引[%s]重复!", key)
}
indexMap1[key] = indexes[i]
}
length = len(entities)
indexMap2 := make(map[string]map[string]string, length)
for i := 0; i < length; i++ {
v1, o1 := indexMap2[entities[i].Name]
if !o1 {
keyLength := len(entities[i].Key)
v1 = make(map[string]string, keyLength)
for j := 0; j < keyLength; j++ {
v2, o2 := v1[entities[i].Key[j].Key]
if !o2 {
v1 = make(map[string]string)
}
v2 = entities[i].Key[j].Key
v1[entities[i].Key[j].Key] = v2
indexMap2[entities[i].Name] = v1
}
}
}
for k1, v1 := range indexMap1 {
_, o2 := indexMap2[k1]
if o2 {
continue
} // 索引存在
if len(fmt.Sprintf("%s.%s.$%s", collection.Name(), name, v1)) > 127 {
err = global.GVA_MONGO.Database.Collection(name).CreateOneIndex(ctx, options.IndexModel{
Key: v1,
IndexOptions: option.Index().SetName(utils.MD5V([]byte(k1))),
// IndexOptions: option.Index().SetName(utils.MD5V([]byte(k1))).SetExpireAfterSeconds(86400), // SetExpireAfterSeconds(86400) 设置索引过期时间, 86400 = 1天
})
if err != nil {
return errors.Wrapf(err, "创建索引[%s]失败!", k1)
}
return nil
}
err = global.GVA_MONGO.Database.Collection(name).CreateOneIndex(ctx, options.IndexModel{
Key: v1,
IndexOptions: option.Index().SetExpireAfterSeconds(86400),
// IndexOptions: option.Index().SetName(utils.MD5V([]byte(k1))).SetExpireAfterSeconds(86400), // SetExpireAfterSeconds(86400) 设置索引过期时间(秒), 86400 = 1天
})
if err != nil {
return errors.Wrapf(err, "创建索引[%s]失败!", k1)
}
}
return nil
}

View File

@@ -0,0 +1,33 @@
package initialize
import (
"bufio"
"os"
"strings"
"github.com/songzhibin97/gkit/cache/local_cache"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/utils"
)
func OtherInit() {
dr, err := utils.ParseDuration(global.GVA_CONFIG.JWT.ExpiresTime)
if err != nil {
panic(err)
}
_, err = utils.ParseDuration(global.GVA_CONFIG.JWT.BufferTime)
if err != nil {
panic(err)
}
global.BlackCache = local_cache.NewCache(
local_cache.SetDefaultExpire(dr),
)
file, err := os.Open("go.mod")
if err == nil && global.GVA_CONFIG.AutoCode.Module == "" {
scanner := bufio.NewScanner(file)
scanner.Scan()
global.GVA_CONFIG.AutoCode.Module = strings.TrimPrefix(scanner.Text(), "module ")
}
}

View File

@@ -0,0 +1,59 @@
package initialize
import (
"context"
"git.echol.cn/loser/ai_proxy/server/config"
"git.echol.cn/loser/ai_proxy/server/global"
"github.com/redis/go-redis/v9"
"go.uber.org/zap"
)
func initRedisClient(redisCfg config.Redis) (redis.UniversalClient, error) {
var client redis.UniversalClient
// 使用集群模式
if redisCfg.UseCluster {
client = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: redisCfg.ClusterAddrs,
Password: redisCfg.Password,
})
} else {
// 使用单例模式
client = redis.NewClient(&redis.Options{
Addr: redisCfg.Addr,
Password: redisCfg.Password,
DB: redisCfg.DB,
})
}
pong, err := client.Ping(context.Background()).Result()
if err != nil {
global.GVA_LOG.Error("redis connect ping failed, err:", zap.String("name", redisCfg.Name), zap.Error(err))
return nil, err
}
global.GVA_LOG.Info("redis connect ping response:", zap.String("name", redisCfg.Name), zap.String("pong", pong))
return client, nil
}
func Redis() {
redisClient, err := initRedisClient(global.GVA_CONFIG.Redis)
if err != nil {
panic(err)
}
global.GVA_REDIS = redisClient
}
func RedisList() {
redisMap := make(map[string]redis.UniversalClient)
for _, redisCfg := range global.GVA_CONFIG.RedisList {
client, err := initRedisClient(redisCfg)
if err != nil {
panic(err)
}
redisMap[redisCfg.Name] = client
}
global.GVA_REDISList = redisMap
}

View File

@@ -0,0 +1,5 @@
package initialize
func init() {
// do nothing, only import source package so that inits can be registered
}

View File

@@ -0,0 +1,45 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/global"
"go.uber.org/zap"
)
// Reload 优雅地重新加载系统配置
func Reload() error {
global.GVA_LOG.Info("正在重新加载系统配置...")
// 重新加载配置文件
if err := global.GVA_VP.ReadInConfig(); err != nil {
global.GVA_LOG.Error("重新读取配置文件失败!", zap.Error(err))
return err
}
// 重新初始化数据库连接
if global.GVA_DB != nil {
db, _ := global.GVA_DB.DB()
err := db.Close()
if err != nil {
global.GVA_LOG.Error("关闭原数据库连接失败!", zap.Error(err))
return err
}
}
// 重新建立数据库连接
global.GVA_DB = Gorm()
// 重新初始化其他配置
OtherInit()
DBList()
if global.GVA_DB != nil {
// 确保数据库表结构是最新的
RegisterTables()
}
// 重新初始化定时任务
Timer()
global.GVA_LOG.Info("系统配置重新加载完成")
return nil
}

106
server/initialize/router.go Normal file
View File

@@ -0,0 +1,106 @@
package initialize
import (
"net/http"
"os"
"git.echol.cn/loser/ai_proxy/server/docs"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/router"
"github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
)
type justFilesFilesystem struct {
fs http.FileSystem
}
func (fs justFilesFilesystem) Open(name string) (http.File, error) {
f, err := fs.fs.Open(name)
if err != nil {
return nil, err
}
stat, err := f.Stat()
if stat.IsDir() {
return nil, os.ErrPermission
}
return f, nil
}
// Routers 初始化总路由
func Routers() *gin.Engine {
Router := gin.New()
// 设置文件上传大小限制10MB
Router.MaxMultipartMemory = 10 << 20
// 使用 Gin 默认的 Recovery 中间件
Router.Use(gin.Recovery())
if gin.Mode() == gin.DebugMode {
Router.Use(gin.Logger())
}
// 简单的 CORS 中间件
Router.Use(func(c *gin.Context) {
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With, x-token")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE")
if c.Request.Method == "OPTIONS" {
c.AbortWithStatus(204)
return
}
c.Next()
})
systemRouter := router.RouterGroupApp.System
appRouter := router.RouterGroupApp.App
// 静态文件服务
Router.StaticFS(global.GVA_CONFIG.Local.StorePath, justFilesFilesystem{http.Dir(global.GVA_CONFIG.Local.StorePath)})
// Swagger 文档
docs.SwaggerInfo.BasePath = global.GVA_CONFIG.System.RouterPrefix
Router.GET(global.GVA_CONFIG.System.RouterPrefix+"/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
global.GVA_LOG.Info("register swagger handler")
// 路由组
PublicGroup := Router.Group(global.GVA_CONFIG.System.RouterPrefix)
{
// 健康检查
PublicGroup.GET("/health", func(c *gin.Context) {
c.JSON(http.StatusOK, "ok")
})
}
// 系统管理路由
{
systemGroup := PublicGroup.Group("v1/system")
systemRouter.UserRouter.InitUserRouter(systemGroup) // 用户管理路由:/v1/system/user/*
systemRouter.ApiRouter.InitApiRouter(systemGroup) // API管理路由/v1/system/api/*
}
// 前台应用路由
{
appGroup := PublicGroup.Group("app")
appRouter.AiPresetRouter.InitAiPresetRouter(appGroup) // AI预设路由/app/preset/*
appRouter.AiProviderRouter.InitAiProviderRouter(appGroup) // AI提供商路由/app/provider/*
appRouter.PresetBindingRouter.InitPresetBindingRouter(appGroup) // 预设绑定路由:/app/binding/*
}
// OpenAI 兼容的代理接口
{
v1Group := PublicGroup.Group("v1")
appRouter.AiProxyRouter.InitAiProxyRouter(v1Group) // /v1/chat/completions
}
global.GVA_ROUTERS = Router.Routes()
global.GVA_LOG.Info("router register success")
return Router
}

View File

@@ -0,0 +1,26 @@
package initialize
import (
"git.echol.cn/loser/ai_proxy/server/router"
"github.com/gin-gonic/gin"
)
// 占位方法保证文件可以正确加载避免go空变量检测报错请勿删除。
func holder(routers ...*gin.RouterGroup) {
_ = routers
_ = router.RouterGroupApp
}
func initBizRouter(routers ...*gin.RouterGroup) {
privateGroup := routers[0]
publicGroup := routers[1]
holder(publicGroup, privateGroup)
// 注册 app 模块路由
appRouter := router.RouterGroupApp.App
appRouter.AiPresetRouter.InitAiPresetRouter(privateGroup)
appRouter.AiProviderRouter.InitAiProviderRouter(privateGroup)
appRouter.AiProxyRouter.InitAiProxyRouter(privateGroup)
appRouter.PresetBindingRouter.InitPresetBindingRouter(privateGroup)
}

View File

@@ -0,0 +1,38 @@
package initialize
import (
"fmt"
"git.echol.cn/loser/ai_proxy/server/task"
"github.com/robfig/cron/v3"
"git.echol.cn/loser/ai_proxy/server/global"
)
func Timer() {
go func() {
var option []cron.Option
option = append(option, cron.WithSeconds())
// 清理DB定时任务
_, err := global.GVA_Timer.AddTaskByFunc("ClearDB", "@daily", func() {
err := task.ClearTable(global.GVA_DB) // 定时任务方法定在task文件包中
if err != nil {
fmt.Println("timer error:", err)
}
}, "定时清理数据库【日志,黑名单】内容", option...)
if err != nil {
fmt.Println("add timer error:", err)
}
// 其他定时任务定在这里 参考上方使用方法
//_, err := global.GVA_Timer.AddTaskByFunc("定时任务标识", "corn表达式", func() {
// 具体执行内容...
// ......
//}, option...)
//if err != nil {
// fmt.Println("add timer error:", err)
//}
}()
}

View File

@@ -0,0 +1,22 @@
package initialize
import "git.echol.cn/loser/ai_proxy/server/utils"
func init() {
_ = utils.RegisterRule("PageVerify",
utils.Rules{
"Page": {utils.NotEmpty()},
"PageSize": {utils.NotEmpty()},
},
)
_ = utils.RegisterRule("IdVerify",
utils.Rules{
"Id": {utils.NotEmpty()},
},
)
_ = utils.RegisterRule("AuthorityIdVerify",
utils.Rules{
"AuthorityId": {utils.NotEmpty()},
},
)
}

View File

@@ -0,0 +1,739 @@
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:49.976 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[8.026ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:92
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:49.977 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:92
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.453 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[7.921ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:92
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.455 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:92
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.269 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[22.029ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:93
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.270 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:93
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.890 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[7.656ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:93
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.891 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:93
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.152 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[9.354ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:93
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.153 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:93
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.429 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[17.993ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:95
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.430 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:95
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.233 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[7.206ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.236 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.744 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[8.725ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.745 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.418 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[7.519ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.420 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:42.978 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[7.195ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:42.979 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:39.899 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[21.072ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:39.900 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:39.921 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[12.273ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:39.922 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.740 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[7.602ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.741 error /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
/Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
/Users/en/GolandProjects/st-ui/server/initialize/gorm.go:96
main.initializeSystem
/Users/en/GolandProjects/st-ui/server/main.go:49
main.main
/Users/en/GolandProjects/st-ui/server/main.go:32
runtime.main
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/runtime/proc.go:285
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:22.771 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296 record not found
[44.080ms] [rows:0] SELECT * FROM "ai_configs" WHERE (provider = 'openai' AND is_active = true) AND "ai_configs"."deleted_at" IS NULL ORDER BY is_default DESC, created_at DESC,"ai_configs"."id" LIMIT 1
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).First
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:129
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).callAIService
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).SendMessage
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:259
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:227
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:22.772 error /Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229 发送消息失败 {"error": "未找到可用的 AI 配置"}
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:43.641 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296 record not found
[30.845ms] [rows:0] SELECT * FROM "ai_configs" WHERE (provider = 'openai' AND is_active = true) AND "ai_configs"."deleted_at" IS NULL ORDER BY is_default DESC, created_at DESC,"ai_configs"."id" LIMIT 1
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).First
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:129
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).callAIService
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).SendMessage
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:259
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:227
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:43.642 error /Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229 发送消息失败 {"error": "未找到可用的 AI 配置"}
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:46.833 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296 record not found
[6.773ms] [rows:0] SELECT * FROM "ai_configs" WHERE (provider = 'openai' AND is_active = true) AND "ai_configs"."deleted_at" IS NULL ORDER BY is_default DESC, created_at DESC,"ai_configs"."id" LIMIT 1
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).First
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:129
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).callAIService
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).SendMessage
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:259
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:227
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:46.834 error /Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229 发送消息失败 {"error": "未找到可用的 AI 配置"}
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:54.855 error /Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31 /Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296 record not found
[16.792ms] [rows:0] SELECT * FROM "ai_configs" WHERE (provider = 'openai' AND is_active = true) AND "ai_configs"."deleted_at" IS NULL ORDER BY is_default DESC, created_at DESC,"ai_configs"."id" LIMIT 1
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
/Users/en/GolandProjects/st-ui/server/initialize/internal/gorm_logger_writer.go:31
gorm.io/gorm/logger.(*logger).Trace
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).First
/Users/en/go/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:129
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).callAIService
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:296
git.echol.cn/loser/ai_proxy/server/service/app.(*ConversationService).SendMessage
/Users/en/GolandProjects/st-ui/server/service/app/conversation.go:259
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:227
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:54.858 error /Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229 发送消息失败 {"error": "未找到可用的 AI 配置"}
git.echol.cn/loser/ai_proxy/server/api/v1/app.(*ConversationApi).SendMessage
/Users/en/GolandProjects/st-ui/server/api/v1/app/conversation.go:229
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.AppJWTAuth.func1
/Users/en/GolandProjects/st-ui/server/middleware/app_jwt.go:71
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.Cors.func1
/Users/en/GolandProjects/st-ui/server/middleware/cors.go:26
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.LoggerWithConfig.func1
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/logger.go:249
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
git.echol.cn/loser/ai_proxy/server/middleware.GinRecovery.func1
/Users/en/GolandProjects/st-ui/server/middleware/error.go:78
github.com/gin-gonic/gin.(*Context).Next
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
/Users/en/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:3340
net/http.(*conn).serve
/Users/en/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.7.darwin-arm64/src/net/http/server.go:2109

View File

@@ -0,0 +1,100 @@
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:46.967 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:50.020 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:100 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:50.084 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:50.099 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:50.100 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:50.101 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:161 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:33:48.393 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:33:48.417 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:07.438 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.494 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:100 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.542 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.558 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.559 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.561 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:162 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:35:50.353 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:35:50.374 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:02.621 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.306 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:101 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.355 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.370 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.372 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.374 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:162 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:35.832 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:35.839 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:42.030 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.935 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:101 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.975 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.990 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.992 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.994 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:162 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:01:44.899 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:01:44.910 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:16.588 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.192 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:101 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.234 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.250 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.255 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.258 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:162 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:25.628 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:25.636 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:53.277 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.466 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:103 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.520 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.535 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.538 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.541 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:163 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:33.169 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:33.201 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:50.302 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.274 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:104 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.313 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.330 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.331 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.332 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:164 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:06.014 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:06.020 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:19.421 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.780 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:104 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.826 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.847 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.849 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.853 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:164 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:53:59.453 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:53:59.511 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:04.529 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.491 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:104 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.531 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.546 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.547 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.548 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:164 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:21.772 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:21.793 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:35.497 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:43.060 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:104 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:43.124 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:43.154 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:43.157 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:43.162 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:164 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:28.437 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:28.457 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:32.919 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:39.949 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:104 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:39.991 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:40.012 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:40.013 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:40.014 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:164 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:32.465 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:39.965 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:104 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:40.019 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:40.035 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:40.041 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:40.042 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:164 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:14:04.444 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:14:04.451 info /Users/en/GolandProjects/st-ui/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:00.587 info /Users/en/GolandProjects/st-ui/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.867 info /Users/en/GolandProjects/st-ui/server/initialize/gorm.go:104 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.932 info /Users/en/GolandProjects/st-ui/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.958 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.960 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.961 info /Users/en/GolandProjects/st-ui/server/initialize/router.go:164 router register success

View File

@@ -0,0 +1,13 @@
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:21:50.100 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:34:14.558 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:36:08.371 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 18:56:48.990 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:02:22.251 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:14:59.536 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:27:56.331 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:45:27.848 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 19:54:11.546 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:17:43.155 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:33:40.013 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 20:49:40.036 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-26 21:15:08.959 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts

File diff suppressed because it is too large Load Diff

60427
server/log/2026-02-27/info.log Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
[git.echol.cn/loser/ai_proxy/server]2026-02-27 14:16:32.040 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 14:53:11.399 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:06:25.876 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:10:59.873 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:13:52.007 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:21:57.951 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:24:45.527 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:41:48.294 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:48:54.136 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 15:55:45.526 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 16:08:32.199 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 16:23:31.784 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 16:30:28.919 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 16:41:46.870 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 16:49:02.739 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 17:03:59.981 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 18:24:51.562 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 19:03:13.475 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 19:07:46.556 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 19:15:47.924 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 19:40:53.649 warn /Users/en/GolandProjects/st-ui/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 22:03:02.617 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 22:34:07.654 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 23:26:58.610 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-27 23:42:35.973 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:26.677 info C:/Users/Administrator/GolandProjects/st-react/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:26.681 info C:/Users/Administrator/GolandProjects/st-react/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:36.835 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:40.277 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:107 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:40.297 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:40.308 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:40.309 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:40.311 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:168 router register success
[git.echol.cn/loser/ai_proxy/server]2026-02-28 14:59:47.761 info C:/Users/Administrator/GolandProjects/st-react/server/core/server_run.go:48 关闭WEB服务...
[git.echol.cn/loser/ai_proxy/server]2026-02-28 14:59:47.762 info C:/Users/Administrator/GolandProjects/st-react/server/core/server_run.go:59 WEB服务已关闭
[git.echol.cn/loser/ai_proxy/server]2026-02-28 15:00:12.331 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:22 pgvector extension is ready
[git.echol.cn/loser/ai_proxy/server]2026-02-28 15:00:15.732 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:107 register table success
[git.echol.cn/loser/ai_proxy/server]2026-02-28 15:00:15.763 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/redis.go:35 redis connect ping response: {"name": "sys-cache", "pong": "PONG"}
[git.echol.cn/loser/ai_proxy/server]2026-02-28 15:00:15.775 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:51 use middleware cors
[git.echol.cn/loser/ai_proxy/server]2026-02-28 15:00:15.777 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:101 register swagger handler
[git.echol.cn/loser/ai_proxy/server]2026-02-28 15:00:15.780 info C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:168 router register success

View File

@@ -0,0 +1,2 @@
[git.echol.cn/loser/ai_proxy/server]2026-02-28 00:18:40.309 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-02-28 15:00:15.777 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts

View File

@@ -0,0 +1,228 @@
[git.echol.cn/loser/ai_proxy/server]2026-03-01 00:00:05.840 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32 C:/Users/Administrator/GolandProjects/st-react/server/task/clearTable.go:46 failed to connect to `user=postgres database=st2`: 219.152.55.29:5432 (219.152.55.29): failed to receive message: unexpected EOF
[5001.319ms] [rows:0] DELETE FROM sys_operation_records WHERE created_at < '2025-12-01 00:00:00.839'
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32
gorm.io/gorm/logger.(*logger).Trace
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/task.ClearTable
C:/Users/Administrator/GolandProjects/st-react/server/task/clearTable.go:46
git.echol.cn/loser/ai_proxy/server/initialize.Timer.func1.1
C:/Users/Administrator/GolandProjects/st-react/server/initialize/timer.go:19
github.com/robfig/cron/v3.FuncJob.Run
D:/GOPATH/pkg/mod/github.com/robfig/cron/v3@v3.0.1/cron.go:136
github.com/robfig/cron/v3.(*Cron).startJob.func1
D:/GOPATH/pkg/mod/github.com/robfig/cron/v3@v3.0.1/cron.go:312
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:22:55.648 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32 C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[3.710ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32
gorm.io/gorm/logger.(*logger).Trace
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:22:55.649 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:46:08.588 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32 C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[3.115ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32
gorm.io/gorm/logger.(*logger).Trace
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:46:08.592 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:50:09.853 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32 C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[4.154ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32
gorm.io/gorm/logger.(*logger).Trace
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:50:09.853 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:52:55.114 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32 C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[3.661ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32
gorm.io/gorm/logger.(*logger).Trace
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:52:55.114 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 22:12:59.096 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32 C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[4.166ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32
gorm.io/gorm/logger.(*logger).Trace
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 22:12:59.100 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 22:18:28.225 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32 C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42 ERROR: relation "ai_memory_vectors" does not exist (SQLSTATE 42P01)
[3.133ms] [rows:0]
CREATE INDEX IF NOT EXISTS idx_memory_vectors_embedding
ON ai_memory_vectors
USING hnsw (embedding vector_cosine_ops)
git.echol.cn/loser/ai_proxy/server/initialize/internal.(*Writer).Printf
C:/Users/Administrator/GolandProjects/st-react/server/initialize/internal/gorm_logger_writer.go:32
gorm.io/gorm/logger.(*logger).Trace
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/logger/logger.go:167
gorm.io/gorm.(*processor).Execute
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/callbacks.go:134
gorm.io/gorm.(*DB).Exec
D:/GOPATH/pkg/mod/gorm.io/gorm@v1.25.12/finisher_api.go:769
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:42
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283
[git.echol.cn/loser/ai_proxy/server]2026-03-01 22:18:28.230 error C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43 failed to create vector indexes {"error": "ERROR: relation \"ai_memory_vectors\" does not exist (SQLSTATE 42P01)"}
git.echol.cn/loser/ai_proxy/server/initialize.CreateVectorIndexes
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm_pgsql_extension.go:43
git.echol.cn/loser/ai_proxy/server/initialize.RegisterTables
C:/Users/Administrator/GolandProjects/st-react/server/initialize/gorm.go:99
main.initializeSystem
C:/Users/Administrator/GolandProjects/st-react/server/main.go:49
main.main
C:/Users/Administrator/GolandProjects/st-react/server/main.go:32
runtime.main
C:/Program Files/Go/src/runtime/proc.go:283

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:22:55.696 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:46:08.641 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:50:09.903 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-01 21:52:55.198 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-01 22:12:59.150 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-01 22:18:28.278 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts

File diff suppressed because it is too large Load Diff

16860
server/log/2026-03-02/info.log Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
[git.echol.cn/loser/ai_proxy/server]2026-03-02 00:25:36.353 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-02 00:29:09.468 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-02 00:57:24.167 warn C:/Users/Administrator/GolandProjects/st-react/server/service/app/regex_script.go:218 正则表达式编译失败 {"pattern": "/<(UpdateVariable)>((?:(?!<\\1>)[\\s\\S])*?)</\\1>/mi", "error": "error parsing regexp: invalid or unsupported Perl syntax: `(?!`"}
[git.echol.cn/loser/ai_proxy/server]2026-03-02 00:57:24.171 warn C:/Users/Administrator/GolandProjects/st-react/server/service/app/regex_script.go:281 执行正则脚本失败 {"name": "对AI隐藏状态栏更新", "error": "error parsing regexp: invalid or unsupported Perl syntax: `(?!`"}
[git.echol.cn/loser/ai_proxy/server]2026-03-02 01:02:44.889 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-02 02:43:19.037 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-02 03:02:08.766 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-02 23:18:20.568 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts

File diff suppressed because it is too large Load Diff

12096
server/log/2026-03-03/info.log Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
[git.echol.cn/loser/ai_proxy/server]2026-03-03 02:14:33.098 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-03 02:59:50.061 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-03 03:13:21.290 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-03 03:20:20.084 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-03 03:26:19.621 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-03 03:30:35.712 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-03 03:37:53.896 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts
[git.echol.cn/loser/ai_proxy/server]2026-03-03 03:54:16.681 warn C:/Users/Administrator/GolandProjects/st-react/server/initialize/router.go:85 SillyTavern 核心脚本目录不存在: data/st-core-scripts

51
server/main.go Normal file
View File

@@ -0,0 +1,51 @@
package main
import (
"git.echol.cn/loser/ai_proxy/server/core"
"git.echol.cn/loser/ai_proxy/server/global"
"git.echol.cn/loser/ai_proxy/server/initialize"
_ "go.uber.org/automaxprocs"
"go.uber.org/zap"
)
//go:generate go env -w GO111MODULE=on
//go:generate go env -w GOPROXY=https://goproxy.cn,direct
//go:generate go mod tidy
//go:generate go mod download
// 这部分 @Tag 设置用于排序, 需要排序的接口请按照下面的格式添加
// swag init 对 @Tag 只会从入口文件解析, 默认 main.go
// 也可通过 --generalInfo flag 指定其他文件
// @Tag.Name Base
// @Tag.Name SysUser
// @Tag.Description 用户
// @title Gin-Vue-Admin Swagger API接口文档
// @version v2.8.9
// @description 使用gin+vue进行极速开发的全栈开发基础平台
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name x-token
// @BasePath /
func main() {
// 初始化系统
initializeSystem()
// 运行服务器
core.RunServer()
}
// initializeSystem 初始化系统所有组件
// 提取为单独函数以便于系统重载时调用
func initializeSystem() {
global.GVA_VP = core.Viper() // 初始化Viper
initialize.OtherInit()
global.GVA_LOG = core.Zap() // 初始化zap日志库
zap.ReplaceGlobals(global.GVA_LOG)
global.GVA_DB = initialize.Gorm() // gorm连接数据库
initialize.Timer()
initialize.DBList()
initialize.SetupHandlers() // 注册全局函数
if global.GVA_DB != nil {
initialize.RegisterTables() // 初始化表
}
}

230
server/model/app/README.md Normal file
View File

@@ -0,0 +1,230 @@
# AI 中转代理系统 - App 模块
## 已完成的功能模块
按照 server 目录的标准结构,已将 AI 中转代理项目的代码编写到各个 `app` 目录下:
### 1. Model 层 (server/model/app/)
**核心模型:**
- `ai_preset.go` - AI 预设模板模型(支持 SillyTavern 格式)
- `ai_provider.go` - AI 服务提供商模型
- `ai_preset_binding.go` - 用户-预设-提供商绑定模型
- `ai_request_log.go` - AI 请求日志模型
- `ai_preset_types.go` - 预设相关的自定义类型
**Request 结构体 (server/model/app/request/)**
- `ai_preset.go` - 预设相关请求(创建、更新、导入)
- `ai_provider.go` - 提供商相关请求(创建、更新)
- `ai_proxy.go` - 代理请求(聊天补全、消息、角色卡片)
**Response 结构体 (server/model/app/response/)**
- `ai_proxy.go` - 代理响应OpenAI 兼容格式)
### 2. Service 层 (server/service/app/)
- `ai_preset.go` - 预设服务CRUD、导入导出
- `ai_provider.go` - 提供商服务CRUD、连接测试
- `ai_proxy.go` - 代理服务(核心预设注入引擎、转发到上游 AI
- `enter.go` - Service 统一入口
### 3. API 层 (server/api/v1/app/)
- `ai_preset.go` - 预设管理 API
- `ai_provider.go` - 提供商管理 API
- `ai_proxy.go` - 代理转发 APIOpenAI 兼容接口)
- `enter.go` - API 统一入口
### 4. Router 层 (server/router/app/)
- `ai_preset.go` - 预设路由
- `ai_provider.go` - 提供商路由
- `ai_proxy.go` - 代理路由
- `enter.go` - Router 统一入口
## 核心功能特性
### 1. AI 预设管理
- ✅ 创建、更新、删除预设
- ✅ 获取预设列表和详情
- ✅ 导入 SillyTavern 格式预设
- ✅ 导出预设为 JSON
- ✅ 支持公开/私有预设
- ✅ 完整的 Prompt 注入配置
- ✅ 正则脚本处理
### 2. AI 服务提供商管理
- ✅ 创建、更新、删除提供商
- ✅ 获取提供商列表和详情
- ✅ 支持自定义配置
- ✅ 启用/禁用状态管理
### 3. AI 代理服务
- ✅ OpenAI 兼容的聊天补全接口
- ✅ 预设注入引擎
- ✅ 变量替换({{user}}, {{char}}
- ✅ 正则脚本处理(输入/输出)
- ✅ 转发到上游 AI 服务
- ✅ 请求日志记录
- ⏳ 流式响应(待实现)
## API 端点
### 预设管理
```
POST /app/preset # 创建预设
PUT /app/preset # 更新预设
DELETE /app/preset/:id # 删除预设
GET /app/preset/:id # 获取预设详情
GET /app/preset/list # 获取预设列表
POST /app/preset/import # 导入预设
GET /app/preset/:id/export # 导出预设
```
### 提供商管理
```
POST /app/provider # 创建提供商
PUT /app/provider # 更新提供商
DELETE /app/provider/:id # 删除提供商
GET /app/provider/:id # 获取提供商详情
GET /app/provider/list # 获取提供商列表
```
### 代理接口OpenAI 兼容)
```
POST /v1/chat/completions # 聊天补全
```
## 数据模型说明
### AiPreset预设模板
```go
- UserID: 用户ID
- Name: 预设名称
- Description: 预设描述
- Prompts: 提示词数组支持 SillyTavern 格式
- RegexScripts: 正则脚本数组
- Temperature, TopP, MaxTokens: 模型参数
- StreamEnabled: 是否启用流式
- IsDefault: 是否默认
- IsPublic: 是否公开
```
### Prompt提示词
```go
- Name: 提示词名称
- Role: 角色system/user/assistant
- Content: 提示词内容
- Identifier: 标识符
- InjectionPosition: 注入位置
- InjectionDepth: 注入深度
- InjectionOrder: 注入顺序
- Marker: 是否为占位符
```
### RegexScript正则脚本
```go
- ScriptName: 脚本名称
- FindRegex: 查找正则
- ReplaceString: 替换字符串
- Placement: 应用位置1=输入, 2=输出
- MinDepth, MaxDepth: 深度限制
```
## 预设注入流程
1. 接收用户请求
2. 加载预设配置
3. 按 injection_order 排序 prompts
4. 根据 injection_depth 插入到对话历史中
5. 替换变量({{user}}, {{char}}
6. 应用正则脚本placement=1 处理输入)
7. 转发到上游 AI
8. 应用正则脚本placement=2 处理输出)
9. 记录日志
10. 返回响应
## 待完善功能
1. **完整的预设注入引擎**
- 完整实现 injection_depth 逻辑
- 完整实现正则脚本处理
- 支持更多变量替换
2. **流式响应**
- 实现 SSE 流式输出
- 支持流式日志记录
3. **预设绑定管理**
- 实现 binding_key 机制
- 支持多预设切换
4. **导入导出**
- 完善 SillyTavern JSON 解析
- 支持批量导入导出
## 使用示例
### 1. 创建 AI 提供商
```bash
POST /app/provider
{
"name": "OpenAI",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "sk-xxx",
"model": "gpt-4",
"isActive": true
}
```
### 2. 导入 SillyTavern 预设
```bash
POST /app/preset/import
{
"name": "TG角色扮演",
"data": { ... } // TGbreak.json 内容
}
```
### 3. 发送聊天请求
```bash
POST /v1/chat/completions
{
"messages": [
{"role": "user", "content": "你好"}
],
"presetId": 1,
"characterCard": {
"name": "小美",
"description": "活泼的女孩"
}
}
```
## 项目结构
```
server/
├── model/app/ # 数据模型
│ ├── ai_preset.go
│ ├── ai_provider.go
│ ├── ai_preset_binding.go
│ ├── ai_request_log.go
│ ├── request/ # 请求结构体
│ └── response/ # 响应结构体
├── service/app/ # 业务逻辑
│ ├── ai_preset.go
│ ├── ai_provider.go
│ ├── ai_proxy.go
│ └── enter.go
├── api/v1/app/ # API 处理器
│ ├── ai_preset.go
│ ├── ai_provider.go
│ ├── ai_proxy.go
│ └── enter.go
└── router/app/ # 路由注册
├── ai_preset.go
├── ai_provider.go
├── ai_proxy.go
└── enter.go
```

View File

@@ -0,0 +1,59 @@
package app
import (
"git.echol.cn/loser/ai_proxy/server/global"
)
// AiPreset AI预设模板
type AiPreset struct {
global.GVA_MODEL
UserID uint `json:"userId" gorm:"comment:用户ID;index"`
Name string `json:"name" gorm:"comment:预设名称;size:200;not null"`
Description string `json:"description" gorm:"comment:预设描述;type:text"`
Prompts Prompts `json:"prompts" gorm:"comment:提示词数组;type:jsonb;not null"`
RegexScripts RegexScripts `json:"regexScripts" gorm:"comment:正则脚本;type:jsonb"`
Temperature float64 `json:"temperature" gorm:"comment:温度;default:1.0"`
TopP float64 `json:"topP" gorm:"comment:TopP;default:0.9"`
MaxTokens int `json:"maxTokens" gorm:"comment:最大Token数;default:4096"`
FrequencyPenalty float64 `json:"frequencyPenalty" gorm:"comment:频率惩罚;default:0"`
PresencePenalty float64 `json:"presencePenalty" gorm:"comment:存在惩罚;default:0"`
StreamEnabled bool `json:"streamEnabled" gorm:"comment:是否启用流式;default:true"`
IsDefault bool `json:"isDefault" gorm:"comment:是否默认;default:false"`
IsPublic bool `json:"isPublic" gorm:"comment:是否公开;default:false"`
}
func (AiPreset) TableName() string {
return "ai_presets"
}
// Prompt 提示词结构
type Prompt struct {
Name string `json:"name"`
SystemPrompt bool `json:"system_prompt"`
Role string `json:"role"`
Content string `json:"content"`
Identifier string `json:"identifier"`
InjectionPosition int `json:"injection_position"`
InjectionDepth int `json:"injection_depth"`
InjectionOrder int `json:"injection_order"`
InjectionTrigger []string `json:"injection_trigger"`
Marker bool `json:"marker"`
ForbidOverrides bool `json:"forbid_overrides"`
}
// RegexScript 正则脚本
type RegexScript struct {
ID string `json:"id"`
ScriptName string `json:"scriptName"`
FindRegex string `json:"findRegex"`
ReplaceString string `json:"replaceString"`
TrimStrings []string `json:"trimStrings"`
Placement []int `json:"placement"`
Disabled bool `json:"disabled"`
MarkdownOnly bool `json:"markdownOnly"`
PromptOnly bool `json:"promptOnly"`
RunOnEdit bool `json:"runOnEdit"`
SubstituteRegex int `json:"substituteRegex"`
MinDepth *int `json:"minDepth"`
MaxDepth *int `json:"maxDepth"`
}

View File

@@ -0,0 +1,22 @@
package app
import (
"git.echol.cn/loser/ai_proxy/server/global"
)
// AiPresetBinding 预设-提供商绑定关系
type AiPresetBinding struct {
global.GVA_MODEL
PresetID uint `json:"presetId" gorm:"comment:预设ID;index"`
ProviderID uint `json:"providerId" gorm:"comment:提供商ID;index"`
Priority int `json:"priority" gorm:"comment:优先级;default:0"` // 多个预设时的执行顺序
IsActive bool `json:"isActive" gorm:"comment:是否启用;default:true"`
// 关联
Preset AiPreset `json:"preset" gorm:"foreignKey:PresetID"`
Provider AiProvider `json:"provider" gorm:"foreignKey:ProviderID"`
}
func (AiPresetBinding) TableName() string {
return "ai_preset_bindings"
}

Some files were not shown because too many files have changed in this diff Show More