KevinHuSh commited on
Commit
4ba8b01
·
1 Parent(s): 1daa4bd

fix bug #314 (#317)

Browse files

### What problem does this PR solve?

Issue link:#314

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. api/apps/conversation_app.py +2 -2
api/apps/conversation_app.py CHANGED
@@ -358,6 +358,8 @@ def use_sql(question, field_map, tenant_id, chat_mdl):
358
  rows = ["|" +
359
  "|".join([rmSpace(str(r[i])) for i in clmn_idx]).replace("None", " ") +
360
  "|" for r in tbl["rows"]]
 
 
361
  if not docid_idx or not docnm_idx:
362
  chat_logger.warning("SQL missing field: " + sql)
363
  return {
@@ -365,8 +367,6 @@ def use_sql(question, field_map, tenant_id, chat_mdl):
365
  "reference": {"chunks": [], "doc_aggs": []}
366
  }
367
 
368
- rows = "\n".join([r + f" ##{ii}$$ |" for ii, r in enumerate(rows)])
369
- rows = re.sub(r"T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+Z)?\|", "|", rows)
370
  docid_idx = list(docid_idx)[0]
371
  docnm_idx = list(docnm_idx)[0]
372
  doc_aggs = {}
 
358
  rows = ["|" +
359
  "|".join([rmSpace(str(r[i])) for i in clmn_idx]).replace("None", " ") +
360
  "|" for r in tbl["rows"]]
361
+ rows = "\n".join([r + f" ##{ii}$$ |" for ii, r in enumerate(rows)])
362
+ rows = re.sub(r"T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+Z)?\|", "|", rows)
363
  if not docid_idx or not docnm_idx:
364
  chat_logger.warning("SQL missing field: " + sql)
365
  return {
 
367
  "reference": {"chunks": [], "doc_aggs": []}
368
  }
369
 
 
 
370
  docid_idx = list(docid_idx)[0]
371
  docnm_idx = list(docnm_idx)[0]
372
  doc_aggs = {}