From d15d118b9bb517296e25f040ab43b5517b9c5fa5 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 06 三月 2026 16:57:30 +0800
Subject: [PATCH] 2026年03月06日16:57:13
---
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 78 +++++++++++++++++++++++++++++++++++++-
1 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 059e728..c5084df 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -47,6 +47,7 @@
import com.hdl.photovoltaic.listener.LinkCallBack;
import com.hdl.photovoltaic.ui.LoginActivity;
import com.hdl.photovoltaic.ui.bean.CUserInfo;
+import com.hdl.photovoltaic.ui.bean.ChatMessageBean;
import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean;
import com.hdl.photovoltaic.ui.bean.DeviceInfoBean;
import com.hdl.photovoltaic.ui.bean.DeviceTimeBean;
@@ -72,6 +73,7 @@
import com.hdl.photovoltaic.uni.HDLUniMPSDKManager;
import com.hdl.photovoltaic.utils.NetworkUtils;
import com.hdl.photovoltaic.utils.PermissionUtils;
+import com.hdl.photovoltaic.utils.SharedPreUtils;
import com.hdl.photovoltaic.utils.WifiUtils;
import com.hdl.sdk.link.common.exception.HDLLinkException;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
@@ -938,6 +940,19 @@
}
});
+ } else if (HDLUniMP.UNI_EVENT_REPLY_AI_MODEL.equals(topic)) {
+ switch (type) {
+ //鍙戦�乤i瀵硅瘽鑱婂ぉ
+ case HDLUniMP.UNI_EVENT_REPLY_AI_MODEL_SENDAIREQUEST: {
+ this.uniSendAIChat(mode_type, data, callback);
+ }
+ break;
+ //鍙戦��(鍙栨秷/鏆傚仠)AI鑱婂ぉ瀵硅瘽
+ case HDLUniMP.UNI_EVENT_REPLY_AI_MODEL_PAUSEAIREQUEST: {
+ this.uniSendStopAIChat(mode_type, data, callback);
+ }
+ break;
+ }
}
} catch (Exception e) {
@@ -946,6 +961,62 @@
}
+ /**
+ * Uni(鍙栨秷/鏆傚仠)AI鑱婂ぉ瀵硅瘽
+ *
+ * @param callback -
+ */
+ private void uniSendStopAIChat(String type, Object data, DCUniMPJSCallback callback) {
+ String task_id = getKeyValue("task_id", getKeyValue("data", data));
+ if (TextUtils.isEmpty(task_id)) {
+ uniCallbackData(type, null, -2, "task_id empty", callback);
+ }
+ HdlAiLogic.getInstance().chatMessageStop(task_id, new CloudCallBeak<Boolean>() {
+ @Override
+ public void onSuccess(Boolean obj) {
+ if (callback != null) {
+ uniSuccessCallback(type, obj, callback);
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+ }
+ });
+ }
+
+ /**
+ * Uni鍙戣捣AI鑱婂ぉ瀵硅瘽
+ *
+ * @param callback -
+ */
+ private void uniSendAIChat(String type, Object data, DCUniMPJSCallback callback) {
+ String query = getKeyValue("query", getKeyValue("data", data));
+ HdlAiLogic.getInstance().chatMessages(query, new CloudCallBeak<ChatMessageBean>() {
+ @Override
+ public void onSuccess(ChatMessageBean obj) {
+ HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
+ if (obj == null) {
+ //琛ㄧず缁撴潫
+ uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_REPLY_AI_MODEL_AISTREAMINGEND);
+ } else {
+ uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_REPLY_AI_MODEL_AISTREAMING);
+ uniCallBackBaseBean.setData(obj);
+ }
+ HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+// HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
+// uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_REPLY_AI_MODEL_AISTREAMINGEND);
+// uniCallBackBaseBean.setData(e.getMessage());
+// HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+ }
+ });
+ }
/**
* 鍘熺敓銆愭墦寮�銆憉ni鎸囧畾椤甸潰
@@ -1879,7 +1950,7 @@
gatewayDriverBean.setDriverCode(driverInfoAry[0]);
gatewayDriverBean.setImageId(driverInfoAry[1]);
gatewayDriverBean.setVersion(driverInfoAry[2].replace(".zip", ""));
- gatewayDriverBean.setLocalUrl(HdlFileLogic.getInstance().getDrivePathFileName(gatewayDriverBean.getDriverCode(),gatewayDriverBean.getImageId(), gatewayDriverBean.getVersion()));
+ gatewayDriverBean.setLocalUrl(HdlFileLogic.getInstance().getDrivePathFileName(gatewayDriverBean.getDriverCode(), gatewayDriverBean.getImageId(), gatewayDriverBean.getVersion()));
list.add(gatewayDriverBean);
}
}
@@ -1912,7 +1983,7 @@
@Override
public void run() {
- String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode,imageId, version);
+ String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode, imageId, version);
//涓嶅湪瀛愮嚎绋嬭娴佷細鍗℃涓荤嚎绋�
boolean isBoolean = HdlOtaLogic.getInstance().disposeDownLoadFile(drivePathFileName, responseBody, md5, HdlOtaLogic.driver_type);
if (isBoolean) {
@@ -1964,7 +2035,7 @@
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
//鏈湴鍗囩骇椹卞姩鏂囦欢璺緞
- String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode,imageId, version);
+ String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode, imageId, version);
byte[] data = HdlFileLogic.getInstance().readFileByte(drivePathFileName);
if (data == null || data.length == 0) {
uniCallbackData(type, null, -2, HDLApp.getInstance().getAppLocaleContext().getString(R.string.found_locally_drive_file), callback);
@@ -3088,6 +3159,7 @@
// data.put("appSecret", AppConfigManage.getAppSecret());
// }
data.put("appLanguage", UserConfigManage.getInstance().getCurrentAppLanguage());
+ data.put("tourist_mode", UserConfigManage.getInstance().isTourist_mode());
uniCallBackBaseBean.setData(data);
return getJSONObject(uniCallBackBaseBean);
} catch (Exception e) {
--
Gitblit v1.8.0