{item.role === 'user' ? '你' : '智能体'}
-diff --git a/.project-docs/30-worklog/tasks/20260914-agent-ux-discussion-930b45dd.md b/.project-docs/30-worklog/tasks/20260914-agent-ux-discussion-930b45dd.md new file mode 100644 index 0000000..d40947b --- /dev/null +++ b/.project-docs/30-worklog/tasks/20260914-agent-ux-discussion-930b45dd.md @@ -0,0 +1,65 @@ +# Task: Discuss guided agent UX for beginners and children + +## Identity + +- Task ID: 20260914-agent-ux-discussion-930b45dd +- Mode: Feature +- Branch: codex/20260914-agent-ux-discussion-930b45dd-agent-ux-discussion +- Worktree: D:\Datas\OthersProjects\.codex-worktrees\makelore\20260914-agent-ux-discussion-930b45dd +- Base commit: 1d00ba39bd598e2f2ea26cc867d82afc2bdba3ee +- Owner: codex +- Status: Ready for Integration + +## Scope + +- Personal cloud Agents creation, requirements editing, model selection guidance, preview transitions/examples/comparison, readable execution confirmation, private-use handoff and desktop UI polish. +- Related unit tests, Electron interaction spec and README. Earlier discussion and interactive mockup led to the user accepting implementation in the same task. +- No changes to Main, cloud contracts, billing, auth, teacher/student permissions, knowledge processing, channel routing or scheduling semantics. + +## Intent And Constraints + +- Confirmed audience: ages 8–15, teacher guidance followed by independent use; nonprofessional adults also matter. +- Confirmed objective: independently create, test and improve a first helper. User accepted the short guide and editable requirements/preview sketch, then approved implementation. +- Concurrent and Planning Gates Passed through the loaded maintain-project-docs bundled check/start/status and required project-memory reads. Same-task feature owner, branch, base and isolated worktree match the identity above. +- Integrated project context remains unchanged. Other historical placeholder task records represent unknown coordination state; no concrete dependency blocks these Renderer edits. Active peer 20260914-cloud-reconnect-5ad71e6c owns Main session time validation and has no semantic overlap. +- Preserve saved/preview/published separation, recovery identities, creator payment and Main-owned backend access. No subagents, live paid requests, real account publication, merge, push or deployment. +- Keep system_prompt as the sole saved instruction source. Style choices add/remove exact plain-language instruction lines; editing other fields preserves arbitrary instructions verbatim. +- The catalog has no recommendation marker. Newly created assistants select the first actual available model, visibly editable; existing assistants never receive an automatic model change. + +## Outcome + +- Creation occupies a focused content area: choose one of four editable purpose starters or a custom idea, enter name/purpose/answer style/special requirements, then save and try the real assistant. Creation and uncertain retries retain the existing operation identity. +- Empty/list states use understandable wording and reflect disabled/archived status. Step navigation and leave protection preserve partial requirements, including when name and purpose remain empty. +- Requirements use three optional answer-style buttons plus free text. Advanced capability, knowledge and limit controls remain available behind an explicit toggle; their state and independent budget saves are preserved. +- Model selection is visible with explanations and loading-error retry. Only a fresh creation preselects an actual catalog model once. Missing models remain explicit; no fake recommendation or model capability is inferred. +- Example questions only fill the composer. Explicit save-and-retrial waits for a successful save, uses its returned revision, preserves existing typed text or reuses the last question without sending, and retains the previous trial for comparison. +- Current runs, queued work, approvals, attachments and uncertain operations block the replacement-trial action. Save-only and tab switching preserve the current trial. Prior-trial downloads continue to use that trial's own thread. +- Approval UI shows actual description/name and arguments with readable known labels, retaining complete technical details and unchanged batch decision/retry identities. +- First private-use confirmation shows availability and creator billing without unrelated sharing/API setup. It uses the existing publish operation, then opens a separate normal conversation. Subsequent sharing, applications, linked channels and version management remain available. +- Buttons in the editor have a minimum 40 px height; existing light theme and split layout remain. Headings/body wrap naturally; small-window panels and initial trial activation remain usable. +- README documents the resulting behavior. The WeChat status unit assertion now waits for the actual asynchronously loaded status rather than merely the presence of the initial placeholder. + +## Verification + +- pnpm 10.33.4 verified against packageManager; install --frozen-lockfile passed. +- Typecheck passed. lint:check passed with 8 pre-existing warnings (CloudChat/CloudCosts generation refs, existing mixed component exports and Home dependency). +- Relevant 4-file regression run: 55 tests passed. Final focused cloud-agents-page run: 18 tests passed, including one additional disabled/archived availability-label test (56 relevant tests across the final checked files). +- Production build:vite passed, including Renderer, Main, Preload and utility bundles. Existing chunk-size/mixed-import warnings remain. +- Electron cloud-agents.spec.ts passed with the real desktop shell and a test-owned Host API fixture. Covers guided creation, model selection, leave protection, save/start, fill-only examples, editing, Ctrl+S, history comparison, combined save/retrial, private-use handoff and the existing knowledge/budget/schedule path. +- Electron checked 1366×768 and 980×680 windows, 125%/150% zoom, fixed composer position, independent scroll, drag/keyboard divider and F6/Escape focus behavior. Inspected creation, requirements, wide/narrow editor and private-use screenshots; corrected creation's excessive vertical offset. +- Full pnpm test first stage: 236 files passed, 1 failed; 2069 tests passed, 1 failed, 2 skipped. Failure: tests/unit/pi-managed-worker-opener.test.ts:292 expects makelore-runtime-v6.mjs while the runtime generates v7. Both the v6 expectation and extension version 7 already exist at base 1d00ba39, and neither source was changed here. The release-proof summary also still names v6. This unrelated baseline inconsistency is recorded, not hidden by changing Pi in a UI task. +- The pressure test skipped by pnpm test's failing && chain was run separately: 1 test passed. +- No live cloud/model quality or student usability study; UI tests use fixture responses. The earlier mockup uses explicitly labeled sample answers and remains outside the repository. +- Final typecheck and production build passed after the creation-layout/status changes. Documentation drift and whitespace checks passed; task result is ready for local commit and registry completion. Generated reports, fixtures, logs and screenshots remain untracked/ignored or outside the repository. + +## Follow-ups + +- Integrate the completed UI branch through the project's normal integration workflow. +- Align the stale Pi managed-worker/release-proof version expectations with the authoritative extension version in a separate runtime task. +- Validate independent first creation and revision with younger and older students; no measured usability improvement is claimed. +- Knowledge/file simplification and teacher templates remain later work. No classroom role model has been introduced. + +## Promotion Candidates + +- Target: personal cloud Agent ADR/product positioning during Integration Gate. Proposal: record the confirmed ages 8–15, teacher-guided introduction and independent first-helper creation/testing/improvement objective. Evidence: explicit audience clarification and accepted sketch/implementation. Future impact: default UI prioritizes the creation/use loop. Semantic conflict: none with the personal-creator boundary. Human confirmation: objective and implementation direction accepted; no new teacher/student access model is authorized. +- Target: personal cloud Agent architecture/current state. Proposal: document guided Renderer requirements over the existing system_prompt and create/save/publish APIs, explicit save-and-retrial, and single-use model preselection only on fresh creation. Evidence: implementation, focused tests and Electron fixture checks above. Future impact: preserve cloud authority and existing recovery semantics in future UX work. Semantic conflicts: no cloud contract changes. Human confirmation: ordinary integration review. diff --git a/README.md b/README.md index 05b1d22..13692e5 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ Makelore 是一个面向软件、视觉创作、智能机器人与个人云智能体的 AI 桌面工作台。当前版本为 `2.0.0`,源码提供四个模块入口;云智能体需配套配置 WS/Yuxi 服务。模块入口页按 Agents、Code、Canvas、Robot 排列,统一采用横向插画卡片;Agents 标语为“打造你想象中的AI助手”。工作区左上角入口点击后返回模块入口页: - `Makelore Code|AI 编程`:管理本地项目、项目智能体、对话、文件上下文、代码变更和运行时。 -- `Makelore Agents|AI 智能体`:配置个人云智能体并试聊,发布后正式对话、按账号分享或创建应用 API Key。支持流式回复、审批、排队请求、附件与产物、自动任务和活动历史;重新进入时恢复最近智能体与对话,未确认操作可按原输入重试。聊天可提出日程建议,由创建者核对能力、时间和费用后启用。知识库支持上传、索引、替换、删除及导入本人会话附件;个人 MCP 凭据、Skills、子智能体可自助管理。支持智能体和会话归档、发布版本比较及恢复为草稿。所有模型调用由创建者个人词元点数支付,可按智能体设置每次任务和每日上限,费用按时间、来源、应用分页统计;分享/API 调用者保有自己的内容空间。Main 管理云会话和本机文件,Renderer 通过 Host API 操作。配套服务接入见 [Yuxi MakeLore 说明](https://xerrors.github.io/Yuxi/advanced/makelore-agents.html)。 编辑采用全高桌面分栏,支持拖动调整与展开、独立滚动、小窗口配置/试用切换。配置分为指令、能力、知识、限制;草稿明确保存(Ctrl/⌘+S),保存与切换页面保留当前试用及未发送文字,新试用明确使用最新保存版本。费用上限在限制中独立保存。Enter 发送、Shift+Enter 换行,F6 切换面板焦点、Esc 恢复分栏。 +- `Makelore Agents|AI 智能体`:配置个人云智能体并试聊,发布后正式对话、按账号分享或创建应用 API Key。支持流式回复、审批、排队请求、附件与产物、自动任务和活动历史;重新进入时恢复最近智能体与对话,未确认操作可按原输入重试。聊天可提出日程建议,由创建者核对能力、时间和费用后启用。知识库支持上传、索引、替换、删除及导入本人会话附件;个人 MCP 凭据、Skills、子智能体可自助管理。支持智能体和会话归档、发布版本比较及恢复为草稿。所有模型调用由创建者个人词元点数支付,可按智能体设置每次任务和每日上限,费用按时间、来源、应用分页统计;分享/API 调用者保有自己的内容空间。Main 管理云会话和本机文件,Renderer 通过 Host API 操作。配套服务接入见 [Yuxi MakeLore 说明](https://xerrors.github.io/Yuxi/advanced/makelore-agents.html)。 编辑采用全高桌面分栏,支持拖动调整与展开、独立滚动、小窗口配置/试用切换。首次创建按选用途、说要求、试一试引导,提供科学问答、故事、英语和笔记整理起点;回答方式可多选,特别要求直接编辑,仍以草稿的 system_prompt 保存。新助手预选云端目录的第一个可用模型并明确显示,可自行更换;已有助手不自动换模型。能力、知识与限制折叠到高级设置。草稿明确保存(Ctrl/⌘+S),保存与切换页面保留当前试用及未发送文字;“保存并重新试用”使用最新保存的要求,保留上次试用供对比,并可复用上次问题,不自动发送。示例问题仅填入输入框;有运行、排队、审批或未确认操作时先处理当前试用。工具确认先展示实际操作说明与参数,完整技术详情可展开。确认“开始使用”会创建仅自己可用的发布版本并进入独立对话,分享与应用仍单独开启。费用上限在限制中独立保存。Enter 发送、Shift+Enter 换行,F6 切换面板焦点、Esc 恢复分栏。 云知识库的向量模型由平台管理员配置:Yuxi 后台「智能体管理 → 模型供应商」启用 embedding 模型并填写实际维度;Works Square 运营后台「模型管理」从 one-api 刷新并激活相同模型 ID。one-api 必须支持该模型的向量接口。客户端区分目录加载中、加载失败与无可用模型,空状态提供管理员配置说明;「刷新知识库与模型」保留未提交名称,未确认的创建请求沿用原操作身份。 - Agents 侧栏的「渠道」统一管理个人微信账号。每个账号由唯一扫码微信身份连接,可以在发布智能体前先扫码,之后选择或更换目标智能体;多个微信账号可以使用同一个已发布智能体,切换目标不需要重新扫码。账号可单独启用、暂停、重新连接或断开,不提供联系人邀请或授权调用者管理。Agent 的「发布与访问」只展示已关联渠道并提供定位入口。选中账号的二级详情保留运行/投递活动、失败文件补发和微信对话;对话可审批、停止、新开一段并保存实际产物,不同账号的会话相互隔离。自动任务可明确选择把结果发送到已经开始对话的微信账号,暂停保留目标;所有模型调用仍由智能体创建者支付,费用统计包含微信渠道。渠道需要配套版本的 AgentBus Core/微信 Adapter、Yuxi 和 Works Square,桌面用户无需填写服务凭据。Main 保管操作恢复记录,重开界面不会自动重发绑定或执行请求;验证码不写入恢复记录,已移除的联系人权限操作记录只能丢弃。用户与应用分享不属于微信渠道账号管理范围。 + Agents 侧栏的「渠道」统一管理个人微信账号。每个账号由唯一扫码微信身份连接,可以在发布智能体前先扫码,之后选择或更换目标智能体;多个微信账号可以使用同一个已发布智能体,切换目标不需要重新扫码。账号可单独启用、暂停、重新连接或断开,不提供联系人邀请或授权调用者管理。Agent 的「使用与分享」只展示已关联渠道并提供定位入口。选中账号的二级详情保留运行/投递活动、失败文件补发和微信对话;对话可审批、停止、新开一段并保存实际产物,不同账号的会话相互隔离。自动任务可明确选择把结果发送到已经开始对话的微信账号,暂停保留目标;所有模型调用仍由智能体创建者支付,费用统计包含微信渠道。渠道需要配套版本的 AgentBus Core/微信 Adapter、Yuxi 和 Works Square,桌面用户无需填写服务凭据。Main 保管操作恢复记录,重开界面不会自动重发绑定或执行请求;验证码不写入恢复记录,已移除的联系人权限操作记录只能丢弃。用户与应用分享不属于微信渠道账号管理范围。 - `Makelore Canvas|AI 绘画`:每个设计项目(Workspace)维护一份从创建起就存在的 Living Form。左侧项目栏负责新建、切换和管理 Workspace,并在桌面设计模式下以 256px 宽度常驻展开;中央沿用 AI 编程的安静对话画布、自然消息流和底部悬浮输入器,AI 整理出的制作方案作为对话内的轻量可编辑稿持续更新;桌面端右侧同为 256px 的全高历史作品栏集中展示当前项目的制作记录与生成结果。紧凑窗口通过左侧抽屉访问项目列表,历史记录保留在时间线中。参考图从本地上传后以 `@图片N` 绑定,具体用法只写在创作提示词中。 - `Makelore Robot|AI 机器`:管理机器人智能体、设备激活绑定、智能体配置与设备分配;机器人工作台的智能体位于 Robot 全局侧栏,选中后在内容区先查看绑定设备、再查看基础设置,当前智能体通过 URL 参数保持可分享选择;绑定设备时默认先选择“引导配网”或“已有激活码”。在 Windows 与 macOS 的引导路径中,Makelore 可在弹窗内扫描并连接附近开放的 `Xiaozhi-*` 配网热点,失败时仍可通过系统 Wi-Fi 手动连接;后续继续复用机器人现有热点配网页面,不修改固件,也不由 Makelore 接收 Wi-Fi 密码。 diff --git a/src/pages/CloudAgents/AgentRequirements.tsx b/src/pages/CloudAgents/AgentRequirements.tsx new file mode 100644 index 0000000..992f0db --- /dev/null +++ b/src/pages/CloudAgents/AgentRequirements.tsx @@ -0,0 +1,32 @@ +import { Button } from '@/components/ui/button'; +import { Textarea } from '@/components/ui/textarea'; + +const styles = [ + { label: '简单易懂', instruction: '使用简单易懂的语言,遇到新词先解释。' }, + { label: '一步一步来', instruction: '把任务拆成小步骤,一次引导我完成一步。' }, + { label: '先给我提示', instruction: '先给我提示和思考问题,让我尝试后再补充答案。' }, +] as const; + +/** Style choices are ordinary instruction lines in the existing system_prompt. */ +export function AgentRequirements({ value, onChange }: { value: string; onChange: (value: string) => void }) { + const selected = styles.filter(style => value.split('\n').includes(style.instruction)); + const custom = value.split('\n').filter(line => !selected.some(style => style.instruction === line)).join('\n'); + return
发布保存的修订 {revision}。发布后仅自己可用,分享与应用需要分别开启。
-{access?.published_version ? '应用最新修改后,新的对话会使用这次保存的要求。已有对话保留原来的版本。' : '开始使用后,只有你自己能用。以后还可以回来修改要求。'}
+分享给别人或接入应用,需要另外开启。
+自己使用、分享使用、API 调用、自动任务和个人微信渠道产生的费用,均从你的个人词元点数扣除。你可以随时停用智能体或撤销访问。
{access?.published_version &&{error}
} {notice &&{notice}
} + {access?.published_version && <> +选择获准使用的账号,再发送分享链接。每个人的对话和文件分别保存。
版本 {v.version} · 草稿修订 {v.draft_revision} · {new Date(v.created_at).toLocaleString()}
)}当前试用 · 修订 {previewRevision}
}由创建者支付词元点数{run?.version && ` · 版本 ${run.version}`}
配置已更新到修订 {latestRevision},当前试用仍保留修订 {previewRevision}。
- - {(Boolean(intent) || Boolean(interrupt) || attachmentIds.length > 0 || childrenPending.hasPending) &&请先完成本次重试或确认,并取消附件选择,再开始新试用。
} + {(stalePreview || hasUnsavedChanges) &&{hasUnsavedChanges ? '要求改好了?保存后再试一次,看看回答有什么不同。' : '要求已保存,重新试用就会使用最新修改。'}
+ + {trialPending &&先完成当前试用或确认操作,并取消附件选择,再重新试用。
} {!previewReady &&当前草稿尚未选择模型。选择模型并保存后,可开始新试用。
}正在读取对话…
- : !history?.messages.length && !liveText &&{item.role === 'user' ? '你' : '智能体'}
-{mode === 'preview' ? '看看它的回答是否符合你的要求。不满意就改一改,再试一次。' : '从下面选一句,或写下你自己的想法。'}
+点选只会填入输入框,由你决定何时发送。
+这是修改前的回答。用同一个问题再问一次,更容易看出变化。
+{proposal.prompt}
@@ -316,12 +343,23 @@ export function CloudChat({ slug, previewRevision: latestRevision, initialThread{progress || (running ? cloudStatus(run?.status ?? request?.status ?? '') : run ? cloudStatus(run.status) : '就绪')}
{running ? - : } + : }{item.role === 'user' ? '你' : '助手'}
+{JSON.stringify(action, null, 2)})}
+ {actions.length ? <>
+ 助手想执行下面{actions.length > 1 ? '这些操作' : '这个操作'}。看清内容后,再决定是否允许。
+ {actions.map((action, i) => { + const detail = object(action); + const args = object(detail.args ?? detail.arguments); + const labels: Record{actions.length > 1 ? (i + 1) + '. ' : ''}{typeof detail.description === 'string' && detail.description ? detail.description : typeof detail.name === 'string' ? names[detail.name] ?? detail.name : '待确认的操作'}
+ {Object.entries(args).map(([key, value]) =>{labels[key] ?? key}
+{typeof value === 'string' ? value : JSON.stringify(value, null, 2)}{JSON.stringify(action, null, 2)}