### What problem does this PR solve? Issue link:#265 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)tags/v0.1.0
| @@ -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) | |||
| @@ -117,6 +117,7 @@ class ZhipuChat(Base): | |||
| history.insert(0, {"role": "system", "content": system}) | |||
| try: | |||
| if "presence_penalty" in gen_conf: del gen_conf["presence_penalty"] | |||
| if "frequency_penalty" in gen_conf: del gen_conf["frequency_penalty"] | |||
| response = self.client.chat.completions.create( | |||
| model=self.model_name, | |||
| messages=history, | |||
| @@ -35,7 +35,7 @@ class EsQueryer: | |||
| @staticmethod | |||
| def rmWWW(txt): | |||
| patts = [ | |||
| (r"是*(什么样的|哪家|那家|啥样|咋样了|什么时候|何时|何地|何人|是否|是不是|多少|哪里|怎么|哪儿|怎么样|如何|哪些|是啥|啥是|啊|吗|呢|吧|咋|什么|有没有|呀)是*", ""), | |||
| (r"是*(什么样的|哪家|一下|那家|啥样|咋样了|什么时候|何时|何地|何人|是否|是不是|多少|哪里|怎么|哪儿|怎么样|如何|哪些|是啥|啥是|啊|吗|呢|吧|咋|什么|有没有|呀)是*", ""), | |||
| (r"(^| )(what|who|how|which|where|why)('re|'s)? ", " "), | |||
| (r"(^| )('s|'re|is|are|were|was|do|does|did|don't|doesn't|didn't|has|have|be|there|you|me|your|my|mine|just|please|may|i|should|would|wouldn't|will|won't|done|go|for|with|so|the|a|an|by|i'm|it's|he's|she's|they|they're|you're|as|by|on|in|at|up|out|down)", " ") | |||
| ] | |||