From 6f785e06a4f6b438d468327a9afbec5e83250c5c Mon Sep 17 00:00:00 2001 From: akie <103188271+zpf121@users.noreply.github.com> Date: Tue, 10 Feb 2026 17:04:45 +0800 Subject: [PATCH] Fix issue #13084 (#13088) 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 --- api/db/services/canvas_service.py | 2 +- rag/utils/infinity_conn.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/db/services/canvas_service.py b/api/db/services/canvas_service.py index ee0710a09d..99cb199004 100644 --- a/api/db/services/canvas_service.py +++ b/api/db/services/canvas_service.py @@ -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." diff --git a/rag/utils/infinity_conn.py b/rag/utils/infinity_conn.py index aa18d044ba..59773052e0 100644 --- a/rag/utils/infinity_conn.py +++ b/rag/utils/infinity_conn.py @@ -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)