添加了模拟识别菜品功能

This commit is contained in:
zxj
2025-08-13 11:29:08 +08:00
parent e93550a24b
commit f055441340
5 changed files with 63 additions and 39 deletions
@@ -16,7 +16,6 @@ import com.sw.plate.utils.ToastUtils
import com.sw.plate.utils.arcface.FaceApi
import com.sw.plate.utils.arcface.facedb.entity.FaceEntity
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
@@ -51,7 +50,6 @@ class UserViewModel : BaseViewModel() {
private val _loadFaceResult = MutableStateFlow<Boolean>(false)
val loadFaceResult : StateFlow<Boolean> = _loadFaceResult
/**
* 获取token
*/
@@ -140,15 +138,10 @@ class UserViewModel : BaseViewModel() {
fun getIdentifiedFoodList() {
Timber.d("identifiedFoodList")
launchWithLoading {
delay(5000)
_identifiedFoodInfoList.value = List(6) {
FoodInfo(
id = "185225109358109491${it}",
foodName = "豆芽炒粉条$it",
imgUrl = "http://101.201.149.156:9002/temp/20230912/f54b2d76-45e1-4c6b-a7a0-5fd1eace99d1_1694484601879.png"
)
val response = repository.getRestInfoFoodsByType(foodName = "")
if (parseResponse(response)) {
_identifiedFoodInfoList.value = response.result ?: emptyList()
}
// _currentFoodInfo.value = _identifiedFoodInfoList.value[0]
}
}