6/22/1
This commit is contained in:
@@ -27,15 +27,9 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
print("-----request----" + response.request.toString());
|
||||
// print("-----headers-----" + response.headers.toString());
|
||||
print("-----payload-----" + payload.toString());
|
||||
// if (response.statusCode == 200) {
|
||||
// print(response.body);
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
print(jsonData);
|
||||
|
||||
return response.body;
|
||||
}
|
||||
|
||||
@@ -55,11 +49,8 @@ class CRUD {
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
var response = jsonDecode(res.body);
|
||||
print(await response);
|
||||
return response['token'];
|
||||
} else {
|
||||
print(res.reasonPhrase);
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future<dynamic> getLlama({
|
||||
@@ -105,10 +96,8 @@ class CRUD {
|
||||
Future.delayed(const Duration(seconds: 2));
|
||||
var extractedString =
|
||||
await arabicTextExtractByVisionAndAI(imagePath: imagePath);
|
||||
// print(extractedString);
|
||||
var json = jsonDecode(extractedString);
|
||||
var textValues = extractTextFromLines(json);
|
||||
print(textValues);
|
||||
// await Get.put(AI()).geminiAiExtraction(prompt, textValues);
|
||||
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
|
||||
}
|
||||
@@ -152,11 +141,8 @@ class CRUD {
|
||||
http.StreamedResponse response = await request.send();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
// print(await response.stream.bytesToString());
|
||||
return await response.stream.bytesToString();
|
||||
} else {
|
||||
print(response.reasonPhrase);
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future<dynamic> getChatGPT({
|
||||
@@ -210,12 +196,8 @@ class CRUD {
|
||||
},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
print(response);
|
||||
return response.body;
|
||||
} else {
|
||||
print('eeeeeeeeerrrrorrrr ${response.statusCode}');
|
||||
print(response.body);
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future<dynamic> post({
|
||||
@@ -236,11 +218,8 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
print(payload);
|
||||
|
||||
var jsonData = jsonDecode(response.body);
|
||||
print(jsonData);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
return response.body;
|
||||
@@ -248,7 +227,6 @@ class CRUD {
|
||||
String errorMessage = jsonData['message'];
|
||||
// Get.snackbar('Error'.tr, errorMessage.tr,
|
||||
// backgroundColor: AppColor.redColor);
|
||||
print(errorMessage.tr);
|
||||
return (jsonData['status']);
|
||||
}
|
||||
} else {
|
||||
@@ -267,11 +245,8 @@ class CRUD {
|
||||
);
|
||||
var response = await http.post(url,
|
||||
body: payload, headers: {'Content-Type': 'application/json'});
|
||||
print(response.request);
|
||||
print(payload);
|
||||
|
||||
var jsonData = jsonDecode(response.body);
|
||||
// print(jsonData);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
return response.body;
|
||||
@@ -297,13 +272,8 @@ class CRUD {
|
||||
request.headers.addAll(headers);
|
||||
|
||||
http.StreamedResponse response = await request.send();
|
||||
// print(request.body);
|
||||
// print(response);
|
||||
if (response.statusCode == 200) {
|
||||
print(await response.stream.bytesToString());
|
||||
} else {
|
||||
print(response.reasonPhrase);
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future<dynamic> postFromDialogue({
|
||||
@@ -324,9 +294,6 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
//print(response.request);
|
||||
//print('body=========================');
|
||||
//print(response.body);
|
||||
|
||||
if (response.body.isNotEmpty) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
@@ -368,10 +335,7 @@ class CRUD {
|
||||
);
|
||||
|
||||
if (response.statusCode == 201) {
|
||||
print('Verification request sent');
|
||||
} else {
|
||||
print('Failed to send verification request');
|
||||
}
|
||||
} else {}
|
||||
|
||||
// Prompt the user to enter the OTP
|
||||
final otpCode = "123456"; // Replace with user input
|
||||
@@ -394,10 +358,7 @@ class CRUD {
|
||||
);
|
||||
|
||||
if (checkResponse.statusCode == 201) {
|
||||
print('Verification successful');
|
||||
} else {
|
||||
print('Verification failed');
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future<dynamic> getGoogleApi({
|
||||
@@ -411,9 +372,7 @@ class CRUD {
|
||||
url,
|
||||
body: payload,
|
||||
);
|
||||
print(response.request);
|
||||
var jsonData = jsonDecode(response.body);
|
||||
// //print(jsonData);
|
||||
if (jsonData['status'] == 'OK') {
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user