Documentation
¶
Index ¶
- type App
- func (a *App) ApproveTool(toolID string, approved bool, feedback string) error
- func (a *App) CancelChat(sessionID string)
- func (a *App) CancelExtract(taskID string)
- func (a *App) CancelExtractPattern(novelID int64)
- func (a *App) Chat(input ChatInput) (*ChatResult, error)
- func (a *App) CheckUpdate(skipDismiss bool) (*update.CheckResult, error)
- func (a *App) CompressContext(input CompressInput) (*CompressResult, error)
- func (a *App) ComputeStyleStats(input ComputeStyleStatsInput) (*style.Stats, error)
- func (a *App) CreateArcNode(novelID int64, input CreateArcNodeInput) (*storyarc.ArcNode, error)
- func (a *App) CreateChapter(input CreateChapterInput) (*chapter.Chapter, error)
- func (a *App) CreateCharacter(novelID int64, input CreateCharacterInput) (*character.Character, error)
- func (a *App) CreateLocation(novelID int64, input CreateLocationInput) (*location.Location, error)
- func (a *App) CreateNovel(input CreateNovelInput) (*novel.Novel, error)
- func (a *App) CreateNovelSetting(novelID int64, input CreateNovelSettingInput) (*setting.SettingItem, error)
- func (a *App) CreatePreference(novelID int64, input CreatePreferenceInput) (*preference.PreferenceItem, error)
- func (a *App) CreateReaderPerspective(novelID int64, input CreateReaderPerspectiveInput) (*reader.ReaderPerspective, error)
- func (a *App) CreateStoryArc(novelID int64, input CreateStoryArcInput) (*storyarc.StoryArc, error)
- func (a *App) CreateStyleSample(input CreateStyleSampleInput) (*style.Sample, error)
- func (a *App) CreateTimelineEntry(novelID int64, input CreateTimelineEntryInput) (*timeline.TimelineEntry, error)
- func (a *App) DeleteArcNode(novelID int64, nodeID int64) error
- func (a *App) DeleteCharacter(novelID int64, charID int64) error
- func (a *App) DeleteCover(novelID int64) error
- func (a *App) DeleteLocation(novelID int64, locID int64) error
- func (a *App) DeleteNovel(novelID int64) error
- func (a *App) DeleteNovelSetting(id int64) error
- func (a *App) DeletePreference(id int64) error
- func (a *App) DeleteReaderPerspective(id int64, novelID int64) error
- func (a *App) DeleteSession(sessionID string) error
- func (a *App) DeleteSkill(input DeleteSkillInput) error
- func (a *App) DeleteStoryArc(novelID int64, arcID int64) error
- func (a *App) DeleteStyleSample(input DeleteStyleSampleInput) error
- func (a *App) DeleteTimelineEntry(novelID int64, entryID int64) error
- func (a *App) DiscoverModels(chatURL, apiKey string) ([]llm.ModelInfo, error)
- func (a *App) DismissUpdate(tagName string) error
- func (a *App) ExportNovel(novelID int64, format string) error
- func (a *App) ExtractPattern(input ExtractPatternInput) (*ExtractPatternResult, error)
- func (a *App) ExtractStyle(input ExtractStyleInput) (*style.ExtractResult, error)
- func (a *App) GetAppConfig() map[string]any
- func (a *App) GetArcNodes(novelID int64) ([]storyarc.ArcNode, error)
- func (a *App) GetChapterPlans(novelID int64) ([]timeline.ChapterPlan, error)
- func (a *App) GetChapters(novelID int64) ([]chapter.Chapter, error)
- func (a *App) GetCharacterRelations(novelID int64) ([]character.CharacterRelation, error)
- func (a *App) GetCharacters(novelID int64) ([]character.Character, error)
- func (a *App) GetCommitFileList(novelID int64, hash string) (*CommitFileListResult, error)
- func (a *App) GetCommitLog(novelID int64, n int, afterHash string) ([]git.CommitInfo, error)
- func (a *App) GetContent(novelID int64, path string) (string, error)
- func (a *App) GetFileDiff(novelID int64, hash string, filePath string) (*git.FileDiff, error)
- func (a *App) GetLLMConfig() (*llm.LLMConfigView, error)
- func (a *App) GetLocationRelations(novelID int64) ([]location.LocationRelation, error)
- func (a *App) GetLocations(novelID int64) ([]location.Location, error)
- func (a *App) GetMaxChapterNumber(novelID int64) (int, error)
- func (a *App) GetModels() []llm.AvailableModel
- func (a *App) GetNovelSettings(novelID int64) (*SettingResult, error)
- func (a *App) GetNovels() ([]novel.Novel, error)
- func (a *App) GetPlatform() map[string]any
- func (a *App) GetPreferences(novelID int64) (*PreferenceResult, error)
- func (a *App) GetReaderPerspectives(novelID int64) ([]reader.ReaderPerspective, error)
- func (a *App) GetRemoteSkillContent(name string) *apperr.Result[string]
- func (a *App) GetSession(sessionID string) (*SessionDetail, error)
- func (a *App) GetSessionMessages(sessionID string) ([]session.Message, error)
- func (a *App) GetSessions(input GetSessionsInput) (*storage.PageResult[SessionMeta], error)
- func (a *App) GetSettings() (*config.AppSettings, error)
- func (a *App) GetStoryArcs(novelID int64) ([]storyarc.StoryArc, error)
- func (a *App) GetStyleSample(id int64) (*style.Sample, error)
- func (a *App) GetTimelineEntries(novelID int64) ([]timeline.TimelineEntry, error)
- func (a *App) GetVersion() string
- func (a *App) GetWritingActivity(months int) ([]writing.DailyActivity, error)
- func (a *App) GetWritingStats() (*writing.WritingStats, error)
- func (a *App) ImportNovel(input ImportNovelInput) (*ImportNovelResult, error)
- func (a *App) ImportWithLLM(input ImportWithLLMInput) (*ImportNovelResult, error)
- func (a *App) Initialize(dataDir string) error
- func (a *App) InstallRemoteSkill(input InstallRemoteSkillInput) *apperr.Result[apperr.Empty]
- func (a *App) IsInitialized() bool
- func (a *App) ListRemoteSkills(input ListRemoteSkillsInput) *apperr.Result[*storage.PageResult[remote.RemoteSkillMeta]]
- func (a *App) ListSkills(input ListSkillsInput) []skill.SkillMeta
- func (a *App) ListSlashCommands(input ListSlashCommandsInput) []SlashCommand
- func (a *App) ListStyleSamples(input ListStyleSamplesInput) (*storage.PageResult[style.Sample], error)
- func (a *App) OnShutdown(shutdownCtx context.Context)
- func (a *App) OnStartup(ctx context.Context)
- func (a *App) PickAndImportNovel() (*ImportNovelResult, error)
- func (a *App) RebuildNovelIndex(novelID int64) error
- func (a *App) SaveAvatar(data []byte) error
- func (a *App) SaveContent(input SaveContentInput) error
- func (a *App) SaveCover(novelID int64, data []byte) error
- func (a *App) SaveGitConfig(name, email string) error
- func (a *App) SaveLLMConfig(input llm.LLMConfigView) error
- func (a *App) SaveSettings(input SaveSettingsInput) error
- func (a *App) SaveUserName(name string) error
- func (a *App) SearchAll(novelID int64, query string) ([]search.Result, error)
- func (a *App) SetActiveNovel(input SetActiveNovelInput) error
- func (a *App) SetApprovalMode(mode string) error
- func (a *App) SetLastSession(sessionID string) error
- func (a *App) SetReasoningEffort(effort string) error
- func (a *App) SetSelectedModel(key, effort string) error
- func (a *App) TestConnection(input TestConnectionInput) (string, error)
- func (a *App) UpdateArcNode(novelID int64, nodeID int64, input UpdateArcNodeInput) error
- func (a *App) UpdateChapterPlan(novelID int64, input UpdateChapterPlanInput) error
- func (a *App) UpdateChapterTitle(novelID int64, chapterNumber int, title string) error
- func (a *App) UpdateCharacter(novelID int64, charID int64, input UpdateCharacterInput) error
- func (a *App) UpdateDataDir(newPath string) error
- func (a *App) UpdateLocation(novelID int64, locID int64, input UpdateLocationInput) error
- func (a *App) UpdateNovel(novelID int64, input UpdateNovelInput) (*novel.Novel, error)
- func (a *App) UpdateNovelSetting(novelID int64, id int64, input UpdateNovelSettingInput) (*setting.SettingItem, error)
- func (a *App) UpdatePreference(novelID int64, id int64, input UpdatePreferenceInput) (*preference.PreferenceItem, error)
- func (a *App) UpdateReaderPerspective(id int64, novelID int64, input UpdateReaderPerspectiveInput) error
- func (a *App) UpdateStoryArc(novelID int64, arcID int64, input UpdateStoryArcInput) error
- func (a *App) UpdateStyleSample(input UpdateStyleSampleInput) (*style.Sample, error)
- func (a *App) UpdateTimelineEntry(novelID int64, entryID int64, input UpdateTimelineEntryInput) error
- type ChatInput
- type ChatResult
- type CommitFileListResult
- type CompressInput
- type CompressResult
- type ComputeStyleStatsInput
- type CreateArcNodeInput
- type CreateChapterInput
- type CreateCharacterInput
- type CreateLocationInput
- type CreateNovelInput
- type CreateNovelSettingInput
- type CreatePreferenceInput
- type CreateReaderPerspectiveInput
- type CreateStoryArcInput
- type CreateStyleSampleInput
- type CreateTimelineEntryInput
- type DeleteSkillInput
- type DeleteStyleSampleInput
- type ExtractPatternInput
- type ExtractPatternProgress
- type ExtractPatternResult
- type ExtractStyleInput
- type GetSessionsInput
- type ImportNovelInput
- type ImportNovelResult
- type ImportProgress
- type ImportWithLLMInput
- type InstallRemoteSkillInput
- type ListRemoteSkillsInput
- type ListSkillsInput
- type ListSlashCommandsInput
- type ListStyleSamplesInput
- type PreferenceResult
- type SaveContentInput
- type SaveSettingsInput
- type SessionDetail
- type SessionMeta
- type SetActiveNovelInput
- type SettingResult
- type SlashCommand
- type TestConnectionInput
- type UpdateArcNodeInput
- type UpdateChapterPlanInput
- type UpdateCharacterInput
- type UpdateLocationInput
- type UpdateNovelInput
- type UpdateNovelSettingInput
- type UpdatePreferenceInput
- type UpdateReaderPerspectiveInput
- type UpdateStoryArcInput
- type UpdateStyleSampleInput
- type UpdateTimelineEntryInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App 是 Wails 绑定的根对象。前端通过 window.go.main.App 调用其导出方法。 各领域方法按文件拆分(novel.go / chapter.go 等),均接收 *App。
func (*App) ApproveTool ¶
ApproveTool 前端调用,响应审批请求。
func (*App) CancelExtract ¶
CancelExtract 取消指定 taskID 的风格提取任务。
func (*App) CancelExtractPattern ¶
CancelExtractPattern 取消正在进行的小说模式提取
func (*App) Chat ¶
func (a *App) Chat(input ChatInput) (*ChatResult, error)
Chat 是对话入口。Wails 绑定,前端调用后同步执行,期间通过 EventsEmit 推流。
func (*App) CheckUpdate ¶
func (a *App) CheckUpdate(skipDismiss bool) (*update.CheckResult, error)
CheckUpdate 检查 GitHub Release 是否有新版本。 skipDismiss 为 true 时跳过已忽略版本的过滤 + 12h 节流(手动检查场景)。 返回 CheckResult(包含是否有更新的信息),网络/解析错误时返回 error。 自动检查场景下,若距上次检查不足 12h,或用户已忽略过该版本且没有更新的版本,返回 nil。
func (*App) CompressContext ¶
func (a *App) CompressContext(input CompressInput) (*CompressResult, error)
CompressContext 手动触发上下文压缩。仅在无进行中 turn 时允许。
func (*App) ComputeStyleStats ¶
func (a *App) ComputeStyleStats(input ComputeStyleStatsInput) (*style.Stats, error)
ComputeStyleStats 对指定的风格素材进行确定性文本统计。
func (*App) CreateArcNode ¶
CreateArcNode 创建弧线节点。
func (*App) CreateChapter ¶
func (a *App) CreateChapter(input CreateChapterInput) (*chapter.Chapter, error)
CreateChapter 创建新章节,章节号自动递增。同时创建空正文文件。
func (*App) CreateCharacter ¶
func (a *App) CreateCharacter(novelID int64, input CreateCharacterInput) (*character.Character, error)
CreateCharacter 创建一个角色。
func (*App) CreateLocation ¶
CreateLocation 创建一个地点。
func (*App) CreateNovel ¶
func (a *App) CreateNovel(input CreateNovelInput) (*novel.Novel, error)
CreateNovel 创建一部新小说。
func (*App) CreateNovelSetting ¶
func (a *App) CreateNovelSetting(novelID int64, input CreateNovelSettingInput) (*setting.SettingItem, error)
CreateNovelSetting 创建一条小说设定。
func (*App) CreatePreference ¶
func (a *App) CreatePreference(novelID int64, input CreatePreferenceInput) (*preference.PreferenceItem, error)
CreatePreference 创建一条创作偏好。
func (*App) CreateReaderPerspective ¶
func (a *App) CreateReaderPerspective(novelID int64, input CreateReaderPerspectiveInput) (*reader.ReaderPerspective, error)
CreateReaderPerspective 创建一条读者认知条目。
func (*App) CreateStoryArc ¶
CreateStoryArc 创建一条叙事弧线。
func (*App) CreateStyleSample ¶
func (a *App) CreateStyleSample(input CreateStyleSampleInput) (*style.Sample, error)
CreateStyleSample 创建一条风格素材。
func (*App) CreateTimelineEntry ¶
func (a *App) CreateTimelineEntry(novelID int64, input CreateTimelineEntryInput) (*timeline.TimelineEntry, error)
CreateTimelineEntry 创建一条伏笔或用户指令。
func (*App) DeleteArcNode ¶
DeleteArcNode 删除弧线节点。
func (*App) DeleteCharacter ¶
DeleteCharacter 删除角色(级联删除关联的关系记录)。
func (*App) DeleteCover ¶
DeleteCover 删除小说封面并提交到 Git 仓库。
func (*App) DeleteLocation ¶
DeleteLocation 删除地点(子地点父级置空,级联删除空间关系)。
func (*App) DeleteNovel ¶
DeleteNovel 删除小说,级联清理所有关联数据、Git 仓库目录。
func (*App) DeleteNovelSetting ¶
DeleteNovelSetting 删除一条小说设定。
func (*App) DeletePreference ¶
DeletePreference 删除一条创作偏好。
func (*App) DeleteReaderPerspective ¶
DeleteReaderPerspective 删除一条读者认知条目。
func (*App) DeleteSession ¶
DeleteSession 删除指定会话及其全部消息、关联的操作日志。不可恢复。
func (*App) DeleteSkill ¶
func (a *App) DeleteSkill(input DeleteSkillInput) error
DeleteSkill 删除用户级或小说级技能文件。内置技能不可删除。
func (*App) DeleteStoryArc ¶
DeleteStoryArc 删除一条叙事弧线(级联删除关联节点)。
func (*App) DeleteStyleSample ¶
func (a *App) DeleteStyleSample(input DeleteStyleSampleInput) error
DeleteStyleSample 删除一条风格素材。
func (*App) DeleteTimelineEntry ¶
DeleteTimelineEntry 删除一条伏笔或用户指令。
func (*App) DiscoverModels ¶
DiscoverModels 调用 /models 端点自动发现可用模型列表。
func (*App) DismissUpdate ¶
DismissUpdate 记录用户已忽略的更新版本号,同一版本不再提示。
func (*App) ExportNovel ¶
ExportNovel 将小说导出为指定格式,弹出保存对话框让用户选择保存位置。
func (*App) ExtractPattern ¶
func (a *App) ExtractPattern(input ExtractPatternInput) (*ExtractPatternResult, error)
ExtractPattern 从指定小说中提取叙事套路模式
func (*App) ExtractStyle ¶
func (a *App) ExtractStyle(input ExtractStyleInput) (*style.ExtractResult, error)
ExtractStyle 从选中的素材中提取写作风格,生成仿写 skill。
func (*App) GetAppConfig ¶
GetAppConfig 返回当前运行时配置信息(供前端诊断)。
func (*App) GetArcNodes ¶
GetArcNodes 返回指定小说的全部弧线节点,供前端列表和关系图渲染。 4b: 改调 ListNodesByNovel(Size=-1) 全量(废弃 ListNodesByChapterRange)。 显式传 Order 补回 story_arc_id 前缀:同一条弧线的节点聚簇连续,避免被跨弧线打散。
func (*App) GetChapterPlans ¶
func (a *App) GetChapterPlans(novelID int64) ([]timeline.ChapterPlan, error)
GetChapterPlans 返回指定小说的章节计划(next/near/far 三个槽位)。
func (*App) GetChapters ¶
GetChapters 返回指定小说的章节列表,含文件路径。
func (*App) GetCharacterRelations ¶
func (a *App) GetCharacterRelations(novelID int64) ([]character.CharacterRelation, error)
GetCharacterRelations 返回指定小说的全部当前角色关系(有向边),供前端关系图渲染。
func (*App) GetCharacters ¶
GetCharacters 返回指定小说的全部角色,供前端侧边栏列表和关系图节点渲染。 4b: 改调 ListByNovel(Size=-1) 全量(废弃 ListAllByNovel),传 Order="name ASC" 保持原 ListAllByNovel 的 name 升序行为。MCP 不传 Order,走默认 updated_at DESC。
func (*App) GetCommitFileList ¶
func (a *App) GetCommitFileList(novelID int64, hash string) (*CommitFileListResult, error)
GetCommitFileList 获取指定 commit 的详细信息和变更文件列表(不含文件内容)。
func (*App) GetCommitLog ¶
GetCommitLog 获取指定小说的 Git 提交历史。 afterHash 非空时返回该 commit 之后的更早提交(游标翻页)。
func (*App) GetContent ¶
GetContent 返回小说仓库中指定路径的文件内容。文件不存在时返回空字符串。 内置 skill 路径(/builtin/skills/)从内存读取。
func (*App) GetFileDiff ¶
GetFileDiff 获取指定 commit 中某个文件的前后内容。
func (*App) GetLLMConfig ¶
func (a *App) GetLLMConfig() (*llm.LLMConfigView, error)
GetLLMConfig 返回合并内置模板和用户配置的完整视图。
func (*App) GetLocationRelations ¶
func (a *App) GetLocationRelations(novelID int64) ([]location.LocationRelation, error)
GetLocationRelations 返回指定小说的全部空间关系(无向边),供前端关系图渲染。
func (*App) GetLocations ¶
GetLocations 返回指定小说的全部地点,供前端侧边栏嵌套树和关系图节点渲染。 4b: 改调 ListByNovel(Size=-1) 全量(废弃 ListAllByNovel),传 Order="name ASC" 保持原 name 升序行为。
func (*App) GetMaxChapterNumber ¶
GetMaxChapterNumber 返回该小说当前最大章节号,无章节时返回 0。前端确定写作进度用。
func (*App) GetModels ¶
func (a *App) GetModels() []llm.AvailableModel
GetModels 返回所有可用模型列表,由后端决定能力和推理程度。
func (*App) GetNovelSettings ¶
func (a *App) GetNovelSettings(novelID int64) (*SettingResult, error)
GetNovelSettings 返回当前小说的全部设定,附带全量 token 数与超预算标记。 token_count 用于前端显示是否超 8k 软上限,不阻塞、不强制精简(用户自行决定)。 注入给 agent 的 NovelState 会按 created_at DESC 截断到 8k 内,与此处 token_count 是两套口径: 这里是"全量实际多少",agent 注入是"截断后剩多少"。
func (*App) GetPlatform ¶
GetPlatform 返回平台信息,供前端决定默认路径等行为。
func (*App) GetPreferences ¶
func (a *App) GetPreferences(novelID int64) (*PreferenceResult, error)
GetPreferences 返回全局偏好和当前小说的专属偏好,附带全量 token 数与超预算标记。 token_count 用于前端显示是否超 4k 软上限,不阻塞、不强制精简(用户自行决定)。 注入给 agent 的 NovelProfile 会按 created_at DESC 截断到 4k 内,与此处 token_count 是两套口径: 这里是"全量实际多少",agent 注入是"截断后剩多少"。
func (*App) GetReaderPerspectives ¶
func (a *App) GetReaderPerspectives(novelID int64) ([]reader.ReaderPerspective, error)
GetReaderPerspectives 返回指定小说的全部读者认知条目,按 type, planted_chapter ASC 排列。 4b: 改调 ListByNovel(Size=-1) 一次拉全(废弃循环翻页拉全)。显式传 Order 保持原排序。
func (*App) GetRemoteSkillContent ¶
GetRemoteSkillContent 拉取指定远程 skill 的 markdown 原文内容。 用于详情面板展示全文。
func (*App) GetSession ¶
func (a *App) GetSession(sessionID string) (*SessionDetail, error)
GetSession 加载单个会话的完整元数据,含用量、推理程度等。
func (*App) GetSessionMessages ¶
GetSessionMessages 加载指定 session 的全部前端可见消息。
func (*App) GetSessions ¶
func (a *App) GetSessions(input GetSessionsInput) (*storage.PageResult[SessionMeta], error)
GetSessions 分页查询当前小说的对话历史。search 非空时搜索消息内容。
func (*App) GetSettings ¶
func (a *App) GetSettings() (*config.AppSettings, error)
GetSettings 返回运行时配置。
func (*App) GetStoryArcs ¶
GetStoryArcs 返回指定小说的全部叙事弧线。弧线通常 3-5 条,全量无分页。 4b: 显式传 Order 保持原排序行为(importance DESC, created_at ASC)。
func (*App) GetStyleSample ¶
GetStyleSample 获取单条风格素材的完整内容。
func (*App) GetTimelineEntries ¶
func (a *App) GetTimelineEntries(novelID int64) ([]timeline.TimelineEntry, error)
GetTimelineEntries 返回指定小说的全部伏笔/用户指令,供前端列表渲染。 4b: 改调 ListByNovel(Size=-1) 全量(废弃 ListByChapterRange,前端 useTimelineEntries 传 0,0 全量 + 内存切窗口,行为等价)。显式传 Order 保持原排序。
func (*App) GetWritingActivity ¶
func (a *App) GetWritingActivity(months int) ([]writing.DailyActivity, error)
GetWritingActivity 返回最近 months 个月每日写作字数汇总。
func (*App) GetWritingStats ¶
func (a *App) GetWritingStats() (*writing.WritingStats, error)
GetWritingStats 返回全局写作统计,跨所有小说。
func (*App) ImportNovel ¶
func (a *App) ImportNovel(input ImportNovelInput) (*ImportNovelResult, error)
ImportNovel 从文件导入一部小说:解析文件 → 创建 Novel → 写入章节文件 → Git 提交。
func (*App) ImportWithLLM ¶
func (a *App) ImportWithLLM(input ImportWithLLMInput) (*ImportNovelResult, error)
ImportWithLLM 使用 LLM 分析章节格式后导入小说。 当 ImportNovel 返回 NeedsLLM=true 时,前端调用此方法。 流程:LLM 生成正则 → 全文分割 → 校验 → 导入。
func (*App) Initialize ¶
Initialize 在用户触发首次初始化时调用。 dataDir 参数保留用于前端兼容,实际数据目录由平台决定。
func (*App) InstallRemoteSkill ¶
InstallRemoteSkill 将指定远程 skill 安装到目标层(user 或 novel)。 安装成功后触发 skill.Store 热重载(失败只 Warn 不返回 error)。 后端不做存在性判断,前端弹确认框处理覆盖语义。
func (*App) IsInitialized ¶
IsInitialized 返回指针文件是否已加载成功。前端据此决定显示初始化界面还是主界面。
func (*App) ListRemoteSkills ¶
func (a *App) ListRemoteSkills(input ListRemoteSkillsInput) *apperr.Result[*storage.PageResult[remote.RemoteSkillMeta]]
ListRemoteSkills 列出远程 skill 市场的所有 skill,支持分页和搜索。 forceRefresh=false 优先使用内存缓存(1h TTL),前端"刷新"按钮可改为 true 强制刷新。 错误以 *apperr.Result[*storage.PageResult[remote.RemoteSkillMeta]] 透传,前端按 err_code 分类反馈。
func (*App) ListSkills ¶
func (a *App) ListSkills(input ListSkillsInput) []skill.SkillMeta
ListSkills 返回所有可用 skill 的元数据(同名覆盖:novel > user > builtin)。
func (*App) ListSlashCommands ¶
func (a *App) ListSlashCommands(input ListSlashCommandsInput) []SlashCommand
ListSlashCommands 返回所有 skill 对应的斜杠菜单条目。
func (*App) ListStyleSamples ¶
func (a *App) ListStyleSamples(input ListStyleSamplesInput) (*storage.PageResult[style.Sample], error)
ListStyleSamples 分页列出风格素材。
func (*App) OnShutdown ¶
OnShutdown 在 Wails 窗口关闭前调用,释放资源。
func (*App) PickAndImportNovel ¶
func (a *App) PickAndImportNovel() (*ImportNovelResult, error)
PickAndImportNovel 打开文件选择对话框,然后导入选中的小说文件。
func (*App) RebuildNovelIndex ¶
RebuildNovelIndex 无条件全量重建指定小说的向量索引,用于数据异常时的手动兜底。
func (*App) SaveContent ¶
func (a *App) SaveContent(input SaveContentInput) error
SaveContent 保存小说仓库中指定路径的文件内容。
func (*App) SaveGitConfig ¶
SaveGitConfig 保存 Git user.name 和 user.email,并同步到所有已有仓库。
func (*App) SaveLLMConfig ¶
func (a *App) SaveLLMConfig(input llm.LLMConfigView) error
SaveLLMConfig 保存用户 LLM 配置并热重载 Client。
func (*App) SaveSettings ¶
func (a *App) SaveSettings(input SaveSettingsInput) error
SaveSettings 保存运行时配置。
func (*App) SetActiveNovel ¶
func (a *App) SetActiveNovel(input SetActiveNovelInput) error
SetActiveNovel 记录当前活跃的小说 ID,下次启动自动恢复。
func (*App) SetApprovalMode ¶
SetApprovalMode 前端调用,切换审批模式并持久化。"auto" 自动批准,"manual" 等待用户操作。
func (*App) SetLastSession ¶
SetLastSession 保存上次活跃的会话 ID。
func (*App) SetReasoningEffort ¶
SetReasoningEffort 单独保存推理程度。
func (*App) SetSelectedModel ¶
SetSelectedModel 保存选中的模型 key 和推理程度,持久化到 DB。
func (*App) TestConnection ¶
func (a *App) TestConnection(input TestConnectionInput) (string, error)
TestConnection 发送最小化请求验证 provider 连通性。 多层 fallback 真测,返回验证通过的实际 URL(可能和入参不同,是探测到的正确端点)。 成功返回 (url, nil),前端应将 url 回写到 provider.chat_url 再保存,确保保存的 URL 和测试时一致。 失败返回 ("", error)。
func (*App) UpdateArcNode ¶
func (a *App) UpdateArcNode(novelID int64, nodeID int64, input UpdateArcNodeInput) error
UpdateArcNode 更新弧线节点。PUT 全量覆盖用户可编辑字段。
func (*App) UpdateChapterPlan ¶
func (a *App) UpdateChapterPlan(novelID int64, input UpdateChapterPlanInput) error
UpdateChapterPlan 更新章节计划(全量替换文件内容)。
func (*App) UpdateChapterTitle ¶
UpdateChapterTitle 更新章节标题。
func (*App) UpdateCharacter ¶
func (a *App) UpdateCharacter(novelID int64, charID int64, input UpdateCharacterInput) error
UpdateCharacter 更新角色。PUT 全量覆盖用户可编辑字段。
func (*App) UpdateDataDir ¶
UpdateDataDir 更改数据目录并重新初始化所有运行时模块。
TODO: 实现数据迁移——更改目录时自动将旧目录中的数据文件移动到新目录。 同盘用 os.Rename(原子),跨盘用递归拷贝+进度回调,目标非空时弹确认框。
func (*App) UpdateLocation ¶
func (a *App) UpdateLocation(novelID int64, locID int64, input UpdateLocationInput) error
UpdateLocation 更新地点。PUT 全量覆盖用户可编辑字段。
func (*App) UpdateNovel ¶
UpdateNovel 更新小说信息。PUT 全量覆盖用户可编辑字段。
func (*App) UpdateNovelSetting ¶
func (a *App) UpdateNovelSetting(novelID int64, id int64, input UpdateNovelSettingInput) (*setting.SettingItem, error)
UpdateNovelSetting 更新一条小说设定。 PUT 语义:前端全量传 category/content,后端全量覆盖 + db.Save(走 GORM 回调)。 归属校验:只能改当前小说的设定。
func (*App) UpdatePreference ¶
func (a *App) UpdatePreference(novelID int64, id int64, input UpdatePreferenceInput) (*preference.PreferenceItem, error)
UpdatePreference 更新一条创作偏好。 novelID 由前端显式传入(当前工作区小说),用于 is_global 切换时填 NovelID。 PUT 语义:前端全量传 category/content/is_global,后端全量覆盖 + db.Save(走 GORM 回调)。
func (*App) UpdateReaderPerspective ¶
func (a *App) UpdateReaderPerspective(id int64, novelID int64, input UpdateReaderPerspectiveInput) error
UpdateReaderPerspective 更新一条读者认知条目。PUT 全量覆盖用户可编辑字段。
func (*App) UpdateStoryArc ¶
func (a *App) UpdateStoryArc(novelID int64, arcID int64, input UpdateStoryArcInput) error
UpdateStoryArc 更新叙事弧线。PUT 全量覆盖用户可编辑字段。
func (*App) UpdateStyleSample ¶
func (a *App) UpdateStyleSample(input UpdateStyleSampleInput) (*style.Sample, error)
UpdateStyleSample 更新一条风格素材。
func (*App) UpdateTimelineEntry ¶
func (a *App) UpdateTimelineEntry(novelID int64, entryID int64, input UpdateTimelineEntryInput) error
UpdateTimelineEntry 更新伏笔或用户指令。PUT 全量覆盖用户可编辑字段。
type ChatInput ¶
type ChatInput struct {
SessionID string `json:"session_id"` // 空=新建会话
NovelID int64 `json:"novel_id"`
Message string `json:"message"`
ProviderName string `json:"provider_name"` // "deepseek"
ModelID string `json:"model_id"` // "deepseek-v4-pro"
ReasoningEffort string `json:"reasoning_effort"` // "high" | "max" | ""
}
ChatInput 是一次对话请求的入参。
type ChatResult ¶
type ChatResult struct {
SessionID string `json:"session_id"`
TurnID int `json:"turn_id"`
FinalText string `json:"final_text"`
}
ChatResult 是一次对话请求的返回值。
type CommitFileListResult ¶
type CommitFileListResult struct {
Commit *git.CommitInfo `json:"commit"`
Files []git.FileEntry `json:"files"`
}
CommitFileListResult 包含一次 commit 的详细信息和变更文件列表(不含内容)。
type CompressInput ¶
type CompressInput struct {
SessionID string `json:"session_id"`
ProviderName string `json:"provider_name"`
ModelID string `json:"model_id"`
}
CompressInput 是手动压缩请求的入参。
type CompressResult ¶
type CompressResult struct {
TurnID int `json:"turn_id"`
}
CompressResult 是手动压缩请求的返回值。
type ComputeStyleStatsInput ¶
type ComputeStyleStatsInput struct {
SampleIDs []int64 `json:"sample_ids"`
}
ComputeStyleStatsInput 是计算风格统计的入参。
type CreateArcNodeInput ¶
type CreateArcNodeInput struct {
StoryArcID int64 `json:"story_arc_id"` // 所属弧线 ID,必填
Title string `json:"title"` // 节点标题,必填
Description string `json:"description,omitempty"` // 节点详情
TargetChapter int `json:"target_chapter"` // 预计章节号,必填
}
CreateArcNodeInput 是 CreateArcNode 的参数。
type CreateChapterInput ¶
CreateChapterInput 是创建章节的入参。
type CreateCharacterInput ¶
type CreateCharacterInput struct {
Name string `json:"name"` // 角色名称,必填
Description string `json:"description,omitempty"` // 自然语言描述
Personality string `json:"personality,omitempty"` // JSON 自由格式,如 {"traits":["勇敢","冲动"]}
Abilities string `json:"abilities,omitempty"` // JSON 数组,如 ["剑术","隐身"]
}
CreateCharacterInput 是 CreateCharacter 的参数。
type CreateLocationInput ¶
type CreateLocationInput struct {
Name string `json:"name"` // 地点名称,必填
LocationType string `json:"location_type,omitempty"` // 自由文本类型
Description string `json:"description,omitempty"` // 自然语言描述
DetailJSON string `json:"detail_json,omitempty"` // JSON 自由格式
ParentLocationID *int64 `json:"parent_location_id,omitempty"` // 父级地点 ID
Tags string `json:"tags,omitempty"` // JSON 数组标签
}
CreateLocationInput 是 CreateLocation 的参数。
type CreateNovelInput ¶
type CreateNovelInput struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Genre string `json:"genre,omitempty"`
}
CreateNovelInput 是创建小说的入参。
type CreateNovelSettingInput ¶
type CreateNovelSettingInput struct {
Category string `json:"category"`
Content string `json:"content"`
}
CreateNovelSettingInput 是创建设定的入参。 v2 取消 is_global 字段,设定全部归属当前小说。
type CreatePreferenceInput ¶
type CreatePreferenceInput struct {
IsGlobal bool `json:"is_global"`
Category string `json:"category"`
Content string `json:"content"`
}
CreatePreferenceInput 是创建偏好的入参。
type CreateReaderPerspectiveInput ¶
type CreateReaderPerspectiveInput struct {
Type string `json:"type"` // 必填:"known" | "suspense" | "misconception"
Content string `json:"content"` // 必填
PlantedChapter int `json:"planted_chapter"` // 必填
RelatedTruth string `json:"related_truth,omitempty"` // 可选
RevealedChapter int `json:"revealed_chapter,omitempty"` // 可选,默认 0
}
CreateReaderPerspectiveInput 是创建读者认知条目的入参。
type CreateStoryArcInput ¶
type CreateStoryArcInput struct {
Name string `json:"name"` // 弧线名称,必填
ArcType string `json:"arc_type"` // 弧线类型,必填
Description string `json:"description,omitempty"` // 弧线整体描述
Importance int `json:"importance,omitempty"` // 重要度 1-5
}
CreateStoryArcInput 是 CreateStoryArc 的参数。
type CreateStyleSampleInput ¶
type CreateStyleSampleInput struct {
NovelID int64 `json:"novel_id"`
IsGlobal bool `json:"is_global"`
Name string `json:"name"`
Content string `json:"content"`
Tags []string `json:"tags"`
}
CreateStyleSampleInput 是创建风格素材的入参。
type CreateTimelineEntryInput ¶
type CreateTimelineEntryInput struct {
Category string `json:"category"` // "foreshadowing" | "user_directive",必填
Title string `json:"title"` // 简短标题,必填
Content string `json:"content,omitempty"` // 详细描述
DetailJSON string `json:"detail_json,omitempty"` // JSON 字符串
TargetChapter int `json:"target_chapter"` // 预计回收章节号,必填
Importance int `json:"importance,omitempty"` // 重要度 1-5
SourceChapter int `json:"source_chapter,omitempty"` // 在哪章创建
Source string `json:"source,omitempty"` // "ai" | "user"
}
CreateTimelineEntryInput 是 CreateTimelineEntry 的参数。
type DeleteSkillInput ¶
type DeleteSkillInput struct {
NovelID int64 `json:"novel_id"`
Name string `json:"name"`
Source string `json:"source"` // "novel" | "user"
}
DeleteSkillInput 是 DeleteSkill 的入参。
type DeleteStyleSampleInput ¶
type DeleteStyleSampleInput struct {
ID int64 `json:"id"`
}
DeleteStyleSampleInput 是删除风格素材的入参。
type ExtractPatternInput ¶
type ExtractPatternInput = pattern.ExtractPatternInput
type ExtractPatternProgress ¶
type ExtractPatternResult ¶
type ExtractPatternResult = pattern.ExtractPatternResult
type ExtractStyleInput ¶
type ExtractStyleInput struct {
TaskID string `json:"task_id"`
SampleIDs []int64 `json:"sample_ids"`
ProviderName string `json:"provider_name"`
ModelID string `json:"model_id"`
ReasoningEffort string `json:"reasoning_effort"`
}
ExtractStyleInput 是风格提取的入参。
type GetSessionsInput ¶
type GetSessionsInput struct {
NovelID int64 `json:"novel_id"`
Page int `json:"page"`
Size int `json:"size"`
Search string `json:"search"`
}
GetSessionsInput 是 GetSessions 的入参。
type ImportNovelInput ¶
type ImportNovelInput struct {
FilePath string `json:"file_path"`
}
ImportNovelInput 是导入小说的入参。
type ImportProgress ¶
type ImportProgress struct {
Stage string `json:"stage"`
Message string `json:"message"`
Current int `json:"current"`
Total int `json:"total"`
Percent int `json:"percent"`
NovelID int64 `json:"novel_id,omitempty"`
}
ImportProgress 是导入过程的前端进度事件。
type ImportWithLLMInput ¶
type ImportWithLLMInput struct {
FilePath string `json:"file_path"`
ProviderName string `json:"provider_name"`
ModelID string `json:"model_id"`
}
ImportWithLLMInput 是 AI 辅助导入小说的入参。
type InstallRemoteSkillInput ¶
type InstallRemoteSkillInput struct {
Name string `json:"name"`
Target string `json:"target"` // "user" or "novel"
NovelID int64 `json:"novel_id"` // target=novel 时必填
}
InstallRemoteSkillInput 是 InstallRemoteSkill 的入参。 Target 取值 "user" 或 "novel";Target=novel 时 NovelID 必填。
type ListRemoteSkillsInput ¶
type ListRemoteSkillsInput struct {
Page int `json:"page"`
Size int `json:"size"`
Query string `json:"query"`
}
ListRemoteSkillsInput 是 ListRemoteSkills 的入参。 Page/Size 走 storage.PageParams 归一化(Page<1 → 1,Size 默认 20,上限 100)。 Query 为 name + description 的模糊匹配(大小写不敏感),空串表示不过滤。
type ListSkillsInput ¶
type ListSkillsInput struct {
NovelID int64 `json:"novel_id"`
}
ListSkillsInput 是 ListSkills 的入参。
type ListSlashCommandsInput ¶
type ListSlashCommandsInput struct {
NovelID int64 `json:"novel_id"`
}
ListSlashCommandsInput 是 ListSlashCommands 的入参。
type ListStyleSamplesInput ¶
type ListStyleSamplesInput struct {
NovelID int64 `json:"novel_id"`
Page int `json:"page"`
Size int `json:"size"`
Search string `json:"search"`
}
ListStyleSamplesInput 是列出风格素材的入参。
type PreferenceResult ¶
type PreferenceResult struct {
Global []preference.PreferenceItem `json:"global"`
Novel []preference.PreferenceItem `json:"novel"`
TokenCount int `json:"token_count"` // 全量偏好 token 数(不截断),前端可显示是否超预算
OverBudget bool `json:"over_budget"` // token_count > PreferencesTokenBudget
}
PreferenceResult 是 GetPreferences 的返回结构。
type SaveContentInput ¶
type SaveContentInput struct {
NovelID int64 `json:"novel_id"`
Path string `json:"path"`
Content string `json:"content"`
}
SaveContentInput 是保存文件内容的入参。
type SessionDetail ¶
type SessionDetail struct {
SessionID string `json:"session_id"`
NovelID int64 `json:"novel_id"`
Title string `json:"title"`
Model string `json:"model"`
ReasoningEffort string `json:"reasoning_effort"`
ActiveVersion int `json:"active_version"`
LastTurnID int `json:"last_turn_id"`
Usage json.RawMessage `json:"usage,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
SessionDetail 是单个会话的完整元数据视图,含用量、推理程度等。
type SessionMeta ¶
type SessionMeta struct {
SessionID string `json:"session_id"`
Title string `json:"title"`
UpdatedAt string `json:"updated_at"` // ISO 8601
}
SessionMeta 是前端会话列表的轻量视图。
type SetActiveNovelInput ¶
type SetActiveNovelInput struct {
NovelID int64 `json:"novel_id"`
}
SetActiveNovelInput 是切换当前小说的入参。
type SettingResult ¶
type SettingResult struct {
Items []setting.SettingItem `json:"items"`
TokenCount int `json:"token_count"` // 全量设定 token 数(不截断),前端可显示是否超预算
OverBudget bool `json:"over_budget"` // token_count > SettingsTokenBudget
}
SettingResult 是 GetNovelSettings 的返回结构。 v2 取消全局设定概念后,设定全部归属当前小说,不再分 Global/Novel 两组。 保留 Items 字段(取代原 Global/Novel),前端可直接遍历。
type SlashCommand ¶
type SlashCommand struct {
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"` // "auto" | "manual" | "always"(对应 skill mode)
}
SlashCommand 是斜杠菜单的统一条目,数据源来自 skill store,Type 直接对应 skill mode。
type TestConnectionInput ¶
type TestConnectionInput struct {
ProviderName string `json:"provider_name"`
ChatURL string `json:"chat_url"`
APIKey string `json:"api_key"`
ModelID string `json:"model_id"`
}
TestConnectionInput 是连通性测试的入参。
type UpdateArcNodeInput ¶
type UpdateArcNodeInput struct {
Title string `json:"title"`
Description string `json:"description"`
TargetChapter int `json:"target_chapter"`
ActualChapter int `json:"actual_chapter"`
Status string `json:"status"` // "pending" | "completed" | "abandoned"
}
UpdateArcNodeInput 采用 PUT 语义:前端全量传,后端全量覆盖。
type UpdateChapterPlanInput ¶
type UpdateChapterPlanInput struct {
Scope string `json:"scope"` // "next" | "near" | "far"
Content string `json:"content"` // 计划内容
}
UpdateChapterPlanInput 采用 PUT 语义:前端全量传,后端全量替换文件内容。
type UpdateCharacterInput ¶
type UpdateCharacterInput struct {
Name string `json:"name"`
Description string `json:"description"`
Abilities string `json:"abilities"`
}
UpdateCharacterInput 采用 PUT 语义:前端全量传,后端全量覆盖。 Personality 是 AI 写入字段,不在 input 里,后端 First 加载原值保留。
type UpdateLocationInput ¶
type UpdateLocationInput struct {
Name string `json:"name"`
LocationType string `json:"location_type"`
Description string `json:"description"`
ParentLocationID *int64 `json:"parent_location_id"`
Tags string `json:"tags"`
}
UpdateLocationInput 采用 PUT 语义:前端全量传,后端全量覆盖。 DetailJSON 是 AI 写入字段,不在 input 里,后端 First 加载原值保留。 ParentLocationID 传 nil 表示根节点(清空父级),传 &id 表示设置父级。
type UpdateNovelInput ¶
type UpdateNovelInput struct {
Title string `json:"title"`
Description string `json:"description"`
Genre string `json:"genre"`
}
UpdateNovelInput 采用 PUT 语义:前端全量传,后端全量覆盖。
type UpdateNovelSettingInput ¶
type UpdateNovelSettingInput struct {
Category string `json:"category"`
Content string `json:"content"`
}
UpdateNovelSettingInput 是更新设定的入参。 采用 PUT 语义:前端全量传,后端全量覆盖。 v2 取消 is_global 后不再需要 is_global 切换的 NovelID 联动,可直接用 PatchAndSave, 但为了与 UpdatePreference 风格一致(db.Save 走 GORM 回调),保留手动 First + Save 模式。
type UpdatePreferenceInput ¶
type UpdatePreferenceInput struct {
Category string `json:"category"`
Content string `json:"content"`
IsGlobal bool `json:"is_global"`
}
UpdatePreferenceInput 是更新偏好的入参。 采用 PUT 语义:前端全量传,后端全量覆盖。 不走 PatchAndSave(偏好可能全局 NovelID=0 + is_global 切换需特殊处理 NovelID)。
type UpdateReaderPerspectiveInput ¶
type UpdateReaderPerspectiveInput struct {
Type string `json:"type"`
Content string `json:"content"`
PlantedChapter int `json:"planted_chapter"`
RelatedTruth string `json:"related_truth"`
RevealedChapter int `json:"revealed_chapter"`
}
UpdateReaderPerspectiveInput 采用 PUT 语义:前端全量传,后端全量覆盖。
type UpdateStoryArcInput ¶
type UpdateStoryArcInput struct {
Name string `json:"name"`
Description string `json:"description"`
ArcType string `json:"arc_type"`
Importance int `json:"importance"`
Status string `json:"status"` // "active" | "paused" | "completed" | "abandoned"
}
UpdateStoryArcInput 采用 PUT 语义:前端全量传,后端全量覆盖。 ReactivateAt 是 AI 写入字段,不在 input 里,后端 First 加载原值保留。
type UpdateStyleSampleInput ¶
type UpdateStyleSampleInput struct {
ID int64 `json:"id"`
Name string `json:"name"`
Content string `json:"content"`
Tags []string `json:"tags"`
IsGlobal bool `json:"is_global"`
NovelID int64 `json:"novel_id"`
}
UpdateStyleSampleInput 是更新风格素材的入参。
type UpdateTimelineEntryInput ¶
type UpdateTimelineEntryInput struct {
Title string `json:"title"`
Content string `json:"content"`
TargetChapter int `json:"target_chapter"`
Importance int `json:"importance"`
Status string `json:"status"` // "pending" | "resolved" | "abandoned"
ResolvedChapter int `json:"resolved_chapter"` // 标记 resolved 时填入
}
UpdateTimelineEntryInput 采用 PUT 语义:前端全量传,后端全量覆盖。 DetailJSON 是 AI 写入字段,不在 input 里,后端 First 加载原值保留。