| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- // Package renamer 提供「智能重命名」共享导出类型。
- // 该包只定义纯数据类型(无数据库 / 框架依赖),供 internal/ai 纯逻辑与
- // renamerstore.go / renamerservice.go 的持久化与 Wails 服务共同引用,
- // 避免 AI 包与 store 之间重复定义结构体。
- package renamer
- // Pair 一对「旧文件名 → 新文件名」。
- type Pair struct {
- From string `json:"from"`
- To string `json:"to"`
- }
- // Config AI 接入商配置(单行存储)。
- type Config struct {
- Provider string `json:"provider"` // openai | ollama
- BaseURL string `json:"baseURL"`
- APIKey string `json:"apiKey"`
- Model string `json:"model"`
- }
- // FileEntry 目录扫描结果中的单个文件。
- type FileEntry struct {
- Name string `json:"name"` // 相对路径(递归时 ToSlash)
- Size int64 `json:"size"` // 字节数
- ModTime string `json:"modTime"` // 修改时间 "2006-01-02 15:04"
- }
- // ScanResult 目录扫描结果。
- type ScanResult struct {
- Dir string `json:"dir"` // 绝对目录路径
- Files []FileEntry `json:"files"` // 文件列表(按名称排序)
- }
- // PreviewEntry AI 预览结果行。
- type PreviewEntry struct {
- From string `json:"from"`
- To string `json:"to"`
- Status string `json:"status"` // ok | same | error
- Reason string `json:"reason,omitempty"`
- }
- // RenameResult 单文件重命名执行结果。
- type RenameResult struct {
- From string `json:"from"`
- To string `json:"to"`
- OK bool `json:"ok"`
- Error string `json:"error,omitempty"`
- }
- // HistoryItem 单个文件的重命名记录。
- type HistoryItem struct {
- From string `json:"from"`
- To string `json:"to"`
- }
- // History 一次批量重命名的历史记录。
- type History struct {
- ID int64 `json:"id"`
- CreatedAt string `json:"createdAt"`
- Dir string `json:"dir"`
- Count int `json:"count"`
- Undone bool `json:"undone"` // 该批次是否已撤回
- Details []HistoryItem `json:"details"`
- }
|