|
|
|
@ -66,45 +66,36 @@ class SummaryTaskService extends GetxService { |
|
|
|
_storage.write("summary_task_list", _taskList); |
|
|
|
} |
|
|
|
|
|
|
|
void _aiServiceMessage(int id, String text, String prompt, String outline) { |
|
|
|
int awaitQuantity = 0; |
|
|
|
String summaryText = ''; |
|
|
|
String overviewText = ''; |
|
|
|
DeapsoundAIService().sendMessage( |
|
|
|
messages: [ |
|
|
|
{ |
|
|
|
'role': 'system', |
|
|
|
'content': prompt, |
|
|
|
}, |
|
|
|
{'role': 'user', 'content': text}, |
|
|
|
], |
|
|
|
).then((value) { |
|
|
|
awaitQuantity++; |
|
|
|
summaryText = value; |
|
|
|
if (awaitQuantity >= 2) { |
|
|
|
_aiServiceValue(id, summaryText, overviewText); |
|
|
|
} |
|
|
|
}); |
|
|
|
DeapsoundAIService().sendMessage( |
|
|
|
messages: [ |
|
|
|
{ |
|
|
|
'role': 'system', |
|
|
|
'content': outline, |
|
|
|
}, |
|
|
|
{'role': 'user', 'content': text}, |
|
|
|
], |
|
|
|
).then((value) { |
|
|
|
awaitQuantity++; |
|
|
|
overviewText = value; |
|
|
|
if (awaitQuantity >= 2) { |
|
|
|
_aiServiceValue(id, summaryText, overviewText); |
|
|
|
} |
|
|
|
}); |
|
|
|
Future<void> _aiServiceMessage( |
|
|
|
int id, String text, String prompt, String outline) async { |
|
|
|
final ai = DeapsoundAIService(); |
|
|
|
try { |
|
|
|
final results = await Future.wait([ |
|
|
|
ai.sendMessage(messages: [ |
|
|
|
{'role': 'system', 'content': prompt}, |
|
|
|
{'role': 'user', 'content': text}, |
|
|
|
]).timeout(const Duration(seconds: 300)), |
|
|
|
ai.sendMessage(messages: [ |
|
|
|
{'role': 'system', 'content': outline}, |
|
|
|
{'role': 'user', 'content': text}, |
|
|
|
]).timeout(const Duration(seconds: 300)), |
|
|
|
], eagerError: true); |
|
|
|
_aiServiceValue(id, results[0], results[1]); |
|
|
|
} catch (e) { |
|
|
|
_isTask = false; |
|
|
|
_executeTask(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void _aiServiceValue(int id, String summaryText, String overviewText) { |
|
|
|
if (!_taskList.any((item) => item['id'] == id)) return; |
|
|
|
SqfliteApi.editMeeting(id, { |
|
|
|
Future<void> _aiServiceValue( |
|
|
|
int id, String summaryText, String overviewText) async { |
|
|
|
final exists = _taskList.any((item) => item['id'] == id); |
|
|
|
if (!exists) { |
|
|
|
_isTask = false; |
|
|
|
_executeTask(); |
|
|
|
return; |
|
|
|
} |
|
|
|
await SqfliteApi.editMeeting(id, { |
|
|
|
'tasktype': 3, |
|
|
|
'summary': summaryText, |
|
|
|
'overview': overviewText, |
|
|
|
|