From d09c25d678c30ee0c4f4edcb8c66f24c5545bb79 Mon Sep 17 00:00:00 2001 From: androidlover5842 Date: Sat, 31 Jan 2026 01:27:12 +0530 Subject: [PATCH] doc: improve questions --- .../controller/GuestDocuments.kt | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt b/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt index 5a8f44a..74a3c70 100644 --- a/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt +++ b/src/main/kotlin/com/android/trisolarisserver/controller/GuestDocuments.kt @@ -24,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional import org.springframework.web.bind.annotation.* import org.springframework.http.MediaType import jakarta.servlet.http.HttpServletResponse +import org.aspectj.weaver.patterns.TypePatternQuestions +import org.hibernate.validator.constraints.URL import org.springframework.web.multipart.MultipartFile import org.springframework.web.server.ResponseStatusException import java.time.OffsetDateTime @@ -31,6 +33,11 @@ import java.nio.file.Files import java.nio.file.Paths import java.util.UUID import java.security.MessageDigest +import kotlin.collections.component1 +import kotlin.collections.component2 +import kotlin.collections.iterator +import kotlin.collections.set +import kotlin.text.set @RestController @RequestMapping("/properties/{propertyId}/guests/{guestId}/documents") @@ -219,18 +226,35 @@ class GuestDocuments( val aadharQuestions = linkedMapOf( "hasAddress" to "ADDRESS PRESENT? Answer YES or NO only.", "hasGender" to "GENDER PRESENT? Answer YES or NO only.", - "name" to "NAME? Reply only the name or NONE.", - "dob" to "DOB? Reply only date or NONE.", - "idNumber" to "ID NUMBER? Reply only number or NONE.", - "address" to "ADDRESS? Reply only address or NONE.", - "pinCode" to "PIN CODE? Reply only pin or NONE.", - "city" to "CITY? Reply only city or NONE.", - "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", - "nationality" to "NATIONALITY? Reply only nationality or NONE." - ) + "hasDob" to "DOB? Reply YES or NO.", + "hasGender" to "GENDER MENTIONED? Reply YES or NO.", + ) for ((key, question) in aadharQuestions) { results[key] = llamaClient.ask(imageUrl, question) } + val hashAddress=isYes("hasAddress") + if (hashAddress){ + val addressQuestions = linkedMapOf( + "pinCode" to "POSTAL ADDRESS PIN CODE (6 digit)? Reply only pin or NONE.", + "address" to "POSTAL ADDRESS? Reply only address or NONE.") + for ((key, question) in addressQuestions) { + results[key] = llamaClient.ask(imageUrl, question) + } + } + val hasDOB=isYes("hasDob") + val hasGender=isYes("hasGender") + if (hasDOB && hasGender){ + val aadharFrontQuestions = linkedMapOf( + "name" to "NAME? Reply only the name or NONE.", + "dob" to "DOB? Reply only date or NONE.", + "idNumber" to "ID NUMBER? Reply only number or NONE.", + "gender" to "GENDER? Reply only MALE/FEMALE/OTHER or NONE.", + ) + for ((key, question) in aadharFrontQuestions) { + results[key] = llamaClient.ask(imageUrl, question) + } + } + } else { val generalQuestions = linkedMapOf( "hasTransportDept" to "CONTAINS TRANSPORT DEPARTMENT? Answer YES or NO only.", @@ -310,7 +334,6 @@ class GuestDocuments( null } } - } data class GuestDocumentResponse( @@ -356,4 +379,4 @@ private fun GuestDocument.toResponse(objectMapper: ObjectMapper): GuestDocumentR private fun isYes(value: String?): Boolean { return value.orEmpty().contains("YES", ignoreCase = true) -} +} \ No newline at end of file