docs: 为全部 38 个源文件补充详细模块级注释
为 iAs 项目的所有 Rust 源文件添加了系统化的模块级文档注释(//!), 覆盖全部 src/ 下的文件。每个文件包含模块职责、架构设计、数据流 和关键设计决策的说明。 主要变更: - 入口/CLI: main.rs, cli.rs — 系统架构概览、子命令说明 - Daemon/Worker: daemon.rs, worker.rs — 三消费者架构、旧架构说明 - 微信通道: mod.rs, client.rs, types.rs — API 端点、登录流程 - LLM 系统: mod.rs, types.rs, provider.rs, deepseek.rs, conversation.rs — 架构分层、流式处理、工具循环、摘要机制 - 上下文管理: mod.rs, types.rs, builder.rs, tools.rs — Checkpoint 机制、Token Budget、双重摘要 - 工具系统: mod.rs, types.rs, builtin.rs, approval.rs — 两层元工具架构、审批流程 - 内置工具: mod.rs + 6 个工具 — API 端点、认证方式、参数说明 - 消息队列: mod.rs, message_queue.rs, runner.rs — 公平轮转算法、三消费者路由 - 数据库/状态/调度/日志: db/mod.rs, state.rs, scheduler.rs, logger.rs — 表结构、回退策略、定时任务、日志初始化
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
// 和风天气查询工具(Rust 原生实现,替代 bash 脚本)
|
||||
//
|
||||
// API:
|
||||
// GeoAPI: GET /geo/v2/city/lookup?location=城市名 → city_id
|
||||
// Now: GET /v7/weather/now?location=city_id → 实时天气
|
||||
// Daily: GET /v7/weather/{3,7,10,15,30}d?location=id → 每日预报
|
||||
// Hourly: GET /v7/weather/{24,72,168}h?location=id → 逐时预报
|
||||
//
|
||||
// 认证: EdDSA JWT (Ed25519)
|
||||
// 缓存: city_id 内存缓存 1h TTL
|
||||
//! ## 和风天气查询工具(Rust 原生实现)
|
||||
//!
|
||||
//! 通过和风天气 API 查询实时天气、每日预报和逐小时预报。
|
||||
//!
|
||||
//! ### API 端点
|
||||
//! - 城市查询: `GET /geo/v2/city/lookup?location=城市名` → 获取 city_id
|
||||
//! - 实时天气: `GET /v7/weather/now?location=city_id`
|
||||
//! - 每日预报: `GET /v7/weather/{3,7,10,15,30}d?location=id`
|
||||
//! - 逐时预报: `GET /v7/weather/{24,72,168}h?location=id`
|
||||
//!
|
||||
//! ### 认证方式
|
||||
//! 使用 EdDSA (Ed25519) JWT 进行 API 认证。
|
||||
//! 密钥对存放在 `qweather/` 目录下。
|
||||
//!
|
||||
//! ### 环境变量
|
||||
//! - `QWEATHER_API_HOST` — API 地址(默认 `api.qweather.com`)
|
||||
//! - `QWEATHER_JWT_KEY_ID` — JWT Key ID
|
||||
//! - `QWEATHER_JWT_PROJECT_ID` — 项目 ID
|
||||
//! - `QWEATHER_JWT_PRIVATE_KEY_FILE` — Ed25519 私钥路径
|
||||
//!
|
||||
//! ### 缓存策略
|
||||
//! city_id 在内存中缓存 1 小时(TTL),减少重复查询。
|
||||
|
||||
use base64::{Engine as _, engine::general_purpose};
|
||||
use chrono::Utc;
|
||||
|
||||
Reference in New Issue
Block a user