mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-04-11 15:08:34 +00:00
Compare commits
24 Commits
dependabot
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bec4f3cd6 | ||
|
|
726edfa850 | ||
|
|
ff33242887 | ||
|
|
56b767ff46 | ||
|
|
102eb14b0b | ||
|
|
e57b9d07f1 | ||
|
|
3be90d00e5 | ||
|
|
efb5cd3586 | ||
|
|
86b1043134 | ||
|
|
36bed846b2 | ||
|
|
9d3d38fa7e | ||
|
|
ddf6b63aec | ||
|
|
079779c2c6 | ||
|
|
afa8bb5fe0 | ||
|
|
127668ae22 | ||
|
|
b00264d060 | ||
|
|
2e135587d4 | ||
|
|
571bffa923 | ||
|
|
bc355d43a0 | ||
|
|
e2a207be92 | ||
|
|
397cc888db | ||
|
|
22a2616534 | ||
|
|
657e8015b2 | ||
|
|
d96000f0d9 |
66
.github/workflows/dev-daily-fixed.yml
vendored
66
.github/workflows/dev-daily-fixed.yml
vendored
@@ -60,7 +60,23 @@ jobs:
|
||||
fi
|
||||
gh release create "$FIXED_DEV_TAG" --repo "$GITHUB_REPOSITORY" --title "Daily Dev Build" --notes "开发版发布页" --prerelease --target "$TARGET_BRANCH"
|
||||
RELEASE_REST_ID="$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$FIXED_DEV_TAG" --jq '.id')"
|
||||
gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_REST_ID" -f draft=false -f prerelease=true >/dev/null
|
||||
RELEASE_ENDPOINT="repos/$GITHUB_REPOSITORY/releases/tags/$FIXED_DEV_TAG"
|
||||
settled="false"
|
||||
for i in 1 2 3 4 5; do
|
||||
gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_REST_ID" -F draft=false -F prerelease=true >/dev/null 2>&1 || true
|
||||
DRAFT_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.draft' 2>/dev/null || echo true)"
|
||||
PRERELEASE_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.prerelease' 2>/dev/null || echo false)"
|
||||
if [ "$DRAFT_STATE" = "false" ] && [ "$PRERELEASE_STATE" = "true" ]; then
|
||||
settled="true"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
if [ "$settled" != "true" ]; then
|
||||
echo "Failed to settle release state after create:"
|
||||
gh api "$RELEASE_ENDPOINT" --jq '{draft: .draft, prerelease: .prerelease, url: .html_url}'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dev-mac-arm64:
|
||||
needs: prepare
|
||||
@@ -81,6 +97,22 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Ensure mac key helpers are executable
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for file in \
|
||||
resources/key/macos/universal/xkey_helper \
|
||||
resources/key/macos/universal/image_scan_helper \
|
||||
resources/key/macos/universal/xkey_helper_macos \
|
||||
resources/key/macos/universal/libwx_key.dylib
|
||||
do
|
||||
if [ -f "$file" ]; then
|
||||
chmod +x "$file"
|
||||
ls -l "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Set dev version
|
||||
shell: bash
|
||||
run: npm version "${{ needs.prepare.outputs.dev_version }}" --no-git-tag-version --allow-same-version
|
||||
@@ -270,21 +302,25 @@ jobs:
|
||||
- name: Update fixed dev release notes
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
FIXED_DEV_TAG: ${{ env.FIXED_DEV_TAG }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
TAG="$FIXED_DEV_TAG"
|
||||
TAG="${FIXED_DEV_TAG:-}"
|
||||
if [ -z "$TAG" ]; then
|
||||
echo "FIXED_DEV_TAG is empty, abort."
|
||||
exit 1
|
||||
fi
|
||||
REPO="$GITHUB_REPOSITORY"
|
||||
RELEASE_PAGE="https://github.com/$REPO/releases/tag/$TAG"
|
||||
echo "Using release tag: $TAG"
|
||||
|
||||
if ! gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then
|
||||
if ! gh api "repos/$REPO/releases/tags/$TAG" >/dev/null 2>&1; then
|
||||
echo "Release $TAG not found, skip notes update."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ASSETS_JSON="$(gh release view "$TAG" --repo "$REPO" --json assets)"
|
||||
ASSETS_JSON="$(gh api "repos/$REPO/releases/tags/$TAG")"
|
||||
|
||||
pick_asset() {
|
||||
local pattern="$1"
|
||||
@@ -350,4 +386,22 @@ jobs:
|
||||
}
|
||||
|
||||
update_release_notes
|
||||
gh release view "$TAG" --repo "$REPO" --json isDraft,isPrerelease,url
|
||||
RELEASE_REST_ID="$(gh api "repos/$REPO/releases/tags/$TAG" --jq '.id')"
|
||||
RELEASE_ENDPOINT="repos/$REPO/releases/tags/$TAG"
|
||||
settled="false"
|
||||
for i in 1 2 3 4 5; do
|
||||
gh api --method PATCH "repos/$REPO/releases/$RELEASE_REST_ID" -F draft=false -F prerelease=true >/dev/null 2>&1 || true
|
||||
DRAFT_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.draft' 2>/dev/null || echo true)"
|
||||
PRERELEASE_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.prerelease' 2>/dev/null || echo false)"
|
||||
if [ "$DRAFT_STATE" = "false" ] && [ "$PRERELEASE_STATE" = "true" ]; then
|
||||
settled="true"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
if [ "$settled" != "true" ]; then
|
||||
echo "Failed to settle release state after notes update:"
|
||||
gh api "$RELEASE_ENDPOINT" --jq '{draft: .draft, prerelease: .prerelease, url: .html_url}'
|
||||
exit 1
|
||||
fi
|
||||
gh api "repos/$REPO/releases/tags/$TAG" --jq '{isDraft: .draft, isPrerelease: .prerelease, url: .html_url}'
|
||||
|
||||
65
.github/workflows/preview-nightly-main.yml
vendored
65
.github/workflows/preview-nightly-main.yml
vendored
@@ -86,7 +86,23 @@ jobs:
|
||||
fi
|
||||
gh release create "$FIXED_PREVIEW_TAG" --repo "$GITHUB_REPOSITORY" --title "Preview Nightly Build" --notes "预览版发布页" --prerelease --target "$TARGET_BRANCH"
|
||||
RELEASE_REST_ID="$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$FIXED_PREVIEW_TAG" --jq '.id')"
|
||||
gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_REST_ID" -f draft=false -f prerelease=true >/dev/null
|
||||
RELEASE_ENDPOINT="repos/$GITHUB_REPOSITORY/releases/tags/$FIXED_PREVIEW_TAG"
|
||||
settled="false"
|
||||
for i in 1 2 3 4 5; do
|
||||
gh api --method PATCH "repos/$GITHUB_REPOSITORY/releases/$RELEASE_REST_ID" -F draft=false -F prerelease=true >/dev/null 2>&1 || true
|
||||
DRAFT_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.draft' 2>/dev/null || echo true)"
|
||||
PRERELEASE_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.prerelease' 2>/dev/null || echo false)"
|
||||
if [ "$DRAFT_STATE" = "false" ] && [ "$PRERELEASE_STATE" = "true" ]; then
|
||||
settled="true"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
if [ "$settled" != "true" ]; then
|
||||
echo "Failed to settle release state after create:"
|
||||
gh api "$RELEASE_ENDPOINT" --jq '{draft: .draft, prerelease: .prerelease, url: .html_url}'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
preview-mac-arm64:
|
||||
needs: prepare
|
||||
@@ -108,6 +124,22 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Ensure mac key helpers are executable
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for file in \
|
||||
resources/key/macos/universal/xkey_helper \
|
||||
resources/key/macos/universal/image_scan_helper \
|
||||
resources/key/macos/universal/xkey_helper_macos \
|
||||
resources/key/macos/universal/libwx_key.dylib
|
||||
do
|
||||
if [ -f "$file" ]; then
|
||||
chmod +x "$file"
|
||||
ls -l "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Set preview version
|
||||
shell: bash
|
||||
run: npm version "${{ needs.prepare.outputs.preview_version }}" --no-git-tag-version --allow-same-version
|
||||
@@ -315,17 +347,22 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
TAG="$FIXED_PREVIEW_TAG"
|
||||
TAG="${FIXED_PREVIEW_TAG:-}"
|
||||
if [ -z "$TAG" ]; then
|
||||
echo "FIXED_PREVIEW_TAG is empty, abort."
|
||||
exit 1
|
||||
fi
|
||||
CURRENT_PREVIEW_VERSION="${{ needs.prepare.outputs.preview_version }}"
|
||||
REPO="$GITHUB_REPOSITORY"
|
||||
RELEASE_PAGE="https://github.com/$REPO/releases/tag/$TAG"
|
||||
echo "Using release tag: $TAG"
|
||||
|
||||
if ! gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then
|
||||
if ! gh api "repos/$REPO/releases/tags/$TAG" >/dev/null 2>&1; then
|
||||
echo "Release $TAG not found (possibly all publish jobs failed), skip notes update."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ASSETS_JSON="$(gh release view "$TAG" --repo "$REPO" --json assets)"
|
||||
ASSETS_JSON="$(gh api "repos/$REPO/releases/tags/$TAG")"
|
||||
|
||||
pick_asset() {
|
||||
local pattern="$1"
|
||||
@@ -392,4 +429,22 @@ jobs:
|
||||
}
|
||||
|
||||
update_release_notes
|
||||
gh release view "$TAG" --repo "$REPO" --json isDraft,isPrerelease,url
|
||||
RELEASE_REST_ID="$(gh api "repos/$REPO/releases/tags/$TAG" --jq '.id')"
|
||||
RELEASE_ENDPOINT="repos/$REPO/releases/tags/$TAG"
|
||||
settled="false"
|
||||
for i in 1 2 3 4 5; do
|
||||
gh api --method PATCH "repos/$REPO/releases/$RELEASE_REST_ID" -F draft=false -F prerelease=true >/dev/null 2>&1 || true
|
||||
DRAFT_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.draft' 2>/dev/null || echo true)"
|
||||
PRERELEASE_STATE="$(gh api "$RELEASE_ENDPOINT" --jq '.prerelease' 2>/dev/null || echo false)"
|
||||
if [ "$DRAFT_STATE" = "false" ] && [ "$PRERELEASE_STATE" = "true" ]; then
|
||||
settled="true"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
if [ "$settled" != "true" ]; then
|
||||
echo "Failed to settle release state after notes update:"
|
||||
gh api "$RELEASE_ENDPOINT" --jq '{draft: .draft, prerelease: .prerelease, url: .html_url}'
|
||||
exit 1
|
||||
fi
|
||||
gh api "repos/$REPO/releases/tags/$TAG" --jq '{isDraft: .draft, isPrerelease: .prerelease, url: .html_url}'
|
||||
|
||||
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -31,6 +31,22 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Ensure mac key helpers are executable
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for file in \
|
||||
resources/key/macos/universal/xkey_helper \
|
||||
resources/key/macos/universal/image_scan_helper \
|
||||
resources/key/macos/universal/xkey_helper_macos \
|
||||
resources/key/macos/universal/libwx_key.dylib
|
||||
do
|
||||
if [ -f "$file" ]; then
|
||||
chmod +x "$file"
|
||||
ls -l "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Sync version with tag
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
51
README.md
51
README.md
@@ -1,34 +1,23 @@
|
||||
# WeFlow
|
||||
|
||||
WeFlow 是一个**完全本地**的微信**实时**聊天记录查看、分析与导出工具。它可以实时获取你的微信聊天记录并将其导出,还可以根据你的聊天记录为你生成独一无二的分析报告
|
||||
|
||||
---
|
||||
WeFlow 是一个**完全本地**的微信**实时**聊天记录查看、分析与导出工具。它可以实时获取你的微信聊天记录并将其导出,还可以根据你的聊天记录为你生成独一无二的分析报告。
|
||||
|
||||
<p align="center">
|
||||
<img src="app.png" alt="WeFlow" width="90%">
|
||||
<img src="app.png" alt="WeFlow 应用预览" width="90%">
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/hicccc77/WeFlow/stargazers">
|
||||
<img src="https://img.shields.io/github/stars/hicccc77/WeFlow?style=flat-square" alt="Stargazers">
|
||||
</a>
|
||||
<a href="https://github.com/hicccc77/WeFlow/network/members">
|
||||
<img src="https://img.shields.io/github/forks/hicccc77/WeFlow?style=flat-square" alt="Forks">
|
||||
</a>
|
||||
<a href="https://github.com/hicccc77/WeFlow/issues">
|
||||
<img src="https://img.shields.io/github/issues/hicccc77/WeFlow?style=flat-square" alt="Issues">
|
||||
</a>
|
||||
<a href="https://github.com/hicccc77/WeFlow/releases">
|
||||
<img src="https://img.shields.io/github/downloads/hicccc77/WeFlow/total?style=flat-square" alt="Downloads" />
|
||||
</a>
|
||||
<a href="https://t.me/weflow_cc">
|
||||
<img src="https://img.shields.io/badge/Telegram%20频道-0088cc?style=flat-square&logo=telegram&logoColor=0088cc&labelColor=white" alt="Telegram">
|
||||
</a>
|
||||
<!-- 第一行修复样式 -->
|
||||
<a href="https://github.com/hicccc77/WeFlow/stargazers"><img src="https://img.shields.io/github/stars/hicccc77/WeFlow?style=flat&label=Stars&labelColor=1F2937&color=2563EB" alt="Stargazers"></a>
|
||||
<a href="https://github.com/hicccc77/WeFlow/network/members"><img src="https://img.shields.io/github/forks/hicccc77/WeFlow?style=flat&label=Forks&labelColor=1F2937&color=7C3AED" alt="Forks"></a>
|
||||
<a href="https://github.com/hicccc77/WeFlow/issues"><img src="https://img.shields.io/github/issues/hicccc77/WeFlow?style=flat&label=Issues&labelColor=1F2937&color=D97706" alt="Issues"></a>
|
||||
<a href="https://github.com/hicccc77/WeFlow/releases"><img src="https://img.shields.io/github/downloads/hicccc77/WeFlow/total?style=flat&label=Downloads&labelColor=1F2937&color=059669" alt="Downloads"></a>
|
||||
<br><br>
|
||||
<!-- 第二行:电报矮一点(22px),排名高一点(32px),使用 vertical-align: middle 居中对齐 -->
|
||||
<a href="https://t.me/weflow_cc"><img src="https://img.shields.io/badge/Telegram-频道-1D9BF0?style=flat&logo=telegram&logoColor=white&labelColor=1F2937&color=1D9BF0" alt="Telegram Channel" style="height: 22px; vertical-align: middle;"></a>
|
||||
<a href="https://www.star-history.com/hicccc77/weflow"><img src="https://api.star-history.com/badge?repo=hicccc77/WeFlow&theme=dark" alt="Star History Rank" style="height: 32px; vertical-align: middle;"></a>
|
||||
</p>
|
||||
|
||||
|
||||
> [!TIP]
|
||||
> 如果导出聊天记录后,想深入分析聊天内容可以试试 [ChatLab](https://chatlab.fun/)
|
||||
|
||||
@@ -47,14 +36,12 @@ WeFlow 是一个**完全本地**的微信**实时**聊天记录查看、分析
|
||||
|
||||
## 支持平台与设备
|
||||
|
||||
|
||||
| 平台 | 设备/架构 | 安装包 |
|
||||
|------|----------|--------|
|
||||
| Windows | Windows10+、x64(amd64) | `.exe` |
|
||||
| macOS | Apple Silicon(M 系列,arm64) | `.dmg` |
|
||||
| Linux | x64 设备(amd64) | `.AppImage`、`.tar.gz` |
|
||||
|
||||
|
||||
## 快速开始
|
||||
|
||||
若你只想使用成品版本,可前往 [Releases](https://github.com/hicccc77/WeFlow/releases) 下载并安装。
|
||||
@@ -93,7 +80,6 @@ WeFlow 提供本地 HTTP API 服务,支持通过接口查询消息数据,可
|
||||
|
||||
完整接口文档:[点击查看](docs/HTTP-API.md)
|
||||
|
||||
|
||||
## 面向开发者
|
||||
|
||||
如果你想从源码构建或为项目贡献代码,请遵循以下步骤:
|
||||
@@ -108,7 +94,6 @@ npm install
|
||||
|
||||
# 3. 运行应用(开发模式)
|
||||
npm run dev
|
||||
|
||||
```
|
||||
|
||||
## 致谢
|
||||
@@ -120,18 +105,16 @@ npm run dev
|
||||
|
||||
如果 WeFlow 确实帮到了你,可以考虑请我们喝杯咖啡:
|
||||
|
||||
|
||||
> TRC20 **Address:** `TZCtAw8CaeARWZBfvjidCnTcfnAtf6nvS6`
|
||||
|
||||
> TRC20 **Address:** `TZCtAw8CaeARWZBfvjidCnTcfnAtf6nvS6`
|
||||
|
||||
## Star History
|
||||
|
||||
<a href="https://www.star-history.com/#hicccc77/WeFlow&type=date&legend=top-left">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=hicccc77/WeFlow&type=date&theme=dark&legend=top-left" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=hicccc77/WeFlow&type=date&legend=top-left" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=hicccc77/WeFlow&type=date&legend=top-left" />
|
||||
</picture>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=hicccc77/WeFlow&type=date&theme=dark&legend=top-left" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=hicccc77/WeFlow&type=date&legend=top-left" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=hicccc77/WeFlow&type=date&legend=top-left" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
<div align="center">
|
||||
|
||||
@@ -2363,6 +2363,21 @@ function registerIpcHandlers() {
|
||||
return chatService.searchMessages(keyword, sessionId, limit, offset, beginTimestamp, endTimestamp)
|
||||
})
|
||||
|
||||
ipcMain.handle('chat:getMyFootprintStats', async (_, beginTimestamp: number, endTimestamp: number, options?: {
|
||||
myWxid?: string
|
||||
privateSessionIds?: string[]
|
||||
groupSessionIds?: string[]
|
||||
mentionLimit?: number
|
||||
privateLimit?: number
|
||||
mentionMode?: 'text_at_me' | string
|
||||
}) => {
|
||||
return chatService.getMyFootprintStats(beginTimestamp, endTimestamp, options)
|
||||
})
|
||||
|
||||
ipcMain.handle('chat:exportMyFootprint', async (_, beginTimestamp: number, endTimestamp: number, format: 'csv' | 'json', filePath: string) => {
|
||||
return chatService.exportMyFootprint(beginTimestamp, endTimestamp, format, filePath)
|
||||
})
|
||||
|
||||
ipcMain.handle('sns:getTimeline', async (_, limit: number, offset: number, usernames?: string[], keyword?: string, startTime?: number, endTime?: number) => {
|
||||
return snsService.getTimeline(limit, offset, usernames, keyword, startTime, endTime)
|
||||
})
|
||||
|
||||
@@ -258,6 +258,24 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
ipcRenderer.invoke('chat:getMessage', sessionId, localId),
|
||||
searchMessages: (keyword: string, sessionId?: string, limit?: number, offset?: number, beginTimestamp?: number, endTimestamp?: number) =>
|
||||
ipcRenderer.invoke('chat:searchMessages', keyword, sessionId, limit, offset, beginTimestamp, endTimestamp),
|
||||
getMyFootprintStats: (
|
||||
beginTimestamp: number,
|
||||
endTimestamp: number,
|
||||
options?: {
|
||||
myWxid?: string
|
||||
privateSessionIds?: string[]
|
||||
groupSessionIds?: string[]
|
||||
mentionLimit?: number
|
||||
privateLimit?: number
|
||||
mentionMode?: 'text_at_me' | string
|
||||
}
|
||||
) => ipcRenderer.invoke('chat:getMyFootprintStats', beginTimestamp, endTimestamp, options),
|
||||
exportMyFootprint: (
|
||||
beginTimestamp: number,
|
||||
endTimestamp: number,
|
||||
format: 'csv' | 'json',
|
||||
filePath: string
|
||||
) => ipcRenderer.invoke('chat:exportMyFootprint', beginTimestamp, endTimestamp, format, filePath),
|
||||
onWcdbChange: (callback: (event: any, data: { type: string; json: string }) => void) => {
|
||||
ipcRenderer.on('wcdb-change', callback)
|
||||
return () => ipcRenderer.removeListener('wcdb-change', callback)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -270,7 +270,9 @@ export class ConfigService {
|
||||
const inLockMode = this.isLockMode() && this.unlockPassword
|
||||
|
||||
if (ENCRYPTED_BOOL_KEYS.has(key)) {
|
||||
toStore = this.safeEncrypt(String(value)) as ConfigSchema[K]
|
||||
const boolValue = value === true || value === 'true'
|
||||
// `false` 不需要写入 keychain,避免无意义触发 macOS 钥匙串弹窗
|
||||
toStore = (boolValue ? this.safeEncrypt('true') : false) as ConfigSchema[K]
|
||||
} else if (ENCRYPTED_NUMBER_KEYS.has(key)) {
|
||||
if (inLockMode && LOCKABLE_NUMBER_KEYS.has(key)) {
|
||||
toStore = this.lockEncrypt(String(value), this.unlockPassword!) as ConfigSchema[K]
|
||||
@@ -649,7 +651,7 @@ export class ConfigService {
|
||||
|
||||
clearHelloSecret(): void {
|
||||
this.store.set('authHelloSecret', '' as any)
|
||||
this.store.set('authUseHello', this.safeEncrypt('false') as any)
|
||||
this.store.set('authUseHello', false as any)
|
||||
}
|
||||
|
||||
// === 迁移 ===
|
||||
@@ -658,13 +660,18 @@ export class ConfigService {
|
||||
// 将旧版明文 auth 字段迁移为 safeStorage 加密格式
|
||||
// 如果已经是 safe: 或 lock: 前缀则跳过
|
||||
const rawEnabled: any = this.store.get('authEnabled')
|
||||
if (typeof rawEnabled === 'boolean') {
|
||||
this.store.set('authEnabled', this.safeEncrypt(String(rawEnabled)) as any)
|
||||
if (rawEnabled === true || rawEnabled === 'true') {
|
||||
this.store.set('authEnabled', this.safeEncrypt('true') as any)
|
||||
} else if (rawEnabled === false || rawEnabled === 'false') {
|
||||
// 保持 false 为明文布尔,避免冷启动访问 keychain
|
||||
this.store.set('authEnabled', false as any)
|
||||
}
|
||||
|
||||
const rawUseHello: any = this.store.get('authUseHello')
|
||||
if (typeof rawUseHello === 'boolean') {
|
||||
this.store.set('authUseHello', this.safeEncrypt(String(rawUseHello)) as any)
|
||||
if (rawUseHello === true || rawUseHello === 'true') {
|
||||
this.store.set('authUseHello', this.safeEncrypt('true') as any)
|
||||
} else if (rawUseHello === false || rawUseHello === 'false') {
|
||||
this.store.set('authUseHello', false as any)
|
||||
}
|
||||
|
||||
const rawPassword: any = this.store.get('authPassword')
|
||||
@@ -729,7 +736,7 @@ export class ConfigService {
|
||||
// === 工具方法 ===
|
||||
|
||||
/**
|
||||
* 获取当前 wxid 对应的图片密钥,优先从 wxidConfigs 中取,找不到则回退到全局<EFBFBD><EFBFBD>置
|
||||
* 获取当前 wxid 对应的图片密钥,优先从 wxidConfigs 中取,找不到则回退到全局配置
|
||||
*/
|
||||
getImageKeysForCurrentWxid(): { xorKey: unknown; aesKey: string } {
|
||||
const wxid = this.get('myWxid')
|
||||
|
||||
@@ -949,7 +949,7 @@ export class ImageDecryptService {
|
||||
} catch { }
|
||||
}
|
||||
|
||||
// --- 绛栫暐 B: 鏂扮増 Session 鍝堝笇璺緞鐚滄祴 ---
|
||||
// --- 策略 B: 新版 Session 哈希路径猜测 ---
|
||||
try {
|
||||
const entries = await fs.readdir(root, { withFileTypes: true })
|
||||
const sessionDirs = entries
|
||||
@@ -1854,7 +1854,7 @@ export class ImageDecryptService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 浠?wxgf 鏁版嵁涓彁鍙?HEVC NALU 瑁告祦
|
||||
* 从 wxgf 数据中提取 HEVC NALU 裸流
|
||||
*/
|
||||
private extractHevcNalu(buffer: Buffer): Buffer | null {
|
||||
const nalUnits: Buffer[] = []
|
||||
|
||||
@@ -316,7 +316,7 @@ class InsightService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 测<EFBFBD><EFBFBD><EFBFBD> API 连接,返回 { success, message }。
|
||||
* 测试 API 连接,返回 { success, message }。
|
||||
* 供设置页"测试连接"按钮调用。
|
||||
*/
|
||||
async testConnection(): Promise<{ success: boolean; message: string }> {
|
||||
@@ -475,7 +475,7 @@ class InsightService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今日全局已触发次数(所有会话合计),用于 prompt 中告知模<EFBFBD><EFBFBD><EFBFBD>全局上下文。
|
||||
* 获取今日全局已触发次数(所有会话合计),用于 prompt 中告知模型全局上下文。
|
||||
*/
|
||||
private getTodayTotalTriggerCount(): number {
|
||||
this.resetIfNewDay()
|
||||
@@ -709,7 +709,7 @@ class InsightService {
|
||||
return
|
||||
}
|
||||
|
||||
// ── 构建 prompt ─────────────<EFBFBD><EFBFBD><EFBFBD>───────────────────────────────<EFBFBD><EFBFBD><EFBFBD>────────────
|
||||
// ── 构建 prompt ────────────────────────────────────────────────────────────
|
||||
|
||||
// 今日触发统计(让模型具备时间与克制感)
|
||||
const sessionTriggerTimes = this.recordTrigger(sessionId)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { app, shell } from 'electron'
|
||||
import { join, basename, dirname } from 'path'
|
||||
import { existsSync, readdirSync, readFileSync, statSync } from 'fs'
|
||||
import { existsSync, readdirSync, readFileSync, statSync, chmodSync } from 'fs'
|
||||
import { execFile, spawn } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import crypto from 'crypto'
|
||||
@@ -403,19 +403,71 @@ export class KeyServiceMac {
|
||||
return `'${String(text).replace(/'/g, `'\\''`)}'`
|
||||
}
|
||||
|
||||
private collectMacKeyArtifactPaths(primaryBinaryPath: string): string[] {
|
||||
const baseDir = dirname(primaryBinaryPath)
|
||||
const names = ['xkey_helper', 'image_scan_helper', 'xkey_helper_macos', 'libwx_key.dylib']
|
||||
const unique: string[] = []
|
||||
for (const name of names) {
|
||||
const full = join(baseDir, name)
|
||||
if (!existsSync(full)) continue
|
||||
if (!unique.includes(full)) unique.push(full)
|
||||
}
|
||||
if (existsSync(primaryBinaryPath) && !unique.includes(primaryBinaryPath)) {
|
||||
unique.unshift(primaryBinaryPath)
|
||||
}
|
||||
return unique
|
||||
}
|
||||
|
||||
private ensureExecutableBitsBestEffort(paths: string[]): void {
|
||||
for (const p of paths) {
|
||||
try {
|
||||
const mode = statSync(p).mode
|
||||
if ((mode & 0o111) !== 0) continue
|
||||
chmodSync(p, mode | 0o111)
|
||||
} catch {
|
||||
// ignore: 可能无权限(例如 /Applications 下 root-owned 的 .app)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async ensureExecutableBitsWithElevation(paths: string[], timeoutMs: number): Promise<void> {
|
||||
const existing = paths.filter(p => existsSync(p))
|
||||
if (existing.length === 0) return
|
||||
|
||||
const quotedPaths = existing.map(p => this.shellSingleQuote(p)).join(' ')
|
||||
const timeoutSec = Math.max(30, Math.ceil(timeoutMs / 1000))
|
||||
const scriptLines = [
|
||||
`set chmodCmd to "/bin/chmod +x ${quotedPaths}"`,
|
||||
`set timeoutSec to ${timeoutSec}`,
|
||||
'with timeout of timeoutSec seconds',
|
||||
'do shell script chmodCmd with administrator privileges',
|
||||
'end timeout'
|
||||
]
|
||||
|
||||
await execFileAsync('/usr/bin/osascript', scriptLines.flatMap(line => ['-e', line]), {
|
||||
timeout: timeoutMs + 10_000
|
||||
})
|
||||
}
|
||||
|
||||
private async getDbKeyByHelperElevated(
|
||||
timeoutMs: number,
|
||||
onStatus?: (message: string, level: number) => void
|
||||
): Promise<string> {
|
||||
const helperPath = this.getHelperPath()
|
||||
const artifactPaths = this.collectMacKeyArtifactPaths(helperPath)
|
||||
this.ensureExecutableBitsBestEffort(artifactPaths)
|
||||
const waitMs = Math.max(timeoutMs, 30_000)
|
||||
const timeoutSec = Math.ceil(waitMs / 1000) + 30
|
||||
const pid = await this.getWeChatPid()
|
||||
const chmodPart = artifactPaths.length > 0
|
||||
? `/bin/chmod +x ${artifactPaths.map(p => this.shellSingleQuote(p)).join(' ')}`
|
||||
: ''
|
||||
const runPart = `${this.shellSingleQuote(helperPath)} ${pid} ${waitMs}`
|
||||
const privilegedCmd = chmodPart ? `${chmodPart} && ${runPart}` : runPart
|
||||
// 用 AppleScript 的 quoted form 组装命令,避免复杂 shell 拼接导致整条失败
|
||||
// 通过 try/on error 回传详细错误,避免只看到 "Command failed"
|
||||
const scriptLines = [
|
||||
`set helperPath to ${JSON.stringify(helperPath)}`,
|
||||
`set cmd to quoted form of helperPath & " ${pid} ${waitMs}"`,
|
||||
`set cmd to ${JSON.stringify(privilegedCmd)}`,
|
||||
`set timeoutSec to ${timeoutSec}`,
|
||||
'try',
|
||||
'with timeout of timeoutSec seconds',
|
||||
@@ -751,10 +803,12 @@ export class KeyServiceMac {
|
||||
try {
|
||||
const helperPath = this.getImageScanHelperPath()
|
||||
const ciphertextHex = ciphertext.toString('hex')
|
||||
const artifactPaths = this.collectMacKeyArtifactPaths(helperPath)
|
||||
this.ensureExecutableBitsBestEffort(artifactPaths)
|
||||
|
||||
// 1) 直接运行 helper(有正式签名的 debugger entitlement 时可用)
|
||||
if (!this._needsElevation) {
|
||||
const direct = await this._spawnScanHelper(helperPath, pid, ciphertextHex, false)
|
||||
const direct = await this._spawnScanHelper(helperPath, pid, ciphertextHex, false, artifactPaths)
|
||||
if (direct.key) return direct.key
|
||||
if (direct.permissionError) {
|
||||
console.warn('[KeyServiceMac] task_for_pid 权限不足,切换到 osascript 提权模式')
|
||||
@@ -765,7 +819,12 @@ export class KeyServiceMac {
|
||||
|
||||
// 2) 通过 osascript 以管理员权限运行 helper(SIP 下 ad-hoc 签名无法获取 task_for_pid)
|
||||
if (this._needsElevation) {
|
||||
const elevated = await this._spawnScanHelper(helperPath, pid, ciphertextHex, true)
|
||||
try {
|
||||
await this.ensureExecutableBitsWithElevation(artifactPaths, 45_000)
|
||||
} catch (e: any) {
|
||||
console.warn('[KeyServiceMac] elevated chmod failed before image scan:', e?.message || e)
|
||||
}
|
||||
const elevated = await this._spawnScanHelper(helperPath, pid, ciphertextHex, true, artifactPaths)
|
||||
if (elevated.key) return elevated.key
|
||||
}
|
||||
} catch (e: any) {
|
||||
@@ -868,12 +927,19 @@ export class KeyServiceMac {
|
||||
}
|
||||
|
||||
private _spawnScanHelper(
|
||||
helperPath: string, pid: number, ciphertextHex: string, elevated: boolean
|
||||
helperPath: string,
|
||||
pid: number,
|
||||
ciphertextHex: string,
|
||||
elevated: boolean,
|
||||
artifactPaths: string[] = []
|
||||
): Promise<{ key: string | null; permissionError: boolean }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let child: ReturnType<typeof spawn>
|
||||
if (elevated) {
|
||||
const shellCmd = `'${helperPath}' ${pid} ${ciphertextHex}`
|
||||
const chmodPart = artifactPaths.length > 0
|
||||
? `/bin/chmod +x ${artifactPaths.map(p => this.shellSingleQuote(p)).join(' ')} && `
|
||||
: ''
|
||||
const shellCmd = `${chmodPart}${this.shellSingleQuote(helperPath)} ${pid} ${ciphertextHex}`
|
||||
child = spawn('/usr/bin/osascript', ['-e', `do shell script ${JSON.stringify(shellCmd)} with administrator privileges`],
|
||||
{ stdio: ['ignore', 'pipe', 'pipe'] })
|
||||
} else {
|
||||
|
||||
@@ -58,6 +58,7 @@ export class WcdbCore {
|
||||
private wcdbGetAnnualReportExtras: any = null
|
||||
private wcdbGetDualReportStats: any = null
|
||||
private wcdbGetGroupStats: any = null
|
||||
private wcdbGetMyFootprintStats: any = null
|
||||
private wcdbGetMessageDates: any = null
|
||||
private wcdbOpenMessageCursor: any = null
|
||||
private wcdbOpenMessageCursorLite: any = null
|
||||
@@ -127,6 +128,8 @@ export class WcdbCore {
|
||||
private logTimer: NodeJS.Timeout | null = null
|
||||
private lastLogTail: string | null = null
|
||||
private lastResolvedLogPath: string | null = null
|
||||
private lastCursorForceReopenAt = 0
|
||||
private readonly cursorForceReopenCooldownMs = 15000
|
||||
|
||||
setPaths(resourcesPath: string, userDataPath: string): void {
|
||||
this.resourcesPath = resourcesPath
|
||||
@@ -923,6 +926,13 @@ export class WcdbCore {
|
||||
this.wcdbGetGroupStats = null
|
||||
}
|
||||
|
||||
// wcdb_status wcdb_get_my_footprint_stats(wcdb_handle handle, const char* options_json, char** out_json)
|
||||
try {
|
||||
this.wcdbGetMyFootprintStats = this.lib.func('int32 wcdb_get_my_footprint_stats(int64 handle, const char* optionsJson, _Out_ void** outJson)')
|
||||
} catch {
|
||||
this.wcdbGetMyFootprintStats = null
|
||||
}
|
||||
|
||||
// wcdb_status wcdb_get_message_dates(wcdb_handle handle, const char* session_id, char** out_json)
|
||||
try {
|
||||
this.wcdbGetMessageDates = this.lib.func('int32 wcdb_get_message_dates(int64 handle, const char* sessionId, _Out_ void** outJson)')
|
||||
@@ -3098,6 +3108,65 @@ export class WcdbCore {
|
||||
}
|
||||
}
|
||||
|
||||
async getMyFootprintStats(options: {
|
||||
beginTimestamp?: number
|
||||
endTimestamp?: number
|
||||
myWxid?: string
|
||||
privateSessionIds?: string[]
|
||||
groupSessionIds?: string[]
|
||||
mentionLimit?: number
|
||||
privateLimit?: number
|
||||
mentionMode?: 'text_at_me' | string
|
||||
}): Promise<{ success: boolean; data?: any; error?: string }> {
|
||||
if (!this.ensureReady()) {
|
||||
return { success: false, error: 'WCDB 未连接' }
|
||||
}
|
||||
if (!this.wcdbGetMyFootprintStats) {
|
||||
return { success: false, error: '接口未就绪' }
|
||||
}
|
||||
|
||||
try {
|
||||
const normalizedPrivateSessions = Array.from(new Set(
|
||||
(options?.privateSessionIds || [])
|
||||
.map((value) => String(value || '').trim())
|
||||
.filter(Boolean)
|
||||
))
|
||||
const normalizedGroupSessions = Array.from(new Set(
|
||||
(options?.groupSessionIds || [])
|
||||
.map((value) => String(value || '').trim())
|
||||
.filter(Boolean)
|
||||
))
|
||||
const mentionLimitRaw = Number(options?.mentionLimit ?? 0)
|
||||
const privateLimitRaw = Number(options?.privateLimit ?? 0)
|
||||
const mentionLimit = Number.isFinite(mentionLimitRaw) && mentionLimitRaw >= 0 ? Math.floor(mentionLimitRaw) : 0
|
||||
const privateLimit = Number.isFinite(privateLimitRaw) && privateLimitRaw >= 0 ? Math.floor(privateLimitRaw) : 0
|
||||
|
||||
const payload = JSON.stringify({
|
||||
begin: this.normalizeTimestamp(options?.beginTimestamp || 0),
|
||||
end: this.normalizeTimestamp(options?.endTimestamp || 0),
|
||||
my_wxid: String(options?.myWxid || '').trim(),
|
||||
private_session_ids: normalizedPrivateSessions,
|
||||
group_session_ids: normalizedGroupSessions,
|
||||
mention_limit: mentionLimit,
|
||||
private_limit: privateLimit,
|
||||
mention_mode: options?.mentionMode || 'text_at_me'
|
||||
})
|
||||
|
||||
const outPtr = [null as any]
|
||||
const result = this.wcdbGetMyFootprintStats(this.handle, payload, outPtr)
|
||||
if (result !== 0 || !outPtr[0]) {
|
||||
return { success: false, error: `获取我的足迹统计失败: ${result}` }
|
||||
}
|
||||
const jsonStr = this.decodeJsonPtr(outPtr[0])
|
||||
if (!jsonStr) {
|
||||
return { success: false, error: '解析我的足迹统计失败' }
|
||||
}
|
||||
return { success: true, data: JSON.parse(jsonStr) || {} }
|
||||
} catch (e) {
|
||||
return { success: false, error: String(e) }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制重新打开账号连接(绕过路径缓存),用于微信重装后消息数据库刷新失败时的自动恢复。
|
||||
* 返回重新打开是否成功。
|
||||
@@ -3119,6 +3188,15 @@ export class WcdbCore {
|
||||
return this.open(path, key, wxid)
|
||||
}
|
||||
|
||||
private shouldRetryCursorAfterNoDb(): boolean {
|
||||
const now = Date.now()
|
||||
if (now - this.lastCursorForceReopenAt < this.cursorForceReopenCooldownMs) {
|
||||
return false
|
||||
}
|
||||
this.lastCursorForceReopenAt = now
|
||||
return true
|
||||
}
|
||||
|
||||
async openMessageCursor(sessionId: string, batchSize: number, ascending: boolean, beginTimestamp: number, endTimestamp: number): Promise<{ success: boolean; cursor?: number; error?: string }> {
|
||||
if (!this.ensureReady()) {
|
||||
return { success: false, error: 'WCDB 未连接' }
|
||||
@@ -3136,7 +3214,7 @@ export class WcdbCore {
|
||||
)
|
||||
// result=-3 表示 WCDB_STATUS_NO_MESSAGE_DB:消息数据库缓存为空(常见于微信重装后)
|
||||
// 自动强制重连并重试一次
|
||||
if (result === -3 && outCursor[0] <= 0) {
|
||||
if (result === -3 && outCursor[0] <= 0 && this.shouldRetryCursorAfterNoDb()) {
|
||||
this.writeLog('openMessageCursor: result=-3 (no message db), attempting forceReopen...', true)
|
||||
const reopened = await this.forceReopen()
|
||||
if (reopened && this.handle !== null) {
|
||||
@@ -3156,11 +3234,13 @@ export class WcdbCore {
|
||||
}
|
||||
}
|
||||
if (result !== 0 || outCursor[0] <= 0) {
|
||||
await this.printLogs(true)
|
||||
this.writeLog(
|
||||
`openMessageCursor failed: sessionId=${sessionId} batchSize=${batchSize} ascending=${ascending ? 1 : 0} begin=${beginTimestamp} end=${endTimestamp} result=${result} cursor=${outCursor[0]}`,
|
||||
true
|
||||
)
|
||||
if (result !== -3) {
|
||||
await this.printLogs(true)
|
||||
this.writeLog(
|
||||
`openMessageCursor failed: sessionId=${sessionId} batchSize=${batchSize} ascending=${ascending ? 1 : 0} begin=${beginTimestamp} end=${endTimestamp} result=${result} cursor=${outCursor[0]}`,
|
||||
true
|
||||
)
|
||||
}
|
||||
const hint = result === -3
|
||||
? `创建游标失败: ${result}(消息数据库未找到)。如果你最近重装过微信,请尝试重新指定数据目录后重试`
|
||||
: result === -7
|
||||
@@ -3197,7 +3277,7 @@ export class WcdbCore {
|
||||
|
||||
// result=-3 表示 WCDB_STATUS_NO_MESSAGE_DB:消息数据库缓存为空
|
||||
// 自动强制重连并重试一次
|
||||
if (result === -3 && outCursor[0] <= 0) {
|
||||
if (result === -3 && outCursor[0] <= 0 && this.shouldRetryCursorAfterNoDb()) {
|
||||
this.writeLog('openMessageCursorLite: result=-3 (no message db), attempting forceReopen...', true)
|
||||
const reopened = await this.forceReopen()
|
||||
if (reopened && this.handle !== null) {
|
||||
@@ -3218,11 +3298,13 @@ export class WcdbCore {
|
||||
}
|
||||
|
||||
if (result !== 0 || outCursor[0] <= 0) {
|
||||
await this.printLogs(true)
|
||||
this.writeLog(
|
||||
`openMessageCursorLite failed: sessionId=${sessionId} batchSize=${batchSize} ascending=${ascending ? 1 : 0} begin=${beginTimestamp} end=${endTimestamp} result=${result} cursor=${outCursor[0]}`,
|
||||
true
|
||||
)
|
||||
if (result !== -3) {
|
||||
await this.printLogs(true)
|
||||
this.writeLog(
|
||||
`openMessageCursorLite failed: sessionId=${sessionId} batchSize=${batchSize} ascending=${ascending ? 1 : 0} begin=${beginTimestamp} end=${endTimestamp} result=${result} cursor=${outCursor[0]}`,
|
||||
true
|
||||
)
|
||||
}
|
||||
if (result === -7) {
|
||||
return { success: false, error: 'message schema mismatch:当前账号消息表结构与程序要求不一致' }
|
||||
}
|
||||
|
||||
@@ -448,6 +448,19 @@ export class WcdbService {
|
||||
return this.callWorker('getGroupStats', { chatroomId, beginTimestamp, endTimestamp })
|
||||
}
|
||||
|
||||
async getMyFootprintStats(options: {
|
||||
beginTimestamp?: number
|
||||
endTimestamp?: number
|
||||
myWxid?: string
|
||||
privateSessionIds?: string[]
|
||||
groupSessionIds?: string[]
|
||||
mentionLimit?: number
|
||||
privateLimit?: number
|
||||
mentionMode?: 'text_at_me' | string
|
||||
}): Promise<{ success: boolean; data?: any; error?: string }> {
|
||||
return this.callWorker('getMyFootprintStats', { options })
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开消息游标
|
||||
*/
|
||||
|
||||
@@ -158,6 +158,9 @@ if (parentPort) {
|
||||
case 'getGroupStats':
|
||||
result = await core.getGroupStats(payload.chatroomId, payload.beginTimestamp, payload.endTimestamp)
|
||||
break
|
||||
case 'getMyFootprintStats':
|
||||
result = await core.getMyFootprintStats(payload.options || {})
|
||||
break
|
||||
case 'openMessageCursor':
|
||||
result = await core.openMessageCursor(payload.sessionId, payload.batchSize, payload.ascending, payload.beginTimestamp, payload.endTimestamp)
|
||||
break
|
||||
|
||||
@@ -115,12 +115,14 @@ export async function showNotification(data: any) {
|
||||
// 检查会话过滤
|
||||
const filterMode = config.get("notificationFilterMode") || "all";
|
||||
const filterList = config.get("notificationFilterList") || [];
|
||||
const sessionId = data.sessionId;
|
||||
const sessionId = typeof data.sessionId === "string" ? data.sessionId : "";
|
||||
// 系统通知(如 "WeFlow 准备就绪")不是聊天消息,不应受会话白/黑名单影响
|
||||
const isSystemNotification = sessionId.startsWith("weflow-");
|
||||
|
||||
if (sessionId && filterMode !== "all" && filterList.length > 0) {
|
||||
const isInList = filterList.includes(sessionId);
|
||||
if (!isSystemNotification && filterMode !== "all") {
|
||||
const isInList = sessionId !== "" && filterList.includes(sessionId);
|
||||
if (filterMode === "whitelist" && !isInList) {
|
||||
// 白名单模式:不在列表中则不显示
|
||||
// 白名单模式:不在列表中则不显示(空列表视为全部拦截)
|
||||
return;
|
||||
}
|
||||
if (filterMode === "blacklist" && isInList) {
|
||||
|
||||
56
package-lock.json
generated
56
package-lock.json
generated
@@ -28,7 +28,7 @@
|
||||
"react-router-dom": "^7.14.0",
|
||||
"react-virtuoso": "^4.18.1",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"sherpa-onnx-node": "^1.12.36",
|
||||
"sherpa-onnx-node": "^1.12.35",
|
||||
"silk-wasm": "^3.7.1",
|
||||
"wechat-emojis": "^1.0.2",
|
||||
"zustand": "^5.0.2"
|
||||
@@ -9093,9 +9093,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/sherpa-onnx-darwin-arm64": {
|
||||
"version": "1.12.36",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.12.36.tgz",
|
||||
"integrity": "sha512-c1C7f2zO2BXNusrDlid5Mq5USfqq4oJrimnnHqNYtm4Kk2UzrxA9l6lAu2FZDj4gTQYRY4IJnlo0T7UXeOsjtQ==",
|
||||
"version": "1.12.35",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.12.35.tgz",
|
||||
"integrity": "sha512-WGIABo3ruBXE/7FhAdaVNuM+ZKx0B7jkA+jT22k5TxUcw58nWzgkY6k+CPdM14lfaaXR+jPWdDrM4gXl/bP4RQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -9106,9 +9106,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/sherpa-onnx-darwin-x64": {
|
||||
"version": "1.12.36",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.12.36.tgz",
|
||||
"integrity": "sha512-pRaELEwQ60cfBTtERiw6muN+0+FhVom0As0erRcRqdPKLNK4HCCSUaoHPYLFT6W1VUiJBzABH+WE2+LTDyx5JA==",
|
||||
"version": "1.12.35",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.12.35.tgz",
|
||||
"integrity": "sha512-hzWQm4CJhGyf3N9Sd1Oobcdz49FauuSCmhrm5vRqydyNsANjs89wATHAuatPAtinpBkgEqacDPrGz+1A/BWpNA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -9119,9 +9119,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/sherpa-onnx-linux-arm64": {
|
||||
"version": "1.12.36",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.12.36.tgz",
|
||||
"integrity": "sha512-Lv+j1Bq0Blp44O/i4gT4RieSDpiCoEPXfvNv0ABR2Gp6IbziI7gEsHgAf8HGjrA7EirtHAgX0o4hzUPW9yc+uw==",
|
||||
"version": "1.12.35",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.12.35.tgz",
|
||||
"integrity": "sha512-9glJ+dRv/rFWz/61tiKfaR9Gj+8B6sXi7NBgwBAnO/+ygu/WAjBfQRz2+S0YIy1dxqu7ng246TBNnx1M2XaNXA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -9132,9 +9132,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/sherpa-onnx-linux-x64": {
|
||||
"version": "1.12.36",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.12.36.tgz",
|
||||
"integrity": "sha512-Wul2WAaUt0e2zZaaQR4N3GTDhcZdz44w3FiStr195TI9U4uNxVbFgZbw9YsEMj8K7gm7JhoH2bnCn8fUJv88EQ==",
|
||||
"version": "1.12.35",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.12.35.tgz",
|
||||
"integrity": "sha512-h+v4Yed8T+k1qLlKX2LTGoXP/11ycz7jbqC2f80kDWgz9J8m46mOBa/H20wVkLyQPy1vG1O5iH5Fe5Wh4QlLhw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -9145,23 +9145,23 @@
|
||||
]
|
||||
},
|
||||
"node_modules/sherpa-onnx-node": {
|
||||
"version": "1.12.36",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.12.36.tgz",
|
||||
"integrity": "sha512-AjdOE0qa3jAmS/zh0BwNVXn9ZRz8PpgCgcLIyf7IYxDfTMWIgHaRFisDL4QzttuDe3apvBXjP1Y7FtZPSRFqqQ==",
|
||||
"version": "1.12.35",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.12.35.tgz",
|
||||
"integrity": "sha512-RHCgV+9fos/ZxP0MsIL7JPU9K3YHnIDmwtX674ChQZY6DLVaIQaju+J3hDqzRu1R3agnDg9WDf01zsT46NC7SQ==",
|
||||
"license": "Apache-2.0",
|
||||
"optionalDependencies": {
|
||||
"sherpa-onnx-darwin-arm64": "^1.12.36",
|
||||
"sherpa-onnx-darwin-x64": "^1.12.36",
|
||||
"sherpa-onnx-linux-arm64": "^1.12.36",
|
||||
"sherpa-onnx-linux-x64": "^1.12.36",
|
||||
"sherpa-onnx-win-ia32": "^1.12.36",
|
||||
"sherpa-onnx-win-x64": "^1.12.36"
|
||||
"sherpa-onnx-darwin-arm64": "^1.12.35",
|
||||
"sherpa-onnx-darwin-x64": "^1.12.35",
|
||||
"sherpa-onnx-linux-arm64": "^1.12.35",
|
||||
"sherpa-onnx-linux-x64": "^1.12.35",
|
||||
"sherpa-onnx-win-ia32": "^1.12.35",
|
||||
"sherpa-onnx-win-x64": "^1.12.35"
|
||||
}
|
||||
},
|
||||
"node_modules/sherpa-onnx-win-ia32": {
|
||||
"version": "1.12.36",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-ia32/-/sherpa-onnx-win-ia32-1.12.36.tgz",
|
||||
"integrity": "sha512-An3O5tEq4P5xKBSZMq10F/w6q79fgdbFZ4NKPoflSKSW37TSyNz9MhHLHwhse/BMPa35eW14J9dsGG3DZTC/xA==",
|
||||
"version": "1.12.35",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-ia32/-/sherpa-onnx-win-ia32-1.12.35.tgz",
|
||||
"integrity": "sha512-6H6BSdXXWtz92AuvOmr4w/QvCofxXbfbNKT7jCxdE7Nd4AvinLJxT02vbnL6T54vuXd9chu0QvQrDl1tuRphAA==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -9172,9 +9172,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/sherpa-onnx-win-x64": {
|
||||
"version": "1.12.36",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-x64/-/sherpa-onnx-win-x64-1.12.36.tgz",
|
||||
"integrity": "sha512-wZLQflcvy8ynsU6B8GvqWIhOCAjP6+rnzyadF+qGWgZzMSCduapD63q++0QDRabGRBL8qfsd2n7O2dF/W2kccQ==",
|
||||
"version": "1.12.35",
|
||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-x64/-/sherpa-onnx-win-x64-1.12.35.tgz",
|
||||
"integrity": "sha512-+GLrxwaEvpJAO0KZgKulfd4qUR089MD+TjE5jVSugMTq4Eh/R/TpPPqYQGibRZVPHW7Se1ABfHGapZQoFMHH5Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"react-router-dom": "^7.14.0",
|
||||
"react-virtuoso": "^4.18.1",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"sherpa-onnx-node": "^1.12.36",
|
||||
"sherpa-onnx-node": "^1.12.35",
|
||||
"silk-wasm": "^3.7.1",
|
||||
"wechat-emojis": "^1.0.2",
|
||||
"zustand": "^5.0.2"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -17,6 +17,7 @@ import AgreementPage from './pages/AgreementPage'
|
||||
import GroupAnalyticsPage from './pages/GroupAnalyticsPage'
|
||||
import SettingsPage from './pages/SettingsPage'
|
||||
import ExportPage from './pages/ExportPage'
|
||||
import MyFootprintPage from './pages/MyFootprintPage'
|
||||
import VideoWindow from './pages/VideoWindow'
|
||||
import ImageWindow from './pages/ImageWindow'
|
||||
import SnsPage from './pages/SnsPage'
|
||||
@@ -689,6 +690,7 @@ function App() {
|
||||
<Route path="/annual-report/view" element={<AnnualReportWindow />} />
|
||||
<Route path="/dual-report" element={<DualReportPage />} />
|
||||
<Route path="/dual-report/view" element={<DualReportWindow />} />
|
||||
<Route path="/footprint" element={<MyFootprintPage />} />
|
||||
|
||||
<Route path="/export" element={<div className="export-route-anchor" aria-hidden="true" />} />
|
||||
<Route path="/sns" element={<SnsPage />} />
|
||||
|
||||
@@ -54,10 +54,11 @@
|
||||
position: absolute;
|
||||
top: calc(100% + 8px);
|
||||
right: 0;
|
||||
background: var(--card-bg);
|
||||
background: var(--bg-secondary-solid, var(--bg-primary, var(--card-bg)));
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
|
||||
backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
border: 1px solid var(--border-color);
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
@@ -288,4 +289,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,20 @@ function DateRangePicker({ startDate, endDate, onStartDateChange, onEndDateChang
|
||||
const [showYearMonthPicker, setShowYearMonthPicker] = useState(false)
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const [internalStart, setInternalStart] = useState(startDate)
|
||||
const [internalEnd, setInternalEnd] = useState(endDate)
|
||||
|
||||
useEffect(() => {
|
||||
setInternalStart(startDate)
|
||||
setInternalEnd(endDate)
|
||||
}, [startDate, endDate])
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
setSelectingStart(true)
|
||||
}
|
||||
}, [isOpen])
|
||||
|
||||
// 点击外部关闭
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (e: MouseEvent) => {
|
||||
@@ -63,8 +77,10 @@ function DateRangePicker({ startDate, endDate, onStartDateChange, onEndDateChang
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setDate(start.getDate() - days)
|
||||
onStartDateChange(start.toISOString().split('T')[0])
|
||||
onEndDateChange(end.toISOString().split('T')[0])
|
||||
const startStr = `${start.getFullYear()}-${String(start.getMonth() + 1).padStart(2, '0')}-${String(start.getDate()).padStart(2, '0')}`
|
||||
const endStr = `${end.getFullYear()}-${String(end.getMonth() + 1).padStart(2, '0')}-${String(end.getDate()).padStart(2, '0')}`
|
||||
onStartDateChange(startStr)
|
||||
onEndDateChange(endStr)
|
||||
}
|
||||
setIsOpen(false)
|
||||
setTimeout(() => onRangeComplete?.(), 0)
|
||||
@@ -89,38 +105,46 @@ function DateRangePicker({ startDate, endDate, onStartDateChange, onEndDateChang
|
||||
const dateStr = `${currentMonth.getFullYear()}-${String(currentMonth.getMonth() + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`
|
||||
|
||||
if (selectingStart) {
|
||||
onStartDateChange(dateStr)
|
||||
if (endDate && dateStr > endDate) {
|
||||
onEndDateChange('')
|
||||
setInternalStart(dateStr)
|
||||
if (internalEnd && dateStr > internalEnd) {
|
||||
setInternalEnd('')
|
||||
}
|
||||
setSelectingStart(false)
|
||||
} else {
|
||||
if (dateStr < startDate) {
|
||||
onStartDateChange(dateStr)
|
||||
onEndDateChange(startDate)
|
||||
} else {
|
||||
onEndDateChange(dateStr)
|
||||
let finalStart = internalStart
|
||||
let finalEnd = dateStr
|
||||
|
||||
if (dateStr < internalStart) {
|
||||
finalStart = dateStr
|
||||
finalEnd = internalStart
|
||||
}
|
||||
|
||||
setInternalStart(finalStart)
|
||||
setInternalEnd(finalEnd)
|
||||
|
||||
setSelectingStart(true)
|
||||
setIsOpen(false)
|
||||
|
||||
onStartDateChange(finalStart)
|
||||
onEndDateChange(finalEnd)
|
||||
setTimeout(() => onRangeComplete?.(), 0)
|
||||
}
|
||||
}
|
||||
|
||||
const isInRange = (day: number) => {
|
||||
if (!startDate || !endDate) return false
|
||||
if (!internalStart || !internalEnd) return false
|
||||
const dateStr = `${currentMonth.getFullYear()}-${String(currentMonth.getMonth() + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`
|
||||
return dateStr >= startDate && dateStr <= endDate
|
||||
return dateStr >= internalStart && dateStr <= internalEnd
|
||||
}
|
||||
|
||||
const isStartDate = (day: number) => {
|
||||
const dateStr = `${currentMonth.getFullYear()}-${String(currentMonth.getMonth() + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`
|
||||
return dateStr === startDate
|
||||
return dateStr === internalStart
|
||||
}
|
||||
|
||||
const isEndDate = (day: number) => {
|
||||
const dateStr = `${currentMonth.getFullYear()}-${String(currentMonth.getMonth() + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`
|
||||
return dateStr === endDate
|
||||
return dateStr === internalEnd
|
||||
}
|
||||
|
||||
const isToday = (day: number) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useRef } from 'react'
|
||||
import { NavLink, useLocation, useNavigate } from 'react-router-dom'
|
||||
import { Home, MessageSquare, BarChart3, FileText, Settings, Download, Aperture, UserCircle, Lock, LockOpen, ChevronUp, RefreshCw, FolderClosed } from 'lucide-react'
|
||||
import { Home, MessageSquare, BarChart3, FileText, Settings, Download, Aperture, UserCircle, Lock, LockOpen, ChevronUp, RefreshCw, FolderClosed, Footprints } from 'lucide-react'
|
||||
import { useAppStore } from '../stores/appStore'
|
||||
import { useChatStore } from '../stores/chatStore'
|
||||
import { useAnalyticsStore } from '../stores/analyticsStore'
|
||||
@@ -459,6 +459,16 @@ function Sidebar({ collapsed }: SidebarProps) {
|
||||
<span className="nav-label">年度报告</span>
|
||||
</NavLink>
|
||||
|
||||
{/* 我的足迹 */}
|
||||
<NavLink
|
||||
to="/footprint"
|
||||
className={`nav-item ${isActive('/footprint') ? 'active' : ''}`}
|
||||
title={collapsed ? '我的足迹' : undefined}
|
||||
>
|
||||
<span className="nav-icon"><Footprints size={20} /></span>
|
||||
<span className="nav-label">我的足迹</span>
|
||||
</NavLink>
|
||||
|
||||
{/* 导出 */}
|
||||
<NavLink
|
||||
to="/export"
|
||||
|
||||
@@ -46,6 +46,12 @@ interface PendingInSessionSearchPayload {
|
||||
results: Message[]
|
||||
}
|
||||
|
||||
interface PendingFootprintJumpPayload {
|
||||
sessionId: string
|
||||
localId: number
|
||||
createTime: number
|
||||
}
|
||||
|
||||
type GlobalMsgSearchPhase = 'idle' | 'seed' | 'backfill' | 'done'
|
||||
type GlobalMsgSearchResult = Message & { sessionId: string }
|
||||
|
||||
@@ -1363,6 +1369,7 @@ function ChatPage(props: ChatPageProps) {
|
||||
const [globalMsgAuthoritativeSessionCount, setGlobalMsgAuthoritativeSessionCount] = useState(0)
|
||||
const [globalMsgSearchError, setGlobalMsgSearchError] = useState<string | null>(null)
|
||||
const pendingInSessionSearchRef = useRef<PendingInSessionSearchPayload | null>(null)
|
||||
const pendingFootprintJumpRef = useRef<PendingFootprintJumpPayload | null>(null)
|
||||
const pendingGlobalMsgSearchReplayRef = useRef<string | null>(null)
|
||||
const globalMsgPrefixCacheRef = useRef<GlobalMsgPrefixCacheEntry | null>(null)
|
||||
|
||||
@@ -5351,18 +5358,89 @@ function ChatPage(props: ChatPageProps) {
|
||||
selectSessionById
|
||||
])
|
||||
|
||||
// 监听URL参数中的sessionId,用于通知点击导航
|
||||
// 监听 URL 参数中的会话/锚点(通知跳转 + 足迹锚点定位)
|
||||
useEffect(() => {
|
||||
if (standaloneSessionWindow) return // standalone模式由上面的useEffect处理
|
||||
const params = new URLSearchParams(location.search)
|
||||
const urlSessionId = params.get('sessionId')
|
||||
const urlSessionId = String(params.get('sessionId') || '').trim()
|
||||
if (!urlSessionId) return
|
||||
if (!isConnected || isConnecting) return
|
||||
if (currentSessionId === urlSessionId) return
|
||||
selectSessionById(urlSessionId)
|
||||
const jumpSource = String(params.get('jumpSource') || '').trim()
|
||||
const jumpLocalId = Number.parseInt(String(params.get('jumpLocalId') || ''), 10)
|
||||
const jumpCreateTime = Number.parseInt(String(params.get('jumpCreateTime') || ''), 10)
|
||||
const hasFootprintAnchor = jumpSource === 'footprint'
|
||||
&& Number.isFinite(jumpLocalId)
|
||||
&& jumpLocalId > 0
|
||||
&& Number.isFinite(jumpCreateTime)
|
||||
&& jumpCreateTime > 0
|
||||
|
||||
if (hasFootprintAnchor) {
|
||||
pendingFootprintJumpRef.current = {
|
||||
sessionId: urlSessionId,
|
||||
localId: jumpLocalId,
|
||||
createTime: jumpCreateTime
|
||||
}
|
||||
if (currentSessionId !== urlSessionId) {
|
||||
selectSessionById(urlSessionId)
|
||||
return
|
||||
}
|
||||
const messageStub: Message = {
|
||||
messageKey: `footprint:${urlSessionId}:${jumpCreateTime}:${jumpLocalId}`,
|
||||
localId: jumpLocalId,
|
||||
serverId: 0,
|
||||
localType: 0,
|
||||
createTime: jumpCreateTime,
|
||||
sortSeq: jumpCreateTime,
|
||||
isSend: null,
|
||||
senderUsername: null,
|
||||
parsedContent: '',
|
||||
rawContent: ''
|
||||
}
|
||||
handleInSessionResultJump(messageStub)
|
||||
pendingFootprintJumpRef.current = null
|
||||
navigate('/chat', { replace: true })
|
||||
return
|
||||
}
|
||||
|
||||
pendingFootprintJumpRef.current = null
|
||||
if (currentSessionId !== urlSessionId) {
|
||||
selectSessionById(urlSessionId)
|
||||
}
|
||||
// 选中后清除URL参数,避免影响后续用户手动切换会话
|
||||
navigate('/chat', { replace: true })
|
||||
}, [standaloneSessionWindow, location.search, isConnected, isConnecting, currentSessionId, selectSessionById, navigate])
|
||||
}, [
|
||||
standaloneSessionWindow,
|
||||
location.search,
|
||||
isConnected,
|
||||
isConnecting,
|
||||
currentSessionId,
|
||||
selectSessionById,
|
||||
handleInSessionResultJump,
|
||||
navigate
|
||||
])
|
||||
|
||||
useEffect(() => {
|
||||
const pending = pendingFootprintJumpRef.current
|
||||
if (!pending) return
|
||||
if (!isConnected || isConnecting) return
|
||||
if (currentSessionId !== pending.sessionId) return
|
||||
|
||||
const messageStub: Message = {
|
||||
messageKey: `footprint:${pending.sessionId}:${pending.createTime}:${pending.localId}`,
|
||||
localId: pending.localId,
|
||||
serverId: 0,
|
||||
localType: 0,
|
||||
createTime: pending.createTime,
|
||||
sortSeq: pending.createTime,
|
||||
isSend: null,
|
||||
senderUsername: null,
|
||||
parsedContent: '',
|
||||
rawContent: ''
|
||||
}
|
||||
handleInSessionResultJump(messageStub)
|
||||
pendingFootprintJumpRef.current = null
|
||||
navigate('/chat', { replace: true })
|
||||
}, [isConnected, isConnecting, currentSessionId, handleInSessionResultJump, navigate])
|
||||
|
||||
useEffect(() => {
|
||||
if (!standaloneSessionWindow || !normalizedInitialSessionId) return
|
||||
|
||||
789
src/pages/MyFootprintPage.scss
Normal file
789
src/pages/MyFootprintPage.scss
Normal file
@@ -0,0 +1,789 @@
|
||||
.my-footprint-page {
|
||||
--timeline-mention: #f59e0b; /* muted orange */
|
||||
--timeline-private: #3b82f6; /* muted blue */
|
||||
|
||||
min-height: 100%;
|
||||
margin: -24px -24px 0;
|
||||
padding: 32px 40px;
|
||||
background: var(--bg-primary); /* Pure minimal background */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
animation: footprintPageEnter 0.4s ease-out;
|
||||
|
||||
.card-surface {
|
||||
/* Removing border and strong shadows, just subtle background if any */
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.spin {
|
||||
animation: footprintSpin 1s linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.footprint-header {
|
||||
position: relative;
|
||||
z-index: 30;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
padding: 10px 0 20px 0;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--border-color) 40%, transparent);
|
||||
animation: footprintFadeSlideUp 0.3s ease both;
|
||||
}
|
||||
|
||||
.footprint-title-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
letter-spacing: -0.3px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: var(--text-tertiary);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.footprint-title-badge {
|
||||
display: none; /* Removed for minimal design */
|
||||
}
|
||||
|
||||
.footprint-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.range-preset-group {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 8%, transparent);
|
||||
padding: 4px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.preset-chip {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
border-radius: 6px;
|
||||
padding: 6px 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-primary);
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
||||
}
|
||||
}
|
||||
|
||||
.custom-range-row {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
|
||||
span {
|
||||
color: var(--text-tertiary);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
input[type="date"] {
|
||||
font-family: inherit;
|
||||
border: 1px solid transparent;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 6%, transparent);
|
||||
color: var(--text-primary);
|
||||
border-radius: 8px;
|
||||
padding: 6px 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--text-tertiary) 12%, transparent);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
background: color-mix(in srgb, var(--primary) 4%, transparent);
|
||||
border-color: color-mix(in srgb, var(--primary) 30%, transparent);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
&::-webkit-calendar-picker-indicator {
|
||||
cursor: pointer;
|
||||
opacity: 0.5;
|
||||
transition: all 0.2s ease;
|
||||
padding: 4px;
|
||||
margin-left: 4px;
|
||||
margin-right: -4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
&::-webkit-calendar-picker-indicator:hover {
|
||||
opacity: 0.9;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 12%, transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border: none;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 8%, transparent);
|
||||
border-radius: 8px;
|
||||
padding: 8px 12px;
|
||||
color: var(--text-tertiary);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:focus-within {
|
||||
background: color-mix(in srgb, var(--primary) 8%, transparent);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
input {
|
||||
min-width: 180px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
|
||||
&::placeholder {
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.action-btn,
|
||||
.jump-btn {
|
||||
border: none;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 8%, transparent);
|
||||
color: var(--text-secondary);
|
||||
border-radius: 8px;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--text-tertiary) 15%, transparent);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.kpi-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 20px;
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--border-color) 40%, transparent);
|
||||
}
|
||||
|
||||
.kpi-card {
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
text-align: left;
|
||||
color: var(--text-primary);
|
||||
animation: footprintKpiIn 0.3s ease both;
|
||||
transition: opacity 0.2s ease;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-size: 32px;
|
||||
font-weight: 300;
|
||||
line-height: 1;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
small {
|
||||
color: var(--text-tertiary);
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.kpi-icon {
|
||||
display: none; /* Minimalistic, hide icon in KPI */
|
||||
}
|
||||
|
||||
.kpi-label {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.kpi-diagnostics {
|
||||
cursor: default;
|
||||
&:hover { opacity: 1; }
|
||||
border-left: 1px solid color-mix(in srgb, var(--border-color) 40%, transparent);
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.footprint-timeline {
|
||||
animation: timelineSwitchFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
|
||||
--timeline-time-col-width: 64px;
|
||||
--timeline-dot-col-width: 20px;
|
||||
--timeline-gap: 24px;
|
||||
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
padding: 10px 0;
|
||||
|
||||
&.timeline-time-month_day_clock {
|
||||
--timeline-time-col-width: 86px;
|
||||
}
|
||||
|
||||
&.timeline-time-full_date_clock {
|
||||
--timeline-time-col-width: 124px;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.timeline-head-left h2 {
|
||||
display: none; /* the minimalist approach relies on content, we skip this redundant title */
|
||||
}
|
||||
|
||||
.timeline-head-left p {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.timeline-mode-row {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 6%, transparent);
|
||||
padding: 3px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.timeline-mode-chip {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-primary);
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-stream {
|
||||
position: relative;
|
||||
padding-bottom: 40px;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: calc(var(--timeline-time-col-width) + var(--timeline-gap) + 9px);
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 2px;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 20%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
display: grid;
|
||||
grid-template-columns: var(--timeline-time-col-width) var(--timeline-dot-col-width) minmax(0, 1fr);
|
||||
column-gap: var(--timeline-gap);
|
||||
align-items: stretch;
|
||||
margin-bottom: 38px;
|
||||
}
|
||||
|
||||
.timeline-time {
|
||||
font-size: 13px;
|
||||
color: var(--text-tertiary);
|
||||
text-align: right;
|
||||
padding-top: 5px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.timeline-time-private {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.timeline-time-range {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.timeline-time-main,
|
||||
.timeline-time-end {
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.timeline-time-sep {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.timeline-dot-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 9px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--text-tertiary);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.timeline-dot-mention {
|
||||
background: var(--timeline-mention);
|
||||
}
|
||||
|
||||
.timeline-dot-private {
|
||||
background: var(--timeline-private);
|
||||
}
|
||||
|
||||
.timeline-dot-private-inbound_only {
|
||||
background: var(--timeline-mention);
|
||||
border: none;
|
||||
}
|
||||
|
||||
.timeline-dot-private-outbound_only {
|
||||
background: #22c55e;
|
||||
}
|
||||
|
||||
.timeline-dot-private-both {
|
||||
background: var(--timeline-private);
|
||||
}
|
||||
|
||||
.timeline-dot-start,
|
||||
.timeline-dot-end {
|
||||
background: transparent;
|
||||
border: 1.5px solid var(--text-tertiary);
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.timeline-dot-range {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.timeline-dot-range-line {
|
||||
width: 2px;
|
||||
flex: 1;
|
||||
margin: 4px 0;
|
||||
background: color-mix(in srgb, var(--timeline-private) 30%, transparent);
|
||||
}
|
||||
|
||||
.timeline-dot-range-line-inbound_only {
|
||||
background: color-mix(in srgb, var(--timeline-mention) 55%, transparent);
|
||||
}
|
||||
|
||||
.timeline-dot-range-line-outbound_only {
|
||||
background: #22c55e;
|
||||
}
|
||||
|
||||
.timeline-dot-range-line-both {
|
||||
background: color-mix(in srgb, var(--timeline-private) 55%, transparent);
|
||||
}
|
||||
|
||||
.timeline-content-wrap {
|
||||
padding-top: 2px;
|
||||
padding-bottom: 6px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.timeline-boundary {
|
||||
font-size: 13px;
|
||||
color: var(--text-tertiary);
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.timeline-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
|
||||
/* completely clean out the old card style */
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.timeline-card-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.timeline-identity {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.timeline-avatar {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%; /* Modern circle avatars */
|
||||
overflow: hidden;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 10%, transparent);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-tertiary);
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-avatar-private {
|
||||
color: var(--timeline-private);
|
||||
}
|
||||
|
||||
.timeline-title-group {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.timeline-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.timeline-subtitle {
|
||||
font-size: 13px;
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
|
||||
.timeline-right-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.timeline-count-badge {
|
||||
font-size: 12px;
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
|
||||
.timeline-jump-btn {
|
||||
padding: 4px 10px;
|
||||
font-size: 12px;
|
||||
background: transparent;
|
||||
color: var(--text-tertiary);
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--text-tertiary) 10%, transparent);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-message {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--text-secondary);
|
||||
padding: 0;
|
||||
margin-top: 4px;
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.mention-message {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.private-message {
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
|
||||
@keyframes timelineSwitchFade {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(12px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.mention-token {
|
||||
color: var(--timeline-mention);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.panel-empty-state {
|
||||
text-align: center;
|
||||
padding: 60px 0;
|
||||
color: var(--text-tertiary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.footprint-loading {
|
||||
padding: 40px 0;
|
||||
}
|
||||
|
||||
.kpi-skeleton-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.kpi-skeleton-card {
|
||||
height: 60px;
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 6%, transparent);
|
||||
}
|
||||
|
||||
.timeline-skeleton-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.timeline-skeleton-item {
|
||||
height: 80px;
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--text-tertiary) 6%, transparent);
|
||||
}
|
||||
|
||||
.footprint-export-modal-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1200;
|
||||
background: color-mix(in srgb, #000 36%, transparent);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.footprint-export-modal {
|
||||
width: min(520px, 100%);
|
||||
border-radius: 16px;
|
||||
background: var(--bg-primary);
|
||||
border: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent);
|
||||
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
|
||||
padding: 22px 22px 18px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
animation: footprintFadeSlideUp 0.2s ease both;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.export-modal-icon {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 10px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.export-modal-icon-progress {
|
||||
color: var(--primary);
|
||||
background: color-mix(in srgb, var(--primary) 16%, transparent);
|
||||
}
|
||||
|
||||
.export-modal-icon-success {
|
||||
color: #16a34a;
|
||||
background: color-mix(in srgb, #16a34a 18%, transparent);
|
||||
}
|
||||
|
||||
.export-modal-icon-error {
|
||||
color: #ef4444;
|
||||
background: color-mix(in srgb, #ef4444 18%, transparent);
|
||||
}
|
||||
|
||||
.export-modal-path {
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
font-family: inherit;
|
||||
font-weight: 500;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
color: var(--text-tertiary);
|
||||
background: color-mix(in srgb, var(--text-tertiary) 8%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--border-color) 40%, transparent);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.export-modal-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.skeleton-shimmer {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
transparent,
|
||||
color-mix(in srgb, var(--bg-primary) 50%, transparent),
|
||||
transparent
|
||||
);
|
||||
transform: translateX(-100%);
|
||||
animation: footprintShimmer 1.5s infinite;
|
||||
}
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes footprintPageEnter {
|
||||
from { opacity: 0; transform: translateY(10px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes footprintFadeSlideUp {
|
||||
from { opacity: 0; transform: translateY(5px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes footprintKpiIn {
|
||||
from { opacity: 0; transform: translateY(8px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes footprintTimelineItemIn {
|
||||
from { opacity: 0; transform: translateY(10px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes footprintSpin {
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@keyframes footprintShimmer {
|
||||
100% { transform: translateX(100%); }
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.kpi-grid,
|
||||
.kpi-skeleton-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.my-footprint-page {
|
||||
padding: 20px;
|
||||
}
|
||||
.kpi-grid,
|
||||
.kpi-skeleton-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
931
src/pages/MyFootprintPage.tsx
Normal file
931
src/pages/MyFootprintPage.tsx
Normal file
@@ -0,0 +1,931 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { AlertCircle, AtSign, CheckCircle2, Download, MessageCircle, RefreshCw, Search, Users } from 'lucide-react'
|
||||
import DateRangePicker from '../components/DateRangePicker'
|
||||
import './MyFootprintPage.scss'
|
||||
|
||||
type RangePreset = 'today' | 'yesterday' | 'this_week' | 'last_week' | 'custom'
|
||||
type TimelineMode = 'all' | 'mention' | 'private'
|
||||
type TimelineTimeMode = 'clock' | 'month_day_clock' | 'full_date_clock'
|
||||
type PrivateDotVariant = 'both' | 'inbound_only' | 'outbound_only'
|
||||
type ExportModalStatus = 'idle' | 'progress' | 'success' | 'error'
|
||||
|
||||
interface MyFootprintSummary {
|
||||
private_inbound_people: number
|
||||
private_replied_people: number
|
||||
private_outbound_people: number
|
||||
private_reply_rate: number
|
||||
mention_count: number
|
||||
mention_group_count: number
|
||||
}
|
||||
|
||||
interface MyFootprintPrivateSession {
|
||||
session_id: string
|
||||
incoming_count: number
|
||||
outgoing_count: number
|
||||
replied: boolean
|
||||
first_incoming_ts: number
|
||||
first_reply_ts: number
|
||||
latest_ts: number
|
||||
anchor_local_id: number
|
||||
anchor_create_time: number
|
||||
displayName?: string
|
||||
avatarUrl?: string
|
||||
}
|
||||
|
||||
interface MyFootprintPrivateSegment {
|
||||
session_id: string
|
||||
segment_index: number
|
||||
start_ts: number
|
||||
end_ts: number
|
||||
duration_sec: number
|
||||
incoming_count: number
|
||||
outgoing_count: number
|
||||
message_count: number
|
||||
replied: boolean
|
||||
first_incoming_ts: number
|
||||
first_reply_ts: number
|
||||
latest_ts: number
|
||||
anchor_local_id: number
|
||||
anchor_create_time: number
|
||||
displayName?: string
|
||||
avatarUrl?: string
|
||||
}
|
||||
|
||||
interface MyFootprintMention {
|
||||
session_id: string
|
||||
local_id: number
|
||||
create_time: number
|
||||
sender_username: string
|
||||
message_content: string
|
||||
source: string
|
||||
sessionDisplayName?: string
|
||||
senderDisplayName?: string
|
||||
senderAvatarUrl?: string
|
||||
}
|
||||
|
||||
interface MyFootprintMentionGroup {
|
||||
session_id: string
|
||||
count: number
|
||||
latest_ts: number
|
||||
displayName?: string
|
||||
avatarUrl?: string
|
||||
}
|
||||
|
||||
interface MyFootprintDiagnostics {
|
||||
truncated: boolean
|
||||
scanned_dbs: number
|
||||
elapsed_ms: number
|
||||
mention_truncated?: boolean
|
||||
private_truncated?: boolean
|
||||
}
|
||||
|
||||
interface MyFootprintData {
|
||||
summary: MyFootprintSummary
|
||||
private_sessions: MyFootprintPrivateSession[]
|
||||
private_segments: MyFootprintPrivateSegment[]
|
||||
mentions: MyFootprintMention[]
|
||||
mention_groups: MyFootprintMentionGroup[]
|
||||
diagnostics: MyFootprintDiagnostics
|
||||
}
|
||||
|
||||
interface TimelineBoundaryItem {
|
||||
kind: 'boundary'
|
||||
edge: 'start' | 'end'
|
||||
key: string
|
||||
time: number
|
||||
label: string
|
||||
}
|
||||
|
||||
interface TimelineMentionItem {
|
||||
kind: 'mention'
|
||||
key: string
|
||||
time: number
|
||||
sessionId: string
|
||||
localId: number
|
||||
createTime: number
|
||||
groupName: string
|
||||
groupAvatarUrl?: string
|
||||
senderName: string
|
||||
messageContent: string
|
||||
}
|
||||
|
||||
interface TimelinePrivateItem {
|
||||
kind: 'private'
|
||||
key: string
|
||||
time: number
|
||||
endTime: number
|
||||
sessionId: string
|
||||
anchorLocalId: number
|
||||
anchorCreateTime: number
|
||||
displayName: string
|
||||
avatarUrl?: string
|
||||
subtitle: string
|
||||
totalInteractions: number
|
||||
summaryText: string
|
||||
dotVariant: PrivateDotVariant
|
||||
isRange: boolean
|
||||
}
|
||||
|
||||
type TimelineItem = TimelineBoundaryItem | TimelineMentionItem | TimelinePrivateItem
|
||||
|
||||
const EMPTY_DATA: MyFootprintData = {
|
||||
summary: {
|
||||
private_inbound_people: 0,
|
||||
private_replied_people: 0,
|
||||
private_outbound_people: 0,
|
||||
private_reply_rate: 0,
|
||||
mention_count: 0,
|
||||
mention_group_count: 0
|
||||
},
|
||||
private_sessions: [],
|
||||
private_segments: [],
|
||||
mentions: [],
|
||||
mention_groups: [],
|
||||
diagnostics: {
|
||||
truncated: false,
|
||||
scanned_dbs: 0,
|
||||
elapsed_ms: 0,
|
||||
mention_truncated: false,
|
||||
private_truncated: false
|
||||
}
|
||||
}
|
||||
|
||||
function toDayStart(date: Date): Date {
|
||||
const next = new Date(date)
|
||||
next.setHours(0, 0, 0, 0)
|
||||
return next
|
||||
}
|
||||
|
||||
function toDayEnd(date: Date): Date {
|
||||
const next = new Date(date)
|
||||
next.setHours(23, 59, 59, 999)
|
||||
return next
|
||||
}
|
||||
|
||||
function toSeconds(date: Date): number {
|
||||
return Math.floor(date.getTime() / 1000)
|
||||
}
|
||||
|
||||
function toDateInputValue(date: Date): string {
|
||||
const y = date.getFullYear()
|
||||
const m = `${date.getMonth() + 1}`.padStart(2, '0')
|
||||
const d = `${date.getDate()}`.padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
|
||||
function getWeekStart(date: Date): Date {
|
||||
const base = toDayStart(date)
|
||||
const day = base.getDay()
|
||||
const diff = day === 0 ? -6 : 1 - day
|
||||
base.setDate(base.getDate() + diff)
|
||||
return base
|
||||
}
|
||||
|
||||
function formatTimelineMoment(seconds: number, mode: TimelineTimeMode): string {
|
||||
if (!seconds || !Number.isFinite(seconds)) return '--'
|
||||
const date = new Date(seconds * 1000)
|
||||
const yyyy = `${date.getFullYear()}`
|
||||
const mm = `${date.getMonth() + 1}`.padStart(2, '0')
|
||||
const dd = `${date.getDate()}`.padStart(2, '0')
|
||||
const hh = `${date.getHours()}`.padStart(2, '0')
|
||||
const min = `${date.getMinutes()}`.padStart(2, '0')
|
||||
if (mode === 'full_date_clock') {
|
||||
return `${yyyy}-${mm}-${dd} ${hh}:${min}`
|
||||
}
|
||||
if (mode === 'month_day_clock') {
|
||||
return `${mm}-${dd} ${hh}:${min}`
|
||||
}
|
||||
return `${hh}:${min}`
|
||||
}
|
||||
|
||||
function formatPercent(value: number): string {
|
||||
const safe = Number.isFinite(value) ? value : 0
|
||||
return `${(safe * 100).toFixed(1)}%`
|
||||
}
|
||||
|
||||
function decodeHtmlEntities(content: string): string {
|
||||
return String(content || '')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, "'")
|
||||
}
|
||||
|
||||
function stripGroupSenderPrefix(content: string): string {
|
||||
return String(content || '')
|
||||
.replace(/^[\s]*([a-zA-Z0-9_@-]+):(?!\/\/)(?:\s*(?:\r?\n|<br\s*\/?>)\s*|\s*)/i, '')
|
||||
.replace(/^[a-zA-Z0-9]+@openim:\n?/i, '')
|
||||
}
|
||||
|
||||
function normalizeFootprintMessageContent(content: string): string {
|
||||
const decoded = decodeHtmlEntities(content || '')
|
||||
const stripped = stripGroupSenderPrefix(decoded)
|
||||
return stripped.trim()
|
||||
}
|
||||
|
||||
function renderMentionContent(content: string): ReactNode {
|
||||
const normalized = String(content || '').trim() || '[空消息]'
|
||||
const parts = normalized.split(/(@我|@我)/g)
|
||||
if (parts.length <= 1) return normalized
|
||||
return parts.map((part, index) => {
|
||||
if (part === '@我' || part === '@我') {
|
||||
return (
|
||||
<span key={index} className="mention-token">
|
||||
{part}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return <span key={index}>{part}</span>
|
||||
})
|
||||
}
|
||||
|
||||
function formatDurationLabel(beginTimestamp: number, endTimestamp: number): string {
|
||||
if (!beginTimestamp || !endTimestamp || endTimestamp <= beginTimestamp) {
|
||||
return '持续不足 1 分钟'
|
||||
}
|
||||
const minutes = Math.max(1, Math.round((endTimestamp - beginTimestamp) / 60))
|
||||
return `持续 ${minutes} 分钟`
|
||||
}
|
||||
|
||||
function resolveRangePresetLabel(preset: RangePreset): string {
|
||||
switch (preset) {
|
||||
case 'today':
|
||||
return '今天'
|
||||
case 'yesterday':
|
||||
return '昨天'
|
||||
case 'this_week':
|
||||
return '本周'
|
||||
case 'last_week':
|
||||
return '上周'
|
||||
default:
|
||||
return '自定义'
|
||||
}
|
||||
}
|
||||
|
||||
function buildRange(preset: RangePreset, customStart: string, customEnd: string): { begin: number; end: number; label: string } {
|
||||
const now = new Date()
|
||||
|
||||
if (preset === 'today') {
|
||||
return {
|
||||
begin: toSeconds(toDayStart(now)),
|
||||
end: toSeconds(now),
|
||||
label: '今天'
|
||||
}
|
||||
}
|
||||
|
||||
if (preset === 'yesterday') {
|
||||
const yesterday = new Date(now)
|
||||
yesterday.setDate(yesterday.getDate() - 1)
|
||||
return {
|
||||
begin: toSeconds(toDayStart(yesterday)),
|
||||
end: toSeconds(toDayEnd(yesterday)),
|
||||
label: '昨天'
|
||||
}
|
||||
}
|
||||
|
||||
if (preset === 'this_week') {
|
||||
const weekStart = getWeekStart(now)
|
||||
const weekEnd = new Date(weekStart)
|
||||
weekEnd.setDate(weekStart.getDate() + 6)
|
||||
return {
|
||||
begin: toSeconds(toDayStart(weekStart)),
|
||||
end: toSeconds(toDayEnd(weekEnd)),
|
||||
label: '本周'
|
||||
}
|
||||
}
|
||||
|
||||
if (preset === 'last_week') {
|
||||
const thisWeekStart = getWeekStart(now)
|
||||
const lastWeekStart = new Date(thisWeekStart)
|
||||
lastWeekStart.setDate(lastWeekStart.getDate() - 7)
|
||||
const lastWeekEnd = new Date(thisWeekStart)
|
||||
lastWeekEnd.setDate(lastWeekEnd.getDate() - 1)
|
||||
return {
|
||||
begin: toSeconds(toDayStart(lastWeekStart)),
|
||||
end: toSeconds(toDayEnd(lastWeekEnd)),
|
||||
label: '上周'
|
||||
}
|
||||
}
|
||||
|
||||
const customStartDate = customStart ? new Date(`${customStart}T00:00:00`) : toDayStart(now)
|
||||
const customEndDate = customEnd ? new Date(`${customEnd}T23:59:59`) : toDayEnd(now)
|
||||
const begin = toSeconds(customStartDate)
|
||||
const end = Math.max(begin, toSeconds(customEndDate))
|
||||
|
||||
return {
|
||||
begin,
|
||||
end,
|
||||
label: `${toDateInputValue(customStartDate)} 至 ${toDateInputValue(customEndDate)}`
|
||||
}
|
||||
}
|
||||
|
||||
function MyFootprintPage() {
|
||||
const navigate = useNavigate()
|
||||
const [preset, setPreset] = useState<RangePreset>('today')
|
||||
const [customStartDate, setCustomStartDate] = useState(() => toDateInputValue(toDayStart(new Date())))
|
||||
const [customEndDate, setCustomEndDate] = useState(() => toDateInputValue(toDayStart(new Date())))
|
||||
const [searchKeyword, setSearchKeyword] = useState('')
|
||||
const [timelineMode, setTimelineMode] = useState<TimelineMode>('all')
|
||||
const [data, setData] = useState<MyFootprintData>(EMPTY_DATA)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [exporting, setExporting] = useState(false)
|
||||
const [exportModalStatus, setExportModalStatus] = useState<ExportModalStatus>('idle')
|
||||
const [exportModalTitle, setExportModalTitle] = useState('')
|
||||
const [exportModalDescription, setExportModalDescription] = useState('')
|
||||
const [exportModalPath, setExportModalPath] = useState('')
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const inflightRangeKeyRef = useRef<string | null>(null)
|
||||
|
||||
const currentRange = useMemo(() => buildRange(preset, customStartDate, customEndDate), [preset, customStartDate, customEndDate])
|
||||
const timelineTimeMode = useMemo<TimelineTimeMode>(() => {
|
||||
const span = Math.max(0, currentRange.end - currentRange.begin)
|
||||
if (span > 365 * 24 * 60 * 60) return 'full_date_clock'
|
||||
if (span > 24 * 60 * 60) return 'month_day_clock'
|
||||
return 'clock'
|
||||
}, [currentRange.begin, currentRange.end])
|
||||
|
||||
const handleJump = useCallback((sessionId: string, localId: number, createTime: number) => {
|
||||
if (!sessionId || !localId || !createTime) return
|
||||
const query = new URLSearchParams({
|
||||
sessionId,
|
||||
jumpLocalId: String(localId),
|
||||
jumpCreateTime: String(createTime),
|
||||
jumpSource: 'footprint'
|
||||
})
|
||||
navigate(`/chat?${query.toString()}`)
|
||||
}, [navigate])
|
||||
|
||||
const loadData = useCallback(async () => {
|
||||
const rangeKey = `${currentRange.begin}-${currentRange.end}`
|
||||
if (inflightRangeKeyRef.current === rangeKey) {
|
||||
return
|
||||
}
|
||||
inflightRangeKeyRef.current = rangeKey
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const result = await window.electronAPI.chat.getMyFootprintStats(currentRange.begin, currentRange.end)
|
||||
if (!result.success || !result.data) {
|
||||
setError(result.error || '读取统计失败')
|
||||
setData(EMPTY_DATA)
|
||||
return
|
||||
}
|
||||
setData({
|
||||
...result.data,
|
||||
private_segments: Array.isArray(result.data.private_segments) ? result.data.private_segments : []
|
||||
})
|
||||
} catch (loadError) {
|
||||
setError(String(loadError))
|
||||
setData(EMPTY_DATA)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
if (inflightRangeKeyRef.current === rangeKey) {
|
||||
inflightRangeKeyRef.current = null
|
||||
}
|
||||
}
|
||||
}, [currentRange.begin, currentRange.end])
|
||||
|
||||
useEffect(() => {
|
||||
void loadData()
|
||||
}, [loadData])
|
||||
|
||||
const keyword = searchKeyword.trim().toLowerCase()
|
||||
|
||||
const privateSessionMetaMap = useMemo(() => {
|
||||
const map = new Map<string, { displayName?: string; avatarUrl?: string }>()
|
||||
for (const item of data.private_sessions) {
|
||||
map.set(item.session_id, {
|
||||
displayName: item.displayName,
|
||||
avatarUrl: item.avatarUrl
|
||||
})
|
||||
}
|
||||
for (const item of data.private_segments) {
|
||||
if (!map.has(item.session_id)) {
|
||||
map.set(item.session_id, {
|
||||
displayName: item.displayName,
|
||||
avatarUrl: item.avatarUrl
|
||||
})
|
||||
}
|
||||
}
|
||||
return map
|
||||
}, [data.private_sessions, data.private_segments])
|
||||
|
||||
const filteredMentions = useMemo(() => {
|
||||
if (!keyword) return data.mentions
|
||||
return data.mentions.filter((item) => {
|
||||
const sessionName = (item.sessionDisplayName || '').toLowerCase()
|
||||
const senderName = (item.senderDisplayName || '').toLowerCase()
|
||||
const sender = item.sender_username.toLowerCase()
|
||||
const content = normalizeFootprintMessageContent(item.message_content).toLowerCase()
|
||||
return sessionName.includes(keyword) || senderName.includes(keyword) || sender.includes(keyword) || content.includes(keyword)
|
||||
})
|
||||
}, [data.mentions, keyword])
|
||||
|
||||
const filteredPrivateSegments = useMemo(() => {
|
||||
const rawSegments = data.private_segments.length > 0
|
||||
? data.private_segments
|
||||
: data.private_sessions.map((item, index) => ({
|
||||
session_id: item.session_id,
|
||||
segment_index: index + 1,
|
||||
start_ts: item.first_incoming_ts > 0
|
||||
? item.first_incoming_ts
|
||||
: item.first_reply_ts > 0
|
||||
? item.first_reply_ts
|
||||
: item.latest_ts,
|
||||
end_ts: item.latest_ts,
|
||||
duration_sec: Math.max(0, item.latest_ts - (item.first_incoming_ts || item.first_reply_ts || item.latest_ts)),
|
||||
incoming_count: item.incoming_count,
|
||||
outgoing_count: item.outgoing_count,
|
||||
message_count: Math.max(0, item.incoming_count + item.outgoing_count),
|
||||
replied: item.replied,
|
||||
first_incoming_ts: item.first_incoming_ts,
|
||||
first_reply_ts: item.first_reply_ts,
|
||||
latest_ts: item.latest_ts,
|
||||
anchor_local_id: item.anchor_local_id,
|
||||
anchor_create_time: item.anchor_create_time,
|
||||
displayName: item.displayName,
|
||||
avatarUrl: item.avatarUrl
|
||||
}))
|
||||
|
||||
if (!keyword) return rawSegments
|
||||
return rawSegments.filter((item) => {
|
||||
const meta = privateSessionMetaMap.get(item.session_id)
|
||||
const name = String(item.displayName || meta?.displayName || '').toLowerCase()
|
||||
const id = item.session_id.toLowerCase()
|
||||
return name.includes(keyword) || id.includes(keyword)
|
||||
})
|
||||
}, [data.private_segments, data.private_sessions, keyword, privateSessionMetaMap])
|
||||
|
||||
const mentionGroupMetaMap = useMemo(() => {
|
||||
const map = new Map<string, { displayName?: string; avatarUrl?: string }>()
|
||||
for (const item of data.mention_groups) {
|
||||
map.set(item.session_id, { displayName: item.displayName, avatarUrl: item.avatarUrl })
|
||||
}
|
||||
for (const item of data.private_sessions) {
|
||||
if (!map.has(item.session_id)) {
|
||||
map.set(item.session_id, { displayName: item.displayName, avatarUrl: item.avatarUrl })
|
||||
}
|
||||
}
|
||||
return map
|
||||
}, [data.mention_groups, data.private_sessions])
|
||||
|
||||
const mentionTimelineItems = useMemo<TimelineMentionItem[]>(() => {
|
||||
return filteredMentions
|
||||
.filter((item) => item.create_time > 0)
|
||||
.map((item) => {
|
||||
const groupMeta = mentionGroupMetaMap.get(item.session_id)
|
||||
return {
|
||||
kind: 'mention' as const,
|
||||
key: `mention:${item.session_id}:${item.local_id}`,
|
||||
time: item.create_time,
|
||||
sessionId: item.session_id,
|
||||
localId: item.local_id,
|
||||
createTime: item.create_time,
|
||||
groupName: item.sessionDisplayName || groupMeta?.displayName || item.session_id,
|
||||
groupAvatarUrl: groupMeta?.avatarUrl,
|
||||
senderName: item.senderDisplayName || item.sender_username || '未知',
|
||||
messageContent: normalizeFootprintMessageContent(item.message_content)
|
||||
}
|
||||
})
|
||||
}, [filteredMentions, mentionGroupMetaMap])
|
||||
|
||||
const privateTimelineItems = useMemo<TimelinePrivateItem[]>(() => {
|
||||
return filteredPrivateSegments
|
||||
.map((item) => {
|
||||
const startTime = item.start_ts > 0
|
||||
? item.start_ts
|
||||
: item.first_incoming_ts > 0
|
||||
? item.first_incoming_ts
|
||||
: item.first_reply_ts > 0
|
||||
? item.first_reply_ts
|
||||
: item.latest_ts
|
||||
|
||||
const endTime = item.end_ts > 0 ? item.end_ts : item.latest_ts
|
||||
const isRange = endTime > startTime + 60
|
||||
const totalInteractions = Math.max(0, item.message_count || (item.incoming_count + item.outgoing_count))
|
||||
const durationLabel = item.duration_sec > 0
|
||||
? `持续 ${Math.max(1, Math.round(item.duration_sec / 60))} 分钟`
|
||||
: formatDurationLabel(startTime, endTime)
|
||||
const subtitle = isRange
|
||||
? `${formatTimelineMoment(startTime, timelineTimeMode)} 至 ${formatTimelineMoment(endTime || startTime, timelineTimeMode)} · ${durationLabel}`
|
||||
: ''
|
||||
const summaryText = `收到 ${item.incoming_count} 条 / 发送 ${item.outgoing_count} 条${item.replied ? ' · 已回复' : ''}`
|
||||
const sessionMeta = privateSessionMetaMap.get(item.session_id)
|
||||
let dotVariant: PrivateDotVariant = 'both'
|
||||
if (item.incoming_count > 0 && item.outgoing_count === 0) {
|
||||
dotVariant = 'inbound_only'
|
||||
} else if (item.incoming_count === 0 && item.outgoing_count > 0) {
|
||||
dotVariant = 'outbound_only'
|
||||
}
|
||||
|
||||
return {
|
||||
kind: 'private' as const,
|
||||
key: `private:${item.session_id}:${item.segment_index}:${item.start_ts}`,
|
||||
time: startTime,
|
||||
endTime,
|
||||
sessionId: item.session_id,
|
||||
anchorLocalId: item.anchor_local_id,
|
||||
anchorCreateTime: item.anchor_create_time,
|
||||
displayName: item.displayName || sessionMeta?.displayName || item.session_id,
|
||||
avatarUrl: item.avatarUrl || sessionMeta?.avatarUrl,
|
||||
subtitle,
|
||||
totalInteractions,
|
||||
summaryText,
|
||||
dotVariant,
|
||||
isRange
|
||||
}
|
||||
})
|
||||
.filter((item) => item.time > 0)
|
||||
}, [filteredPrivateSegments, privateSessionMetaMap, timelineTimeMode])
|
||||
|
||||
const timelineItems = useMemo<TimelineItem[]>(() => {
|
||||
const events: TimelineItem[] = []
|
||||
if (timelineMode !== 'private') {
|
||||
events.push(...mentionTimelineItems)
|
||||
}
|
||||
if (timelineMode !== 'mention') {
|
||||
events.push(...privateTimelineItems)
|
||||
}
|
||||
|
||||
events.sort((a, b) => {
|
||||
if (a.time !== b.time) return a.time - b.time
|
||||
const rankA = a.kind === 'mention' ? 0 : a.kind === 'private' ? 1 : 2
|
||||
const rankB = b.kind === 'mention' ? 0 : b.kind === 'private' ? 1 : 2
|
||||
return rankA - rankB
|
||||
})
|
||||
|
||||
const presetLabel = resolveRangePresetLabel(preset)
|
||||
const startNode: TimelineBoundaryItem = {
|
||||
kind: 'boundary',
|
||||
edge: 'start',
|
||||
key: 'boundary:start',
|
||||
time: currentRange.begin,
|
||||
label: `区域时间开始(${presetLabel})`
|
||||
}
|
||||
|
||||
const endNode: TimelineBoundaryItem = {
|
||||
kind: 'boundary',
|
||||
edge: 'end',
|
||||
key: 'boundary:end',
|
||||
time: currentRange.end,
|
||||
label: `区域时间结束(${preset === 'today' ? '现在' : presetLabel})`
|
||||
}
|
||||
|
||||
return [startNode, ...events, endNode]
|
||||
}, [timelineMode, mentionTimelineItems, privateTimelineItems, currentRange.begin, currentRange.end, preset])
|
||||
|
||||
const timelineEventCount = useMemo(
|
||||
() => timelineItems.filter((item) => item.kind !== 'boundary').length,
|
||||
[timelineItems]
|
||||
)
|
||||
|
||||
const handleExport = useCallback(async (format: 'csv' | 'json') => {
|
||||
try {
|
||||
setExporting(true)
|
||||
setExportModalStatus('progress')
|
||||
setExportModalTitle(`正在准备导出 ${format.toUpperCase()}`)
|
||||
setExportModalDescription('正在准备文件保存信息...')
|
||||
setExportModalPath('')
|
||||
const downloadsPath = await window.electronAPI.app.getDownloadsPath()
|
||||
const separator = downloadsPath && downloadsPath.includes('\\') ? '\\' : '/'
|
||||
const rangeName = currentRange.label.replace(/[\\/:*?"<>|\s]+/g, '_')
|
||||
const suggestedName = `my_footprint_${rangeName}_${Date.now()}.${format}`
|
||||
const defaultPath = downloadsPath ? `${downloadsPath}${separator}${suggestedName}` : suggestedName
|
||||
|
||||
setExportModalDescription('请在弹窗中选择导出路径...')
|
||||
const saveResult = await window.electronAPI.dialog.saveFile({
|
||||
title: format === 'csv' ? '导出我的足迹 CSV' : '导出我的足迹 JSON',
|
||||
defaultPath,
|
||||
filters: format === 'csv'
|
||||
? [{ name: 'CSV', extensions: ['csv'] }]
|
||||
: [{ name: 'JSON', extensions: ['json'] }]
|
||||
})
|
||||
if (saveResult.canceled || !saveResult.filePath) {
|
||||
setExportModalStatus('idle')
|
||||
setExportModalTitle('')
|
||||
setExportModalDescription('')
|
||||
setExportModalPath('')
|
||||
return
|
||||
}
|
||||
|
||||
setExportModalDescription('正在导出数据,请稍候...')
|
||||
setExportModalPath(saveResult.filePath)
|
||||
const exportResult = await window.electronAPI.chat.exportMyFootprint(
|
||||
currentRange.begin,
|
||||
currentRange.end,
|
||||
format,
|
||||
saveResult.filePath
|
||||
)
|
||||
if (!exportResult.success) {
|
||||
setExportModalStatus('error')
|
||||
setExportModalTitle('导出失败')
|
||||
setExportModalDescription(exportResult.error || '未知错误')
|
||||
setExportModalPath(saveResult.filePath)
|
||||
return
|
||||
}
|
||||
setExportModalStatus('success')
|
||||
setExportModalTitle('导出完成')
|
||||
setExportModalDescription(`文件已成功导出为 ${format.toUpperCase()}。`)
|
||||
setExportModalPath(exportResult.filePath || saveResult.filePath)
|
||||
} catch (exportError) {
|
||||
setExportModalStatus('error')
|
||||
setExportModalTitle('导出失败')
|
||||
setExportModalDescription(String(exportError))
|
||||
} finally {
|
||||
setExporting(false)
|
||||
}
|
||||
}, [currentRange.begin, currentRange.end, currentRange.label])
|
||||
|
||||
return (
|
||||
<div className="my-footprint-page">
|
||||
<section className="footprint-header">
|
||||
<div className="footprint-title-wrap">
|
||||
<h1>我的微信足迹</h1>
|
||||
<p>范围:{currentRange.label}</p>
|
||||
</div>
|
||||
|
||||
<div className="footprint-toolbar">
|
||||
<div className="range-preset-group">
|
||||
{[
|
||||
{ value: 'today', label: '今天' },
|
||||
{ value: 'yesterday', label: '昨天' },
|
||||
{ value: 'this_week', label: '本周' },
|
||||
{ value: 'last_week', label: '上周' },
|
||||
{ value: 'custom', label: '自定义' }
|
||||
].map((item) => (
|
||||
<button
|
||||
key={item.value}
|
||||
type="button"
|
||||
className={`preset-chip ${preset === item.value ? 'active' : ''}`}
|
||||
onClick={() => setPreset(item.value as RangePreset)}
|
||||
>
|
||||
{item.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{preset === 'custom' && (
|
||||
<div className="custom-range-row">
|
||||
<DateRangePicker
|
||||
startDate={customStartDate}
|
||||
endDate={customEndDate}
|
||||
onStartDateChange={setCustomStartDate}
|
||||
onEndDateChange={setCustomEndDate}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="toolbar-actions">
|
||||
<div className="search-input">
|
||||
<Search size={15} />
|
||||
<input
|
||||
value={searchKeyword}
|
||||
onChange={(event) => setSearchKeyword(event.target.value)}
|
||||
placeholder="搜索联系人/群聊/内容"
|
||||
/>
|
||||
</div>
|
||||
<button type="button" className="action-btn" onClick={() => void loadData()} disabled={loading}>
|
||||
<RefreshCw size={15} className={loading ? 'spin' : ''} />
|
||||
<span>刷新</span>
|
||||
</button>
|
||||
<button type="button" className="action-btn" onClick={() => void handleExport('csv')} disabled={exporting || loading}>
|
||||
<Download size={15} />
|
||||
<span>导出 CSV</span>
|
||||
</button>
|
||||
<button type="button" className="action-btn" onClick={() => void handleExport('json')} disabled={exporting || loading}>
|
||||
<Download size={15} />
|
||||
<span>导出 JSON</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{loading ? (
|
||||
<section className="footprint-loading" aria-live="polite">
|
||||
<div className="kpi-skeleton-grid">
|
||||
{Array.from({ length: 4 }).map((_, index) => (
|
||||
<div key={index} className="kpi-skeleton-card skeleton-shimmer" />
|
||||
))}
|
||||
</div>
|
||||
<div className="timeline-skeleton-list">
|
||||
{Array.from({ length: 7 }).map((_, index) => (
|
||||
<div key={index} className="timeline-skeleton-item skeleton-shimmer" />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : error ? (
|
||||
<section className="footprint-error" role="alert">
|
||||
<h3>读取我的足迹失败</h3>
|
||||
<p>{error}</p>
|
||||
<button type="button" className="action-btn" onClick={() => void loadData()}>
|
||||
<RefreshCw size={15} />
|
||||
<span>重试</span>
|
||||
</button>
|
||||
</section>
|
||||
) : (
|
||||
<>
|
||||
<section className="kpi-grid">
|
||||
<button type="button" className="kpi-card" onClick={() => setTimelineMode('private')}>
|
||||
<span className="kpi-label">有聊天的人数</span>
|
||||
<strong>{data.summary.private_inbound_people}</strong>
|
||||
<small>回复了其中 {data.summary.private_replied_people} 人</small>
|
||||
</button>
|
||||
<button type="button" className="kpi-card" onClick={() => setTimelineMode('private')}>
|
||||
<span className="kpi-label">我有回复的人数</span>
|
||||
<strong>{data.summary.private_outbound_people}</strong>
|
||||
<small>回复率 {formatPercent(data.summary.private_reply_rate)}</small>
|
||||
</button>
|
||||
<button type="button" className="kpi-card" onClick={() => setTimelineMode('mention')}>
|
||||
<span className="kpi-label">@我次数</span>
|
||||
<strong>{data.summary.mention_count}</strong>
|
||||
<small>可点击查看原消息</small>
|
||||
</button>
|
||||
<button type="button" className="kpi-card" onClick={() => setTimelineMode('mention')}>
|
||||
<span className="kpi-label">涉及群聊</span>
|
||||
<strong>{data.summary.mention_group_count}</strong>
|
||||
<small>按群聚合 @我消息</small>
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section
|
||||
className={`footprint-timeline timeline-time-${timelineTimeMode}`}
|
||||
key={`${timelineMode}:${currentRange.begin}:${currentRange.end}`}
|
||||
>
|
||||
<div className="timeline-head">
|
||||
<div className="timeline-head-left">
|
||||
<h2>联络时间线</h2>
|
||||
<p>最上方是时间区间开始,最下方是时间区间终点,中间按时间展示群聊 @我 与私聊分段会话节点。</p>
|
||||
</div>
|
||||
<div className="timeline-mode-row">
|
||||
<button
|
||||
type="button"
|
||||
className={`timeline-mode-chip ${timelineMode === 'all' ? 'active' : ''}`}
|
||||
onClick={() => setTimelineMode('all')}
|
||||
>
|
||||
全部 {timelineEventCount}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`timeline-mode-chip ${timelineMode === 'mention' ? 'active' : ''}`}
|
||||
onClick={() => setTimelineMode('mention')}
|
||||
>
|
||||
@我群聊 {mentionTimelineItems.length}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`timeline-mode-chip ${timelineMode === 'private' ? 'active' : ''}`}
|
||||
onClick={() => setTimelineMode('private')}
|
||||
>
|
||||
私聊 {privateTimelineItems.length}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{timelineEventCount === 0 ? (
|
||||
<div className="panel-empty-state">当前区间暂无联络事件,试试切换日期范围或清空关键词筛选。</div>
|
||||
) : (
|
||||
<div className="timeline-stream">
|
||||
{timelineItems.map((item, index) => (
|
||||
<div
|
||||
key={item.key}
|
||||
className={`timeline-item timeline-item-${item.kind}`}
|
||||
style={{ animationDelay: `${Math.min(index, 12) * 0.04}s` }}
|
||||
>
|
||||
<div className={`timeline-time timeline-time-${item.kind}`}>
|
||||
{item.kind === 'private' ? (
|
||||
<div className="timeline-time-range">
|
||||
<span className="timeline-time-main">{formatTimelineMoment(item.time, timelineTimeMode)}</span>
|
||||
{item.isRange && (
|
||||
<span className="timeline-time-end-wrap">
|
||||
<span className="timeline-time-end">{formatTimelineMoment(item.endTime, timelineTimeMode)}</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
formatTimelineMoment(item.time, timelineTimeMode)
|
||||
)}
|
||||
</div>
|
||||
<div className={`timeline-dot-col timeline-dot-col-${item.kind}`}>
|
||||
{item.kind === 'private' ? (
|
||||
<div className="timeline-dot-range">
|
||||
<div className={`timeline-dot timeline-dot-private timeline-dot-private-start timeline-dot-private-${item.dotVariant}`} />
|
||||
{item.isRange && (
|
||||
<>
|
||||
<div className={`timeline-dot-range-line timeline-dot-range-line-${item.dotVariant}`} />
|
||||
<div className={`timeline-dot timeline-dot-private timeline-dot-private-end timeline-dot-private-${item.dotVariant}`} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className={`timeline-dot timeline-dot-${item.kind}${item.kind === 'boundary' ? ` timeline-dot-${item.edge}` : ''}`} />
|
||||
)}
|
||||
</div>
|
||||
<div className="timeline-content-wrap">
|
||||
{item.kind === 'boundary' && (
|
||||
<div className={`timeline-boundary timeline-boundary-${item.edge}`}>{item.label}</div>
|
||||
)}
|
||||
|
||||
{item.kind === 'mention' && (
|
||||
<div className="timeline-card timeline-card-mention">
|
||||
<div className="timeline-card-head">
|
||||
<div className="timeline-identity">
|
||||
<div className="timeline-avatar">
|
||||
{item.groupAvatarUrl ? (
|
||||
<img src={item.groupAvatarUrl} alt={item.groupName} />
|
||||
) : (
|
||||
<Users size={16} />
|
||||
)}
|
||||
</div>
|
||||
<div className="timeline-title-group">
|
||||
<div className="timeline-title">{item.groupName}</div>
|
||||
<div className="timeline-subtitle">发送人:{item.senderName}</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="jump-btn timeline-jump-btn"
|
||||
onClick={() => handleJump(item.sessionId, item.localId, item.createTime)}
|
||||
>
|
||||
跳转
|
||||
</button>
|
||||
</div>
|
||||
<div className="timeline-message mention-message">{renderMentionContent(item.messageContent)}</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{item.kind === 'private' && (
|
||||
<div className="timeline-card timeline-card-private">
|
||||
<div className="timeline-card-head">
|
||||
<div className="timeline-identity">
|
||||
<div className="timeline-avatar timeline-avatar-private">
|
||||
{item.avatarUrl ? (
|
||||
<img src={item.avatarUrl} alt={item.displayName} />
|
||||
) : (
|
||||
<MessageCircle size={16} />
|
||||
)}
|
||||
</div>
|
||||
<div className="timeline-title-group">
|
||||
<div className="timeline-title">{item.displayName}</div>
|
||||
<div className="timeline-subtitle">{item.subtitle}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="timeline-right-tools">
|
||||
<span className="timeline-count-badge">共 {item.totalInteractions} 条</span>
|
||||
<button
|
||||
type="button"
|
||||
className="jump-btn timeline-jump-btn"
|
||||
disabled={!item.anchorLocalId || !item.anchorCreateTime}
|
||||
onClick={() => handleJump(item.sessionId, item.anchorLocalId, item.anchorCreateTime)}
|
||||
>
|
||||
跳转
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="timeline-message private-message">{item.summaryText}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</>
|
||||
)}
|
||||
{exportModalStatus !== 'idle' && (
|
||||
<div className="footprint-export-modal-mask" role="presentation">
|
||||
<div className="footprint-export-modal" role="dialog" aria-modal="true" aria-live="polite">
|
||||
<div className={`export-modal-icon export-modal-icon-${exportModalStatus}`}>
|
||||
{exportModalStatus === 'progress' && <RefreshCw size={20} className="spin" />}
|
||||
{exportModalStatus === 'success' && <CheckCircle2 size={20} />}
|
||||
{exportModalStatus === 'error' && <AlertCircle size={20} />}
|
||||
</div>
|
||||
<h3>{exportModalTitle}</h3>
|
||||
<p>{exportModalDescription}</p>
|
||||
{exportModalPath && <code className="export-modal-path">{exportModalPath}</code>}
|
||||
{exportModalStatus !== 'progress' && (
|
||||
<div className="export-modal-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="action-btn"
|
||||
onClick={() => {
|
||||
setExportModalStatus('idle')
|
||||
setExportModalTitle('')
|
||||
setExportModalDescription('')
|
||||
setExportModalPath('')
|
||||
}}
|
||||
>
|
||||
知道了
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default MyFootprintPage
|
||||
@@ -125,7 +125,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
|
||||
setHttpApiToken(token)
|
||||
await configService.setHttpApiToken(token)
|
||||
showMessage('已生成<EFBFBD><EFBFBD>保存新的 Access Token', true)
|
||||
showMessage('已生成并保存新的 Access Token', true)
|
||||
}
|
||||
|
||||
const clearApiToken = async () => {
|
||||
@@ -618,7 +618,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
showMessage(`已切换到${channelLabel}更新渠道,正在检查更新`, true)
|
||||
await handleCheckUpdate()
|
||||
} catch (e: any) {
|
||||
showMessage(`切换更新渠道<EFBFBD><EFBFBD>败: ${e}`, false)
|
||||
showMessage(`切换更新渠道失败: ${e}`, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1213,7 +1213,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
if (result.success && result.aesKey) {
|
||||
if (typeof result.xorKey === 'number') setImageXorKey(`0x${result.xorKey.toString(16).toUpperCase().padStart(2, '0')}`)
|
||||
setImageAesKey(result.aesKey)
|
||||
setImageKeyStatus('已获取图片<EFBFBD><EFBFBD>钥')
|
||||
setImageKeyStatus('已获取图片密钥')
|
||||
showMessage('已自动获取图片密钥', true)
|
||||
const newXorKey = typeof result.xorKey === 'number' ? result.xorKey : 0
|
||||
const newAesKey = result.aesKey
|
||||
@@ -2872,7 +2872,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
type="password"
|
||||
className="field-input"
|
||||
style={{ width: '100%' }}
|
||||
placeholder="110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw"
|
||||
placeholder="在此处填入你的 Telegram Bot Token"
|
||||
value={aiInsightTelegramToken}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value
|
||||
@@ -3207,7 +3207,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
value={`http://${httpApiHost}:${httpApiPort}`}
|
||||
readOnly
|
||||
/>
|
||||
<button className="btn btn-secondary" onClick={handleCopyApiUrl} title="复<EFBFBD><EFBFBD><EFBFBD>">
|
||||
<button className="btn btn-secondary" onClick={handleCopyApiUrl} title="复制">
|
||||
<Copy size={16} />
|
||||
</button>
|
||||
</div>
|
||||
@@ -3341,7 +3341,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
try {
|
||||
const verifyResult = await window.electronAPI.auth.hello('请验证您的身份以开启 Windows Hello')
|
||||
if (!verifyResult.success) {
|
||||
showMessage(verifyResult.error || 'Windows Hello <EFBFBD><EFBFBD>证失败', false)
|
||||
showMessage(verifyResult.error || 'Windows Hello 验证失败', false)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3573,7 +3573,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
onClick={handleSetupHello}
|
||||
disabled={!helloAvailable || isSettingHello || !authEnabled || !helloPassword}
|
||||
>
|
||||
{isSettingHello ? '<EFBFBD><EFBFBD><EFBFBD>置中...' : '开启与设置'}
|
||||
{isSettingHello ? '配置中...' : '开启与设置'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1127,7 +1127,7 @@ export default function SnsPage() {
|
||||
activeContactsCountTaskIdRef.current = null
|
||||
}
|
||||
finishBackgroundTask(taskId, 'completed', {
|
||||
detail: '鑱旂郴浜烘湅鍙嬪湀鏉℃暟琛ョ畻瀹屾垚',
|
||||
detail: '联系人朋友圈条数补算完成',
|
||||
progressText: `${totalTargets}/${totalTargets}`
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ const isMac = navigator.userAgent.toLowerCase().includes('mac')
|
||||
const isLinux = navigator.userAgent.toLowerCase().includes('linux')
|
||||
const isWindows = !isMac && !isLinux
|
||||
|
||||
const dbDirName = isMac ? '2.0b4.0.9 目录' : 'xwechat_files 目录'
|
||||
const DB_PATH_CHINESE_ERROR = '路径包含中文字符,迁移至全英文目录后再试'
|
||||
const dbPathPlaceholder = isMac
|
||||
? '例如: ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9'
|
||||
@@ -25,7 +24,7 @@ const dbPathPlaceholder = isMac
|
||||
|
||||
const steps = [
|
||||
{ id: 'intro', title: '欢迎', desc: '准备开始你的本地数据探索' },
|
||||
{ id: 'db', title: '数据库目录', desc: `定位 ${dbDirName}` },
|
||||
{ id: 'db', title: '数据库目录', desc: `定位 xwechat_files 目录` },
|
||||
{ id: 'cache', title: '缓存目录', desc: '设置本地缓存存储位置(可选)' },
|
||||
{ id: 'key', title: '解密密钥', desc: '获取密钥与自动识别账号' },
|
||||
{ id: 'image', title: '图片密钥', desc: '获取 XOR 与 AES 密钥' },
|
||||
|
||||
@@ -520,7 +520,7 @@ export async function setExportDefaultTxtColumns(columns: string[]): Promise<voi
|
||||
await config.set(CONFIG_KEYS.EXPORT_DEFAULT_TXT_COLUMNS, columns)
|
||||
}
|
||||
|
||||
// 获取导出默认并发<EFBFBD><EFBFBD>
|
||||
// 获取导出默认并发数
|
||||
export async function getExportDefaultConcurrency(): Promise<number | null> {
|
||||
const value = await config.get(CONFIG_KEYS.EXPORT_DEFAULT_CONCURRENCY)
|
||||
if (typeof value === 'number' && Number.isFinite(value)) return value
|
||||
|
||||
89
src/types/electron.d.ts
vendored
89
src/types/electron.d.ts
vendored
@@ -393,6 +393,95 @@ export interface ElectronAPI {
|
||||
getVoiceTranscript: (sessionId: string, msgId: string, createTime?: number) => Promise<{ success: boolean; transcript?: string; error?: string }>
|
||||
onVoiceTranscriptPartial: (callback: (payload: { sessionId?: string; msgId: string; createTime?: number; text: string }) => void) => () => void
|
||||
getMessage: (sessionId: string, localId: number) => Promise<{ success: boolean; message?: Message; error?: string }>
|
||||
getMyFootprintStats: (
|
||||
beginTimestamp: number,
|
||||
endTimestamp: number,
|
||||
options?: {
|
||||
myWxid?: string
|
||||
privateSessionIds?: string[]
|
||||
groupSessionIds?: string[]
|
||||
mentionLimit?: number
|
||||
privateLimit?: number
|
||||
mentionMode?: 'text_at_me' | string
|
||||
}
|
||||
) => Promise<{
|
||||
success: boolean
|
||||
data?: {
|
||||
summary: {
|
||||
private_inbound_people: number
|
||||
private_replied_people: number
|
||||
private_outbound_people: number
|
||||
private_reply_rate: number
|
||||
mention_count: number
|
||||
mention_group_count: number
|
||||
}
|
||||
private_sessions: Array<{
|
||||
session_id: string
|
||||
incoming_count: number
|
||||
outgoing_count: number
|
||||
replied: boolean
|
||||
first_incoming_ts: number
|
||||
first_reply_ts: number
|
||||
latest_ts: number
|
||||
anchor_local_id: number
|
||||
anchor_create_time: number
|
||||
displayName?: string
|
||||
avatarUrl?: string
|
||||
}>
|
||||
private_segments: Array<{
|
||||
session_id: string
|
||||
segment_index: number
|
||||
start_ts: number
|
||||
end_ts: number
|
||||
duration_sec: number
|
||||
incoming_count: number
|
||||
outgoing_count: number
|
||||
message_count: number
|
||||
replied: boolean
|
||||
first_incoming_ts: number
|
||||
first_reply_ts: number
|
||||
latest_ts: number
|
||||
anchor_local_id: number
|
||||
anchor_create_time: number
|
||||
displayName?: string
|
||||
avatarUrl?: string
|
||||
}>
|
||||
mentions: Array<{
|
||||
session_id: string
|
||||
local_id: number
|
||||
create_time: number
|
||||
sender_username: string
|
||||
message_content: string
|
||||
source: string
|
||||
sessionDisplayName?: string
|
||||
senderDisplayName?: string
|
||||
senderAvatarUrl?: string
|
||||
}>
|
||||
mention_groups: Array<{
|
||||
session_id: string
|
||||
count: number
|
||||
latest_ts: number
|
||||
displayName?: string
|
||||
avatarUrl?: string
|
||||
}>
|
||||
diagnostics: {
|
||||
truncated: boolean
|
||||
scanned_dbs: number
|
||||
elapsed_ms: number
|
||||
}
|
||||
}
|
||||
error?: string
|
||||
}>
|
||||
exportMyFootprint: (
|
||||
beginTimestamp: number,
|
||||
endTimestamp: number,
|
||||
format: 'csv' | 'json',
|
||||
filePath: string
|
||||
) => Promise<{
|
||||
success: boolean
|
||||
filePath?: string
|
||||
error?: string
|
||||
}>
|
||||
onWcdbChange: (callback: (event: any, data: { type: string; json: string }) => void) => () => void
|
||||
}
|
||||
biz: {
|
||||
|
||||
Reference in New Issue
Block a user