# lxj5820/nano-banana architecture

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

- Interactive diagram: https://gitdiagram.com/lxj5820/nano-banana
- Repository: https://github.com/lxj5820/nano-banana

## Overview

词元AI生图工坊是一个单文件 Web 图片生成与图库管理应用。用户配置 API Key、输入提示词并选择模型和生成参数，可选添加参考图，然后请求图像服务；生成记录可在本地图库中管理、复用和下载。README 还记录了合集、多选、重试、预览对比及响应式交互等能力。源码未提供，因此节点均指向 README 所述的主页面，连线仅依据文档描述，未验证具体调用实现。

Main entry points: [`index.html`](https://github.com/lxj5820/nano-banana/blob/main/index.html) (历史图库)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_creation["生成与配置"]
  node_app["单页应用<br/>[index.html]"]
  node_settings["API 设置<br/>[index.html]"]
  node_prompt["提示词输入<br/>[index.html]"]
  node_modelparams["模型与生成参数<br/>[index.html]"]
end

subgraph group_media["参考图与结果"]
  node_reference["参考图处理<br/>[index.html]"]
  node_progress["生成状态与结果<br/>[index.html]"]
  node_compare["结果对比与预览<br/>[index.html]"]
end

subgraph group_library["图库管理"]
  node_gallery["历史图库<br/>[index.html]"]
  node_collections["合集与批量管理<br/>[index.html]"]
  node_reuse["参数复用与重试<br/>[index.html]"]
  node_downloads["图片与 ZIP 下载<br/>[index.html]"]
end

subgraph group_persistence["本地与外部服务"]
  node_imageapi{{"图像生成 API"}}
  node_idb[("IndexedDB 图库<br/>[index.html]")]
  node_localstorage[("localStorage<br/>[index.html]")]
end

node_user(("用户"))

node_user -->|"使用"| node_app
node_user -->|"配置密钥"| node_settings
node_settings -->|"保存设置"| node_localstorage
node_user -->|"输入提示词"| node_prompt
node_user -->|"选择参数"| node_modelparams
node_user -->|"添加参考图"| node_reference
node_prompt -->|"提交生成"| node_imageapi
node_modelparams -->|"指定模型参数"| node_imageapi
node_reference -->|"提供参考图"| node_imageapi
node_imageapi -->|"返回生成结果"| node_progress
node_progress -->|"记录结果"| node_gallery
node_gallery -->|"持久化图片"| node_idb
node_user -->|"查看对比"| node_compare
node_gallery -->|"打开图片"| node_compare
node_user -->|"管理合集"| node_collections
node_collections -->|"保存图库数据"| node_idb
node_user -->|"复用或重试"| node_reuse
node_reuse -->|"恢复生成参数"| node_modelparams
node_reuse -->|"重试生成"| node_imageapi
node_user -->|"下载图片"| node_downloads
node_gallery -->|"导出所选图片"| node_downloads

click node_app "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_settings "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_prompt "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_modelparams "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_reference "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_progress "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_compare "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_gallery "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_collections "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_reuse "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_downloads "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_idb "https://github.com/lxj5820/nano-banana/blob/main/index.html"
click node_localstorage "https://github.com/lxj5820/nano-banana/blob/main/index.html"

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_app,node_settings,node_prompt,node_modelparams toneBlue
class node_reference,node_progress,node_compare toneAmber
class node_gallery,node_collections,node_reuse,node_downloads toneMint
class node_imageapi,node_idb,node_localstorage toneRose
class node_user toneIndigo
```

## Components

### 生成与配置

- [单页应用](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [API 设置](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [提示词输入](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [模型与生成参数](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`

### 参考图与结果

- [参考图处理](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [生成状态与结果](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [结果对比与预览](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`

### 图库管理

- [历史图库](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [合集与批量管理](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [参数复用与重试](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [图片与 ZIP 下载](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`

### 本地与外部服务

- **图像生成 API**
- [IndexedDB 图库](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`
- [localStorage](https://github.com/lxj5820/nano-banana/blob/main/index.html): `index.html`

### Other components

- **用户**

## Connections

- 用户 → 单页应用: 使用 (evidence: `README.md`)
- 用户 → API 设置: 配置密钥 (evidence: `README.md`)
- API 设置 → localStorage: 保存设置 (evidence: `README.md`)
- 用户 → 提示词输入: 输入提示词 (evidence: `README.md`)
- 用户 → 模型与生成参数: 选择参数 (evidence: `README.md`)
- 用户 → 参考图处理: 添加参考图 (evidence: `README.md`)
- 提示词输入 → 图像生成 API: 提交生成 (evidence: `README.md`)
- 模型与生成参数 → 图像生成 API: 指定模型参数 (evidence: `README.md`)
- 参考图处理 → 图像生成 API: 提供参考图 (evidence: `README.md`)
- 图像生成 API → 生成状态与结果: 返回生成结果 (evidence: `README.md`)
- 生成状态与结果 → 历史图库: 记录结果 (evidence: `README.md`)
- 历史图库 → IndexedDB 图库: 持久化图片 (evidence: `README.md`)
- 用户 → 结果对比与预览: 查看对比 (evidence: `README.md`)
- 历史图库 → 结果对比与预览: 打开图片 (evidence: `README.md`)
- 用户 → 合集与批量管理: 管理合集 (evidence: `README.md`)
- 合集与批量管理 → IndexedDB 图库: 保存图库数据 (evidence: `README.md`)
- 用户 → 参数复用与重试: 复用或重试 (evidence: `README.md`)
- 参数复用与重试 → 模型与生成参数: 恢复生成参数 (evidence: `README.md`)
- 参数复用与重试 → 图像生成 API: 重试生成 (evidence: `README.md`)
- 用户 → 图片与 ZIP 下载: 下载图片 (evidence: `README.md`)
- 历史图库 → 图片与 ZIP 下载: 导出所选图片 (evidence: `README.md`)
