Commit Graph
990 Commits
Author SHA1 Message Date
LeoandAgent Memory OS 674fc2af2a fix(charts): improve ranking labels and emoji cleanup (#225)
Co-authored-by: Agent Memory OS <jxy0811@users.noreply.github.com>
2026-06-15 10:42:01 +08:00
digua fd55e85d05 release: v0.26.3 v0.26.3 2026-06-15 10:14:09 +08:00
LeoandAgent Memory OS 208a125c48 fix(analysis): filter reply placeholders from catchphrases (#223)
Co-authored-by: Agent Memory OS <jxy0811@users.noreply.github.com>
2026-06-15 10:02:26 +08:00
Agent Memory OS ec2bb3d54b fix(wordcloud): filter media placeholders from text 2026-06-14 23:59:54 +08:00
diguaandClaude Sonnet 4.6 72f911a1cb fix(analytics): invalidate language-preference cache when Jieba dict changes
The language-preference endpoint calls createJiebaNlpProvider() which
uses the on-disk zh-CN dict. If the result was cached before the dict
was downloaded, the built-in fallback tokenization was served even after
the dict became available, until a DB write invalidated the cache.

Include the zh-CN dict file mtime/size as extraVersion in the cache
version so the entry is recomputed whenever the dict is added, replaced,
or deleted — consistent with the word-frequency fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 23:54:12 +08:00
diguaandClaude Sonnet 4.6 da2c48c801 fix(nlp): invalidate word-frequency cache when Jieba dict changes
When no dict was downloaded, word-frequency results were computed with
the built-in tokenizer and cached. Downloading a dict cleared the in-
memory Jieba instance but left the cached result unchanged, so subsequent
requests returned the lower-quality built-in tokenization until the chat
DB was modified.

Add an extraVersion option to withAnalyticsCache and pass the dict file's
mtime/size as extraVersion for word-frequency requests so the cache is
invalidated whenever the dict file is added, replaced, or deleted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 23:54:12 +08:00
diguaandClaude Sonnet 4.6 8a1ed8005c fix(analytics): invalidate time-sensitive cache entries daily
getDivingAnalysis and getNightOwlAnalysis derive values from the current
date (daysSinceLastMessage, currentStreak) that change even when the DB
file is untouched. Without a date component in the cache version, stale
results were returned until the next import or DB write.

Add a dailyInvalidate option to withAnalyticsCache that appends today's
date to the version string, and enable it for the diving and night-owl
endpoints.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 23:54:12 +08:00
digua 77c5718b44 docs: update frontend architecture paths 2026-06-14 23:54:12 +08:00
diguaandCursor cc4e67bd24 refactor(data): remove pluginCompute plugin-compute path
图表已统一走缓存端点,pluginCompute 不再被任何调用方使用,移除其全链路实现。
pluginQuery 保留供消息浏览/搜索/分页与 session-index 等通用 SQL 访问。

- 删除 ElectronDataAdapter(已无覆写),electron registry 直接使用 FetchDataAdapter
- 移除 IPC handler、preload API/类型、worker dispatch 与 workerManager 导出中的 pluginCompute

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 93608fa5eb refactor(analysis): migrate chart views to components/analysis on cached data layer
把 src/features 下的图表视图全部迁到 src/components/analysis(message/ranking/relationships),
数据访问统一改为 useDataService().getXxx() 走缓存端点,删除前端 pluginQuery/pluginCompute
图表查询与重复的分析类型定义,最终清空并移除 src/features。

- 视图迁移:message/ranking(含 sections、charts)/relationships(cluster、interaction)
- 数据层:fetch.ts/types.ts 新增 adapter 方法并移除 pluginCompute;类型统一到 @openchatlab/core
- 调用方更新:group/private ViewTab、GroupRelationships、HotRepeatTab import 与查询

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 99ed14f8a5 refactor(analysis): add cached analytics endpoints for message & ranking charts
将 charts-message 的文字统计/长消息/月度趋势/文本长度百分位,以及 charts-ranking
的龙王/潜水/打卡/斗图/夜猫/复读六项分析从前端 pluginQuery+pluginCompute 移植到
@openchatlab/core,并通过 analytics 缓存路由暴露,消除前端拉全量数据再计算的开销。

- core: 新增 basic-queries 文本统计函数与 advanced/ranking.ts 六项分析及类型,含单测
- http-routes: 新增对应缓存路由,long-message-count 的 minLength 进缓存 key

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 8192a43a41 refactor(electron): unify worker analytics cache onto file-version invalidation
The desktop worker kept a second analytics result cache in the same
cacheDir/query directory but invalidated it with a fragile scheme:
app-version .cache_version file, a dev-startup wipe, and explicit
invalidateAnalysisCache() calls after import. Replace it with the shared
getOrComputeAnalysisCache, fingerprinting entries by product version plus
the session DB file state, so the worker (still used by AI tools and the
desktop public REST API) and the shared HTTP routes share one cache and
one invalidation model. Fold the product version into the HTTP-route
fingerprint too, preserving the cross-release invalidation that
.cache_version used to provide, and drop the now-dead invalidation code.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor e87b359d23 perf(analysis): cache analytics results on disk keyed by db file version
Repeatedly switching time filters recomputed expensive analytics/NLP
queries from scratch (e.g. a 1-year word cloud took 10s+ after a detour
through 5-year), because cancelling the network request cannot stop the
synchronous server-side computation. Add a shared, platform-agnostic
disk cache under cacheDir/query, validated by a fingerprint derived from
the session DB file (mtime+size of the main file and its -wal sidecar) so
any import, incremental import or member edit transparently invalidates
it. Wire it through the shared HTTP routes (word-frequency plus all
analytics endpoints), so CLI Web and the desktop internal server share
one implementation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 22df3bc6fe perf(analysis): cancel stale analytics requests on filter/session change
Switching the time filter or active session while analytics requests are
in flight left obsolete requests pending, exhausting the browser's
per-origin connection budget and letting stale responses overwrite fresh
data. Introduce an AbortController-backed analytics request epoch
(analyticsGet/analyticsPost) that is reset whenever the filter or session
changes, silencing AbortError so cancelled requests never settle the UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 3bcdd3a2d4 perf(nlp): avoid re-segmentation when switching wordcloud word count
Switching the word count (80/100/150/200/300) in Insights > Topics >
Wordcloud re-ran a full-corpus jieba segmentation on the Electron main
thread, since topN only affects the final slice while the segmentation
cost is independent of it. This blocked the main process and froze the UI.

- Frontend: fetch the full word list once (max tier) and slice locally on
  word-count change, recomputing percentages over the displayed subset.
  Word-count switching no longer hits the backend or triggers segmentation.
- Backend: for Chinese meaningful/custom mode, produce word frequency and
  POS-tag stats in a single jieba.tag pass instead of two, halving CPU for
  genuine recomputes (filter/time/member changes). Behavior is preserved
  (verified by an equivalence regression test).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 9fbabd02b6 fix(electron): pre-bundle lazy-route deps to avoid dev 504
Analysis pages (private/group chat) are lazy-loaded routes that pull in
heavy deps (echarts, markdown-it, snapdom, vue-virtual, etc.) which Vite's
cold-start scan does not discover. The first navigation triggered an
in-flight dependency re-optimization, invalidating already-loaded chunks
and failing with 504 (Outdated Optimize Dep) on the dynamically imported
page module. This surfaced after a fresh pnpm install wiped the warm
node_modules/.vite cache.

Add optimizeDeps.include so the initial optimize pass already contains
these deps, preventing mid-session re-optimization and the 504.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 3cd0d0f680 refactor(records): rename timeline panel label to summary
将聊天记录查看器左侧面板标题及空状态由「会话」统一改为「摘要」,
同步更新 zh-CN/zh-TW/en-US/ja-JP 四种语言。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor 7a7a322496 fix(records): restore timeline default scroll and session jump (resolve #199)
时间线左侧面板在 isLoading 为 true 时调用滚动,此时虚拟滚动容器(v-else)尚未挂载,
getScrollElement 返回 null 导致滚动失效,左侧停留在最早会话,与右侧消息列表展示最新内容不一致。
现将滚动移到加载完成后执行,并优先滚动到当前激活会话。

同时 FetchSessionIndexAdapter 的 getSessions/getByTimeRange/getRecent 查询漏掉 firstMessageId,
导致点击左侧会话无法跳转到对应消息(桌面端与 CLI Web 共用该 adapter,两端均受影响)。
补回与 core getChatSessionList 一致的 firstMessageId 子查询,并新增内存 SQLite 回归测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
digua 615c0191b8 fix(database): repair missing segment message contexts 2026-06-14 23:54:12 +08:00
diguaandCursor 7afb31e679 fix(data): populate aiConversationCount from conversations.db instead of returning 0
The /_web/sessions route never called getAIChatCountsBySession() to
enrich session DTOs, leaving aiConversationCount always 0 in the
data management UI. Use the existing enrichSession callback and
AIChatManager to fill real counts for both list and detail endpoints.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
diguaandCursor d90a6e4bf7 ci: add R2 cleanup workflow to remove old release versions
Keep only the latest 3 versions in Cloudflare R2 to stay within
storage limits. Triggered automatically after each stable release
and manually via workflow_dispatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 16:24:53 +08:00
diguaandClaude Sonnet 4.6 c80ee8b8ec fix(cli): sync cli package version with product version to stop false update notice
In CLI Web mode, the frontend displays __APP_VERSION__ injected from the
root package.json at build time (0.26.2), while the server-side getVersion()
reads apps/cli/package.json at runtime (stuck at 0.25.1). This caused
buildWebUpdateCheckResult to compare remote 0.26.2 against local 0.25.1,
permanently reporting a false update notice even when the user was already
on the latest version.

Fix apps/cli/package.json to 0.26.2 to align with the product version.

Also extend set_release_version.sh to keep apps/cli/package.json in sync
with the root package.json on every release, preventing the drift from
recurring. apps/desktop/package.json is intentionally kept at 0.0.0 (the
desktop runtime uses app.getVersion() with __APP_VERSION__ fallback).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 16:24:53 +08:00
diguaandClaude Sonnet 4.6 674db15b69 feat(web): add favicon for CLI Web
Copy favicon.ico from chatlab.fun and serve it via Vite's publicDir
(src/public/). Update index.html to reference the standard /favicon.ico
path; the previous /assets/imgs/favicon.ico path had no backing file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 16:24:53 +08:00
diguaandCursor f56b2b79d6 fix(home): update tutorial link to docs.chatlab.fun root with locale path
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 16:24:53 +08:00
diguaandCursor e6d67afdad fix(ai,cli): remove top capture button from AI chat and support arrow key selection in CLI update prompt
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 16:24:53 +08:00
digua 40a4357ff7 release: v0.26.2 v0.26.2 2026-06-13 13:24:04 +08:00
diguaandClaude Sonnet 4.6 968cb39e87 fix(cli): invalidate preferences cache before applying owner profile on sync
The sync module creates its own PreferencesManager at server startup,
separate from the one shared by web routes. When the user configures their
identity through the web UI, the web routes' manager writes to disk and
updates its own cache, but the sync module's manager retains a stale cache
from startup. Subsequent pull imports then call tryApplyOwnerProfile with
the stale cache, returning no_profile and skipping owner assignment even
though a profile exists on disk.

Fix: invalidate the sync manager's cache before each onSessionImported
callback so the fresh profile is always read from disk.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 13:16:52 +08:00
diguaandClaude Sonnet 4.6 68cc5ffcee fix(owner): correct per-session ownerId cache and share one PreferencesManager
On name-match platforms (WhatsApp/Line/Instagram), applyProfileToOtherSessions
writes the local member's platformId to each session, which can differ from the
source ownerId. The session store was caching the source ownerId for all updated
sessions, causing owner display misalignment before a full reload.

Fix: applyProfileToOtherSessions now returns {id, ownerId}[] so the service can
expose updatedSessionOwnerIds in the result; the store uses that map instead of
the single source ownerId.

Also fix a stale-cache issue: registerSessionRoutes and registerPreferencesRoutes
each created their own PreferencesManager when ctx.preferencesManager was absent
(CLI and Electron both omit it). Two independent caches caused a later PATCH to
preferences to deep-merge against stale data and overwrite ownerProfilesByPlatform
back to its pre-selection value. registerSharedRoutes now creates one shared
instance and passes it to all routes via resolvedCtx.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 13:16:52 +08:00
diguaandClaude Fable 5 82ce9dcc2f feat(owner): auto-apply owner profile after pull sync and CLI import
PullEngine gains an onSessionImported hook (hook errors never fail the
pull), wired in both the CLI server and Electron main to silently fill
session owner from the stored platform profile. The chatlab import CLI
command does the same after a successful import.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 13:16:52 +08:00
diguaandClaude Fable 5 502762bcf5 feat(owner): add owner prompt modal and unify owner selection UI
Opening an unowned session first tries to auto-apply the platform
owner profile; only when that fails (and the session is not dismissed)
a lightweight searchable prompt pops up with Later / Don't remind /
Save actions. Member management now uses an entry card opening the
same modal, replacing the embedded OwnerSelector dropdown. Imports in
the session store silently retry profile application per session.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 13:16:52 +08:00
diguaandClaude Fable 5 a75d17e310 feat(owner): add owner profile service and shared web routes
Shared node-runtime service writes session owner, maintains the
per-platform profile in preferences.json, and batch-applies it to
other unowned same-platform sessions (unique match only, never
overriding an existing owner). Exposed via /_web/sessions/:id/owner/
{apply-profile,select,dismiss-prompt} for both Electron and CLI Web.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 13:16:52 +08:00
diguaandClaude Fable 5 7589515eeb feat(owner): add platform-level owner profile types and matching
Add deterministic owner matching in core (exact platformId first, then
normalized-name fallback limited to whatsapp/line/instagram), plus
OwnerProfile preferences fields shared across Electron and CLI Web.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 13:16:52 +08:00
digua 82a6be4fcb fix(sync): delete imported session files completely 2026-06-13 13:16:52 +08:00
digua 848a44310c fix(ai): preserve render chart order 2026-06-11 22:35:07 +08:00
digua 3725a5bbea fix(ai): remove empty render-only chart rows 2026-06-12 11:36:46 +08:00
digua fc2ecf7b27 fix(capture): resize charts before screenshots 2026-06-12 11:36:46 +08:00
digua 56693685fa fix(ai): stabilize chart rendering during streaming 2026-06-12 11:36:46 +08:00
digua eea7ed88b9 fix(ai): show chart generation progress 2026-06-12 11:36:46 +08:00
diguaandClaude Opus 4.8 bd1bc037b3 fix(ai): clarify last_message_time is data coverage end, not group activity time
AI was treating last_message_time as "when the group last had activity"
and drawing inferences like "the group has been quiet for two months,
maybe send a message to revive it." In reality, the timestamp only
reflects the end of imported data — the user may simply not have
imported newer records yet.

Add an inline parenthetical to the last_message_time field in all four
locale templates, and append a dedicated usage rule in
dataSnapshotUsageRules (zh-CN, en-US, zh-TW, ja-JP) explicitly
prohibiting inferences about group inactivity based on this value.
Also add the same note to formatDataSnapshotForPlanner's notes section
in data-snapshot.ts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 11:36:46 +08:00
diguaandClaude Opus 4.8 7316a09823 fix(ai): fix stale overview and analysis caches after incremental import
Overview cache had no self-invalidation: once written it would return
stale lastMessageTs forever if the postImportHook failed silently.
Analysis query cache (17 chart/stats queries) was never cleared on
import, so charts showed stale data until the user triggered a manual
invalidate.

Add MAX(message.id) fingerprint to OverviewCache and introduce
getValidatedOverviewCache(), which recomputes automatically when new
messages are inserted. Update resolveOverview() in the Electron worker
to use this instead of bare getCache().

In both postImportHooks (incrementalImport, streamImport) also call
deleteSessionCache against the query cache directory so chart data is
fresh after every import.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 11:36:46 +08:00
digua ce5e6c2d4a release: v0.26.1 v0.26.1 2026-06-10 22:28:51 +08:00
diguaandClaude Sonnet 4.6 76acbabcc2 fix(ai): preserve tool-only turns in history replay and fix export regressions
- Include assistant messages with tool content blocks in getHistoryForAgent
  even when text content is empty, so multi-turn tool results are not lost
- Append Date.now() timestamp to export filenames to prevent silent overwrites
- Pass 600s timeout to exportFilterResultToFile worker call to match the
  actual upper bound of large-session exports

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 22:18:20 +08:00
diguaandCursor 39700b95b7 feat(ai): display cache hit/miss token usage in chat status bar
Extend TokenUsage types across the full data pipeline to include
cacheReadTokens and cacheWriteTokens. The ChatStatusBar tooltip now
shows cache hit information when available. This is a generic
implementation that works with any API provider reporting cache metrics,
not limited to DeepSeek.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 22:18:20 +08:00
diguaandCursor 2b6aed52c9 fix(ai): replay reasoning_content for DeepSeek tool-call turns
DeepSeek API requires reasoning_content to be retransmitted on assistant
messages that precede tool results. Add ReplayOptions to history replay
so thinking blocks are included as ThinkingContent when the model uses
DeepSeek-format thinking, preventing 400 errors in multi-turn tool-call
conversations.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 22:18:20 +08:00
digua 42649d835d fix(ai): count replayed tool results in compression token accounting 2026-06-10 22:18:20 +08:00
diguaandClaude Fable 5 9c7778f7e3 fix(ai): keep rawMessages out of LLM-facing tool result text
Message-retrieval tools mirror rawMessages inside data, and the
preprocessing pipeline rendered that array into the tool result text as
"rawMessages: [object Object], [object Object], ..." — roughly 1.7KB of
junk per call (~400-500 wasted tokens) that also polluted the truncated
result text persisted for history replay.

- formatToolResultAsText skips the rawMessages key (raw message objects
  are already rendered via the formatted messages list)
- CLI tool adapter strips rawMessages from extraDetails before invoking
  the pipeline, matching the existing desktop adapter behavior

Regression tests fail without the fix at both the format layer and the
CLI adapter layer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 22:18:20 +08:00
diguaandClaude Fable 5 ad96dca7ac fix(ai): persist and replay tool calls in chat history
Multi-turn agent conversations rebuilt history as plain text, dropping
all tool calls and results. Later turns could not see what the model
had actually retrieved, so it imitated tool-free answers and
hallucinated chat records instead of re-querying (worse after
incremental imports and in long conversations).

- Persist provider-issued toolCallId, truncated result text and isError
  on tool content blocks (written by the shared frontend store from
  stream chunks; pi-agent-core events already carry these fields)
- Replay persisted tool blocks as real toolCall/toolResult message
  pairs in toPiHistoryMessages: stable ids keep requests byte-identical
  across turns (prompt cache friendly), unfinished blocks are skipped
  so no toolCall is left unanswered, errors map to isError, results are
  capped at 4000 chars, runtime-injected underscore params are stripped
- Legacy messages without persisted tool data fall back to the old
  plain-text replay; no migration needed

Verified on a real CLI web session: 25+ replayed tool pairs accepted by
the provider across turns with zero API errors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 22:18:20 +08:00
digua 6ec736c05a feat(export): simplify message export and support multiple formats 2026-06-10 22:18:20 +08:00
digua 4f1aac55b6 refactor(layout): share session page header 2026-06-10 22:18:20 +08:00
digua bbcc350d97 fix(layout): close tools panel on outside click 2026-06-10 22:18:20 +08:00