Files
st/server/model/app/request/world_info.go
2026-02-11 23:44:09 +08:00

75 lines
2.8 KiB
Go

package request
import (
"git.echol.cn/loser/st/server/model/app"
common "git.echol.cn/loser/st/server/model/common/request"
)
// CreateWorldBookRequest 创建世界书请求
type CreateWorldBookRequest struct {
BookName string `json:"bookName" binding:"required,min=1,max=500"`
IsGlobal bool `json:"isGlobal"`
Entries []app.AIWorldInfoEntry `json:"entries" binding:"required"`
LinkedChars []string `json:"linkedChars"`
}
// UpdateWorldBookRequest 更新世界书请求
type UpdateWorldBookRequest struct {
BookName string `json:"bookName" binding:"required,min=1,max=500"`
IsGlobal bool `json:"isGlobal"`
Entries []app.AIWorldInfoEntry `json:"entries" binding:"required"`
LinkedChars []string `json:"linkedChars"`
}
// WorldBookListRequest 世界书列表查询请求
type WorldBookListRequest struct {
common.PageInfo
BookName string `json:"bookName" form:"bookName"` // 世界书名称(模糊搜索)
IsGlobal *bool `json:"isGlobal" form:"isGlobal"` // 是否全局
CharacterID *uint `json:"characterId" form:"characterId"` // 关联角色ID
}
// CreateWorldEntryRequest 创建世界书条目请求
type CreateWorldEntryRequest struct {
BookID uint `json:"bookId" binding:"required"`
Entry app.AIWorldInfoEntry `json:"entry" binding:"required"`
}
// UpdateWorldEntryRequest 更新世界书条目请求
type UpdateWorldEntryRequest struct {
BookID uint `json:"bookId" binding:"required"`
Entry app.AIWorldInfoEntry `json:"entry" binding:"required"`
}
// DeleteWorldEntryRequest 删除世界书条目请求
type DeleteWorldEntryRequest struct {
BookID uint `json:"bookId" binding:"required"`
EntryID string `json:"entryId" binding:"required"`
}
// LinkCharacterRequest 关联角色请求
type LinkCharacterRequest struct {
BookID uint `json:"bookId" binding:"required"`
CharacterIDs []uint `json:"characterIds" binding:"required"`
}
// WorldBookImportRequest 导入世界书请求
type WorldBookImportRequest struct {
BookName string `json:"bookName" binding:"required"`
Format string `json:"format" binding:"required,oneof=json lorebook"`
}
// WorldBookExportRequest 导出世界书请求
type WorldBookExportRequest struct {
BookID uint `json:"bookId" binding:"required"`
Format string `json:"format" binding:"required,oneof=json lorebook"`
}
// MatchWorldInfoRequest 匹配世界书条目请求(用于聊天时激活)
type MatchWorldInfoRequest struct {
CharacterID uint `json:"characterId" binding:"required"`
Messages []string `json:"messages" binding:"required"`
ScanDepth int `json:"scanDepth" binding:"min=1,max=100"`
MaxTokens int `json:"maxTokens" binding:"min=100"`
}