[t1t2]
[fea]
[vlm 添加时间戳和日志]
This commit is contained in:
yangyakun
2025-06-23 15:59:29 +08:00
parent d1c110be64
commit 9b92a92e99
6 changed files with 45 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.bridge.BridgeServiceManager
import com.mogo.och.common.module.biz.birdge.data.VlmData
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import vllm.Vlm
import kotlin.properties.Delegates
@@ -25,22 +26,31 @@ object OchVlmManager : IVlmListener {
if (oldValue != newValue) {
if(newValue.imageSourceTimestamp == vllmData.messageSourceTimestamp){
CallerLogger.d(TAG," message先来 图片后来 发送message和图片 ${newValue.imageSourceTimestamp}---${vllmData.messageSourceTimestamp}")
BridgeServiceManager.invokeVlmData(VlmData(vllmData.id,vllmData.message,newValue.image))
val timemillis = System.currentTimeMillis()
BridgeServiceManager.invokeVlmData(VlmData(vllmData.id,vllmData.message,newValue.image, timemillis))
OchChainLogManager.writeChainLogEyeVlm("收到VlmData"," message先来 图片后来 发送message和图片 ${newValue.imageSourceTimestamp}---${vllmData.messageSourceTimestamp}--$timemillis")
}
}
}
private var vllmData: VlmMessageData by Delegates.observable(VlmMessageData(0.0,0,"")) { _, oldValue, newValue ->
if (oldValue != newValue) {
if(newValue.messageSourceTimestamp== vllmImageData.imageSourceTimestamp){
val currentTimeMillis = System.currentTimeMillis()
if(newValue.messageSourceTimestamp== vllmImageData.imageSourceTimestamp){
// 图片先来 发送message和图片
BridgeServiceManager.invokeVlmData(VlmData(newValue.id,newValue.message,
vllmImageData.image)
vllmImageData.image, currentTimeMillis
)
)
CallerLogger.d(TAG,"messsage后来 图片先来 发送message和图片 ${newValue.message}----${newValue.messageSourceTimestamp}---${newValue.id}")
OchChainLogManager.writeChainLogEyeVlm("收到VlmData","messsage后来 图片先来 发送message和图片 ${newValue.message}----${newValue.messageSourceTimestamp}---${newValue.id}--$currentTimeMillis")
}else{
// message 先来 单独发送message 图片来了后 再次发送出去
BridgeServiceManager.invokeVlmData(VlmData(newValue.id,newValue.message,null))
CallerLogger.d(TAG,"message先来 图片后来 发送message ${newValue.message}---${newValue.messageSourceTimestamp}---${newValue.id}")
BridgeServiceManager.invokeVlmData(VlmData(newValue.id,newValue.message,null,
currentTimeMillis
))
CallerLogger.d(TAG,"message先来 图片后来 发送message ${newValue.message}---${newValue.messageSourceTimestamp}---${newValue.id}---$currentTimeMillis")
OchChainLogManager.writeChainLogEyeVlm("收到VlmData","message先来 图片后来 发送message ${newValue.message}---${newValue.messageSourceTimestamp}---${newValue.id}---$currentTimeMillis")
}
}
}

View File

@@ -1,6 +1,11 @@
package com.mogo.och.common.module.biz.birdge.data
data class VlmData(val id:Int?,val message:String?,var image: ByteArray?) {
data class VlmData(
val id: Int?,
val message: String?,
var image: ByteArray?,
var timestamp: Long = System.currentTimeMillis()
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

View File

@@ -64,12 +64,16 @@ object OchChainLogManager {
const val EVENT_KEY_INFO_ERROR = "analytics_event_och_error"
const val EVENT_KEY_INFO_VLM = "analytics_event_och_vlm"
fun writeChainLogEye(title: String, info: String) {
writeChainLog(title, info, true, EVENT_KEY_INFO_CALL_EYE)
}
fun writeChainLogEyeVlm(title: String, info: String) {
writeChainLog(title, info, false, EVENT_KEY_INFO_VLM)
}
// 时间方面的日志
fun writeChainLogTime(title: String, info: String) {

View File

@@ -177,11 +177,4 @@ sealed class AIMessage(
var roadList: List<RoadMsg>
): AIMessage(id,title)
data class AiVlmData(
override val id: String,
override val title: String,
var desc: String,
var vlmData: VlmData
):AIMessage(id,title)
}

View File

@@ -28,7 +28,6 @@ import com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventLivePlayView
import com.mogo.eagle.core.function.view.MapRoamView
import com.mogo.eagle.core.function.view.RoadCrossRoamListAdapter
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView
@@ -454,6 +453,7 @@ class NDEViewHolder(binding: View) : MessageViewHolder(binding){
class VlmViewHolder(binding: View) : MessageViewHolder(binding){
private var tvNdeTitle: TextView = binding.findViewById(R.id.tvVlmMessage)
private var tvVlmTime: TextView = binding.findViewById(R.id.tvVlmTimeStr)
private var acivVlmImage: AppCompatImageView = binding.findViewById(R.id.acivVlmImage)
@@ -461,6 +461,7 @@ class VlmViewHolder(binding: View) : MessageViewHolder(binding){
if(item is AIMessage.AiVlmData){
tvNdeTitle.text = item.vlmData.message
acivVlmImage.showOrHideWithByteArray(item.vlmData.image)
tvVlmTime.text = "更新时间:${DateTimeUtils.getTimeText(item.vlmData.timestamp,DateTimeUtils.HH_mm_ss)}"
}
}

View File

@@ -27,24 +27,39 @@
android:layout_marginStart="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_27"
android:layout_marginBottom="@dimen/dp_20"
tools:text="前方100米有道路施工施工长度100米影响第1、2车道通行。"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/acivVlmImage"
app:layout_constraintTop_toBottomOf="@+id/tvVlmMessage"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_27"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:src="@drawable/icon_image_holder"
tools:background="@color/taxi_cp_394047"
android:layout_width="@dimen/dp_0"
android:layout_height="@dimen/dp_387"/>
<TextView
android:id="@+id/tvVlmTimeStr"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:ellipsize="end"
android:gravity="start"
android:maxLines="1"
android:textColor="#131415"
android:textSize="@dimen/dp_24"
android:layout_marginStart="@dimen/dp_30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/acivVlmImage"
tools:text="更新时间10:38:20" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>