doc: improve questions

This commit is contained in:
androidlover5842
2026-01-31 01:27:12 +05:30
parent 3d1bf64790
commit d09c25d678

View File

@@ -24,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import org.springframework.http.MediaType import org.springframework.http.MediaType
import jakarta.servlet.http.HttpServletResponse 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.multipart.MultipartFile
import org.springframework.web.server.ResponseStatusException import org.springframework.web.server.ResponseStatusException
import java.time.OffsetDateTime import java.time.OffsetDateTime
@@ -31,6 +33,11 @@ import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import java.util.UUID import java.util.UUID
import java.security.MessageDigest 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 @RestController
@RequestMapping("/properties/{propertyId}/guests/{guestId}/documents") @RequestMapping("/properties/{propertyId}/guests/{guestId}/documents")
@@ -219,18 +226,35 @@ class GuestDocuments(
val aadharQuestions = linkedMapOf( val aadharQuestions = linkedMapOf(
"hasAddress" to "ADDRESS PRESENT? Answer YES or NO only.", "hasAddress" to "ADDRESS PRESENT? Answer YES or NO only.",
"hasGender" to "GENDER PRESENT? Answer YES or NO only.", "hasGender" to "GENDER PRESENT? Answer YES or NO only.",
"name" to "NAME? Reply only the name or NONE.", "hasDob" to "DOB? Reply YES or NO.",
"dob" to "DOB? Reply only date or NONE.", "hasGender" to "GENDER MENTIONED? Reply YES or NO.",
"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."
)
for ((key, question) in aadharQuestions) { for ((key, question) in aadharQuestions) {
results[key] = llamaClient.ask(imageUrl, question) 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 { } else {
val generalQuestions = linkedMapOf( val generalQuestions = linkedMapOf(
"hasTransportDept" to "CONTAINS TRANSPORT DEPARTMENT? Answer YES or NO only.", "hasTransportDept" to "CONTAINS TRANSPORT DEPARTMENT? Answer YES or NO only.",
@@ -310,7 +334,6 @@ class GuestDocuments(
null null
} }
} }
} }
data class GuestDocumentResponse( data class GuestDocumentResponse(