Skip to content

Repository files navigation

AI-WisGen

WisBlock 固件智能生成系统 — 自然语言或模块清单 → 可编译烧录的 PlatformIO 工程。

"温度传感器和气压传感器,每2秒log一次, OTAA上报"
                    ↓
    PlatformIO 工程 → pio run → 烧录 → ChirpStack 收到传感器数据

架构边界与能力分层见 docs/AI-WisGen_项目架构与边界说明.md

文档入口(汇报 / 演示 / 维护)docs/README.md · 演示全文 → docs/AI-WisGen_演示文档.md


快速开始

pip install -r requirements.txt

# Agent 模式 (推荐, 需要 DeepSeek API Key)
set DEEPSEEK_API_KEY=sk-xxx
python tools/wisgen_cli.py agent "温湿度传感器,每2秒采集一次" --build -v

# 带烧录
python tools/wisgen_cli.py agent "温度传感器+气压传感器, OTAA上报" --build --port COM6 -v

# 无 LLM 模式 (只认模块 ID)
python tools/wisgen_cli.py agent "RAK1901 and RAK1902" --no-llm -v

# JSON 生成 (不需要 LLM)
python tools/wisgen_cli.py generate --spec spec/test_v2.json

# 查看全部 WisMAP 可匹配模块
python tools/wisgen_cli.py list

# Web 演示(根目录 shim 或模块入口均可)
python web_server.py
# 等价: python web/server.py

# Windows 双击
scripts\启动网页演示.bat

三种调用方式

方式 命令 LLM NL 理解
Agent wisgen_cli.py agent "<输入>" --build 可选 中文+英文语义
Build wisgen_cli.py build "<模块ID>" --build 模块 ID + 关键词
Generate wisgen_cli.py generate --spec spec.json 无 (JSON)

核心能力

  • 118 模块可匹配 — WisMAP YAML 统一目录;~123 个 .v2.json hooks(113 Ready + 5 Draft)
  • WisMAP 主路径引脚解析resolve_hardware() 运行时验证 slot/引脚;data/pinmaps/ 为静态 fallback
  • 中文 NL 解析 — LLM (DeepSeek) + V2 语义规则(33 条)+ V1 兜底
  • LoRaWAN 双编码 — 默认 raw(RAK 示例风格);显式要求「TLV编码」时启用结构化 TLV(15 模块预定义)
  • 编译修复闭环 — Build → Fixer (100+ 规则 + LLM <EDIT> 块) → Build,最多 3 次
  • 自动烧录--port COM6 编译成功直接烧录
  • Docker — 预装 nordicnrf52 等平台的容器化构建

项目结构

agent/          LangGraph 六节点 + LLM + Agent 工具
data/           模块 hooks、静态 pinmap fallback、schema、fix 规则
template/       PlatformIO 模板(.j2 占位符)
tools/          CLI、生成引擎、NL 解析、WisMAP 桥接
web/            Web 演示服务与静态页面(根目录 web_server.py 为 shim)
scripts/        Windows 启动脚本(wisgen.bat、演示 .bat)
vendor/wismap/  WisMAP 子模块(硬件匹配与引脚真值源)
knowledge_base/ RAK 官方 Example 索引(hooks 与检索来源)
tests/          pytest 套件
docs/           架构、导航、演示、边界说明(**从 [docs/README.md](docs/README.md) 进入**)
workspace/      生成工程输出(gitignored)

详细目录说明见 docs/项目文件目录分析.md


依赖

  • Python 3.10+
  • PlatformIO CLI
  • (可选) DeepSeek API Key — 启用 LLM 语义理解
  • (可选) Docker — 容器化构建

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages