Skip to content
dsh.fish
Bundle

dsh-xiaomili

小米粒 —— 常驻右侧的金毛秘书:实时捕捉 chat 内容、意图识别、关键词/概念提取、自动 LLM 简报。

Source
Olympianz
License
MIT
Updated
Updated 17 hours ago

Readme

# 小米粒(dsh-xiaomili)

常驻 chatbox 右侧的金毛秘书插件。它会实时旁听对话、识别用户意图、提取关键词/概念、并自动生成秘书简报。

## 功能

- 🦮 右侧悬浮的金毛头像(`assets/theme.png`,无边框、带浮动动画),点击展开下拉窗;
- ⚡ 实时捕捉:监听 `session/event`,即时正则抓取邮箱 / 链接;
- 🎯 意图识别 → 关键词 / 概念:用 LLM(默认 `deepseek-official/deepseek-v4-flash`)先判断意图再提取,不用朴素词频;
- 📝 自动简报:防抖自动调用 LLM 归纳,无需点击;
- 💾 持久化:邮箱 / 链接 / 关键词 / 概念 / 意图 / 简报 / 通知等记忆自动落盘,重启后恢复;
- 邮箱 / 链接 / 关键词 / 概念各展示频次最高的前 N 条。

## 目录

```
dsh-xiaomili/
├── package.json        # dsh.bundle + dsh.client manifest
├── cordis.patch.yml    # 组合层:激活 host 插件
├── index.js            # host 半部(事件监听 + LLM + HTTP 路由)
├── lib/client.js       # browser 半部(shell.overlay 悬浮挂件 + 下拉窗)
├── assets/theme.png    # 头像图片
└── README.md
```

## 安装

```bash
dsh plugin --profile web add ./dsh-xiaomili
```

然后正常启动 profile 即可,无需构建(纯 JS,无外部运行时依赖)。

## 可配置项(Schemastery `Config`)

内置 Schemastery `Config` schema,可在 profile 的 `cordis.patch.yml` 中覆盖该行:

```yaml
- insert:
    - id: xiaomili
      name: dsh-xiaomili
      config:
        debounceMs: 3000
        maxMessages: 20
```

| 键 | 默认 | 说明 |
| --- | --- | --- |
| `provider` | `deepseek-official` | LLM provider |
| `model` | `deepseek-v4-flash` | 归纳用模型 |
| `debounceMs` | `1600` | 归纳防抖毫秒 |
| `maxMessages` | `16` | 送入 LLM 的最近消息条数 |
| `projectsDir` | `''` | 项目扫描根目录(空则扫 workspace 及其父目录) |
| `maxProjects` | `8` | 「最近项目」展示条数 |
| `dataDir` | `''` | 数据落盘目录(空则 `$DSH_HOME/storages/xiaomili` 或 `~/.dsh/storages/xiaomili`) |

## 持久化

host 半部会把秘书记忆(邮箱 / 链接 / 关键词 / 概念 / 意图 / 简报 / 通知 / 会话统计等)序列化为 JSON 快照,写入 `<dataDir>/state.json`(默认 `~/.dsh/storages/xiaomili/state.json`)。

- 每次捕捉到消息或 LLM 分析完成后,防抖 800ms 原子落盘(临时文件 + `rename` 替换,避免写一半损坏);
- 启动时自动读取并恢复上次记忆;文件不存在或损坏则从空状态开始;
- 调用 `POST /xiaomili/clear` 清空记忆时同步落盘。

## 通信

host 通过 `webServer` 暴露 `GET /xiaomili/state`、`POST /xiaomili/refresh`、`POST /xiaomili/clear`、`GET /xiaomili/avatar.png`,browser 半部用 `fetch` 调用。

Install

dsh plugin --profile web add github:Olympianz/dsh-xiaomili

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source