新增世界书模块

This commit is contained in:
2026-02-11 14:55:41 +08:00
parent 1757b92b5f
commit 2bca8e2788
15 changed files with 2311 additions and 11 deletions

View File

@@ -0,0 +1,71 @@
package request
import "git.echol.cn/loser/st/server/model/app"
// 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 {
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"`
}