mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-04 09:17:48 +08:00
When match_expressions contains coroutine objects (from GraphRAG's Dealer.get_vector()), the code cannot identify this type because it only checks for MatchTextExpr, MatchDenseExpr, or FusionExpr. As a result: score_func remains initialized as an empty string "" This empty string is appended to the output list The output list is passed to Infinity SDK's table_instance.output() method Infinity's SQL parser (via sqlglot) fails to parse the empty string, throwing a ParseError
This commit is contained in:
@ -203,7 +203,7 @@ async def completion(tenant_id, agent_id, session_id=None, **kwargs):
|
||||
conv.message = []
|
||||
if not isinstance(conv.dsl, str):
|
||||
conv.dsl = json.dumps(conv.dsl, ensure_ascii=False)
|
||||
canvas = Canvas(conv.dsl, tenant_id, agent_id, custom_header=custom_header)
|
||||
canvas = Canvas(conv.dsl, tenant_id, agent_id, canvas_id=agent_id, custom_header=custom_header)
|
||||
else:
|
||||
e, cvs = UserCanvasService.get_by_id(agent_id)
|
||||
assert e, "Agent not found."
|
||||
|
||||
@ -134,11 +134,11 @@ class InfinityConnection(InfinityConnectionBase):
|
||||
score_column = "SIMILARITY"
|
||||
break
|
||||
if match_expressions:
|
||||
if score_func not in output:
|
||||
if score_func and score_func not in output:
|
||||
output.append(score_func)
|
||||
if PAGERANK_FLD not in output:
|
||||
output.append(PAGERANK_FLD)
|
||||
output = [f for f in output if f != "_score"]
|
||||
output = [f for f in output if f and f != "_score"]
|
||||
if limit <= 0:
|
||||
# ElasticSearch default limit is 10000
|
||||
limit = 10000
|
||||
@ -272,7 +272,7 @@ class InfinityConnection(InfinityConnectionBase):
|
||||
df_list.append(kb_res)
|
||||
self.connPool.release_conn(inf_conn)
|
||||
res = self.concat_dataframes(df_list, output)
|
||||
if match_expressions:
|
||||
if match_expressions and score_column:
|
||||
res["_score"] = res[score_column] + res[PAGERANK_FLD]
|
||||
res = res.sort_values(by="_score", ascending=False).reset_index(drop=True)
|
||||
res = res.head(limit)
|
||||
|
||||
Reference in New Issue
Block a user