mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-23 18:46:53 +08:00
@@ -806,14 +806,20 @@ class VideoHttp {
|
||||
'up_mid': upMid,
|
||||
});
|
||||
var res = await Request().get(Api.aiConclusion, queryParameters: params);
|
||||
if (res.data['code'] == 0 && res.data['data']['code'] == 0) {
|
||||
final code = res.data['code'];
|
||||
final dataCode = res.data['data']?['code'];
|
||||
if (code == 0 && dataCode == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': AiConclusionData.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
final handling = res.data['code'] == 0 && res.data['data']['code'] == 1;
|
||||
return {'status': false, 'msg': res.data['message'], 'handling': handling};
|
||||
final handling = code == 0 && dataCode == 1;
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
'handling': handling,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import 'package:PiliPlus/pages/video/related/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
@@ -744,6 +745,10 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
|
||||
// ai总结
|
||||
Future aiConclusion() async {
|
||||
if (!Accounts.heartbeat.isLogin) {
|
||||
SmartDialog.showToast("账号未登录");
|
||||
return;
|
||||
}
|
||||
SmartDialog.showLoading(msg: '正在获取AI总结');
|
||||
final res = await VideoHttp.aiConclusion(
|
||||
bvid: bvid,
|
||||
|
||||
@@ -890,30 +890,28 @@ class _UgcIntroPanelState extends TripleState<UgcIntroPanel>
|
||||
);
|
||||
|
||||
Widget get _aiBtn => Positioned(
|
||||
right: 10,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
right: 8,
|
||||
child: Center(
|
||||
child: Semantics(
|
||||
label: 'AI总结',
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () async {
|
||||
if (introController.aiConclusionResult == null) {
|
||||
await introController.aiConclusion();
|
||||
}
|
||||
if (introController.aiConclusionResult == null) {
|
||||
return;
|
||||
}
|
||||
if (introController.aiConclusionResult!.summary?.isNotEmpty ==
|
||||
true ||
|
||||
introController.aiConclusionResult!.outline?.isNotEmpty ==
|
||||
true) {
|
||||
if (introController.aiConclusionResult case final res?) {
|
||||
if (res.summary?.isNotEmpty == true ||
|
||||
res.outline?.isNotEmpty == true) {
|
||||
widget.showAiBottomSheet();
|
||||
} else {
|
||||
SmartDialog.showToast("当前视频不支持AI视频总结");
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Image.asset('assets/images/ai.png', height: 22),
|
||||
child: Image.asset(
|
||||
semanticLabel: 'AI总结',
|
||||
'assets/images/ai.png',
|
||||
height: 18,
|
||||
width: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user