初始化合并后端代码- 修复合并BUG

pull/22121/head
liuchangsheng@wisdomidata.com 12 months ago
parent ae25db7ad1
commit c55285bace

@ -405,6 +405,9 @@ class RetrievalService:
record["child_chunks"] = segment_child_map[record["segment"].id].get("child_chunks") # type: ignore record["child_chunks"] = segment_child_map[record["segment"].id].get("child_chunks") # type: ignore
record["score"] = segment_child_map[record["segment"].id]["max_score"] record["score"] = segment_child_map[record["segment"].id]["max_score"]
# 高分片段,自动拼接相近的片段
cls.append_next_segments(records=records,dataset_documents=dataset_documents)
result = [] result = []
for record in records: for record in records:
# Extract segment # Extract segment
@ -422,8 +425,6 @@ class RetrievalService:
if score_value is not None and isinstance(score_value, int | float | str) if score_value is not None and isinstance(score_value, int | float | str)
else None else None
) )
cls.append_next_segments(records=records,dataset_documents=dataset_documents)
# Create RetrievalSegments object # Create RetrievalSegments object
retrieval_segment = RetrievalSegments(segment=segment, child_chunks=child_chunks, score=score) retrieval_segment = RetrievalSegments(segment=segment, child_chunks=child_chunks, score=score)
result.append(retrieval_segment) result.append(retrieval_segment)
@ -435,7 +436,6 @@ class RetrievalService:
@classmethod @classmethod
def append_next_segments(cls, records: list[dict], dataset_documents : dict): def append_next_segments(cls, records: list[dict], dataset_documents : dict):
# import pdb; pdb.set_trace()
def filter_record(record): def filter_record(record):
document_id = record["segment"].document_id document_id = record["segment"].document_id
if document_id in dataset_documents: if document_id in dataset_documents:

@ -8,7 +8,7 @@ from core.workflow.entities.node_entities import NodeRunResult
from core.workflow.nodes.enums import NodeType from core.workflow.nodes.enums import NodeType
from core.workflow.nodes.llm import LLMNode from core.workflow.nodes.llm import LLMNode
from extensions.utils.vanna_text2sql import VannaServer from extensions.utils.vanna_text2sql import VannaServer
from models.workflow import WorkflowNodeExecutionStatus from core.workflow.entities.workflow_node_execution import WorkflowNodeExecutionStatus
from .entities import VannaNodeData from .entities import VannaNodeData

@ -2,8 +2,12 @@
name = "dify-api" name = "dify-api"
dynamic = ["version"] dynamic = ["version"]
requires-python = ">=3.11,<3.13" requires-python = ">=3.11,<3.13"
dependencies = [ dependencies = [
"vanna[milvus,mysql,ollama,postgres]>=0.7.9,<0.8.0",
"pymilvus[model]>=2.5.8,<2.6.0",
"pillow>=11.2.1,<12.0.0",
"pymupdf>=1.25.5,<1.26.0",
"kaleido==0.2.1",
"authlib==1.3.1", "authlib==1.3.1",
"azure-identity==1.16.1", "azure-identity==1.16.1",
"beautifulsoup4==4.12.2", "beautifulsoup4==4.12.2",
@ -190,7 +194,6 @@ vdb = [
"oracledb==3.0.0", "oracledb==3.0.0",
"pgvecto-rs[sqlalchemy]~=0.2.1", "pgvecto-rs[sqlalchemy]~=0.2.1",
"pgvector==0.2.5", "pgvector==0.2.5",
"pymilvus~=2.5.0",
"pymochow==1.3.1", "pymochow==1.3.1",
"pyobvector~=0.1.6", "pyobvector~=0.1.6",
"qdrant-client==1.9.0", "qdrant-client==1.9.0",

Loading…
Cancel
Save