Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -192,12 +192,16 @@ async def process_batch_job(dataset: Dict[str, Any]):
|
|
192 |
try:
|
193 |
|
194 |
openai_tasks = []
|
|
|
|
|
195 |
for ds in dataset.get('data'):
|
196 |
-
message_id = ds.get('message_id')
|
197 |
user_id = ds.get('user_id')
|
|
|
|
|
|
|
198 |
receipt_text = ds.get('receipt_text')
|
199 |
email = ds.get('email')
|
200 |
-
|
201 |
text = adjust_prompt_tokens_v1(receipt_radar_prompt(receipt_text))
|
202 |
|
203 |
task = {
|
@@ -242,8 +246,12 @@ async def process_batch_job(dataset: Dict[str, Any]):
|
|
242 |
"batch_job_status": False,
|
243 |
"batch_job_id" : batch_job.id
|
244 |
}).execute()
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
247 |
print("Batch sent for processing")
|
248 |
except Exception as e:
|
249 |
logger.error(f"Error processing batch job {batch_job_id}: {str(e)}")
|
|
|
192 |
try:
|
193 |
|
194 |
openai_tasks = []
|
195 |
+
|
196 |
+
user_details = {}
|
197 |
for ds in dataset.get('data'):
|
|
|
198 |
user_id = ds.get('user_id')
|
199 |
+
|
200 |
+
message_id = ds.get('message_id')
|
201 |
+
|
202 |
receipt_text = ds.get('receipt_text')
|
203 |
email = ds.get('email')
|
204 |
+
|
205 |
text = adjust_prompt_tokens_v1(receipt_radar_prompt(receipt_text))
|
206 |
|
207 |
task = {
|
|
|
246 |
"batch_job_status": False,
|
247 |
"batch_job_id" : batch_job.id
|
248 |
}).execute()
|
249 |
+
|
250 |
+
for ds in dataset.get('data'):
|
251 |
+
user_id = ds.get('user_id')
|
252 |
+
message_id = ds.get('message_id')
|
253 |
+
email = ds.get('email')
|
254 |
+
supabase.table("gmail_receipts_data").update({"batch_id":batch_job.id}).eq('user_id',user_id).eq("message_id",message_id).eq("email",email).execute()
|
255 |
print("Batch sent for processing")
|
256 |
except Exception as e:
|
257 |
logger.error(f"Error processing batch job {batch_job_id}: {str(e)}")
|