# zaochuanyitian/chatnest-ui architecture

> Architecture diagram of the GitHub repository zaochuanyitian/chatnest-ui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zaochuanyitian/chatnest-ui
- Repository: https://github.com/zaochuanyitian/chatnest-ui

## Overview

这是一个手机优先、可独立演示的 Claude 聊天 Web 前端，主要流程是用户在页面发送消息，经聊天界面请求 `/api/chat` 并展示流式回复。它还提供会话管理与搜索、Profile/记忆、摘要、日记与心情日历、上传和本地消息缓存。仓库另含时钟和记忆去重两个 Python 服务端辅助模块。前端主体未提供源码摘录，因此其内部调用关系仅按 README 明示的接口与职责表示。

Main entry points: [`index.html`](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html) (聊天前端), [`server-memory.py`](https://github.com/zaochuanyitian/chatnest-ui/blob/main/server-memory.py) (记忆去重规则), [`server-clock.py`](https://github.com/zaochuanyitian/chatnest-ui/blob/main/server-clock.py) (内置时钟)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["聊天与会话"]
  node_webapp["聊天前端<br/>[index.html]"]
  node_chat_ui["对话界面<br/>[index.html]"]
  node_session_ui["会话侧栏<br/>[index.html]"]
  node_chat_search["聊天搜索<br/>[index.html]"]
  node_message_cache[("消息缓存<br/>[index.html]")]
  node_attachments["上传与附件<br/>[index.html]"]
  node_artifact_view["Artifact 预览<br/>[index.html]"]
end

subgraph group_personal["个人记忆"]
  node_profile_ui["Profile<br/>[index.html]"]
  node_saved_memories["Saved memories<br/>[index.html]"]
  node_memory_summary["Memory summary<br/>[index.html]"]
end

subgraph group_journal["日记与日历"]
  node_diary_ui["日记列表<br/>[index.html]"]
  node_calendar_ui["心情日历<br/>[index.html]"]
end

subgraph group_runtime["运行时辅助"]
  node_memory_dedupe["记忆去重规则<br/>[server-memory.py]"]
  node_clock_helper["内置时钟<br/>[server-clock.py]"]
end

node_user(("用户"))
node_api_backend["自接后端"]
node_model_service["模型服务"]

node_user -->|"打开并使用"| node_webapp
node_webapp -->|"请求接口"| node_api_backend
node_api_backend -.->|"调用模型"| node_model_service
node_clock_helper -->|"追加提示行"| node_api_backend
node_memory_dedupe -->|"校验记忆写入"| node_api_backend
node_profile_ui -->|"同步重复判定"| node_memory_dedupe

click node_webapp "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_chat_ui "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_session_ui "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_chat_search "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_message_cache "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_attachments "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_artifact_view "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_profile_ui "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_saved_memories "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_memory_summary "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_memory_dedupe "https://github.com/zaochuanyitian/chatnest-ui/blob/main/server-memory.py"
click node_diary_ui "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_calendar_ui "https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html"
click node_clock_helper "https://github.com/zaochuanyitian/chatnest-ui/blob/main/server-clock.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_chat_ui,node_session_ui,node_chat_search,node_message_cache,node_attachments,node_artifact_view toneBlue
class node_profile_ui,node_saved_memories,node_memory_summary toneAmber
class node_diary_ui,node_calendar_ui toneMint
class node_memory_dedupe,node_clock_helper toneRose
class node_user,node_api_backend,node_model_service toneIndigo
```

## Components

### 聊天与会话

- [聊天前端](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [对话界面](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [会话侧栏](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [聊天搜索](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [消息缓存](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [上传与附件](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [Artifact 预览](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`

### 个人记忆

- [Profile](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [Saved memories](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [Memory summary](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`

### 日记与日历

- [日记列表](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`
- [心情日历](https://github.com/zaochuanyitian/chatnest-ui/blob/main/index.html): `index.html`

### 运行时辅助

- [记忆去重规则](https://github.com/zaochuanyitian/chatnest-ui/blob/main/server-memory.py): `server-memory.py`
- [内置时钟](https://github.com/zaochuanyitian/chatnest-ui/blob/main/server-clock.py): `server-clock.py`

### Other components

- **用户**
- **自接后端**
- **模型服务**

## Connections

- 用户 → 聊天前端: 打开并使用 (evidence: `README.md`)
- 聊天前端 → 自接后端: 请求接口 (evidence: `README.md`)
- 自接后端 → 模型服务: 调用模型
- 内置时钟 → 自接后端: 追加提示行 (evidence: `server-clock.py`)
- 记忆去重规则 → 自接后端: 校验记忆写入 (evidence: `server-memory.py`)
- Profile → 记忆去重规则: 同步重复判定 (evidence: `README.md`)
