识别图片处理、查询菜品数据
This commit is contained in:
@@ -49,6 +49,8 @@ class UserViewModel : BaseViewModel() {
|
||||
*/
|
||||
private val _loadFaceResult = MutableStateFlow<Boolean>(false)
|
||||
val loadFaceResult : StateFlow<Boolean> = _loadFaceResult
|
||||
private val _identifiedFoodInfoList2 = MutableStateFlow<List<FoodInfo>>(emptyList())
|
||||
val identifiedFoodInfoList2: StateFlow<List<FoodInfo>> = _identifiedFoodInfoList2
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
@@ -205,4 +207,14 @@ class UserViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getFoodInfo(foodName: String) {
|
||||
Timber.d("getFoodInfo")
|
||||
launchWithLoading {
|
||||
val response = repository.getFoodInfo(foodName = foodName)
|
||||
if (parseResponse(response)) {
|
||||
_identifiedFoodInfoList2.value = response.result ?: emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user