Skip to content

Commit 7983be5

Browse files
committed
feat: 补上极简记账、随机菜品模块,用户设置补上备份恢复页面(以上都未重构和优化)
1 parent d7bb945 commit 7983be5

26 files changed

+17640
-51
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ dart run build_runner build --delete-conflicting-outputs
8181
- feat: “智能对话”添加了讯飞云的 Spark Lite 模型接口。
8282
- feat: “智能对话”添加了腾讯的混元 Lite 模型接口。
8383

84+
#### 2024-08-18
85+
86+
- feat: 补上“极简记账”、“随机菜品”模块,“用户设置”补上“备份恢复”页面(以上都未重构和优化)。
87+
8488
### todo:
8589

8690
- (done)得到流式响应的数据的处理都非常相似,可以抽出来公共函数

_dishes/HowToCook/HowToCook-All合并-持续更新-20240711.json

+6,115
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-主食-20240708done.json

+982
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-早餐-20240701done.json

+422
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-水产-20240711done.json

+615
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-汤粥-20240626done.json

+371
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-甜品-20240701done.json

+331
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-素菜-20240328done.json

+988
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-荤菜-20240703done.json

+2,080
Large diffs are not rendered by default.

_dishes/HowToCook/HowToCook-饮料-20240701done.json

+340
Large diffs are not rendered by default.

devtools_options.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:

lib/common/utils/db_tools/db_helper.dart

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ import '../../../models/text_to_image/com_tti_state.dart';
1515
import '../../constants.dart';
1616
import 'ddl_swmate.dart';
1717

18-
// 导出表文件临时存放的文件夹
19-
const DB_EXPORT_DIR = "db_export";
20-
// 导出的表前缀
21-
const DB_EXPORT_TABLE_PREFIX = "sm_";
22-
2318
class DBHelper {
2419
///
2520
/// 数据库初始化相关
@@ -137,7 +132,7 @@ class DBHelper {
137132
for (Map<String, dynamic> table in tables) {
138133
String tableName = table['name'];
139134
// 不是自建的表,不导出
140-
if (!tableName.startsWith(DB_EXPORT_TABLE_PREFIX)) {
135+
if (!tableName.startsWith(DB_TABLE_PREFIX)) {
141136
continue;
142137
}
143138

lib/common/utils/db_tools/ddl_swmate.dart

+16-37
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1+
// ignore_for_file: constant_identifier_names
2+
3+
///
4+
/// 数据库导出备份、db操作等相关关键字
5+
/// db_helper、备份恢复页面能用到
6+
///
7+
// 导出表文件临时存放的文件夹
8+
const DB_EXPORT_DIR = "db_export";
9+
// 导出的表前缀
10+
const DB_TABLE_PREFIX = "sm_";
11+
112
/// AI Light Life 数据库中相关表的创建
213
class SWMateDdl {
314
// db名称
415
static String databaseName = "embedded_swmate.db";
516

617
// 账单条目表
7-
static const tableNameOfBillItem = 'sm_bill_item';
18+
static const tableNameOfBillItem = '${DB_TABLE_PREFIX}bill_item';
819

920
static const String ddlForBillItem = """
1021
CREATE TABLE $tableNameOfBillItem (
@@ -21,7 +32,7 @@ class SWMateDdl {
2132

2233
/// 2024-06-01 新增AI对话留存
2334
// 账单条目表
24-
static const tableNameOfChatHistory = 'sm_chat_history';
35+
static const tableNameOfChatHistory = '${DB_TABLE_PREFIX}chat_history';
2536

2637
// 2024-06-14
2738
// 图像理解也有对话,所以新加一个对话类型栏位:aigc、image2text、text2image……
@@ -42,7 +53,8 @@ class SWMateDdl {
4253

4354
/// 2024-06-13 新增文生图简单内容流程
4455
// 账单条目表
45-
static const tableNameOfText2ImageHistory = 'sm_text2image_history';
56+
static const tableNameOfText2ImageHistory =
57+
'${DB_TABLE_PREFIX}text2image_history';
4658

4759
static const String ddlForText2ImageHistory = """
4860
CREATE TABLE $tableNameOfText2ImageHistory (
@@ -58,7 +70,7 @@ class SWMateDdl {
5870
""";
5971

6072
// 菜品基础表
61-
static const tableNameOfDish = 'sm_dish';
73+
static const tableNameOfDish = '${DB_TABLE_PREFIX}dish';
6274

6375
// 2023-03-10 避免导入时重复导入,还是加一个unique
6476
static const String ddlForDish = """
@@ -75,37 +87,4 @@ class SWMateDdl {
7587
UNIQUE(dish_name,tags)
7688
);
7789
""";
78-
79-
/// ---------------------- 下面的暂时简化为上面,如果后续真的记录非常多,再考虑拆分为支出和收入两部分
80-
81-
// 创建的表名加上数据库明缩写前缀,避免出现关键字问题
82-
// 基础活动基础表
83-
static const tableNameOfExpend = 'sm_expend';
84-
// 动作基础表
85-
static const tableNameOfIncome = 'sm_income';
86-
87-
// (预留的)收入和支出的分类不一样,暂时只用一个表,加个栏位来区分时支出还是收入的分类
88-
static const tableNameOfCategory = 'sm_category';
89-
90-
static const String ddlForExpend = """
91-
CREATE TABLE $tableNameOfExpend (
92-
expend_id INTEGER, NOT NULL,
93-
date TEXT,
94-
category TEXT,
95-
item TEXT NOT NULL,
96-
value REAL NOT NULL,
97-
PRIMARY KEY("expend_id" AUTOINCREMENT)
98-
);
99-
""";
100-
101-
static const String ddlForIncome = """
102-
CREATE TABLE $tableNameOfIncome (
103-
income_id INTEGER NOT NULL,
104-
date TEXT,
105-
category TEXT,
106-
item TEXT NOT NULL,
107-
value REAL NOT NULL,
108-
PRIMARY KEY("income_id" AUTOINCREMENT)
109-
);
110-
""";
11190
}

lib/views/ai_assistant/_chat_screen_parts/chat_appbar_area.dart

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ class ChatAppBarArea extends StatelessWidget implements PreferredSizeWidget {
3434
return AppBar(
3535
title: title != null ? Text(title!) : null,
3636
actions: [
37+
// TODO 预设的纯对话智能体(就是一堆预设的system prompt)
38+
TextButton(
39+
onPressed: () {
40+
if (onZoomOutPressed != null) {
41+
onZoomOutPressed!();
42+
}
43+
},
44+
child: const Text("智能体"),
45+
),
3746
if (showZoomOutButton)
3847
IconButton(
3948
onPressed: () {

0 commit comments

Comments
 (0)