This commit is contained in:
Hamza-Ayed
2024-07-19 15:25:36 +03:00
parent 1fe98b698b
commit 27de944c2f
7 changed files with 71 additions and 326 deletions

View File

@@ -83,10 +83,6 @@ PODS:
- google_mlkit_commons (0.7.1):
- Flutter
- MLKitVision
- google_mlkit_face_detection (0.11.0):
- Flutter
- google_mlkit_commons
- GoogleMLKit/FaceDetection (~> 6.0.0)
- google_mlkit_text_recognition (0.13.0):
- Flutter
- google_mlkit_commons
@@ -106,9 +102,6 @@ PODS:
- GoogleMaps/Base (7.4.0)
- GoogleMaps/Maps (7.4.0):
- GoogleMaps/Base
- GoogleMLKit/FaceDetection (6.0.0):
- GoogleMLKit/MLKitCore
- MLKitFaceDetection (~> 5.0.0)
- GoogleMLKit/MLKitCore (6.0.0):
- MLKitCommon (~> 11.0.0)
- GoogleMLKit/TextRecognition (6.0.0):
@@ -192,9 +185,6 @@ PODS:
- GoogleUtilities/UserDefaults (< 8.0, >= 7.13.0)
- GoogleUtilitiesComponents (~> 1.0)
- GTMSessionFetcher/Core (< 4.0, >= 3.3.2)
- MLKitFaceDetection (5.0.0):
- MLKitCommon (~> 11.0)
- MLKitVision (~> 7.0)
- MLKitTextRecognition (4.0.0):
- MLKitCommon (~> 11.0)
- MLKitTextRecognitionCommon (= 3.0.0)
@@ -303,7 +293,6 @@ DEPENDENCIES:
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- google_mlkit_commons (from `.symlinks/plugins/google_mlkit_commons/ios`)
- google_mlkit_face_detection (from `.symlinks/plugins/google_mlkit_face_detection/ios`)
- google_mlkit_text_recognition (from `.symlinks/plugins/google_mlkit_text_recognition/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
@@ -349,7 +338,6 @@ SPEC REPOS:
- Mantle
- MLImage
- MLKitCommon
- MLKitFaceDetection
- MLKitTextRecognition
- MLKitTextRecognitionCommon
- MLKitVision
@@ -399,8 +387,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
google_mlkit_commons:
:path: ".symlinks/plugins/google_mlkit_commons/ios"
google_mlkit_face_detection:
:path: ".symlinks/plugins/google_mlkit_face_detection/ios"
google_mlkit_text_recognition:
:path: ".symlinks/plugins/google_mlkit_text_recognition/ios"
google_sign_in_ios:
@@ -467,7 +453,6 @@ SPEC CHECKSUMS:
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
google_maps_flutter_ios: 590249c67f34f422122c232f2a626192adbc78ee
google_mlkit_commons: 96aaca445520311b84a2da013dedf3427fe4cc69
google_mlkit_face_detection: b760d6035222630f347352b3b13f4a23ea9fb994
google_mlkit_text_recognition: 393c2526da49aa6c9c883e6d69100f54af011e24
google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
@@ -488,7 +473,6 @@ SPEC CHECKSUMS:
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
MLImage: 1824212150da33ef225fbd3dc49f184cf611046c
MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1
MLKitFaceDetection: 7c0e8bf09ddd27105da32d088fca978a99fc30cc
MLKitTextRecognition: c83c18ad25496f2077f6ec93c5940487ff2eb343
MLKitTextRecognitionCommon: c0b3a63d529296a19bce1f8bc8a513644ed4d1f6
MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1

View File

@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>49</string>
<string>50</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>4.0.49</string>
<string>4.0.50</string>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
<key>GMSApiKey</key>

View File

@@ -111,6 +111,9 @@ class AppLink {
static String addApiKey = "$ride/apiKey/add.php";
static String getApiKey = "$ride/apiKey/get.php";
static String getCnMap = "$server/auth/cnMap.php";
static String getPromptDriverDocumentsEgypt =
"$server/auth/captin/getPromptDriverDocumentsEgypt.php";
static String updateApiKey = "$ride/apiKey/update.php";
static String deleteApiKey = "$ride/apiKey/delete.php";
static String checkPhoneNumberISVerfiedDriver =

View File

@@ -27,7 +27,8 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
},
);
print(response);
print(response.request);
print(response.body);
// if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {

View File

@@ -1410,9 +1410,22 @@ Output the extracted information in the following JSON formate and make date for
} else {}
}
List prompts = [];
getPrompt() async {
var res = await CRUD()
.get(link: AppLink.getPromptDriverDocumentsEgypt, payload: {});
if (res != 'failure') {
var d = jsonDecode(res)['message'];
prompts = d;
// print('prompts: ${prompts}');
} else {
print(res);
}
}
@override
void onInit() {
// generateContent();
getPrompt();
super.onInit();
}
}

View File

@@ -301,29 +301,10 @@ class EgyptCardAI extends StatelessWidget {
Text('Driver\'s License'.tr, style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
await ai.allMethodForAI("""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"license_type": "",
"national_number": "",
"name_arabic": "",
"name_english": "",
"firstName": "",
"lastName": "",
"address": "",
"issue_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"employmentType": "",
"license_categories": []
}
Important notes:
1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals.
2. The 'license_categories' should be an array, even if there's only one category.
3. Fill in all fields based on the information provided in the Arabic text.
4. If any information is missing, leave the field as an empty string or empty array as appropriate.
""", AppLink.uploadEgypt, 'driver_license'); //egypt
await ai.allMethodForAI(
ai.prompts[0]['prompt'].toString(),
AppLink.uploadEgypt,
'driver_license'); //egypt
},
icon: const Icon(Icons.refresh),
),
@@ -382,29 +363,8 @@ Important notes:
return Card(
child: InkWell(
onTap: () async {
await ai.allMethodForAI("""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"license_type": "",
"national_number": "",
"name_arabic": "",
"name_english": "",
"firstName": "",
"lastName": "",
"address": "",
"issue_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"employmentType": "",
"license_categories": []
}
Important notes:
1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals.
2. The 'license_categories' should be an array, even if there's only one category.
3. Fill in all fields based on the information provided in the Arabic text.
4. If any information is missing, leave the field as an empty string or empty array as appropriate.
""", AppLink.uploadEgypt, 'driver_license'); //egypt
await ai.allMethodForAI(ai.prompts[0]['prompt'].toString(),
AppLink.uploadEgypt, 'driver_license'); //egypt
},
child: Column(
children: [
@@ -456,29 +416,9 @@ Important notes:
Text('ID Documents Back'.tr, style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
await ai.allMethodForAI("""
Given the following Arabic text values:
Please create a JSON object with the following fields:
nationalID: Use exactly 14 digits, converting from Arabic numerals to Latin numerals (0-9).
issueDate: Format as YYYY-MM-DD using Latin numerals, setting the date to the last day of the provided month.
occupation: Translate and format consistently (e.g., all lowercase).
gender: Translate and format consistently (e.g., all lowercase).
country: Set to "egypt".
religion: Translate and format consistently (e.g., all lowercase).
maritalStatus: Translate and format consistently (e.g., all lowercase).
fullNameMarital: If maritalStatus is "أعزب", set this to "none". Otherwise, leave it as "none".
expirationDate: Format as YYYY-MM-DD using Latin numerals.
Important notes:
Ensure all date fields use Latin (Western) numerals (0-9) instead of Arabic numerals.
For the nationalID, use exactly 14 digits from the provided Arabic numeral string, converting to Latin numerals.
For issueDate, use the last day of the month since only year and month are provided.
Include the country field as "egypt".
Format all string values consistently (e.g., all lowercase or proper case).
Please provide the resulting JSON object. """, AppLink.uploadEgypt,
await ai.allMethodForAI(
ai.prompts[1]['prompt'].toString(),
AppLink.uploadEgypt,
'id_back'); //egypt
},
icon: const Icon(Icons.refresh),
@@ -547,30 +487,8 @@ Please provide the resulting JSON object. """, AppLink.uploadEgypt,
return Card(
child: InkWell(
onTap: () async {
await ai.allMethodForAI('''
Given the following Arabic text values:
Please create a JSON object with the following fields:
nationalID: Use exactly 14 digits, converting from Arabic numerals to Latin numerals (0-9).
issueDate: Format as YYYY-MM-DD using Latin numerals, setting the date to the last day of the provided month.
occupation: Translate and format consistently (e.g., all lowercase).
gender: Translate and format consistently (e.g., all lowercase).
country: Set to "egypt".
religion: Translate and format consistently (e.g., all lowercase).
maritalStatus: Translate and format consistently (e.g., all lowercase).
fullNameMarital: If maritalStatus is "أعزب", set this to "none". Otherwise, leave it as "none".
expirationDate: Format as YYYY-MM-DD using Latin numerals.
Important notes:
Ensure all date fields use Latin (Western) numerals (0-9) instead of Arabic numerals.
For the nationalID, use exactly 14 digits from the provided Arabic numeral string, converting to Latin numerals.
For issueDate, use the last day of the month since only year and month are provided.
Include the country field as "egypt".
Format all string values consistently (e.g., all lowercase or proper case).
Please provide the resulting JSON object.''', AppLink.uploadEgypt,
'id_back'); //egypt
await ai.allMethodForAI(ai.prompts[1]['prompt'].toString(),
AppLink.uploadEgypt, 'id_back'); //egypt
},
child: Column(
children: [
@@ -612,27 +530,10 @@ Please provide the resulting JSON object.''', AppLink.uploadEgypt,
Text('ID Documents Front'.tr, style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
await ai.allMethodForAI('''
Write a JSON object from the following information extracted from the provided Arabic text:
{
"first_name": "", // The word next to "بطاقة تحقيق الشخصية" (National Identification Card)
"full_name": "", // The full name on the next line after the first name
"address": "", // The complete address spanning the next two lines
"national_number": "", // The National ID number before the last line (convert Arabic numerals to Latin)
"card_id": "", // The card ID in English on the last line
"dob": "" // Year of birth only, in Latin numerals (YYYY format)
}
Important notes:
1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية".
2. 'full_name' should be the complete name found on the line after the first name.
3. 'address' should combine information from two consecutive lines.
4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9).
5. 'card_id' should be extracted as-is from the last line (it's already in English).
6. For 'dob', include only the year of birth in YYYY format using Latin numerals.
7. If any information is missing, leave the field as an empty string.
''', AppLink.uploadEgypt, 'id_front'); //egypt
await ai.allMethodForAI(
ai.prompts[2]['id_front'].toString(),
AppLink.uploadEgypt,
'id_front'); //egypt
},
icon: const Icon(Icons.refresh),
),
@@ -685,27 +586,8 @@ Important notes:
return Card(
child: InkWell(
onTap: () async {
await ai.allMethodForAI(""""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"first_name": "", // The word next to "بطاقة تحقيق الشخصية" (National Identification Card)
"full_name": "", // The full name on the next line after the first name
"address": "", // The complete address spanning the next two lines
"national_number": "", // The National ID number before the last line (convert Arabic numerals to Latin)
"card_id": "", // The card ID in English on the last line
"dob": "" // Year of birth only, in Latin numerals (YYYY format)
}
Important notes:
1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية".
2. 'full_name' should be the complete name found on the line after the first name.
3. 'address' should combine information from two consecutive lines.
4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9).
5. 'card_id' should be extracted as-is from the last line (it's already in English).
6. For 'dob', include only the year of birth in YYYY format using Latin numerals.
7. If any information is missing, leave the field as an empty string.
""", AppLink.uploadEgypt, 'id_front'); //egypt
await ai.allMethodForAI(ai.prompts[2]['prompt'].toString(),
AppLink.uploadEgypt, 'id_front'); //egypt
},
child: Column(
children: [
@@ -755,34 +637,8 @@ Important notes:
style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
ai.allMethodForAI("""
Extract the following details from the provided car license data and format them into a JSON object:
License Expiration Date
Car Plate
Owner
Address
Car License Data:
JSON Format:
{
"LicenseExpirationDate": "YYYY-MM-DD",
"car_plate": "[Car plate number]",//the car plate is line next to line contain 'ادارة مرور' for bot numbers and letters in arabic with partition like| but you remove |
"owner": "[Owner's full name]",
"address": "[Address if available, otherwise 'Not provided']"
}
Important notes:
1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Replace all occurrences of '|' (pipe character) with a space in all fields.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_front');
ai.allMethodForAI(ai.prompts[3]['prompt'].toString(),
AppLink.uploadEgypt, 'car_front');
},
icon: const Icon(Icons.refresh),
),
@@ -826,34 +682,8 @@ Please fill in the JSON object with the extracted information, following these g
return Card(
child: InkWell(
onTap: () async {
ai.allMethodForAI("""
Extract the following details from the provided car license data and format them into a JSON object:
License Expiration Date
Car Plate
Owner
Address
Car License Data:
JSON Format:
{
"LicenseExpirationDate": "YYYY-MM-DD",
"car_plate": "[Car plate number]",//the car plate is line next to line contain 'ادارة مرور' for bot numbers and letters in arabic with partition like| but you remove |
"owner": "[Owner's full name]",
"address": "[Address if available, otherwise 'Not provided']"
}
Important notes:
1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Replace all occurrences of '|' (pipe character) with a space in all fields.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_front');
ai.allMethodForAI(ai.prompts[3]['prompt'].toString(),
AppLink.uploadEgypt, 'car_front');
},
child: Column(
children: [
@@ -880,13 +710,14 @@ Please fill in the JSON object with the extracted information, following these g
builder: (ai) {
if (ai.responseIdCardDriverEgyptBack.isNotEmpty) {
// Get the tax expiry date from the response
final taxExpiryDate = ai.responseIdCardDriverEgyptBack['tax_expiry'];
final taxExpiryDate =
ai.responseIdCardDriverEgyptBack['tax_expiry'].toString();
// final displacement = ai.responseIdCardDriverEgyptBack['displacement'];
// if (int.parse(displacement) < 1000) {}
// Get the inspection date from the response
final inspectionDate =
ai.responseIdCardDriverEgyptBack['inspection_date'];
final year = int.parse(inspectionDate.split('-')[0]);
ai.responseIdCardDriverEgyptBack['inspection_date'].toString();
final year = int.parse(inspectionDate.toString().split('-')[0]);
// Set inspectionDateTime to December 31st of the given year
final inspectionDateTime = DateTime(year, 12, 31);
@@ -919,34 +750,8 @@ Please fill in the JSON object with the extracted information, following these g
style: AppStyle.headTitle2),
IconButton(
onPressed: () async {
ai.allMethodForAI("""
Analyze the extracted car license information and create a JSON object with the following keys:
{
"make": "",
"year": "",
"chassis": "",
"model": "",
"engine": "",
"displacement": "",
"cylinders": "",
"fuel": "",
"color": "",
"color_hex": "",
"inspection_date": "",
"assuranceNumber": "",
"tax_expiry": ""
}
Important notes:
1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9).
2. Convert the color name to its corresponding hex color code for the 'color_hex' field.
3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals.
4. If any information is missing, leave the corresponding field as an empty string.
5. Do not include any explanatory text in the JSON fields, only the extracted values.
displacement in the line contain (سم٣ )
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_back');
ai.allMethodForAI(ai.prompts[4]['prompt'].toString(),
AppLink.uploadEgypt, 'car_back');
},
icon: const Icon(Icons.refresh),
),
@@ -1016,34 +821,8 @@ Please fill in the JSON object with the extracted information, following these g
return Card(
child: InkWell(
onTap: () async {
ai.allMethodForAI("""
Analyze the extracted car license information and create a JSON object with the following keys:
{
"make": "",
"year": "",
"chassis": "",
"model": "",
"engine": "",
"displacement": "",
"cylinders": "",
"fuel": "",
"color": "",
"color_hex": "",
"inspection_date": "",
"assuranceNumber": "",
"tax_expiry": ""
}
Important notes:
1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9).
2. Convert the color name to its corresponding hex color code for the 'color_hex' field.
3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals.
4. If any information is missing, leave the corresponding field as an empty string.
5. Do not include any explanatory text in the JSON fields, only the extracted values.
Please fill in the JSON object with the extracted information, following these guidelines.
""", AppLink.uploadEgypt, 'car_back');
ai.allMethodForAI(ai.prompts[4]['prompt'].toString(),
AppLink.uploadEgypt, 'car_back');
},
child: Column(
children: [
@@ -1086,25 +865,7 @@ Please fill in the JSON object with the extracted information, following these g
IconButton(
onPressed: () async {
await ai.allMethodForAI(
"""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"InspectionResult": "",
"NationalID": "",
"FullName": "",
"IssueDate": "" // Format: YYYY-MM-DD
}
Important notes:
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Add appropriate spaces in all text fields to ensure readability.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
Please fill in the JSON object with the extracted information, following these guidelines.
""",
ai.prompts[5]['prompt'].toString(),
AppLink.uploadEgypt,
'criminalRecord',
);
@@ -1142,25 +903,7 @@ Please fill in the JSON object with the extracted information, following these g
child: InkWell(
onTap: () async {
await ai.allMethodForAI(
"""
Write a JSON object from the following information extracted from the provided Arabic text:
{
"InspectionResult": "",
"NationalID": "",
"FullName": "",
"IssueDate": "" // Format: YYYY-MM-DD
}
Important notes:
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Add appropriate spaces in all text fields to ensure readability.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
Please fill in the JSON object with the extracted information, following these guidelines.
""",
ai.prompts[5]['prompt'].toString(),
AppLink.uploadEgypt,
'criminalRecord',
);

View File

@@ -1,5 +1,6 @@
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart';
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:get/get.dart';
@@ -172,24 +173,24 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
),
),
),
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration(
// color: AppColor.secondaryColor,
// border: Border.all(color: AppColor.blueColor),
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () async {
// Get.to(() => EgyptCardAI());
// },
// icon: const Icon(
// FontAwesome5.grin_tears,
// size: 29,
// color: AppColor.blueColor,
// ),
// ),
// ),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () async {
Get.to(() => EgyptCardAI());
},
icon: const Icon(
FontAwesome5.grin_tears,
size: 29,
color: AppColor.blueColor,
),
),
),
],
)),
);