Conversation
- 新增 lib/sessionMirror: 复用会话镜像骨架 (activeId/pendingResolver/settle/onUnmounted 兜底) - useDesignCardSession 152→93, useAIWorkflowSession 221→149, 消除 ~140 行重复骨架 - usePlotWorkspace 659→343, 拆出 7 个职责文件 (updates/subscription/scriptOps/aiSettings/paneLayout + helpers) - App.vue import 路径同步至 workspace/usePlotWorkspace
- app.go 435→130 (骨架: struct + NewApp + Startup/Shutdown + emit/requireContext) - app_env.go 111 (GetEnvironmentStatus/InitializeApp/RebuildRuntime) - app_update.go 73 (update 四方法 + mapUpdateStatus) - app_subscription.go 57 (GetSubscriptionStatus/OpenSubscriptionPurchase) - app_screening.go 44 (Toggle*/handleContextMenu + mapScreeningState) - app_ai.go 45 (GetAISettings/SaveAISettings) - 方法签名零变更, wails build 绑定文件无需更新
- scripts_workspace.go 139 (Bootstrap/workspaceSnapshot/Switch/Create/Rename/Delete Workspace + resolveCurrentFile + mapWorkspaces) - scripts_run.go 106 (SaveAndRun/StopCurrentRun) - scripts_crud.go 103 (脚本 CRUD: List/Content/Create/Refresh/Reorder/Rename/Delete/Save) - scripts_note.go 67 (Note CRUD + mapNoteImages) - scripts.go 405→删除, 方法签名零变更, wails build 绑定无改动
- useFluidScrim: moon/warm 主题 rgba 调色板柔化, setAnchor 加空尺寸守卫防除零 - corner-pocket.css: 右下角 AI 按钮覆盖层 360ms 进入动画 (opacity + scale)
- 8 个 *Dialog.vue: components/ -> components/dialogs/ (App.vue 8 处 import 同步)
- RuntimeLoadingScreen / TopBar 留顶层 (非对话框)
- 删除空壳目录: internal/diagnostics, internal/diaglog,
frontend/src/features/{aiExecution,diagnostics,preferences} (无文件无引用)
Go: - testify v1.11.1 (测试用例待写) Frontend: - vitest 2.1.9 + @vue/test-utils 2.4.11 + jsdom 25 + @vitest/coverage-v8 2.1.9 - vitest.config.ts 独立于 vite.config.ts (生产 build 不读测试配置, 测试不读 build 配置) - package.json scripts: test / test:run / test:coverage - 断言风格: expect (BDD 链式, vitest 官方主推) - include: src/**/*.spec.ts - smoke 已验证 (2/2 通过后删除)
Go: internal/aicode/workflow/service_test.go (187 行, 9 用例) - TestStart_RequiresSceneName / DefaultMaxAttempts / RejectsDuplicate - TestRun_SucceedsOnReady / BuildPatchErrorFailsNotRepairable - TestRun_ExecuteFailedRetriesThenSucceeds / ExecuteInterrupted - TestStop_CancelsAndCallsExecutorStop / UnknownSessionErrors - 手写 fake 实现 Builder/Executor/EventSink 三接口, sink.done channel 同步异步 run - testify/assert 断言 Frontend: lib/sessionMirror/useSessionMirror.spec.ts (121 行, 8 用例) - vi.mock wailsjs/runtime EventsOn 捕获回调手动触发事件 - 9 场景: 挂起/终态/sessionId 不匹配/busy/startBridge 抛错/stopActiveSession/onSettle/safeCall 吞错/onUnmounted 兜底 - @vue/test-utils mount 测 onUnmounted 兜底 - expect (BDD) 断言 验证: go test ./... 5 包全 ok, npm test 8/8 通过, wails build 通过
Go (4 包, 22 用例): - ai/provider/router_test.go (59 行, 3 用例): 模式分发 / 错误传播 / 请求透传 - ai/generation/service_test.go (73 行, 5 用例): fence 提取 / 无 fence / 错误传播 / subscription 路由 / extractCode 单测 - ai/optimize/service_test.go (67 行, 5 用例): fence 剥离 / 空 patch 报错 / 错误传播 / buildUserPrompt / resolvePromptPath - ai/repair/service_test.go (68 行, 5 用例): 同 optimize 结构 + StripFence 变体 - fake ChatClient + fakeLoader 注入, 真实 Router 验证模式分发 Frontend (4 文件, 28 用例累计): - lib/errors.spec.ts (23 行, 5 用例): Error/string/object/number/null - lib/zoomGuards.spec.ts (53 行, 4 用例): ctrl+wheel/ctrl+0/ctrl+其他/无 ctrl - lib/pythonHighlighter.spec.ts (71 行, 11 用例): 空行/关键字/内置/注释/装饰器/字符串/数字/运算符/合并/复杂行 验证: go test 9 包全 ok, npm test 28/28 通过, wails build 23.1s, tsc src/ 下零新错
Go (3 包, 22 用例): - codeversions/store_test.go (108 行, 8 用例): List 空/空代码报错/空 note 默认/Label 递增/持久化/Delete+relabel/未知 id/场景隔离 - subscription/service_test.go (105 行, 9 用例): stateToView 字段映射/Activated 条件/canUseCache 5 场景/resolveDeviceID 存储优先+回退 provider - settings/ai_store_test.go (40 行, 5 用例): normalize 默认 custom/保留 subscription/非 subscription→custom/trim/默认值 Frontend (1 文件, 5 用例): - composables/useTheme.spec.ts (52 行): 默认主题/localStorage 读取/非法回退/setTheme 持久化+CSS 变量/cycleTheme 循环 验证: go test 12 包全 ok, npm test 33/33 通过, wails build 24.8s, tsc src/ 零新错
解耦: - store.go: 新增 WorkspaceResolver interface (CurrentDir/WorkspaceDir/ReserveWorkspaceImport) - Store.workspaces: *workspaces.Manager -> WorkspaceResolver - NewStore 签名改接收接口, *workspaces.Manager 已实现 -> bridge/app.go 调用方零改动 - 编译期断言: var _ WorkspaceResolver = (*workspaces.Manager)(nil) 测试 scripts_test.go (155 行, 13 用例): - ListScripts 空/创建顺序/默认 main+note - CreateScript 幂等 - ReadScript 读回内容/不存在报错 - SaveScript 写读回环 - RenameScript 移目录+更新 order/目标存在报错 - DeleteScript 移目录+移 order - ReorderScripts 持久化顺序 - SceneMainPath 路径拼装 - SceneDir 空名兜底 untitled 验证: go test 13 包全 ok, wails build 39.1s (接口解耦不破坏调用方)
- ai/prompting/builder_test.go (60 行, 6 用例): BuildSystemPrompt/BuildUserPrompt/ExtractImageDataURLs - aicode/runstate/normalize_test.go (60 行, 7 用例): NormalizeExecutionResult 各状态/defaultErrorText - aicode/patch/apply_test.go (90 行, 14 用例): ParseRepairPatch/ApplyRepairPatch/ApplyGeneratedCode/normalizeNewlines/buildGenerationPrefix - scriptsafety/validator_test.go (75 行, 13 用例): Analyze 各规则/去重/排序/Validate/ValidateFile - version/version_test.go (15 行, 2 用例): Current 非空+确定 - windowmetrics/size_test.go (75 行, 8 用例): maxInt/minInt/clamp/fitToAvailable 5 场景/fallbackSize - paths/paths_test.go (55 行, 6 用例): fileExists/isProjectRoot/isRuntimeRoot 全是纯函数/正则逻辑, 无需解耦
- env/status_test.go (62 行, 8 用例): mapCheckStatus/mapFileMessage/mapImportMessage/buildImportCheckScript/DefaultRequirements/reportProgress - env/archive_test.go (70 行, 5 用例): retryRename/copyFile/copyDirContents (t.TempDir 真实 fs) - env/archive_parser_test.go (48 行, 6 用例): archiveProgressParser 百分比解析/截断/忽略非进度行/单调不回退/Write 分行 - instancelock/lock_test.go (32 行, 3 用例): Acquire 端口占用/Release 关闭+幂等/nil 安全 - startupdiag/message_test.go (16 行, 2 用例): StartupErrorMessage nil+带错 验证: go test 23 包全 ok
device (小解耦): - service.go: guidProvider func 注入, NewService() 默认用 machineGuid, NewServiceWithProvider() 测试用 - service_test.go (52 行, 5 用例): hash 大小写归一/trim/确定/错误传播/hex 长度 bridge (纯函数, 无解耦): - mappers_test.go (78 行, 6 用例): mapScreeningState 字段+slice 独立复制+空安全 / mapUpdateStatus / mapAISelectionItems + nil 验证: go test 25 包全 ok
解耦 (包级 provider 注入, 调用方零改动): - discovery.go: scriptsRootProvider 默认 paths.ScriptsDir, 加 WithScriptsRoot 注入 - state_store.go: statePathProvider 默认 paths.WorkspaceStatePath, 加 WithWorkspaceStatePath 注入 - scriptsRoot() / StateStore 内部改调 provider manager_test.go (200 行, 24 用例): - NormalizeName / contains / chooseInitialWorkspace (纯函数) - List 空根创建 Default - Create 创建+设 active / 重复报错 / 空名报错 - Switch 切换+持久化 / 未知报错 / 空名报错 - WorkspaceDir 返回路径 / 未知报错 / 空名报错 - ReserveWorkspaceImport 去重 副本2 / 空名用 Default - Rename 移目录 / 目标存在报错 / 空名报错 - Delete 移目录 / active 不能删 / 空名报错 - nextAvailablePath 首选空闲 / 副本2 验证: go test 26 包全 ok, wails build 通过
- runner_test.go (88 行, 13 用例): - RunError.Error 三种形态 (traceback/err/type) - detectPythonErrorType 找 Error/Exception 后缀/无匹配用 fallback/默认 PythonError - tail 空输入/少于 N 行/截最后 N 行/正好 N 行 - BuildPythonEnv 设 MPLBACKEND/SENTINEL/Qt 路径/PATH Run/Stop 依赖 exec.Command 真起子进程, 留给集成测试
- screening/session_test.go (115 行, 14 用例): - normalizeSceneNames 去重+去空 / normalizeStartRequest 校验+默认值+越界钳制 - sceneNameOf/entryWindow nil 安全 / orderedStackEntries 过滤+排序 - targetIndicesLocked 从 current 到 pool 限制 / 钳制到 scenes 长度 - stateLocked 反映 active 字段 / inactive 不设 CurrentSceneName - aicode/operations/service_test.go (36 行, 5 用例): - BuildError.Error/Unwrap / repairErrorText 首次用 ErrorText / 重试用 LastFailure / 无 LastFailure 回退 screening 完整导航需隔离 windowctrl (窗口动画), 留给集成测试
纯函数: - notebook/noteMarkdownBlocks (insertBlockReference/collapseBlankLines/escapeRegExp) - scripts/scriptWorkspaceUtils (asString/withTimeout/wait/typingDuration/phase) - plot/workspace/updateStatusHelpers + subscriptionStatusHelpers 注入式 composable (mock repository/bridge): - scripts/useScriptFileActions (18 用例: select/create/rename/delete/reorder/run) - scripts/useWorkspaceActions (9 用例: switch/create/rename/delete workspace) - scripts/useScriptAutoSync (7 用例: 自动保存/sync 间隔/暂停) - notebook/useNoteImages (8 用例: add/remove/move 图片引用) - plot/usePackageTransfer (8 用例: import/export/pending 不关) - plot/useAINoteGeneration + useAIActivityStatus - aiRepair/useAIRunErrorRepair - errors/useRunErrorDialog - runtime/useRuntimeState 验证: npm test 19 files / 145 用例全绿
…P status Free mode uses公益语气 (429: 过段时间再试试; 403: 模型配置异常; 404: 服务暂未开放; 503: 暂时不可用), with no ads and no upsell. Custom/subscription modes get neutral technical文案. Unlisted status codes and unknown modes fall back to the generic 'AI 服务返回失败' message. openai.Request gains a Mode field; each provider (free/custom/ subscription) passes its ServiceMode through. openai.Client.Generate routes StatusCode>=400 via friendlyError + errorMessagesByMode.
代码生成 (custom/subscription.txt): - color 偏甜(L 0.72~0.84 / S 0.45~0.70 / α 0.18~0.25 不洗白) - style 拆 subplots(3d/2d-curve/2d-shape 视情况而用) - experiment.method 七步 + structure 封装六律 - example 换自由平面切立方体 卡片生成 (generate/custom + subscription): - color 偏甜同步(与代码生成同色系) - method 七步注入(含 5 种子图类型 + 阳马参考范例) - 例子瘦文字(svg 显示 25→16,砍章节标签+公式) - not 规则写硬 + 硬性要求 +6/+7(svg 文字极简)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Notes