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,
defaultVal: false,
),
const SetSwitchItem(
title: '启用ai总结',
subTitle: '视频详情页开启ai总结',
setKey: SettingBoxKey.enableAi,
defaultVal: true,
),
ListTile(
dense: false,
title: Text('评论展示', style: titleStyle),

View File

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

View File

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

View File

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