npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xhopcfine/aster-plugin-chat-history

v0.1.0

Published

Aster plugin for importing WeFlow chat JSON files as searchable conversation context

Downloads

102

Readme

@xhopcfine/aster-plugin-chat-history

Aster 的微信聊天记录上下文插件。

插件用于导入 WeFlow 导出的微信聊天记录 JSON,把群聊或私聊历史变成 Aster 对话中的可检索上下文。导入后,用户可以直接问“之前群里讨论过什么”“某个人说过什么”“搜索某个关键词”,Aster 会调用插件工具读取相关历史消息,再基于这些消息继续对话。

本插件不做向量检索,不启动 Web 页面,只在本机保存和检索聊天记录。

主要能力

  • 导入 WeFlow 导出的微信聊天记录 JSON。
  • 自动识别聊天名称、消息数量和时间范围。
  • 将最近导入的聊天记录设为当前默认上下文。
  • 支持查看已导入聊天记录列表。
  • 支持按关键词、发送人和时间范围搜索消息。
  • 支持获取最近 N 条聊天消息。
  • 支持根据用户当前问题提取相关聊天上下文。
  • 所有数据保存在本机 Aster 插件数据目录,不依赖外部服务。

安装

插件和 Aster 都建议始终安装 latest 版本。

1. 安装或升级 Aster

npm install -g aster-agent@latest --registry=https://registry.npmjs.org/

2. 安装或升级插件

npm install -g @xhopcfine/aster-plugin-chat-history@latest --registry=https://registry.npmjs.org/

3. 首次注册并启用插件

aster plugins install chat-history --package @xhopcfine/aster-plugin-chat-history --enabled

如果已经注册过插件,只需要重新执行上面的 npm install -g ...@latest,然后退出并重新启动 Aster,不需要重复注册。

4. 启动 Aster

aster

插件更新后必须重新启动正在运行的 Aster,新的工具和提示词才会生效。

使用示例

安装并重启 Aster 后,可以直接用自然语言对话,不需要手动输入工具名称。

导入聊天记录

导入 D:\wechat-msg\wechatmsg2\texts\群聊_干就完了!.json 作为聊天上下文

Aster 会调用 chat_history_import,导入成功后会返回聊天名称、消息数量和时间范围。

搜索聊天内容

搜索这个群里“加油”相关的聊天,返回前 5 条
查一下 Max(谢总)之前有没有提到发票
搜索 2025 年 4 月到 5 月之间关于合同的聊天记录

查看最近聊天

看看这个群最近 50 条聊天记录
最近大家在聊什么?

基于历史聊天继续对话

之前群里讨论过哪些客户需求?
根据这个群的聊天记录,整理一下我们之前提到过的产品想法
结合聊天记录,帮我总结一下 Max 主要关注哪些事情

当问题明显依赖历史聊天时,Aster 应先调用 chat_history_context 取回相关消息,再回答用户。

Aster 工具

插件会向 Aster 暴露这些工具。通常用户不需要手动输入工具名,直接用中文描述需求即可。

| 工具 | 作用 | | --- | --- | | chat_history_import | 导入 WeFlow 聊天记录 JSON,并自动设为当前上下文 | | chat_history_list | 查看已导入聊天记录,以及当前默认上下文 | | chat_history_set_active | 切换当前默认聊天上下文 | | chat_history_recent | 获取当前或指定聊天记录的最近 N 条消息 | | chat_history_search | 按关键词、发送人和时间范围搜索聊天消息 | | chat_history_context | 根据用户问题提取相关历史聊天上下文 |

支持格式

当前版本只支持 WeFlow 导出的 JSON,不做其它聊天记录格式兼容。

JSON 根对象需要包含:

  • session:聊天会话信息。
  • messages:消息数组。

消息字段需要包含:

| 字段 | 说明 | | --- | --- | | localId | 本地消息 ID | | createTime | 秒级时间戳 | | formattedTime | 格式化时间,例如 2025-02-05 13:37:33 | | type | 消息类型,例如 文本消息系统消息引用消息 | | content | 消息内容 | | isSend | 是否自己发送 | | senderUsername | 发送人账号 | | senderDisplayName | 发送人显示名称 |

典型文件路径:

D:\wechat-msg\wechatmsg2\texts\群聊_干就完了!.json

数据目录

默认数据目录由 Aster 分配,通常类似:

~/.aster/plugins/chat-history

插件会把导入后的结构化聊天记录保存到该目录下。后续检索使用插件数据目录中的副本,不依赖原始 JSON 文件继续存在。

限制说明

  • 不做向量检索,只做结构化关键词检索和上下文提取。
  • 不支持多种导出格式,只支持当前 WeFlow JSON。
  • 不处理图片、语音、文件等附件内容,只保留 JSON 中的文本描述。
  • 文件不会很大时可以直接导入;如果后续要处理几十万条消息,需要再增加分页、索引或数据库存储。
  • 插件只负责取回聊天上下文,最终回答仍由 Aster 当前模型生成。

常见问题

需要启动 Web 页面吗?

不需要。本插件没有 Web 页面,也没有独立端口。Aster 直接调用插件工具完成导入、搜索和上下文提取。

导入后原始 JSON 文件可以移动吗?

可以。插件导入时会把消息结构化保存到 Aster 插件数据目录。后续搜索不依赖原始文件。

为什么问题回答得不完整?

插件不会把全部聊天记录一次性塞给模型,而是根据问题搜索相关消息。如果问题比较宽泛,可以先让 Aster 搜索几个关键词,或者限定发送人、时间范围。

示例:

搜索“客户”“需求”“合同”相关聊天,然后总结

如何切换多个聊天记录?

先查看已导入记录:

列出已导入的聊天记录

再切换:

把“干就完了!”设为当前聊天上下文

更新插件

后续发布新版本后,执行:

npm install -g @xhopcfine/aster-plugin-chat-history@latest --registry=https://registry.npmjs.org/

安装完成后退出并重新启动:

aster