diff --git a/lib/data/services/db/database_helper.dart b/lib/data/services/db/database_helper.dart index fcefe6bbf..b0d7562c0 100644 --- a/lib/data/services/db/database_helper.dart +++ b/lib/data/services/db/database_helper.dart @@ -104,6 +104,7 @@ class DatabaseHelper { icon TEXT, tag TEXT, desc TEXT, + outline TEXT, prompt TEXT ) '''); @@ -112,207 +113,6 @@ class DatabaseHelper { 'synctime': 0, 'privatecloud': 0, }); - // 商务会议助手插入默认模版 - batch.insert('meetingcategorytemplate', { - 'id': 1, - 'name': '通用', - }); - batch.insert('meetingcategorytemplate', { - 'id': 2, - 'name': '会议', - }); - batch.insert('meetingcategorytemplate', { - 'id': 3, - 'name': '演讲', - }); - batch.insert('meetingcategorytemplate', { - 'id': 4, - 'name': '自定义', - }); - batch.insert('meetingtemplate', { - 'categoryid': 1, - 'name': '会议纪要', - 'icon': 'auto_stories', - 'tag': '主题, 代办事项', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 1, - 'name': 'Autopilot', - 'icon': 'auto_graph', - 'tag': '自适应结构, 全场景适配', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 1, - 'name': '推理Autopilot', - 'icon': 'add_to_drive_outlined', - 'tag': '推理模型, 自动结构化', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 1, - 'name': '通话', - 'icon': 'perm_phone_msg', - 'tag': '主题, 代办事项', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 1, - 'name': '项目计划', - 'icon': 'assignment', - 'tag': '目标, 里程碑', - 'desc': '用于规划项目阶段和关键节点,跟踪项目执行进度', - 'prompt': '请按时间顺序整理项目阶段' - }); - batch.insert('meetingtemplate', { - 'categoryid': 1, - 'name': '头脑风暴', - 'icon': 'lightbulb', - 'tag': '创意, 发散思维', - 'desc': '记录创意发散过程,结构化整理核心创意点', - 'prompt': '请将讨论内容按创新性排序' - }); - batch.insert('meetingtemplate', { - 'categoryid': 1, - 'name': '日常记录', - 'icon': 'note', - 'tag': '日志, 每日总结', - 'desc': '自动化生成结构化日报,自动提取工作亮点与待办事项', - 'prompt': '请按优先级排列今日工作事项' - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '咨询', - 'icon': 'auto_stories', - 'tag': '主题, 代办事项', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '讨论', - 'icon': 'auto_graph', - 'tag': '自适应结构, 全场景适配', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '汇报', - 'icon': 'add_to_drive_outlined', - 'tag': '推理模型, 自动结构化', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '任务分配', - 'icon': 'perm_phone_msg', - 'tag': '主题, 代办事项', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '评审会议', - 'icon': 'rate_review', - 'tag': '质量评估, 改进建议', - 'desc': '用于评估项目阶段成果,生成改进建议和风险评估', - 'prompt': '请按优先级列出需要改进的环节' - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '周例会', - 'icon': 'event_repeat', - 'tag': '进度汇报, 计划制定', - 'desc': '自动生成每周工作进展摘要,识别延期风险', - 'prompt': '请按部门分类整理工作进度' - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '客户洽谈', - 'icon': 'handshake', - 'tag': '需求沟通, 合同条款', - 'desc': '记录客户核心诉求和合作关键条款', - 'prompt': '请按优先级排列客户需求' - }); - batch.insert('meetingtemplate', { - 'categoryid': 2, - 'name': '项目复盘', - 'icon': 'restart_alt', - 'tag': '经验总结, 问题分析', - 'desc': '自动生成项目得失分析报告', - 'prompt': '请按影响程度排序待改进项' - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': '课堂笔记', - 'icon': 'auto_stories', - 'tag': '主题, 代办事项', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': '讲座', - 'icon': 'auto_graph', - 'tag': '自适应结构, 全场景适配', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': '培训', - 'icon': 'add_to_drive_outlined', - 'tag': '推理模型, 自动结构化', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': 'Sermon', - 'icon': 'perm_phone_msg', - 'tag': '主题, 代办事项', - 'desc': '旨在概述和回顾项目内容,重点捕捉所提话题的精髓和关键点', - 'prompt': '提示词', - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': '产品发布会', - 'icon': 'rocket_launch', - 'tag': '功能展示, 市场定位', - 'desc': '结构化整理产品核心卖点和市场差异化特征', - 'prompt': '请按用户场景分类产品功能' - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': '技术分享', - 'icon': 'code', - 'tag': '知识传递, 最佳实践', - 'desc': '自动提取技术要点和可复用代码片段', - 'prompt': '请按技术难度分级整理内容' - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': '投资者路演', - 'icon': 'bar_chart', - 'tag': '财务数据, 商业模式', - 'desc': '自动提取核心财务指标和增长预期', - 'prompt': '请按投资关注度整理内容' - }); - batch.insert('meetingtemplate', { - 'categoryid': 3, - 'name': '学术报告', - 'icon': 'school', - 'tag': '研究成果, 数据分析', - 'desc': '结构化整理实验数据和学术论点', - 'prompt': '请按研究重要性排序结论' - }); await batch.commit(); } } diff --git a/lib/data/services/db/sqflite_api.dart b/lib/data/services/db/sqflite_api.dart index 51c43babe..5b5a8641a 100644 --- a/lib/data/services/db/sqflite_api.dart +++ b/lib/data/services/db/sqflite_api.dart @@ -210,6 +210,41 @@ class SqfliteApi { await db.insert('meetingai', meeting); } + // 初始化模版 + static Future initMeetingTemplate(List data) async { + final db = await DatabaseHelper().database; + await db.transaction((txn) async { + // 清空旧数据 + await txn.delete('meetingtemplate'); + await txn.delete('meetingcategorytemplate'); + + List categoryList = []; + + for (var i = 0; i < data.length; i++) { + Map item = data[i]; + int index = categoryList.indexOf(item['ttype']); + int categoryId = categoryList.length; + if (index == -1) { + categoryList.add(item['ttype']); + categoryId++; + await txn.insert('meetingcategorytemplate', { + 'id': categoryId, + 'name': item['ttype'], + }); + } + await txn.insert('meetingtemplate', { + 'categoryid': categoryId, + 'name': item['title'], + 'icon': item['icon'], + 'tag': item['tags'], + 'desc': item['description'], + 'outline': item['outline'], + 'prompt': item['template'], + }); + } + }); + } + // 获取商务会议助手所有分类模版列表 static Future getMeetingCategoryTemplateList() async { final db = await DatabaseHelper().database; diff --git a/lib/data/services/network/api.dart b/lib/data/services/network/api.dart index 8e36e726c..ef52ac4e5 100644 --- a/lib/data/services/network/api.dart +++ b/lib/data/services/network/api.dart @@ -180,4 +180,13 @@ class Api { params: params, ); } + + //获取模版数据 + static getEchomeetTemplates([params]) { + return DioManager().request( + NWMethod.post, + '/api/home/echomeet_gettemplates', + params: params, + ); + } } diff --git a/lib/modules/login/controllers/login_controller.dart b/lib/modules/login/controllers/login_controller.dart index a159b0269..395c197a2 100644 --- a/lib/modules/login/controllers/login_controller.dart +++ b/lib/modules/login/controllers/login_controller.dart @@ -8,6 +8,7 @@ import 'package:logger/web.dart'; import 'package:get_storage/get_storage.dart'; import 'package:device_info_plus/device_info_plus.dart'; import 'dart:convert'; +import '../../../data/services/db/sqflite_api.dart'; import 'facebookLogin.dart'; import 'googleLogin.dart'; import 'weixinLogin.dart'; @@ -869,6 +870,7 @@ class LoginController extends GetxController { // 获取app的配置信息 await getAppConfig(); + await _initMeetingTemplate(); Get.offAllNamed(Routes.pairing); } else { throw Exception('接口返回错误: ${response['msg']}'); @@ -991,4 +993,11 @@ class LoginController extends GetxController { return false; } } + + Future _initMeetingTemplate() async { + var response = await Api.getEchomeetTemplates(); + if (response != null) { + await SqfliteApi.initMeetingTemplate(response['templates']); + } + } }