fix: 视频总结

This commit is contained in:
guozhigq
2024-09-30 11:23:40 +08:00
parent c3d23dfdba
commit ed9a75ecd3
3 changed files with 17 additions and 14 deletions

View File

@ -39,11 +39,11 @@ class ModelResult {
ModelResult.fromJson(Map<String, dynamic> json) { ModelResult.fromJson(Map<String, dynamic> json) {
resultType = json['result_type']; resultType = json['result_type'];
summary = json['summary']; summary = json['summary'];
outline = json['result_type'] == 2 outline = json['result_type'] == 0
? json['outline'] ? <OutlineItem>[]
: json['outline']
.map<OutlineItem>((e) => OutlineItem.fromJson(e)) .map<OutlineItem>((e) => OutlineItem.fromJson(e))
.toList() .toList();
: <OutlineItem>[];
} }
} }

View File

@ -541,7 +541,7 @@ class VideoIntroController extends GetxController {
// ai总结 // ai总结
Future aiConclusion() async { Future aiConclusion() async {
SmartDialog.showLoading(msg: '正在生ai总结'); SmartDialog.showLoading(msg: '正在生ai总结');
final res = await VideoHttp.aiConclusion( final res = await VideoHttp.aiConclusion(
bvid: bvid, bvid: bvid,
cid: lastPlayCid.value, cid: lastPlayCid.value,
@ -551,7 +551,7 @@ class VideoIntroController extends GetxController {
if (res['status']) { if (res['status']) {
modelResult = res['data'].modelResult; modelResult = res['data'].modelResult;
} else { } else {
SmartDialog.showToast("当前视频可能暂不支持AI视频总结"); SmartDialog.showToast("当前视频暂不支持AI视频总结");
} }
return res; return res;
} }

View File

@ -49,6 +49,8 @@ class AiDetail extends StatelessWidget {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
if (modelResult!.resultType != 0 &&
modelResult!.summary != '') ...[
SelectableText( SelectableText(
modelResult!.summary!, modelResult!.summary!,
style: const TextStyle( style: const TextStyle(
@ -58,6 +60,7 @@ class AiDetail extends StatelessWidget {
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
],
ListView.builder( ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),