feat: 添加个人规则功能

- 新增个人规则管理模块 (personalRulesManager.ts)
   - 支持创建、编辑、删除多条规则
   - 规则存储在用户目录 ~/.iccoder/rules/
   - 对话时自动将规则传递给后端
   - 添加后端对接文档和 webpack 优化指南
This commit is contained in:
Roe-xin
2026-03-07 15:13:54 +08:00
parent 06573e37d7
commit 8751944053
10 changed files with 1139 additions and 100 deletions

View File

@ -28,6 +28,7 @@ import type {
PlanConfirmEvent,
} from "../types/api";
import { submitToolConfirm, submitAnswer, stopDialog } from "./apiClient";
import { getActiveRules } from "../utils/personalRulesManager";
import { ChatHistoryManager } from "../utils/chatHistoryManager";
import { getUserIdFromToken, isTokenExpired } from "../utils/jwtUtils";
import { updateCachedBalance } from "./creditsService";
@ -502,6 +503,7 @@ export class DialogSession {
compactedData: compactedData || undefined,
newMessages: newMessages.length > 0 ? newMessages : undefined,
knowledgeData: knowledgeData || undefined,
personalRules: getActiveRules() || undefined,
};
// 追踪用户消息