新增正则和扩展模块

This commit is contained in:
2026-02-11 23:44:09 +08:00
parent 2bca8e2788
commit 4e611d3a5e
47 changed files with 10058 additions and 49 deletions

View File

@@ -0,0 +1,88 @@
package request
import (
"git.echol.cn/loser/st/server/model/app"
common "git.echol.cn/loser/st/server/model/common/request"
)
// CreateRegexScriptRequest 创建正则脚本请求
type CreateRegexScriptRequest struct {
ScriptName string `json:"scriptName" binding:"required"`
Description string `json:"description"`
FindRegex string `json:"findRegex" binding:"required"`
ReplaceString string `json:"replaceString"`
Enabled bool `json:"enabled"`
IsGlobal bool `json:"isGlobal"`
TrimStrings bool `json:"trimStrings"`
OnlyFormat bool `json:"onlyFormat"`
RunOnEdit bool `json:"runOnEdit"`
SubstituteRegex bool `json:"substituteRegex"`
MinDepth *int `json:"minDepth"`
MaxDepth *int `json:"maxDepth"`
Placement string `json:"placement"`
AffectMinDepth *int `json:"affectMinDepth"`
AffectMaxDepth *int `json:"affectMaxDepth"`
LinkedChars []string `json:"linkedChars"`
ScriptData map[string]interface{} `json:"scriptData"`
}
// UpdateRegexScriptRequest 更新正则脚本请求
type UpdateRegexScriptRequest struct {
ScriptName string `json:"scriptName"`
Description string `json:"description"`
FindRegex string `json:"findRegex"`
ReplaceString string `json:"replaceString"`
Enabled *bool `json:"enabled"`
IsGlobal *bool `json:"isGlobal"`
TrimStrings *bool `json:"trimStrings"`
OnlyFormat *bool `json:"onlyFormat"`
RunOnEdit *bool `json:"runOnEdit"`
SubstituteRegex *bool `json:"substituteRegex"`
MinDepth *int `json:"minDepth"`
MaxDepth *int `json:"maxDepth"`
Placement string `json:"placement"`
AffectMinDepth *int `json:"affectMinDepth"`
AffectMaxDepth *int `json:"affectMaxDepth"`
LinkedChars []string `json:"linkedChars"`
ScriptData map[string]interface{} `json:"scriptData"`
}
// RegexScriptListRequest 正则脚本列表查询请求
type RegexScriptListRequest struct {
common.PageInfo
ScriptName string `json:"scriptName" form:"scriptName"` // 脚本名称(模糊搜索)
IsGlobal *bool `json:"isGlobal" form:"isGlobal"` // 是否全局
Enabled *bool `json:"enabled" form:"enabled"` // 是否启用
CharacterID *uint `json:"characterId" form:"characterId"` // 关联角色ID
}
// LinkCharacterToRegexRequest 关联角色到正则脚本请求
type LinkCharacterToRegexRequest struct {
CharacterIDs []uint `json:"characterIds" binding:"required"`
}
// TestRegexScriptRequest 测试正则脚本请求
type TestRegexScriptRequest struct {
FindRegex string `json:"findRegex" binding:"required"`
ReplaceString string `json:"replaceString"`
TestInput string `json:"testInput" binding:"required"`
TrimStrings bool `json:"trimStrings"`
SubstituteRegex bool `json:"substituteRegex"`
}
// ApplyRegexScriptsRequest 应用正则脚本请求
type ApplyRegexScriptsRequest struct {
Text string `json:"text" binding:"required"`
RegexIDs []uint `json:"regexIds"` // 指定要应用的脚本ID列表
CharacterID *uint `json:"characterId"` // 角色ID自动应用关联的脚本
Placement string `json:"placement"` // 应用位置
MinDepth *int `json:"minDepth"` // 最小深度
MaxDepth *int `json:"maxDepth"` // 最大深度
UseGlobal bool `json:"useGlobal"` // 是否应用全局脚本
}
// ImportRegexScriptsRequest 导入正则脚本请求
type ImportRegexScriptsRequest struct {
Scripts []app.AIRegexScript `json:"scripts" binding:"required"`
OverwriteMode string `json:"overwriteMode"` // skip, overwrite, merge
}