采集向量优化调试
This commit is contained in:
@@ -40,12 +40,12 @@ class UserViewModel : BaseViewModel() {
|
||||
private val faceApi: FaceApi = FaceApi()
|
||||
|
||||
// 识别出的列表
|
||||
private val _identifiedFoodInfoList = MutableStateFlow<List<FoodInfo>>(emptyList())
|
||||
val identifiedFoodInfoList: StateFlow<List<FoodInfo>> = _identifiedFoodInfoList
|
||||
// private val _identifiedFoodInfoList = MutableStateFlow<List<FoodInfo>>(emptyList())
|
||||
// val identifiedFoodInfoList: StateFlow<List<FoodInfo>> = _identifiedFoodInfoList
|
||||
|
||||
// 搜索出的食物列表
|
||||
private val _searchFoodInfoList = MutableStateFlow<List<FoodInfo>>(emptyList())
|
||||
val searchFoodInfoList: StateFlow<List<FoodInfo>> = _searchFoodInfoList
|
||||
// private val _searchFoodInfoList = MutableStateFlow<List<FoodInfo>>(emptyList())
|
||||
// val searchFoodInfoList: StateFlow<List<FoodInfo>> = _searchFoodInfoList
|
||||
|
||||
// 就餐数据
|
||||
// private val _nutritionData = MutableStateFlow<UserNutritionData?>(null)
|
||||
@@ -225,6 +225,8 @@ class UserViewModel : BaseViewModel() {
|
||||
val list: List<CollectedFoodInfo> = response.data ?: emptyList()
|
||||
block(list)
|
||||
}
|
||||
} else {
|
||||
block(emptyList())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -278,10 +280,10 @@ class UserViewModel : BaseViewModel() {
|
||||
// }
|
||||
// }
|
||||
|
||||
fun cleanIdentifiedFoodInfoList() {
|
||||
Timber.tag(TAG).d("cleanIdentifiedFoodInfoList")
|
||||
_identifiedFoodInfoList.value = emptyList<FoodInfo>()
|
||||
}
|
||||
// fun cleanIdentifiedFoodInfoList() {
|
||||
// Timber.tag(TAG).d("cleanIdentifiedFoodInfoList")
|
||||
// _identifiedFoodInfoList.value = emptyList<FoodInfo>()
|
||||
// }
|
||||
|
||||
/**
|
||||
* 搜索食物
|
||||
@@ -293,15 +295,15 @@ class UserViewModel : BaseViewModel() {
|
||||
if (parseResponse(response)) {
|
||||
val list = response.data ?: emptyList()
|
||||
action(list)
|
||||
_identifiedFoodInfoList.value = response.data ?: emptyList()
|
||||
// _identifiedFoodInfoList.value = response.data ?: emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun cleanSearchFoodInfoList() {
|
||||
Timber.tag(TAG).d("cleanSearchFoodInfoList")
|
||||
_searchFoodInfoList.value = emptyList<FoodInfo>()
|
||||
}
|
||||
// fun cleanSearchFoodInfoList() {
|
||||
// Timber.tag(TAG).d("cleanSearchFoodInfoList")
|
||||
// _searchFoodInfoList.value = emptyList<FoodInfo>()
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 获取用户就餐数据
|
||||
@@ -383,7 +385,7 @@ class UserViewModel : BaseViewModel() {
|
||||
val response = repository.getFoodInfo(foodName = foodName)
|
||||
if (parseResponse(response)) {
|
||||
val list = response.data ?: emptyList()
|
||||
_identifiedFoodInfoList.value = list
|
||||
// _identifiedFoodInfoList.value = list
|
||||
action(list)
|
||||
} else {
|
||||
action(emptyList())
|
||||
|
||||
Reference in New Issue
Block a user