VietCat commited on
Commit
7fffc3e
·
1 Parent(s): a4c95d4

fix duplicate message

Browse files
Files changed (1) hide show
  1. app/sheets.py +6 -6
app/sheets.py CHANGED
@@ -129,7 +129,7 @@ class SheetsClient:
129
  action: str = "",
130
  purpose: str = "",
131
  timestamp: str = "",
132
- is_done: bool = False
133
  ) -> Optional[Dict[str, Any]]:
134
  """
135
  Ghi log hội thoại vào Google Sheets.
@@ -191,7 +191,7 @@ class SheetsClient:
191
  action,
192
  purpose,
193
  json.dumps(timestamp),
194
- str(is_done).lower()
195
  ]
196
 
197
  body = {
@@ -206,7 +206,7 @@ class SheetsClient:
206
  body=body
207
  ).execute()
208
 
209
- logger.info(f"Thêm mới conversation: {conversation_id} | Giá trị: {dict(zip(['conversation_id','command','content','attachments','user_id','page_id','originaltext','vehicle','action','purpose','timestamp','is_done'], new_row))}")
210
 
211
  # Return the conversation data directly
212
  return {
@@ -221,7 +221,7 @@ class SheetsClient:
221
  'originalaction': action,
222
  'originalpurpose': purpose,
223
  'timestamp': timestamp,
224
- 'isdone': is_done
225
  }
226
  else:
227
  # Update existing conversation
@@ -258,7 +258,7 @@ class SheetsClient:
258
  action if action else current_row[8],
259
  purpose if purpose else current_row[9],
260
  json.dumps(current_timestamps),
261
- str(is_done).lower() if is_done is not None else current_row[11]
262
  ]
263
  update_range = f"{SHEET_RANGE.split('!')[0]}!A{sheet_row_number}"
264
  logger.info(f"[DEBUG] Gsheet update range {update_range}")
@@ -271,7 +271,7 @@ class SheetsClient:
271
  valueInputOption='RAW',
272
  body=body
273
  ).execute()
274
- changed_cols = ['conversation_id','command','content','attachments','user_id','page_id','originaltext','vehicle','action','purpose','timestamp','is_done']
275
  for idx, (old, new) in enumerate(zip(current_row, new_row)):
276
  if old != new:
277
  changed_cols.append(changed_cols[idx])
 
129
  action: str = "",
130
  purpose: str = "",
131
  timestamp: str = "",
132
+ isdone: bool = False
133
  ) -> Optional[Dict[str, Any]]:
134
  """
135
  Ghi log hội thoại vào Google Sheets.
 
191
  action,
192
  purpose,
193
  json.dumps(timestamp),
194
+ str(isdone).lower()
195
  ]
196
 
197
  body = {
 
206
  body=body
207
  ).execute()
208
 
209
+ logger.info(f"Thêm mới conversation: {conversation_id} | Giá trị: {dict(zip(['conversation_id','command','content','attachments','user_id','page_id','originaltext','vehicle','action','purpose','timestamp','isdone'], new_row))}")
210
 
211
  # Return the conversation data directly
212
  return {
 
221
  'originalaction': action,
222
  'originalpurpose': purpose,
223
  'timestamp': timestamp,
224
+ 'isdone': isdone
225
  }
226
  else:
227
  # Update existing conversation
 
258
  action if action else current_row[8],
259
  purpose if purpose else current_row[9],
260
  json.dumps(current_timestamps),
261
+ str(isdone).lower() if isdone is not None else current_row[11]
262
  ]
263
  update_range = f"{SHEET_RANGE.split('!')[0]}!A{sheet_row_number}"
264
  logger.info(f"[DEBUG] Gsheet update range {update_range}")
 
271
  valueInputOption='RAW',
272
  body=body
273
  ).execute()
274
+ changed_cols = ['conversation_id','command','content','attachments','user_id','page_id','originaltext','vehicle','action','purpose','timestamp','isdone']
275
  for idx, (old, new) in enumerate(zip(current_row, new_row)):
276
  if old != new:
277
  changed_cols.append(changed_cols[idx])