feat: v0.3.17 修复多项问题(sandbox/全局配置层/继承选项/配置刷新/附件提示/content_filter 错误处理)
- fix: sandbox: true → false(ESM preload 不兼容 sandbox 导致 window.metona 不可用,选择文件夹按钮无反应) - feat: 全局配置层(GlobalConfigService)— LLM/Agent 等配置跨工作空间共享,切换工作空间后不再丢失 - 读取时工作空间 DB 空值或默认值回退到全局 JSON - 写入时双写(DB + 全局 JSON) - 首次启动迁移旧配置到全局层 - fix: 工作空间继承选项显示条件放宽 + push 前校验避免覆盖目标已有文件(SOUL.md/agent.db) - fix: config:changed IPC 广播 + 前端监听,修改 Agent 配置后详情栏 maxIterations 实时刷新 - feat: 上传图片/文件时在 System Prompt 注入附件提示,避免 AI 在工作空间查找用户上传的文件 - feat: content_filter 错误识别(ContentFilterError)+ 友好提示,替代原始 JSON 错误体透传 - fix: JSDoc 注释中 llm.* / agent.* / onboarding.completed 中的 */ 被解析为注释结束符
This commit is contained in:
@@ -148,11 +148,11 @@ function WorkspaceSettings() {
|
||||
setApplying(true);
|
||||
try {
|
||||
// 如果勾选了继承文件,从旧工作空间复制到新工作空间
|
||||
// - SOUL.md: Agent 身份定义
|
||||
// - .metona/agent.db: 数据库(会话/消息/记忆/Trace),后端白名单校验
|
||||
// - SOUL.md: Agent 身份定义(仅目标缺少时才继承,避免覆盖已有定义)
|
||||
// - .metona/agent.db: 数据库(仅目标不存在时才继承,避免覆盖已有数据)
|
||||
const filesToInherit: string[] = [];
|
||||
if (inheritSoul) filesToInherit.push('SOUL.md');
|
||||
if (inheritDatabase) filesToInherit.push('.metona/agent.db');
|
||||
if (inheritSoul && checkResult?.missingFiles?.includes('SOUL.md')) filesToInherit.push('SOUL.md');
|
||||
if (inheritDatabase && !checkResult?.dbExists) filesToInherit.push('.metona/agent.db');
|
||||
|
||||
// #51 修复: 继承数据库前校验源数据库完整性,避免继承损坏的数据库导致新工作空间数据丢失
|
||||
if (inheritDatabase && currentPath) {
|
||||
@@ -277,18 +277,22 @@ function WorkspaceSettings() {
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{/* 继承选项(仅当当前有工作空间且新工作空间需要创建文件时显示) */}
|
||||
{currentPath && currentPath !== pendingPath && (checkResult.isNewWorkspace || (checkResult.missingFiles && checkResult.missingFiles.length > 0)) && (
|
||||
{/* 继承选项(当前有工作空间、目标不是同一目录、且目标有可继承的文件时显示) */}
|
||||
{currentPath && currentPath !== pendingPath &&
|
||||
(checkResult.missingFiles?.includes('SOUL.md') || !checkResult.dbExists) && (
|
||||
<Stack spacing={0.5} sx={{ mt: 0.5 }}>
|
||||
<Typography variant="caption" sx={{ fontWeight: 600, color: 'text.secondary' }}>
|
||||
从当前工作空间继承基础设置:
|
||||
从当前工作空间继承:
|
||||
</Typography>
|
||||
<FormControlLabel
|
||||
control={<Checkbox size="small" checked={inheritSoul} onChange={(e) => setInheritSoul(e.target.checked)} />}
|
||||
label={<Typography variant="caption">SOUL.md(身份与角色定义)</Typography>}
|
||||
/>
|
||||
{/* 数据库继承:仅在新工作空间(空目录)时显示,避免覆盖已有工作空间的数据 */}
|
||||
{checkResult.isNewWorkspace && (
|
||||
{/* SOUL.md 继承:目标缺少 SOUL.md 时才允许勾选,避免覆盖已有定义 */}
|
||||
{checkResult.missingFiles && checkResult.missingFiles.includes('SOUL.md') && (
|
||||
<FormControlLabel
|
||||
control={<Checkbox size="small" checked={inheritSoul} onChange={(e) => setInheritSoul(e.target.checked)} />}
|
||||
label={<Typography variant="caption">SOUL.md(身份与角色定义)</Typography>}
|
||||
/>
|
||||
)}
|
||||
{/* 数据库继承:目标 .metona/agent.db 不存在时才显示,避免覆盖已有工作空间数据 */}
|
||||
{!checkResult.dbExists && (
|
||||
<>
|
||||
<FormControlLabel
|
||||
control={<Checkbox size="small" checked={inheritDatabase} onChange={(e) => setInheritDatabase(e.target.checked)} />}
|
||||
|
||||
Reference in New Issue
Block a user