|
|
|
@ -240,19 +240,58 @@ class MeetingDetailsController extends GetxController |
|
|
|
allText = text; |
|
|
|
} |
|
|
|
if (allText.isEmpty) return; |
|
|
|
await _aiServiceSummary(); |
|
|
|
_aiServiceMessage(); |
|
|
|
} |
|
|
|
|
|
|
|
Future<void> _aiServiceSummary() async { |
|
|
|
String summaryText = await DeapsoundAIService().sendMessage( |
|
|
|
messages: [ |
|
|
|
{'role': 'system', 'content': _systemPrompt}, |
|
|
|
{'role': 'user', 'content': allText}, |
|
|
|
], |
|
|
|
); |
|
|
|
SqfliteApi.editMeeting(id, {'tasktype': 3, 'summary': summaryText}); |
|
|
|
void _aiServiceMessage() { |
|
|
|
int awaitQuantity = 0; |
|
|
|
int verifyQuantity = 0; |
|
|
|
String summaryText = meetingDetails.value.summary; |
|
|
|
String overviewText = meetingDetails.value.overview; |
|
|
|
if (summaryText.isEmpty) { |
|
|
|
verifyQuantity++; |
|
|
|
DeapsoundAIService().sendMessage( |
|
|
|
messages: [ |
|
|
|
{'role': 'system', 'content': _systemPrompt}, |
|
|
|
{'role': 'user', 'content': allText}, |
|
|
|
], |
|
|
|
).then((value) { |
|
|
|
awaitQuantity++; |
|
|
|
summaryText = value; |
|
|
|
if (awaitQuantity >= verifyQuantity) { |
|
|
|
_aiServiceValue(summaryText, overviewText); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (overviewText.isEmpty) { |
|
|
|
verifyQuantity++; |
|
|
|
DeapsoundAIService().sendMessage( |
|
|
|
messages: [ |
|
|
|
{ |
|
|
|
'role': 'system', |
|
|
|
'content': '您将扮演一名会议事件归纳专家,能准确抓住会议中事件的关键点,并每个事件只需一句话精简总结。', |
|
|
|
}, |
|
|
|
{'role': 'user', 'content': allText}, |
|
|
|
], |
|
|
|
).then((value) { |
|
|
|
awaitQuantity++; |
|
|
|
overviewText = value; |
|
|
|
if (awaitQuantity >= verifyQuantity) { |
|
|
|
_aiServiceValue(summaryText, overviewText); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void _aiServiceValue(String summaryText, String overviewText) { |
|
|
|
SqfliteApi.editMeeting(id, { |
|
|
|
'tasktype': 3, |
|
|
|
'summary': summaryText, |
|
|
|
'overview': overviewText, |
|
|
|
}); |
|
|
|
meetingDetails.value.tasktype = 3; |
|
|
|
meetingDetails.value.summary = summaryText; |
|
|
|
meetingDetails.value.overview = overviewText; |
|
|
|
meetingDetails.refresh(); |
|
|
|
} |
|
|
|
|
|
|
|
|