Branch AI questions based on Aadhaar detection
All checks were successful
build-and-deploy / build-deploy (push) Successful in 31s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 31s
This commit is contained in:
@@ -211,36 +211,54 @@ class GuestDocuments(
|
||||
val imageUrl =
|
||||
"${aiBaseUrl}/properties/$propertyId/guests/$guestId/documents/${document.id}/file?token=$token"
|
||||
|
||||
val questions = linkedMapOf(
|
||||
"hasAadhar" to "CONTAINS AADHAAR? Answer YES or NO only.",
|
||||
"hasUidai" to "CONTAINS UIDAI? Answer YES or NO only.",
|
||||
"hasTransportDept" to "CONTAINS TRANSPORT DEPARTMENT? Answer YES or NO only.",
|
||||
"hasIncomeTaxDept" to "CONTAINS INCOME TAX DEPARTMENT? Answer YES or NO only.",
|
||||
"hasElectionCommission" to "CONTAINS ELECTION COMMISSION OF INDIA? Answer YES or NO only.",
|
||||
"hasDrivingLicence" to "CONTAINS DRIVING LICENCE? Answer YES or NO only.",
|
||||
"hasPassport" to "CONTAINS PASSPORT? Answer YES or NO only.",
|
||||
"hasPolice" to "CONTAINS POLICE? Answer YES or NO only.",
|
||||
"hasCourt" to "CONTAINS COURT? Answer YES or NO only.",
|
||||
"hasHighCourt" to "CONTAINS HIGH COURT? Answer YES or NO only.",
|
||||
"hasSupremeCourt" to "CONTAINS SUPREME COURT? Answer YES or NO only.",
|
||||
"hasJudiciary" to "CONTAINS JUDICIARY? Answer YES or NO only.",
|
||||
"hasAddress" to "ADDRESS PRESENT? Answer YES or NO only.",
|
||||
"hasGender" to "GENDER PRESENT? Answer YES or NO only.",
|
||||
"hasNationality" to "NATIONALITY 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.",
|
||||
"vehicleNumber" to "VEHICLE NUMBER? Reply only number or NONE.",
|
||||
"isVehiclePhoto" to "IS THIS A VEHICLE PHOTO? Answer YES or NO only.",
|
||||
"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."
|
||||
)
|
||||
val results = linkedMapOf<String, String>()
|
||||
for ((key, question) in questions) {
|
||||
results[key] = llamaClient.ask(imageUrl, question)
|
||||
results["hasAadhar"] = llamaClient.ask(imageUrl, "CONTAINS AADHAAR? Answer YES or NO only.")
|
||||
results["hasUidai"] = llamaClient.ask(imageUrl, "CONTAINS UIDAI? Answer YES or NO only.")
|
||||
val hasAadhar = results["hasAadhar"].orEmpty().contains("YES", true) ||
|
||||
results["hasUidai"].orEmpty().contains("YES", true)
|
||||
if (hasAadhar) {
|
||||
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."
|
||||
)
|
||||
for ((key, question) in aadharQuestions) {
|
||||
results[key] = llamaClient.ask(imageUrl, question)
|
||||
}
|
||||
} else {
|
||||
val generalQuestions = linkedMapOf(
|
||||
"hasTransportDept" to "CONTAINS TRANSPORT DEPARTMENT? Answer YES or NO only.",
|
||||
"hasIncomeTaxDept" to "CONTAINS INCOME TAX DEPARTMENT? Answer YES or NO only.",
|
||||
"hasElectionCommission" to "CONTAINS ELECTION COMMISSION OF INDIA? Answer YES or NO only.",
|
||||
"hasDrivingLicence" to "CONTAINS DRIVING LICENCE? Answer YES or NO only.",
|
||||
"hasPassport" to "CONTAINS PASSPORT? Answer YES or NO only.",
|
||||
"hasPolice" to "CONTAINS POLICE? Answer YES or NO only.",
|
||||
"hasCourt" to "CONTAINS COURT? Answer YES or NO only.",
|
||||
"hasHighCourt" to "CONTAINS HIGH COURT? Answer YES or NO only.",
|
||||
"hasSupremeCourt" to "CONTAINS SUPREME COURT? Answer YES or NO only.",
|
||||
"hasJudiciary" to "CONTAINS JUDICIARY? Answer YES or NO only.",
|
||||
"hasNationality" to "NATIONALITY 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.",
|
||||
"vehicleNumber" to "VEHICLE NUMBER? Reply only number or NONE.",
|
||||
"isVehiclePhoto" to "IS THIS A VEHICLE PHOTO? Answer YES or NO only.",
|
||||
"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 generalQuestions) {
|
||||
results[key] = llamaClient.ask(imageUrl, question)
|
||||
}
|
||||
}
|
||||
|
||||
results["docType"] = when {
|
||||
|
||||
Reference in New Issue
Block a user