Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

resolve issure to call ZH?IPUAI (#277)

KevinHuSh653c759d8d4e
diff --git a/api/apps/conversation_app.py b/api/apps/conversation_app.py
index 6ece253caf..2379d30bd1 100644
--- a/api/apps/conversation_app.py
+++ b/api/apps/conversation_app.py
@@ -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)
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index 98f6ce641c..498595de7d 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -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,
diff --git a/rag/nlp/query.py b/rag/nlp/query.py
index 26753d7210..e62fb9fbb3 100644
--- a/rag/nlp/query.py
+++ b/rag/nlp/query.py
@@ -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)", " ")
]