mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 23:41:12 +08:00
[Bug fix] fix bug found in regression when view chunks for document that not parsed in infinity, it would fail in UI (#14168)
### What problem does this PR solve? See title, the fail image: <img width="2667" height="915" alt="20260416-205718" src="https://github.com/user-attachments/assets/0c564237-5ed0-49af-bf4c-d3b5519abc6e" /> ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -491,17 +491,29 @@ class InfinityConnectionBase(DocStoreConnection):
|
||||
return len(res)
|
||||
|
||||
def get_doc_ids(self, res: tuple[pd.DataFrame, int] | pd.DataFrame) -> list[str]:
|
||||
# Extract DataFrame from result
|
||||
if isinstance(res, tuple):
|
||||
res = res[0]
|
||||
return list(res["id"])
|
||||
df, count = res
|
||||
if count == 0:
|
||||
return []
|
||||
else:
|
||||
df = res
|
||||
return list(df["id"])
|
||||
|
||||
@abstractmethod
|
||||
def get_fields(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, fields: list[str]) -> dict[str, dict]:
|
||||
raise NotImplementedError("Not implemented")
|
||||
|
||||
def get_highlight(self, res: tuple[pd.DataFrame, int] | pd.DataFrame, keywords: list[str], field_name: str):
|
||||
# Extract DataFrame from result
|
||||
if isinstance(res, tuple):
|
||||
res = res[0]
|
||||
df, _ = res
|
||||
else:
|
||||
df = res
|
||||
|
||||
if df.empty or field_name not in df.columns:
|
||||
return {}
|
||||
|
||||
ans = {}
|
||||
num_rows = len(res)
|
||||
column_id = res["id"]
|
||||
|
||||
Reference in New Issue
Block a user