Releases: helloAping/P-chat
Releases · helloAping/P-chat
Release list
v1.0.10-release
Immutable
release. Only release title and notes can be modified.
feat:调整版本
v1.0.9-release
Immutable
release. Only release title and notes can be modified.
feat:调整版本
v1.0.8-release
Immutable
release. Only release title and notes can be modified.
feat:调整版本
v1.0.7-release
Immutable
release. Only release title and notes can be modified.
Fix tray close confirmation flow 将窗口关闭确认从 Wails 原生 MessageDialog 改为前端应用内弹窗,避免 OnBeforeClose 中同步弹窗导致确认后无法关闭。 本次提交新增 app:close-request 事件和 ConfirmWindowClose/CancelWindowClose 绑定,由前端勾选框决定收缩到托盘或直接退出;同时保留托盘可用性判断和退出路径的 server 清理。 纳入 docs/tray-residency-plan.md 作为托盘驻留落地计划文档。 验证: - go test -count=1 ./... - go test -count=1 . (cmd/pchat-gui) - npx vue-tsc -b - npm run build - task build:gui
v1.0.6.1-release
Immutable
release. Only release title and notes can be modified.
feat:调整版本
v1.0.6-release
Immutable
release. Only release title and notes can be modified.
feat:调整版本
v1.0.5-release
Immutable
release. Only release title and notes can be modified.
build: fix Compress-Archive file lock + add Linux/macOS GUI packaging…
1.0.4.1-release
Immutable
release. Only release title and notes can be modified.
feat:调整版本
v1.0.3-release
Immutable
release. Only release title and notes can be modified.
Feat 1.0.3 (#7)
* feat: Wiki/FTS5 knowledge base system refactoring
重构知识库系统:从向量嵌入迁移到 Wiki/FTS5 + 增量扫描 + LLM 总结 + 对话级 KB 选择器。
核心变更:
- 新增 WikiStore (SQLite FTS5): wiki_sections/wiki_fts/media_cache/file_mtimes 四表
- 新增 wiki_lookup/wiki_index/grep 工具,支持 base 参数 + resolveBases 多库选择
- 扫描管道:wikiScan (文本解析+LLM总结) + mediaScan (视觉模型媒体描述)
- SHA256 缓存避免重复 API 调用,mtime 比对实现增量扫描
- 对话级 KB 选择器:sessionMeta.KnowledgeBase → KBBase → 工具过滤+索引注入
- buildKBIndex 将 section 标题树注入 system prompt
- 前端知识库 Tab 单卡片布局 + InputArea KB 选择器
- 清理旧代码:embed_local/embed_openai/embedding/recall.go 等向量嵌入遗留
- 新增 .agents/docs/knowledge.md 模块文档
* fix: knowledge base system bug fixes and test coverage
Phase A — Critical Bug 修复:
- GetOrOpenWikiStore 单例 → sync.Map per-name 缓存(多 base 互不干扰)
- ReplaceBase DELETE FROM wiki_fts 限定 WHERE base=?(跨库误删修复)
- defer f.Close() 在 Walk 回调内 → 手动 Close()(文件句柄泄漏)
- startScanJob 静默写盘 → 仅内存临时生效
- wikiScan Walk 错误值丢弃 → 捕获并日志
Phase B — 正确性 & 边界情况:
- UpdateKnowledgeConfig bool 零值覆写 → KnowledgeConfigPatch 指针类型
- RemoveStaleSources 嵌套循环 → 子查询 batch delete
- buildKBIndex 60s TTL 缓存,Reload() 时失效
- wikiScan+mediaScan 三 Walk → 单 Walk 收集媒体文件
- ExcludePatterns 贯通 grep + scan
- wiki_parser 支持 H1/代码块/preamble
- FTS insert 显式设置 rowid
- ListBase('') 加 LIMIT 5000
Phase D — UX 打磨:
- KB 选择器 watch(kbConfigVersion) 自动刷新
- KB 删除加 NPopconfirm 确认弹窗
- ScanStatus 空闲时返回 wiki_store doc_count
- onBeforeUnmount 清理扫描轮询定时器
Phase C — 测试覆盖 (新增 45 项):
- wiki_store_test.go (18 tests) — SearchFTS/ReplaceBase/mtime/Index/Cache
- wiki_parser_test.go (11 tests) — H1/CJK/代码块/空输入
- wiki_test.go (9 tests) — lookup/index/resolveBases
- grep_test.go (7 tests) — walk/exclude/size/specific base
补充修复:
- ScanStatus/CancelScan 乱码消息纠正
- wikiIndexHandler json.Unmarshal 错误显式返回
- ftsSearch 空结果与 DB 错误分离
- migrateKnowledgeDefaults Initialized 标记防反复注入
- wiki_index 空索引 IsError:true → false
- wikiScan phase 2 Walk 返回值捕获
CLI:
- kb.go 从 stub → 对接 knowledge config + wiki store
* feat: knowledge base LLM indexing pipeline + PDF/Office support
T1-T2: HeadingNode tree parser (BuildHeadingTree, AggregatedContent, HasContent)
T3: LLM indexer pipeline (prompt + ParseIndexEntry + buildIndexEntry)
T4-T5: wikiScan rewrite + offline fallback removal
T6-T7: wiki_index/buildKBIndex hierarchy + keywords
T8-T9: frontend cards heading tag + scan button disabled on missing model
New files: knowledge/pdf.go, knowledge/office.go, knowledge/indexer.go, prompts/knowledge_indexer.md
CRUD: WikiStore GetSection/DeleteSection/InsertSection/UpdateSection, 5 new REST endpoints
Tests: 26 knowledge tests, 22/22 packages green
* feat: agent loop resilience — auto-compact, retry, token budget, graceful shutdown
Major improvements across four audit rounds:
Round 1 (KB): wiki_index query param + SearchFTS, frequency guard, WHEN/HOW/FLOW prompt
Round 2 (Shell): PowerShell bypass cmd /C + UTF-8, same-tool error counter
Round 3 (Loops): MaxRoundsDefault 30→300, auto-compact token-budget-driven, pre-limit warning,
API retry with backoff, tool result pruning, LimitsConfig, sub-agent auto-compact+
concurrency semaphore, model-specific context window
Round 4 (Safety): Tool Registry RWMutex, config hot-reload polling, graceful Shutdown,
shell output LimitReader 256KB, sub-agent+SSE panic recovery, SSE reconnect
New file: internal/llm/token_count.go (CJK+ASCII token estimator)
Deleted: prompts/knowledge_indexer.md (unused)
16 files changed, 817 insertions(+), 169 deletions(-)
* feat: message model v2 — msg_type/submit_to_llm, full parts snapshot, tool_id matching, question persist
Add msg_type (0-6) and submit_to_llm flags to ChatMessage and DB schema.
- Migrations v5 (add columns + index) and v6 (backfill from metadata.type)
- MsgType constants: text(0), image(1), video(2), audio(3), tool(4), command(5), question(6)
- MsgTypeForLegacy() maps old Type strings to new numeric enums
- submit_to_llm controls LLM context inclusion; exec_command output excluded
Parts accumulator overhaul:
- snapshotStructural() serializes full parts (text+thinking+tool+sub_agent)
- decodePartsFromMeta auto-detects new/old format with hasTextOrThinking()
- ToolID field on ChatStreamChunk and MessagePart for unique tool matching
- PartKind* numeric constants (0-4) with dual String/Int maps
Agent loop enhancements:
- persistQuestion/persistQuestionAnswer in agent.go for history reload
- ChatStreamChunk.ToolID on all tool lifecycle events (start/ok/warn/err)
- LLM filter replaced with SubmitToLLM check; tool results remapped to user role
Server/API changes:
- MessageResponse carries MsgType; StreamEvent carries tool_id
- mergeConsecutiveAssistant collapses multi-round ReAct into single bubble
- pairQuestionMessages merges q+a (both msg_type=6) into one card
- buildMessageResponse filters msg_type=4 (tool) and 5 (command)
- parseCommandFromToolInput extracts shell command for ExecOutputCard
Frontend:
- MessageBubble.vue dispatches by msg_type instead of role
- ExecOutputCard.vue — terminal panel for command output
- QuestionTable.vue — table card for question/answer pairs
- appendStreamEvent tool case uses tool_id-based matching
- MessagePart type includes tool_id + question kind
* feat: knowledge base three-level index (L1/L2/L3/contents) with ranked search
Schema: index_nodes + contents + index_fts (FTS5, triggers for level>=2)
- IndexNode (id, parent_id, base, level, source, kind, title, keywords, overview)
- ContentNode (id, node_id, content, content_type)
- FTS5 index_fts(title, keywords, overview) with INSERT/UPDATE/DELETE triggers
- Aux indexes: idx_nodes_parent, idx_nodes_level_base, idx_contents_node
Scan pipeline: indexScan() generates L1(root)/L2(file)/L3(section)/content(leaf)
- Phase 1: walk files, parse heading tree, generate L3 + content per heading
- Phase 2: aggregate L2 per file from L3 summaries
- Phase 3: build L1 overview (formatted list of all L2, 2000-char limit)
- Runs alongside old wikiScan (both tables coexist)
Tools refactored:
- wiki_lookup(query, base, expand, level, page, size) — unified search
* query=empty: browse L2 directory with pagination
* query=keyword: 5-strategy ranked search (title 1.0 > keywords 0.8 > overview 0.6 > L2 0.4 > content LIKE 0.2)
* expand=true: load content leaves for matched L3 nodes
* Default 20/page, max 50/page
- wiki_list(parent_id, page, size) — list children, default 50/page
- wiki_index removed (replaced by wiki_lookup + wiki_list)
Prompt injection: buildKBIndex() now reads GetL1Overview() (L1 node's overview field)
instead of listing all wiki_sections — reduces from thousands of lines to ~20 lines.
Migration: MigrateBaseToIndex() converts legacy wiki_sections ▸ index_nodes.
EnsureMigrated() called at startup, idempotent (skips when data exists).
Static prompt updated to describe wiki_lookup/wiki_list usage flow.
KB switch filters wiki_lookup+wiki_list (was wiki_lookup+wiki_index).
Tests: 9 new index store tests (search, keyword match, title match, expand,
pagination, list children, L1 overview, migration, empty search).
* fix(sandbox): fix confirm channel race, JSON parsing, and double API call
三处改动:
1. confirm.go — confirmChs 从 map[string]chan 改为 map[string][]chan FIFO 队列,多工具并发确认不再互相关闭 channel。
2. agent.go — exec_command 的 CheckExecDecision/MatchedPattern 先 json.Unmarshal 取出 command 字段再匹配,此前传入完整 JSON 导致 ^ 锚定正则失效。
3. chat.ts — pendingConfirm 从单对象改为数组支持排队,submitToolConfirm 移除冗余 API 调用(由 .then() 链触发)。
* feat: context window management + KB store cleanup
两大部分改动:
1. LLM 上下文窗口管理:
- contextLevelLimit() 从硬编码 50 消息改为按模型上下文窗口动态计算
- SendMessage 路径移除消息数封顶,GetChatMessagesFor(0) 全量加载
- Memory.MaxHistory 从 50 改为 0(无限制 DB 保留)
- auto-compaction 触发阈值改用 config 配置,支持 tryAutoCompact 失败后 fallback hard truncation
- 首轮 LLM 后 stripImageContent 移除 base64 数据节省 token
- pruneOldToolResults 读取 config.PruneAfterRounds 代替硬编码 15
- 新增 /api/v1/config GET/PATCH 系统配置接口 + 前端「系统配置」tab
- Concurrent send 保护:sessionLocks sync.Map → 409 拒绝
2. 知识库存储清理:
- 移除 FTS5 全文索引表(wiki_sections)
- 简化 wiki_store 为纯 title + content 存储
- 精简 wiki_parser、knowledge_api、CLI /kb 命令
- 更新知识库模块文档
* feat:调整版本
v1.0.2-release
Immutable
release. Only release title and notes can be modified.
feat:调整版本