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:
@@ -36,6 +36,7 @@ import type {
|
||||
} from '../types';
|
||||
import { MetonaStreamEventType, MetonaFinishReason, MetonaErrorCode } from '../types';
|
||||
import { estimateMessagesTokens } from '../utils/token-estimator';
|
||||
import { ContentFilterError } from '../adapters/base-adapter';
|
||||
import log from 'electron-log';
|
||||
|
||||
/**
|
||||
@@ -1149,6 +1150,8 @@ export class AgentLoopEngine extends EventEmitter {
|
||||
// v0.3.0 删除了 emit('error') 导致所有 adapter 错误对前端不可见
|
||||
// 此处用 emit('streamEvent', { type: ERROR }) 不会触发 EventEmitter 的同步 throw
|
||||
if ((reason === TerminationReason.ERROR || reason === TerminationReason.DEAD_LOOP) && error) {
|
||||
// v0.3.17: 识别 ContentFilterError,映射为 CONTENT_FILTERED 错误码 + 友好消息
|
||||
const isContentFilter = error instanceof ContentFilterError;
|
||||
this.emit('streamEvent', {
|
||||
type: MetonaStreamEventType.ERROR,
|
||||
requestId: this.currentRequestId,
|
||||
@@ -1158,8 +1161,10 @@ export class AgentLoopEngine extends EventEmitter {
|
||||
timestamp: Date.now(),
|
||||
runId: this.runId,
|
||||
error: {
|
||||
code: MetonaErrorCode.UNKNOWN,
|
||||
message: error.message,
|
||||
code: isContentFilter ? MetonaErrorCode.CONTENT_FILTERED : MetonaErrorCode.UNKNOWN,
|
||||
message: isContentFilter
|
||||
? '内容被 Provider 安全审核拦截,请修改图片或文本后重试'
|
||||
: error.message,
|
||||
retryable: false,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user