- Backend: .NET 10 Minimal API + EF Core + PostgreSQL - Frontend: Flutter + Riverpod + GoRouter + Dio - AI: DeepSeek LLM + Qwen VLM (OpenAI-compatible) - Auth: SMS + JWT (access/refresh tokens) - Features: AI chat, health tracking, medication management, diet analysis, exercise plans, doctor consultations, report analysis
947 B
947 B
AI APP — 编码规范
后端 C# (.NET 10)
- 主构造函数:
public class Service(DbContext db) { } - 静态方法必须标记
static - 集合表达式:
[]/[..src] TryGetValue替代GetValueOrDefault- 空 catch 必须指定异常类型
- DTO 用
record类型 private static readonly缓存可复用对象- 本地函数优于
Func<T>赋值 - file-scoped namespace、global using、target-typed
new()、Nullable=enable - Minimal API 扩展方法模式:
public static class XxxEndpoints { } - AI 请求用
HttpClient直连,不引入第三方 AI SDK - 文件命名 snake_case:
auth_service.cs、auth_endpoints.cs
前端 Flutter (Dart)
-前端用sqlite存储信息,不用shared_preferences
- 用 Riverpod 管理所有状态和页面跳转
运行与测试
- 测试时自行启动后端,通过浏览器 DevTools 发送请求验证
- Flutter 用
flutter run连模拟器/真机