refactor: 移除多余依赖,统一 MUI 为唯一 UI 库
- 移除 radix-ui、clsx、tailwind-merge、class-variance-authority、react-router-dom - 前后端全面适配 MUI 组件,清理残留 Tailwind 工具类引用 - 优化 Agent Loop 引擎、IPC 处理器、Provider Adapter 等后端模块 - 新增 Agent 网络工具通用设计文档 v2
This commit is contained in:
@@ -86,7 +86,7 @@ export class SessionService {
|
||||
ORDER BY pinned DESC, updated_at DESC
|
||||
`).all(archived ? 1 : 0) as SessionRow[];
|
||||
|
||||
return rows.map(this.toSessionInfo);
|
||||
return rows.map((row) => this.toSessionInfo(row));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,7 +183,7 @@ export class SessionService {
|
||||
ORDER BY created_at ASC
|
||||
`).all(sessionId) as MessageRow[];
|
||||
|
||||
return rows.map(this.toMessageInfo);
|
||||
return rows.map((row) => this.toMessageInfo(row));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,11 +316,22 @@ export class SessionService {
|
||||
role: row.role,
|
||||
content: row.content,
|
||||
reasoningContent: row.reasoning_content ?? undefined,
|
||||
toolCalls: row.tool_calls ? JSON.parse(row.tool_calls) : undefined,
|
||||
toolResult: row.tool_result ? JSON.parse(row.tool_result) : undefined,
|
||||
attachments: row.attachments ? JSON.parse(row.attachments) : undefined,
|
||||
toolCalls: row.tool_calls ? this.safeJsonParse(row.tool_calls) as unknown[] : undefined,
|
||||
toolResult: row.tool_result ? this.safeJsonParse(row.tool_result) : undefined,
|
||||
attachments: row.attachments ? this.safeJsonParse(row.attachments) as unknown[] : undefined,
|
||||
iteration: row.iteration ?? undefined,
|
||||
timestamp: row.created_at,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全 JSON 解析:解析失败时返回 undefined 而非抛出异常
|
||||
*/
|
||||
private safeJsonParse(json: string): unknown {
|
||||
try {
|
||||
return JSON.parse(json);
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user