🎨 移除多余模块
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
package request
|
||||
|
||||
type AutoMcpTool struct {
|
||||
type McpToolTemplateRequest struct {
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Description string `json:"description" form:"description" binding:"required"`
|
||||
Params []struct {
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Description string `json:"description" form:"description" binding:"required"`
|
||||
Type string `json:"type" form:"type" binding:"required"` // string, number, boolean, object, array
|
||||
Type string `json:"type" form:"type" binding:"required"`
|
||||
Required bool `json:"required" form:"required"`
|
||||
Default string `json:"default" form:"default"`
|
||||
} `json:"params" form:"params"`
|
||||
Response []struct {
|
||||
Type string `json:"type" form:"type" binding:"required"` // text, image
|
||||
Type string `json:"type" form:"type" binding:"required"`
|
||||
} `json:"response" form:"response"`
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
common "github.com/flipped-aurora/gin-vue-admin/server/model/common"
|
||||
commonReq "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
system "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
)
|
||||
|
||||
type SysAIWorkflowSessionUpsert struct {
|
||||
ID uint `json:"id"`
|
||||
Tab string `json:"tab"`
|
||||
Title string `json:"title"`
|
||||
Summary string `json:"summary"`
|
||||
ConversationID string `json:"conversationId"`
|
||||
MessageID string `json:"messageId"`
|
||||
CurrentNodeID string `json:"currentNodeId"`
|
||||
Settings common.JSONMap `json:"settings"`
|
||||
FormData common.JSONMap `json:"formData"`
|
||||
ResultData common.JSONMap `json:"resultData"`
|
||||
Messages []system.AIWorkflowMessage `json:"messages"`
|
||||
}
|
||||
|
||||
type SysAIWorkflowSessionSearch struct {
|
||||
commonReq.PageInfo
|
||||
Tab string `json:"tab" form:"tab"`
|
||||
}
|
||||
|
||||
type SysAIWorkflowMarkdownDump struct {
|
||||
ID uint `json:"id"`
|
||||
Tab string `json:"tab"`
|
||||
Title string `json:"title"`
|
||||
Summary string `json:"summary"`
|
||||
ConversationID string `json:"conversationId"`
|
||||
MessageID string `json:"messageId"`
|
||||
CurrentNodeID string `json:"currentNodeId"`
|
||||
Settings common.JSONMap `json:"settings"`
|
||||
FormData common.JSONMap `json:"formData"`
|
||||
ResultData common.JSONMap `json:"resultData"`
|
||||
Messages []system.AIWorkflowMessage `json:"messages"`
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
"github.com/pkg/errors"
|
||||
"go/token"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type AutoCode struct {
|
||||
Package string `json:"package"`
|
||||
PackageT string `json:"-"`
|
||||
TableName string `json:"tableName" example:"表名"` // 表名
|
||||
BusinessDB string `json:"businessDB" example:"业务数据库"` // 业务数据库
|
||||
StructName string `json:"structName" example:"Struct名称"` // Struct名称
|
||||
PackageName string `json:"packageName" example:"文件名称"` // 文件名称
|
||||
Description string `json:"description" example:"Struct中文名称"` // Struct中文名称
|
||||
Abbreviation string `json:"abbreviation" example:"Struct简称"` // Struct简称
|
||||
HumpPackageName string `json:"humpPackageName" example:"go文件名称"` // go文件名称
|
||||
GvaModel bool `json:"gvaModel" example:"false"` // 是否使用gva默认Model
|
||||
AutoMigrate bool `json:"autoMigrate" example:"false"` // 是否自动迁移表结构
|
||||
AutoCreateResource bool `json:"autoCreateResource" example:"false"` // 是否自动创建资源标识
|
||||
AutoCreateApiToSql bool `json:"autoCreateApiToSql" example:"false"` // 是否自动创建api
|
||||
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql" example:"false"` // 是否自动创建menu
|
||||
AutoCreateBtnAuth bool `json:"autoCreateBtnAuth" example:"false"` // 是否自动创建按钮权限
|
||||
OnlyTemplate bool `json:"onlyTemplate" example:"false"` // 是否只生成模板
|
||||
IsTree bool `json:"isTree" example:"false"` // 是否树形结构
|
||||
TreeJson string `json:"treeJson" example:"展示的树json字段"` // 展示的树json字段
|
||||
IsAdd bool `json:"isAdd" example:"false"` // 是否新增
|
||||
Fields []*AutoCodeField `json:"fields"`
|
||||
GenerateWeb bool `json:"generateWeb" example:"true"` // 是否生成web
|
||||
GenerateServer bool `json:"generateServer" example:"true"` // 是否生成server
|
||||
Module string `json:"-"`
|
||||
DictTypes []string `json:"-"`
|
||||
PrimaryField *AutoCodeField `json:"primaryField"`
|
||||
DataSourceMap map[string]*DataSource `json:"-"`
|
||||
HasPic bool `json:"-"`
|
||||
HasFile bool `json:"-"`
|
||||
HasTimer bool `json:"-"`
|
||||
NeedSort bool `json:"-"`
|
||||
NeedJSON bool `json:"-"`
|
||||
HasRichText bool `json:"-"`
|
||||
HasDataSource bool `json:"-"`
|
||||
HasSearchTimer bool `json:"-"`
|
||||
HasArray bool `json:"-"`
|
||||
HasExcel bool `json:"-"`
|
||||
}
|
||||
|
||||
type DataSource struct {
|
||||
DBName string `json:"dbName"`
|
||||
Table string `json:"table"`
|
||||
Label string `json:"label"`
|
||||
Value string `json:"value"`
|
||||
Association int `json:"association"` // 关联关系 1 一对一 2 一对多
|
||||
HasDeletedAt bool `json:"hasDeletedAt"`
|
||||
}
|
||||
|
||||
func (r *AutoCode) Apis() []model.SysApi {
|
||||
return []model.SysApi{
|
||||
{
|
||||
Path: "/" + r.Abbreviation + "/" + "create" + r.StructName,
|
||||
Description: "新增" + r.Description,
|
||||
ApiGroup: r.Description,
|
||||
Method: "POST",
|
||||
},
|
||||
{
|
||||
Path: "/" + r.Abbreviation + "/" + "delete" + r.StructName,
|
||||
Description: "删除" + r.Description,
|
||||
ApiGroup: r.Description,
|
||||
Method: "DELETE",
|
||||
},
|
||||
{
|
||||
Path: "/" + r.Abbreviation + "/" + "delete" + r.StructName + "ByIds",
|
||||
Description: "批量删除" + r.Description,
|
||||
ApiGroup: r.Description,
|
||||
Method: "DELETE",
|
||||
},
|
||||
{
|
||||
Path: "/" + r.Abbreviation + "/" + "update" + r.StructName,
|
||||
Description: "更新" + r.Description,
|
||||
ApiGroup: r.Description,
|
||||
Method: "PUT",
|
||||
},
|
||||
{
|
||||
Path: "/" + r.Abbreviation + "/" + "find" + r.StructName,
|
||||
Description: "根据ID获取" + r.Description,
|
||||
ApiGroup: r.Description,
|
||||
Method: "GET",
|
||||
},
|
||||
{
|
||||
Path: "/" + r.Abbreviation + "/" + "get" + r.StructName + "List",
|
||||
Description: "获取" + r.Description + "列表",
|
||||
ApiGroup: r.Description,
|
||||
Method: "GET",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r *AutoCode) Menu(template string) model.SysBaseMenu {
|
||||
component := fmt.Sprintf("view/%s/%s/%s.vue", r.Package, r.PackageName, r.PackageName)
|
||||
if template != "package" {
|
||||
component = fmt.Sprintf("plugin/%s/view/%s.vue", r.Package, r.PackageName)
|
||||
}
|
||||
return model.SysBaseMenu{
|
||||
ParentId: 0,
|
||||
Path: r.Abbreviation,
|
||||
Name: r.Abbreviation,
|
||||
Component: component,
|
||||
Meta: model.Meta{
|
||||
Title: r.Description,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Pretreatment 预处理
|
||||
// Author [SliverHorn](https://github.com/SliverHorn)
|
||||
func (r *AutoCode) Pretreatment() error {
|
||||
r.Module = global.GVA_CONFIG.AutoCode.Module
|
||||
if token.IsKeyword(r.Abbreviation) {
|
||||
r.Abbreviation = r.Abbreviation + "_"
|
||||
} // go 关键字处理
|
||||
if strings.HasSuffix(r.HumpPackageName, "test") {
|
||||
r.HumpPackageName = r.HumpPackageName + "_"
|
||||
} // test
|
||||
length := len(r.Fields)
|
||||
dict := make(map[string]string, length)
|
||||
r.DataSourceMap = make(map[string]*DataSource, length)
|
||||
for i := 0; i < length; i++ {
|
||||
if r.Fields[i].Excel {
|
||||
r.HasExcel = true
|
||||
}
|
||||
if r.Fields[i].DictType != "" {
|
||||
dict[r.Fields[i].DictType] = ""
|
||||
}
|
||||
if r.Fields[i].Sort {
|
||||
r.NeedSort = true
|
||||
}
|
||||
switch r.Fields[i].FieldType {
|
||||
case "file":
|
||||
r.HasFile = true
|
||||
r.NeedJSON = true
|
||||
case "json":
|
||||
r.NeedJSON = true
|
||||
case "array":
|
||||
r.NeedJSON = true
|
||||
r.HasArray = true
|
||||
case "video":
|
||||
r.HasPic = true
|
||||
case "richtext":
|
||||
r.HasRichText = true
|
||||
case "picture":
|
||||
r.HasPic = true
|
||||
case "pictures":
|
||||
r.HasPic = true
|
||||
r.NeedJSON = true
|
||||
case "time.Time":
|
||||
r.HasTimer = true
|
||||
if r.Fields[i].FieldSearchType != "" && r.Fields[i].FieldSearchType != "BETWEEN" && r.Fields[i].FieldSearchType != "NOT BETWEEN" {
|
||||
r.HasSearchTimer = true
|
||||
}
|
||||
}
|
||||
if r.Fields[i].DataSource != nil {
|
||||
if r.Fields[i].DataSource.Table != "" && r.Fields[i].DataSource.Label != "" && r.Fields[i].DataSource.Value != "" {
|
||||
r.HasDataSource = true
|
||||
r.Fields[i].CheckDataSource = true
|
||||
r.DataSourceMap[r.Fields[i].FieldJson] = r.Fields[i].DataSource
|
||||
}
|
||||
}
|
||||
if !r.GvaModel && r.PrimaryField == nil && r.Fields[i].PrimaryKey {
|
||||
r.PrimaryField = r.Fields[i]
|
||||
} // 自定义主键
|
||||
}
|
||||
{
|
||||
for key := range dict {
|
||||
r.DictTypes = append(r.DictTypes, key)
|
||||
}
|
||||
} // DictTypes => 字典
|
||||
{
|
||||
if r.GvaModel {
|
||||
r.PrimaryField = &AutoCodeField{
|
||||
FieldName: "ID",
|
||||
FieldType: "uint",
|
||||
FieldDesc: "ID",
|
||||
FieldJson: "ID",
|
||||
DataTypeLong: "20",
|
||||
Comment: "主键ID",
|
||||
ColumnName: "id",
|
||||
}
|
||||
}
|
||||
} // GvaModel
|
||||
{
|
||||
if r.IsAdd && r.PrimaryField == nil {
|
||||
r.PrimaryField = new(AutoCodeField)
|
||||
}
|
||||
} // 新增字段模式下不关注主键
|
||||
if r.Package == "" {
|
||||
return errors.New("Package为空!")
|
||||
} // 增加判断:Package不为空
|
||||
packages := []rune(r.Package)
|
||||
if len(packages) > 0 {
|
||||
if packages[0] >= 97 && packages[0] <= 122 {
|
||||
packages[0] = packages[0] - 32
|
||||
}
|
||||
r.PackageT = string(packages)
|
||||
} // PackageT 是 Package 的首字母大写
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AutoCode) History() SysAutoHistoryCreate {
|
||||
bytes, _ := json.Marshal(r)
|
||||
return SysAutoHistoryCreate{
|
||||
Table: r.TableName,
|
||||
Package: r.Package,
|
||||
Request: string(bytes),
|
||||
StructName: r.StructName,
|
||||
BusinessDB: r.BusinessDB,
|
||||
Description: r.Description,
|
||||
}
|
||||
}
|
||||
|
||||
type AutoCodeField struct {
|
||||
FieldName string `json:"fieldName"` // Field名
|
||||
FieldDesc string `json:"fieldDesc"` // 中文名
|
||||
FieldType string `json:"fieldType"` // Field数据类型
|
||||
FieldJson string `json:"fieldJson"` // FieldJson
|
||||
DataTypeLong string `json:"dataTypeLong"` // 数据库字段长度
|
||||
Comment string `json:"comment"` // 数据库字段描述
|
||||
ColumnName string `json:"columnName"` // 数据库字段
|
||||
FieldSearchType string `json:"fieldSearchType"` // 搜索条件
|
||||
FieldSearchHide bool `json:"fieldSearchHide"` // 是否隐藏查询条件
|
||||
DictType string `json:"dictType"` // 字典
|
||||
//Front bool `json:"front"` // 是否前端可见
|
||||
Form bool `json:"form"` // 是否前端新建/编辑
|
||||
Table bool `json:"table"` // 是否前端表格列
|
||||
Desc bool `json:"desc"` // 是否前端详情
|
||||
Excel bool `json:"excel"` // 是否导入/导出
|
||||
Require bool `json:"require"` // 是否必填
|
||||
DefaultValue string `json:"defaultValue"` // 是否必填
|
||||
ErrorText string `json:"errorText"` // 校验失败文字
|
||||
Clearable bool `json:"clearable"` // 是否可清空
|
||||
Sort bool `json:"sort"` // 是否增加排序
|
||||
PrimaryKey bool `json:"primaryKey"` // 是否主键
|
||||
DataSource *DataSource `json:"dataSource"` // 数据源
|
||||
CheckDataSource bool `json:"checkDataSource"` // 是否检查数据源
|
||||
FieldIndexType string `json:"fieldIndexType"` // 索引类型
|
||||
}
|
||||
|
||||
type AutoFunc struct {
|
||||
Package string `json:"package"`
|
||||
FuncName string `json:"funcName"` // 方法名称
|
||||
Router string `json:"router"` // 路由名称
|
||||
FuncDesc string `json:"funcDesc"` // 方法介绍
|
||||
BusinessDB string `json:"businessDB"` // 业务库
|
||||
StructName string `json:"structName"` // Struct名称
|
||||
PackageName string `json:"packageName"` // 文件名称
|
||||
Description string `json:"description"` // Struct中文名称
|
||||
Abbreviation string `json:"abbreviation"` // Struct简称
|
||||
HumpPackageName string `json:"humpPackageName"` // go文件名称
|
||||
Method string `json:"method"` // 方法
|
||||
IsPlugin bool `json:"isPlugin"` // 是否插件
|
||||
IsAuth bool `json:"isAuth"` // 是否鉴权
|
||||
IsPreview bool `json:"isPreview"` // 是否预览
|
||||
IsAi bool `json:"isAi"` // 是否AI
|
||||
ApiFunc string `json:"apiFunc"` // API方法
|
||||
ServerFunc string `json:"serverFunc"` // 服务方法
|
||||
JsFunc string `json:"jsFunc"` // JS方法
|
||||
}
|
||||
|
||||
type InitMenu struct {
|
||||
PlugName string `json:"plugName"`
|
||||
ParentMenu string `json:"parentMenu"`
|
||||
Menus []uint `json:"menus"`
|
||||
}
|
||||
|
||||
type InitApi struct {
|
||||
PlugName string `json:"plugName"`
|
||||
APIs []uint `json:"apis"`
|
||||
}
|
||||
|
||||
type InitDictionary struct {
|
||||
PlugName string `json:"plugName"`
|
||||
Dictionaries []uint `json:"dictionaries"`
|
||||
}
|
||||
|
||||
type LLMAutoCode struct {
|
||||
Prompt string `json:"prompt" form:"prompt" gorm:"column:prompt;comment:提示语;type:text;"` //提示语
|
||||
Mode string `json:"mode" form:"mode" gorm:"column:mode;comment:模式;type:text;"` //模式
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
)
|
||||
|
||||
type SysAutoCodePackageCreate struct {
|
||||
Desc string `json:"desc" example:"描述"`
|
||||
Label string `json:"label" example:"展示名"`
|
||||
Template string `json:"template" example:"模版"`
|
||||
PackageName string `json:"packageName" example:"包名"`
|
||||
Module string `json:"-" example:"模块"`
|
||||
}
|
||||
|
||||
func (r *SysAutoCodePackageCreate) AutoCode() AutoCode {
|
||||
return AutoCode{
|
||||
Package: r.PackageName,
|
||||
Module: global.GVA_CONFIG.AutoCode.Module,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *SysAutoCodePackageCreate) Create() model.SysAutoCodePackage {
|
||||
return model.SysAutoCodePackage{
|
||||
Desc: r.Desc,
|
||||
Label: r.Label,
|
||||
Template: r.Template,
|
||||
PackageName: r.PackageName,
|
||||
Module: global.GVA_CONFIG.AutoCode.Module,
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
common "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
)
|
||||
|
||||
type SysAutoHistoryCreate struct {
|
||||
Table string // 表名
|
||||
Package string // 模块名/插件名
|
||||
Request string // 前端传入的结构化信息
|
||||
StructName string // 结构体名称
|
||||
BusinessDB string // 业务库
|
||||
Description string // Struct中文名称
|
||||
Injections map[string]string // 注入路径
|
||||
Templates map[string]string // 模板信息
|
||||
ApiIDs []uint // api表注册内容
|
||||
MenuID uint // 菜单ID
|
||||
ExportTemplateID uint // 导出模板ID
|
||||
}
|
||||
|
||||
func (r *SysAutoHistoryCreate) Create() model.SysAutoCodeHistory {
|
||||
entity := model.SysAutoCodeHistory{
|
||||
Package: r.Package,
|
||||
Request: r.Request,
|
||||
Table: r.Table,
|
||||
StructName: r.StructName,
|
||||
Abbreviation: r.StructName,
|
||||
BusinessDB: r.BusinessDB,
|
||||
Description: r.Description,
|
||||
Injections: r.Injections,
|
||||
Templates: r.Templates,
|
||||
ApiIDs: r.ApiIDs,
|
||||
MenuID: r.MenuID,
|
||||
ExportTemplateID: r.ExportTemplateID,
|
||||
}
|
||||
if entity.Table == "" {
|
||||
entity.Table = r.StructName
|
||||
}
|
||||
return entity
|
||||
}
|
||||
|
||||
type SysAutoHistoryRollBack struct {
|
||||
common.GetById
|
||||
DeleteApi bool `json:"deleteApi" form:"deleteApi"` // 是否删除接口
|
||||
DeleteMenu bool `json:"deleteMenu" form:"deleteMenu"` // 是否删除菜单
|
||||
DeleteTable bool `json:"deleteTable" form:"deleteTable"` // 是否删除表
|
||||
}
|
||||
|
||||
func (r *SysAutoHistoryRollBack) ApiIds(entity model.SysAutoCodeHistory) common.IdsReq {
|
||||
length := len(entity.ApiIDs)
|
||||
ids := make([]int, 0)
|
||||
for i := 0; i < length; i++ {
|
||||
ids = append(ids, int(entity.ApiIDs[i]))
|
||||
}
|
||||
return common.IdsReq{Ids: ids}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package request
|
||||
|
||||
import "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
|
||||
type SkillToolRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
}
|
||||
|
||||
type SkillDetailRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
}
|
||||
|
||||
type SkillDeleteRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
}
|
||||
|
||||
type SkillPackageRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
}
|
||||
|
||||
type SkillSaveRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
Meta system.SkillMeta `json:"meta"`
|
||||
Markdown string `json:"markdown"`
|
||||
SyncTools []string `json:"syncTools"`
|
||||
}
|
||||
|
||||
type SkillScriptCreateRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
FileName string `json:"fileName"`
|
||||
ScriptType string `json:"scriptType"`
|
||||
}
|
||||
|
||||
type SkillResourceCreateRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
FileName string `json:"fileName"`
|
||||
}
|
||||
|
||||
type SkillReferenceCreateRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
FileName string `json:"fileName"`
|
||||
}
|
||||
|
||||
type SkillTemplateCreateRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
FileName string `json:"fileName"`
|
||||
}
|
||||
|
||||
type SkillFileRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
FileName string `json:"fileName"`
|
||||
}
|
||||
|
||||
type SkillFileSaveRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
FileName string `json:"fileName"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type SkillGlobalConstraintSaveRequest struct {
|
||||
Tool string `json:"tool"`
|
||||
Content string `json:"content"`
|
||||
SyncTools []string `json:"syncTools"`
|
||||
}
|
||||
|
||||
type DownloadOnlineSkillReq struct {
|
||||
Tool string `json:"tool" binding:"required"`
|
||||
ID uint `json:"id" binding:"required"`
|
||||
Version string `json:"version" binding:"required"`
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package response
|
||||
|
||||
import "time"
|
||||
|
||||
type SysAIWorkflowSessionListItem struct {
|
||||
ID uint `json:"ID"`
|
||||
CreatedAt time.Time `json:"CreatedAt"`
|
||||
UpdatedAt time.Time `json:"UpdatedAt"`
|
||||
Tab string `json:"tab"`
|
||||
Title string `json:"title"`
|
||||
Summary string `json:"summary"`
|
||||
ConversationID string `json:"conversationId"`
|
||||
CurrentNodeID string `json:"currentNodeId"`
|
||||
}
|
||||
|
||||
type AIWorkflowMarkdownDumpResult struct {
|
||||
FileName string `json:"fileName"`
|
||||
FilePath string `json:"filePath"`
|
||||
RelativePath string `json:"relativePath"`
|
||||
Directory string `json:"directory"`
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package response
|
||||
|
||||
import "github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
|
||||
type Db struct {
|
||||
Database string `json:"database" gorm:"column:database"`
|
||||
}
|
||||
|
||||
type Table struct {
|
||||
TableName string `json:"tableName" gorm:"column:table_name"`
|
||||
}
|
||||
|
||||
type Column struct {
|
||||
DataType string `json:"dataType" gorm:"column:data_type"`
|
||||
ColumnName string `json:"columnName" gorm:"column:column_name"`
|
||||
DataTypeLong string `json:"dataTypeLong" gorm:"column:data_type_long"`
|
||||
ColumnComment string `json:"columnComment" gorm:"column:column_comment"`
|
||||
PrimaryKey bool `json:"primaryKey" gorm:"column:primary_key"`
|
||||
}
|
||||
|
||||
type PluginInfo struct {
|
||||
PluginName string `json:"pluginName"`
|
||||
PluginType string `json:"pluginType"` // web, server, full
|
||||
Apis []system.SysApi `json:"apis"`
|
||||
Menus []system.SysBaseMenu `json:"menus"`
|
||||
Dictionaries []system.SysDictionary `json:"dictionaries"`
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
common "github.com/flipped-aurora/gin-vue-admin/server/model/common"
|
||||
)
|
||||
|
||||
type AIWorkflowMessage struct {
|
||||
ID string `json:"id"`
|
||||
Role string `json:"role"`
|
||||
Content string `json:"content"`
|
||||
Snapshot common.JSONMap `json:"snapshot"`
|
||||
ConversationID string `json:"conversationId"`
|
||||
MessageID string `json:"messageId"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
type SysAIWorkflowSession struct {
|
||||
global.GVA_MODEL
|
||||
UserID uint `json:"userId" gorm:"column:user_id;index;comment:用户ID"`
|
||||
Tab string `json:"tab" gorm:"column:tab;size:32;index;comment:会话类型"`
|
||||
Title string `json:"title" gorm:"column:title;size:255;comment:会话标题"`
|
||||
Summary string `json:"summary" gorm:"column:summary;type:text;comment:摘要"`
|
||||
ConversationID string `json:"conversationId" gorm:"column:conversation_id;size:255;comment:Dify会话ID"`
|
||||
MessageID string `json:"messageId" gorm:"column:message_id;size:255;comment:Dify消息ID"`
|
||||
CurrentNodeID string `json:"currentNodeId" gorm:"column:current_node_id;size:64;comment:当前选中节点ID"`
|
||||
Settings common.JSONMap `json:"settings" gorm:"column:settings;type:longtext;comment:页面设置"`
|
||||
FormData common.JSONMap `json:"formData" gorm:"column:form_data;type:longtext;comment:表单数据"`
|
||||
ResultData common.JSONMap `json:"resultData" gorm:"column:result_data;type:longtext;comment:当前展示结果"`
|
||||
Messages []AIWorkflowMessage `json:"messages" gorm:"column:messages;serializer:json;type:longtext;comment:会话消息"`
|
||||
}
|
||||
|
||||
func (s *SysAIWorkflowSession) TableName() string {
|
||||
return "sys_ai_workflow_sessions"
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SysAutoCodeHistory 自动迁移代码记录,用于回滚,重放使用
|
||||
type SysAutoCodeHistory struct {
|
||||
global.GVA_MODEL
|
||||
Table string `json:"tableName" gorm:"column:table_name;comment:表名"`
|
||||
Package string `json:"package" gorm:"column:package;comment:模块名/插件名"`
|
||||
Request string `json:"request" gorm:"type:text;column:request;comment:前端传入的结构化信息"`
|
||||
StructName string `json:"structName" gorm:"column:struct_name;comment:结构体名称"`
|
||||
Abbreviation string `json:"abbreviation" gorm:"column:abbreviation;comment:结构体名称缩写"`
|
||||
BusinessDB string `json:"businessDb" gorm:"column:business_db;comment:业务库"`
|
||||
Description string `json:"description" gorm:"column:description;comment:Struct中文名称"`
|
||||
Templates map[string]string `json:"template" gorm:"serializer:json;type:text;column:templates;comment:模板信息"`
|
||||
Injections map[string]string `json:"injections" gorm:"serializer:json;type:text;column:Injections;comment:注入路径"`
|
||||
Flag int `json:"flag" gorm:"column:flag;comment:[0:创建,1:回滚]"`
|
||||
ApiIDs []uint `json:"apiIDs" gorm:"serializer:json;column:api_ids;comment:api表注册内容"`
|
||||
MenuID uint `json:"menuId" gorm:"column:menu_id;comment:菜单ID"`
|
||||
ExportTemplateID uint `json:"exportTemplateID" gorm:"column:export_template_id;comment:导出模板ID"`
|
||||
AutoCodePackage SysAutoCodePackage `json:"autoCodePackage" gorm:"foreignKey:ID;references:PackageID"`
|
||||
PackageID uint `json:"packageID" gorm:"column:package_id;comment:包ID"`
|
||||
}
|
||||
|
||||
func (s *SysAutoCodeHistory) BeforeCreate(db *gorm.DB) error {
|
||||
templates := make(map[string]string, len(s.Templates))
|
||||
for key, value := range s.Templates {
|
||||
server := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server)
|
||||
{
|
||||
hasServer := strings.Index(key, server)
|
||||
if hasServer != -1 {
|
||||
key = strings.TrimPrefix(key, server)
|
||||
keys := strings.Split(key, string(os.PathSeparator))
|
||||
key = path.Join(keys...)
|
||||
}
|
||||
} // key
|
||||
web := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.WebRoot())
|
||||
hasWeb := strings.Index(value, web)
|
||||
if hasWeb != -1 {
|
||||
value = strings.TrimPrefix(value, web)
|
||||
values := strings.Split(value, string(os.PathSeparator))
|
||||
value = path.Join(values...)
|
||||
templates[key] = value
|
||||
continue
|
||||
}
|
||||
hasServer := strings.Index(value, server)
|
||||
if hasServer != -1 {
|
||||
value = strings.TrimPrefix(value, server)
|
||||
values := strings.Split(value, string(os.PathSeparator))
|
||||
value = path.Join(values...)
|
||||
templates[key] = value
|
||||
continue
|
||||
}
|
||||
}
|
||||
s.Templates = templates
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SysAutoCodeHistory) TableName() string {
|
||||
return "sys_auto_code_histories"
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
)
|
||||
|
||||
type SysAutoCodePackage struct {
|
||||
global.GVA_MODEL
|
||||
Desc string `json:"desc" gorm:"comment:描述"`
|
||||
Label string `json:"label" gorm:"comment:展示名"`
|
||||
Template string `json:"template" gorm:"comment:模版"`
|
||||
PackageName string `json:"packageName" gorm:"comment:包名"`
|
||||
Module string `json:"-" example:"模块"`
|
||||
}
|
||||
|
||||
func (s *SysAutoCodePackage) TableName() string {
|
||||
return "sys_auto_code_packages"
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package system
|
||||
|
||||
type SkillMeta struct {
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
AllowedTools string `json:"allowedTools" yaml:"allowed-tools,omitempty"`
|
||||
Context string `json:"context" yaml:"context,omitempty"`
|
||||
Agent string `json:"agent" yaml:"agent,omitempty"`
|
||||
}
|
||||
|
||||
type SkillDetail struct {
|
||||
Tool string `json:"tool"`
|
||||
Skill string `json:"skill"`
|
||||
Meta SkillMeta `json:"meta"`
|
||||
Markdown string `json:"markdown"`
|
||||
Scripts []string `json:"scripts"`
|
||||
Resources []string `json:"resources"`
|
||||
References []string `json:"references"`
|
||||
Templates []string `json:"templates"`
|
||||
}
|
||||
|
||||
type SkillTool struct {
|
||||
Key string `json:"key"`
|
||||
Label string `json:"label"`
|
||||
}
|
||||
Reference in New Issue
Block a user