feat: v1.1.0 — 上下文引擎重构 + 技能系统升级 + SOUL.md 支持

- 版本号更新: 1.0.0 → 1.1.0,全量同步 package.json/lock/README/docs/UI
- 上下文长度自动检测: 切换模型时从 model_info 读取实际 context_length
- SOUL.md 支持: 每次发送自动扫描工作空间 SOUL.md,注入为首条 system 消息且不可压缩
- 系统提示词卡片: AI 回复顶部可折叠展示实际发送给模型的完整 system prompt
- Token 校准: 利用 Ollama 返回的实际计数动态修正估算器(EMA)
- 消息重要性评分: 纯规则打分,trim/summarize 按重要性而非时间顺序
- 结构化压缩: LLM 压缩输出 JSON 格式(topics/decisions/pendingTasks/constraints)
- 技能系统 v1.1: 语义匹配(embedding) + 参数自优化 + 未使用衰减 + 技能链合并
- 修复: 100+ TypeScript strict 模式编译错误清零
This commit is contained in:
thzxx
2026-06-04 21:47:18 +08:00
parent b12837433b
commit db6cb8d2cc
27 changed files with 646 additions and 139 deletions
+4 -5
View File
@@ -100,8 +100,8 @@ async function migrateIndexedDBToSQLite(db: ChatDB): Promise<void> {
created_at: s.createdAt,
updated_at: s.updatedAt
})),
messages: sessions.flatMap(s =>
s.messages.map((m: Record<string, unknown>, idx: number) => ({
messages: (sessions as any[]).flatMap((s: any) =>
(s.messages || []).map((m: any, idx: number) => ({
id: `${s.id}_msg_${idx}_${m.timestamp}`,
session_id: s.id,
role: m.role,
@@ -120,7 +120,7 @@ async function migrateIndexedDBToSQLite(db: ChatDB): Promise<void> {
type: m.type,
content: m.content,
importance: m.importance || 5,
tags: m.tags?.length ? JSON.stringify(m.tags) : null,
tags: (m.tags as any[])?.length ? JSON.stringify(m.tags) : null,
source: m.source || null,
session_id: m.sessionId || null,
use_count: m.useCount || 0,
@@ -354,9 +354,8 @@ async function init(): Promise<void> {
state.set(KEYS.NUM_CTX, numCtx);
state.set('temperature', temperature);
(document.querySelector('#inputNumCtx') as HTMLInputElement).value = String(numCtx);
(document.querySelector('#inputTemperature') as HTMLInputElement).value = String(temperature);
document.querySelector('#tempValue')!.textContent = parseFloat(temperature).toFixed(1);
document.querySelector('#tempValue')!.textContent = parseFloat(String(temperature)).toFixed(1);
// ── v5.1.1 Agent 最大轮数 ──
const maxTurns = await db.getSetting('maxTurns', 85);