识别图片处理、查询菜品数据

This commit is contained in:
2025-10-17 14:47:28 +08:00
parent dd51448aea
commit a27cc5f7ee
10 changed files with 221 additions and 31 deletions
@@ -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()
}
}
}
}