|
|
@@ -10,6 +10,7 @@ import '../../utils/atmob_log.dart';
|
|
|
import '../../utils/http_handler.dart';
|
|
|
import '../api/atmob_api.dart';
|
|
|
import '../api/request/intimacy_analyze_request.dart';
|
|
|
+import '../api/response/intimacy_analyze_chat_config_response.dart';
|
|
|
import '../api/response/intimacy_analyze_config_response.dart';
|
|
|
import '../api/response/intimacy_analyze_response.dart';
|
|
|
|
|
|
@@ -24,10 +25,15 @@ class IntimacyAnalyzeRepository {
|
|
|
Rxn<IntimacyAnalyzeConfigResponse> intimacyAnalyzeConfig =
|
|
|
Rxn<IntimacyAnalyzeConfigResponse>();
|
|
|
|
|
|
+ /// 对话分析配置
|
|
|
+ Rxn<IntimacyAnalyzeChatConfigResponse> intimacyAnalyzeChatConfig =
|
|
|
+ Rxn<IntimacyAnalyzeChatConfigResponse>();
|
|
|
+
|
|
|
IntimacyAnalyzeRepository(this.atmobApi) {
|
|
|
AtmobLog.d(tag, '$tag...init');
|
|
|
// 初始化时,刷新配置
|
|
|
- refreshIntimacyAnalyzeConfig();
|
|
|
+ _refreshIntimacyAnalyzeConfig();
|
|
|
+ _refreshIntimacyAnalyzeChatConfig();
|
|
|
}
|
|
|
|
|
|
/// 从Getx的依赖注入中,获取实例,适合在没有依赖注入上下文的地方使用
|
|
|
@@ -36,7 +42,7 @@ class IntimacyAnalyzeRepository {
|
|
|
}
|
|
|
|
|
|
/// 刷新亲密度配置
|
|
|
- void refreshIntimacyAnalyzeConfig() {
|
|
|
+ void _refreshIntimacyAnalyzeConfig() {
|
|
|
AsyncUtil.retry(
|
|
|
() => requestIntimacyAnalyzeConfig(),
|
|
|
Duration(seconds: 3),
|
|
|
@@ -47,6 +53,18 @@ class IntimacyAnalyzeRepository {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /// 刷新对话分析配置
|
|
|
+ void _refreshIntimacyAnalyzeChatConfig() {
|
|
|
+ AsyncUtil.retry(
|
|
|
+ () => requestIntimacyAnalyzeChatConfig(),
|
|
|
+ Duration(seconds: 3),
|
|
|
+ maxRetry: 100,
|
|
|
+ ).then((IntimacyAnalyzeChatConfigResponse configResponse) {
|
|
|
+ AtmobLog.d(tag, "获取对话分析配置成功: ${configResponse.toJson()}");
|
|
|
+ intimacyAnalyzeChatConfig.value = configResponse;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/// 获取亲密度配置
|
|
|
Future<IntimacyAnalyzeConfigResponse> requestIntimacyAnalyzeConfig() {
|
|
|
return atmobApi
|
|
|
@@ -54,6 +72,13 @@ class IntimacyAnalyzeRepository {
|
|
|
.then(HttpHandler.handle(true));
|
|
|
}
|
|
|
|
|
|
+ /// 获取对话分析配置
|
|
|
+ Future<IntimacyAnalyzeChatConfigResponse> requestIntimacyAnalyzeChatConfig() {
|
|
|
+ return atmobApi
|
|
|
+ .getIntimacyAnalyzeChatConfig(AppBaseRequest())
|
|
|
+ .then(HttpHandler.handle(true));
|
|
|
+ }
|
|
|
+
|
|
|
/// 分析亲密度
|
|
|
Future<IntimacyAnalyzeResponse> getIntimacyAnalyze(
|
|
|
IntimacyAnalyzeRequest request,
|