resolve table issues (#125)

This commit is contained in:
KevinHuSh
2024-03-15 14:59:28 +08:00
committed by GitHub
parent 82350c4139
commit de09b0e1a4
7 changed files with 15 additions and 14 deletions

View File

@ -309,6 +309,7 @@ def use_sql(question, field_map, tenant_id, chat_mdl):
# compose markdown table
clmns = "|"+"|".join([re.sub(r"(/.*|[^]+)", "", field_map.get(tbl["columns"][i]["name"], tbl["columns"][i]["name"])) for i in clmn_idx]) + ("|原文|" if docid_idx and docid_idx else "|")
line = "|"+"|".join(["------" for _ in range(len(clmn_idx))]) + ("|------|" if docid_idx and docid_idx else "")
line = re.sub(r"T[0-9]{2}:[0-9]{2}:[0-9]{2}\|", "|", line)
rows = ["|"+"|".join([rmSpace(str(r[i])) for i in clmn_idx]).replace("None", " ") + "|" for r in tbl["rows"]]
if not docid_idx or not docnm_idx:
chat_logger.warning("SQL missing field: " + sql)

View File

@ -94,7 +94,7 @@ def init_llm_factory():
"name": "Local",
"logo": "",
"tags": "LLM,TEXT EMBEDDING,SPEECH2TEXT,MODERATION",
"status": "0",
"status": "1",
},{
"name": "Moonshot",
"logo": "",

View File

@ -78,7 +78,7 @@ class KnowledgebaseService(CommonService):
if isinstance(v, dict):
assert isinstance(old[k], dict)
dfs_update(old[k], v)
if isinstance(v, list):
elif isinstance(v, list):
assert isinstance(old[k], list)
old[k] = list(set(old[k]+v))
else: old[k] = v