resolve issure to call ZH?IPUAI (#277)

### What problem does this PR solve?

Issue link:#265

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
KevinHuSh
2024-04-09 16:16:10 +08:00
committed by GitHub
parent c24a790c9e
commit 653c759d8d
3 changed files with 6 additions and 2 deletions

View File

@ -360,7 +360,10 @@ def use_sql(question, field_map, tenant_id, chat_mdl):
"|" for r in tbl["rows"]]
if not docid_idx or not docnm_idx:
chat_logger.warning("SQL missing field: " + sql)
return "\n".join([clmns, line, "\n".join(rows)]), []
return {
"answer": "\n".join([clmns, line, rows]),
"reference": {"chunks": [], "doc_aggs": []}
}
rows = "\n".join([r + f" ##{ii}$$ |" for ii, r in enumerate(rows)])
rows = re.sub(r"T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+Z)?\|", "|", rows)