|
@@ -3,8 +3,10 @@ import 'package:get/get.dart';
|
|
|
import 'package:injectable/injectable.dart';
|
|
import 'package:injectable/injectable.dart';
|
|
|
import 'package:keyboard/base/base_controller.dart';
|
|
import 'package:keyboard/base/base_controller.dart';
|
|
|
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
|
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
|
|
|
|
+import '../../../data/api/response/intimacy_analyze_config_response.dart';
|
|
|
import '../../../data/bean/option_select_config.dart';
|
|
import '../../../data/bean/option_select_config.dart';
|
|
|
import '../../../data/bean/option_select_item.dart';
|
|
import '../../../data/bean/option_select_item.dart';
|
|
|
|
|
+import '../../../data/repository/intimacy_analyze_repository.dart';
|
|
|
import '../../../router/app_page_arguments.dart';
|
|
import '../../../router/app_page_arguments.dart';
|
|
|
import '../../../utils/atmob_log.dart';
|
|
import '../../../utils/atmob_log.dart';
|
|
|
import '../../../utils/image_picker_util.dart';
|
|
import '../../../utils/image_picker_util.dart';
|
|
@@ -14,22 +16,31 @@ import '../../../utils/image_picker_util.dart';
|
|
|
class IntimacyAnalyseUploadController extends BaseController {
|
|
class IntimacyAnalyseUploadController extends BaseController {
|
|
|
final String tag = "IntimacyAnalyseUploadController";
|
|
final String tag = "IntimacyAnalyseUploadController";
|
|
|
|
|
|
|
|
|
|
+ /// 亲密度分析Repository
|
|
|
|
|
+ IntimacyAnalyzeRepository intimacyAnalyzeRepository;
|
|
|
|
|
+
|
|
|
|
|
+ /// 亲密度配置
|
|
|
|
|
+ Rxn<IntimacyAnalyzeConfigResponse> get intimacyAnalyzeConfig =>
|
|
|
|
|
+ intimacyAnalyzeRepository.intimacyAnalyzeConfig;
|
|
|
|
|
+
|
|
|
/// 已选择的图片列表
|
|
/// 已选择的图片列表
|
|
|
RxList<AssetEntity> selectedAssetList = <AssetEntity>[].obs;
|
|
RxList<AssetEntity> selectedAssetList = <AssetEntity>[].obs;
|
|
|
|
|
|
|
|
/// Ai模型列表
|
|
/// Ai模型列表
|
|
|
- RxList<String> aiModelList =
|
|
|
|
|
- <String>['通用模式', 'DeepSeek R2', 'DeepSeek R1'].obs;
|
|
|
|
|
|
|
+ RxList<String> aiModelList = <String>[].obs;
|
|
|
|
|
|
|
|
/// 当前应用的Ai模型
|
|
/// 当前应用的Ai模型
|
|
|
- Rx<String> currentAiModel = 'DeepSeek R1'.obs;
|
|
|
|
|
|
|
+ Rx<String> currentAiModel = ''.obs;
|
|
|
|
|
|
|
|
/// 预测方向的选项列表
|
|
/// 预测方向的选项列表
|
|
|
RxList<OptionSelectConfig> directionOptionSelectConfigList =
|
|
RxList<OptionSelectConfig> directionOptionSelectConfigList =
|
|
|
<OptionSelectConfig>[].obs;
|
|
<OptionSelectConfig>[].obs;
|
|
|
|
|
|
|
|
/// 是否上传页
|
|
/// 是否上传页
|
|
|
- RxBool isUploadPage = false.obs;
|
|
|
|
|
|
|
+ RxBool isUploadPage = true.obs;
|
|
|
|
|
+
|
|
|
|
|
+ /// 是否可以自定义方向
|
|
|
|
|
+ RxBool isCanCustomDirection = false.obs;
|
|
|
|
|
|
|
|
/// 报告的markdown数据
|
|
/// 报告的markdown数据
|
|
|
RxString reportMarkdownData =
|
|
RxString reportMarkdownData =
|
|
@@ -58,6 +69,8 @@ class IntimacyAnalyseUploadController extends BaseController {
|
|
|
/// 报告是否已解锁
|
|
/// 报告是否已解锁
|
|
|
Rx<bool> isReportUnlock = true.obs;
|
|
Rx<bool> isReportUnlock = true.obs;
|
|
|
|
|
|
|
|
|
|
+ IntimacyAnalyseUploadController(this.intimacyAnalyzeRepository);
|
|
|
|
|
+
|
|
|
@override
|
|
@override
|
|
|
void onInit() {
|
|
void onInit() {
|
|
|
super.onInit();
|
|
super.onInit();
|
|
@@ -67,31 +80,50 @@ class IntimacyAnalyseUploadController extends BaseController {
|
|
|
@override
|
|
@override
|
|
|
void onReady() {
|
|
void onReady() {
|
|
|
super.onReady();
|
|
super.onReady();
|
|
|
- _initDirectionOptionSelectConfigList();
|
|
|
|
|
|
|
+ updateIntimacyAnalyzeConfig(intimacyAnalyzeConfig.value);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// 更新亲密度配置
|
|
|
|
|
+ void updateIntimacyAnalyzeConfig(IntimacyAnalyzeConfigResponse? config) {
|
|
|
|
|
+ isCanCustomDirection.value = (config != null ? config.custom : false)!;
|
|
|
|
|
+ _initDirectionOptionSelectConfigList(config);
|
|
|
|
|
+ _initAiModelList(config);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// 初始化预测方向选项列表
|
|
/// 初始化预测方向选项列表
|
|
|
- void _initDirectionOptionSelectConfigList() {
|
|
|
|
|
- directionOptionSelectConfigList.add(
|
|
|
|
|
- OptionSelectConfig("初相识", "", [
|
|
|
|
|
- OptionSelectItem("缘分指数", false),
|
|
|
|
|
- OptionSelectItem("暧昧进展", false),
|
|
|
|
|
- OptionSelectItem("感情调整", false),
|
|
|
|
|
- ]),
|
|
|
|
|
- );
|
|
|
|
|
- directionOptionSelectConfigList.add(
|
|
|
|
|
- OptionSelectConfig("恋爱", "", [
|
|
|
|
|
- OptionSelectItem("复合几率", false),
|
|
|
|
|
- OptionSelectItem("占有欲", false),
|
|
|
|
|
- OptionSelectItem("相爱相杀", false),
|
|
|
|
|
- ]),
|
|
|
|
|
- );
|
|
|
|
|
- directionOptionSelectConfigList.add(
|
|
|
|
|
- OptionSelectConfig("未来", "", [
|
|
|
|
|
- OptionSelectItem("结婚几率", false),
|
|
|
|
|
- OptionSelectItem("情感未来", false),
|
|
|
|
|
- ]),
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ void _initDirectionOptionSelectConfigList(
|
|
|
|
|
+ IntimacyAnalyzeConfigResponse? config,
|
|
|
|
|
+ ) {
|
|
|
|
|
+ List<OptionSelectConfig> newList =
|
|
|
|
|
+ config?.direction?.map((item) {
|
|
|
|
|
+ var title = item.title ?? "";
|
|
|
|
|
+ var iconUrl = item.iconUrl ?? "";
|
|
|
|
|
+ var optionList =
|
|
|
|
|
+ item.options?.map((value) {
|
|
|
|
|
+ return OptionSelectItem(value, false);
|
|
|
|
|
+ }).toList() ??
|
|
|
|
|
+ [];
|
|
|
|
|
+ return OptionSelectConfig(title, iconUrl, optionList);
|
|
|
|
|
+ }).toList() ??
|
|
|
|
|
+ [];
|
|
|
|
|
+ directionOptionSelectConfigList.clear();
|
|
|
|
|
+ directionOptionSelectConfigList.addAll(newList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// 初始化Ai模型列表
|
|
|
|
|
+ void _initAiModelList(IntimacyAnalyzeConfigResponse? config) {
|
|
|
|
|
+ List<String> newModelList =
|
|
|
|
|
+ config?.modes?.map((item) {
|
|
|
|
|
+ return item.name ?? "";
|
|
|
|
|
+ }).toList() ??
|
|
|
|
|
+ [];
|
|
|
|
|
+ aiModelList.clear();
|
|
|
|
|
+ aiModelList.addAll(newModelList);
|
|
|
|
|
+
|
|
|
|
|
+ // 默认取第一个作为选中项
|
|
|
|
|
+ if (newModelList.isNotEmpty) {
|
|
|
|
|
+ currentAiModel.value = aiModelList.first;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// 初始化参数
|
|
/// 初始化参数
|