@@ -94,7 +94,7 @@ private fun parseAlphaResponse(raw: String): String {
9494fun AlphaQueryAnswer (
9595 alphaLLMApiKey : String ,
9696 alphaLLMApiUrl : String ,
97- predictions : Map < String , Pair < String , Float >> ? ,
97+ insectName : String? ,
9898 modifier : Modifier = Modifier
9999) {
100100 var queryText by remember { mutableStateOf(" " ) }
@@ -130,10 +130,9 @@ fun AlphaQueryAnswer(
130130 val ctx = LocalContext .current
131131
132132 // Auto-generate query from predictions and auto-query when predictions change
133- LaunchedEffect (predictions) {
134- predictions?.takeIf { it.isNotEmpty() }?.let { infos ->
135- val insectName = infos.values.joinToString(" " )
136- queryText = " Write a short description of this insect: $insectName : characteristics, habitat, and interesting facts"
133+ LaunchedEffect (insectName) {
134+ insectName?.takeIf { it.isNotEmpty() }?.let { name ->
135+ queryText = " Write a short description of this insect: $name : characteristics, habitat, and interesting facts"
137136
138137 // Auto-launch query
139138 isLoading = true
@@ -170,10 +169,9 @@ fun AlphaQueryAnswer(
170169
171170
172171 fun resetQuery () {
173- predictions?.takeIf { it.isNotEmpty() }?.let { infos ->
174- val insectName = infos.values.joinToString(" " )
172+ insectName?.takeIf { it.isNotEmpty() }?.let { name ->
175173 queryText =
176- " Write a short description of this insect: $insectName : characteristics, habitat, and interesting facts"
174+ " Write a short description of this insect: $name : characteristics, habitat, and interesting facts"
177175 }
178176 }
179177
0 commit comments