|
|
|
@ -6,7 +6,6 @@ import 'package:http/http.dart' as http; |
|
|
|
|
|
|
|
import '../../../core/utils/logger.dart'; |
|
|
|
import '../../../core/utils/synchrodata.dart'; |
|
|
|
import '../../models/appconfig.dart'; |
|
|
|
import '../db/sqflite_api.dart'; |
|
|
|
import '../deapsound_ai_service.dart'; |
|
|
|
import 'meeting_upload_service.dart'; |
|
|
|
@ -21,7 +20,6 @@ class MeetingTaskService extends GetxService { |
|
|
|
|
|
|
|
bool _isTask = false; |
|
|
|
|
|
|
|
String _systemPrompt = ''; |
|
|
|
String _userId = ''; |
|
|
|
|
|
|
|
final String _appid = '2316081933'; |
|
|
|
@ -50,7 +48,6 @@ class MeetingTaskService extends GetxService { |
|
|
|
void _getAgent() async { |
|
|
|
Map userInfo = _storage.read("user_info"); |
|
|
|
_userId = userInfo['user']['uid']; |
|
|
|
_systemPrompt = AppConfig.agentsystemPrompt("meet_assistant") ?? ''; |
|
|
|
} |
|
|
|
|
|
|
|
void _getTaskList() { |
|
|
|
@ -59,7 +56,8 @@ class MeetingTaskService extends GetxService { |
|
|
|
_executeTask(); |
|
|
|
} |
|
|
|
|
|
|
|
Future<void> addTask(int id, String audiourl, String taskid) async { |
|
|
|
Future<void> addTask(int id, String audiourl, String taskid, String language, |
|
|
|
String prompt, String outline) async { |
|
|
|
if (audiourl.isEmpty) { |
|
|
|
Map uploadData = _uploadService.uploadList.firstWhere( |
|
|
|
(element) => element['id'] == id, |
|
|
|
@ -68,24 +66,31 @@ class MeetingTaskService extends GetxService { |
|
|
|
if (uploadData.isNotEmpty) { |
|
|
|
if (uploadData['audiourl'].isEmpty) { |
|
|
|
uploadData['isTask'] = true; |
|
|
|
uploadData['language'] = language; |
|
|
|
uploadData['prompt'] = prompt; |
|
|
|
uploadData['outline'] = outline; |
|
|
|
} else { |
|
|
|
await addTaskList(id, uploadData['audiourl'], taskid); |
|
|
|
await addTaskList( |
|
|
|
id, uploadData['audiourl'], taskid, language, prompt, outline); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
await addTaskList(id, audiourl, taskid); |
|
|
|
await addTaskList(id, audiourl, taskid, language, prompt, outline); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Future<void> addTaskList(int id, String audiourl, String taskId) async { |
|
|
|
Future<void> addTaskList(int id, String audiourl, String taskId, |
|
|
|
String language, String prompt, String outline) async { |
|
|
|
if (taskId.isEmpty) { |
|
|
|
taskId = await _submitTask(audiourl); |
|
|
|
taskId = await _submitTask(audiourl, language); |
|
|
|
} |
|
|
|
await SqfliteApi.editMeeting(id, {'tasktype': 1, 'taskid': taskId}); |
|
|
|
_taskList.add({ |
|
|
|
'id': id, |
|
|
|
'taskid': taskId, |
|
|
|
'tasktype': 1, |
|
|
|
'prompt': prompt, |
|
|
|
'outline': outline, |
|
|
|
}); |
|
|
|
taskFinishList.add({ |
|
|
|
'id': id, |
|
|
|
@ -126,7 +131,7 @@ class MeetingTaskService extends GetxService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Future<String> _submitTask(String audiourl) async { |
|
|
|
Future<String> _submitTask(String audiourl, String language) async { |
|
|
|
String format = _getFileType(audiourl); |
|
|
|
|
|
|
|
final requestBody = jsonEncode({ |
|
|
|
@ -143,6 +148,7 @@ class MeetingTaskService extends GetxService { |
|
|
|
"url": audiourl, |
|
|
|
}, |
|
|
|
"additions": { |
|
|
|
"language": language, |
|
|
|
"with_speaker_info": "True", |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -206,7 +212,12 @@ class MeetingTaskService extends GetxService { |
|
|
|
var code = respDic['resp']['code'] as int; |
|
|
|
|
|
|
|
if (code == 1000) { |
|
|
|
await _addTextList(item['id'], respDic['resp']['utterances']); |
|
|
|
await _addTextList( |
|
|
|
item['id'], |
|
|
|
respDic['resp']['utterances'], |
|
|
|
item['prompt'], |
|
|
|
item['outline'], |
|
|
|
); |
|
|
|
return; |
|
|
|
} else if (code < 2000) { |
|
|
|
Logger.debug("FileRecognize failed"); |
|
|
|
@ -217,7 +228,8 @@ class MeetingTaskService extends GetxService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Future<void> _addTextList(int id, List utterances) async { |
|
|
|
Future<void> _addTextList( |
|
|
|
int id, List utterances, String prompt, String outline) async { |
|
|
|
String text = ''; |
|
|
|
String personnel = ''; |
|
|
|
List<Map<String, Object?>> list = []; |
|
|
|
@ -267,10 +279,10 @@ class MeetingTaskService extends GetxService { |
|
|
|
_storage.write("meeting_task_list", _taskList); |
|
|
|
_storage.write("meeting_task_finish_list", taskFinishList); |
|
|
|
} |
|
|
|
aiServiceMessage(id, text); |
|
|
|
aiServiceMessage(id, text, prompt, outline); |
|
|
|
} |
|
|
|
|
|
|
|
void aiServiceMessage(int id, String text) { |
|
|
|
void aiServiceMessage(int id, String text, String prompt, String outline) { |
|
|
|
int awaitQuantity = 0; |
|
|
|
String summaryText = ''; |
|
|
|
String overviewText = ''; |
|
|
|
@ -278,8 +290,7 @@ class MeetingTaskService extends GetxService { |
|
|
|
messages: [ |
|
|
|
{ |
|
|
|
'role': 'system', |
|
|
|
'content': |
|
|
|
'您将扮演一名会议总结专家,拥有超强的信息归纳与细分能力。不仅能高效处理各类通用场景会议,精准提炼会议核心内容,为后续思维导图生成奠定坚实基础。若涉及人员,人员名称保留[]。并根据内容只输出对应语言。', |
|
|
|
'content': prompt, |
|
|
|
}, |
|
|
|
{'role': 'user', 'content': text}, |
|
|
|
], |
|
|
|
@ -294,7 +305,7 @@ class MeetingTaskService extends GetxService { |
|
|
|
messages: [ |
|
|
|
{ |
|
|
|
'role': 'system', |
|
|
|
'content': '您将扮演一名会议事件归纳专家,能准确抓住会议中事件的关键点,并每个事件只需一句话精简总结。', |
|
|
|
'content': outline, |
|
|
|
}, |
|
|
|
{'role': 'user', 'content': text}, |
|
|
|
], |
|
|
|
|