feat: ai总结开关

This commit is contained in:
guozhigq
2023-12-02 23:10:11 +08:00
parent 00f84e1a1c
commit 4550ce2637
4 changed files with 24 additions and 22 deletions

View File

@ -169,6 +169,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
setKey: SettingBoxKey.enableSaveLastData, setKey: SettingBoxKey.enableSaveLastData,
defaultVal: false, defaultVal: false,
), ),
const SetSwitchItem(
title: '启用ai总结',
subTitle: '视频详情页开启ai总结',
setKey: SettingBoxKey.enableAi,
defaultVal: true,
),
ListTile( ListTile(
dense: false, dense: false,
title: Text('评论展示', style: titleStyle), title: Text('评论展示', style: titleStyle),

View File

@ -568,13 +568,7 @@ class VideoIntroController extends GetxController {
upMid: videoDetail.value.owner!.mid!, upMid: videoDetail.value.owner!.mid!,
); );
if (res['status']) { if (res['status']) {
if (res['data'].modelResult.resultType == 0) { modelResult = res['data'].modelResult;
SmartDialog.showToast('该视频不支持ai总结');
}
if (res['data'].modelResult.resultType == 2 ||
res['data'].modelResult.resultType == 1) {
modelResult = res['data'].modelResult;
}
} }
SmartDialog.dismiss(); SmartDialog.dismiss();
return res; return res;

View File

@ -134,6 +134,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
late final dynamic followStatus; late final dynamic followStatus;
late int mid; late int mid;
late String memberHeroTag; late String memberHeroTag;
late bool enableAi;
@override @override
void initState() { void initState() {
@ -150,6 +151,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? '-' ? '-'
: Utils.numFormat(videoIntroController.userStat['follower']); : Utils.numFormat(videoIntroController.userStat['follower']);
followStatus = videoIntroController.followStatus; followStatus = videoIntroController.followStatus;
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
} }
// 收藏 // 收藏
@ -317,23 +319,22 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
), ),
), ),
Positioned( if (enableAi)
right: 10, Positioned(
top: 6, right: 10,
child: GestureDetector( top: 6,
onTap: () async { child: GestureDetector(
var res = await videoIntroController.aiConclusion(); onTap: () async {
if (res['status']) { var res =
if (res['data'].modelResult.resultType == 2 || await videoIntroController.aiConclusion();
res['data'].modelResult.resultType == 1) { if (res['status']) {
showAiBottomSheet(); showAiBottomSheet();
} }
} },
}, child:
child: Image.asset('assets/images/ai.png', height: 22),
Image.asset('assets/images/ai.png', height: 22), ),
), )
)
], ],
), ),
// 点赞收藏转发 布局样式1 // 点赞收藏转发 布局样式1

View File

@ -138,6 +138,7 @@ class SettingBoxKey {
static const String displayMode = 'displayMode'; static const String displayMode = 'displayMode';
static const String customRows = 'customRows'; // 自定义列 static const String customRows = 'customRows'; // 自定义列
static const String enableMYBar = 'enableMYBar'; static const String enableMYBar = 'enableMYBar';
static const String enableAi = 'enableAi';
} }
class LocalCacheKey { class LocalCacheKey {