Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: fix DocumentSegment.keywords can not a valid json (#36715)
wangxiaolei6464255d33a4
diff --git a/api/controllers/console/datasets/datasets_segments.py b/api/controllers/console/datasets/datasets_segments.pyindex 38ad7dfdd19..3b01ef75582 100644--- a/api/controllers/console/datasets/datasets_segments.py+++ b/api/controllers/console/datasets/datasets_segments.py@@ -169,9 +169,12 @@ class DatasetDocumentSegmentListApi(Resource):# Use database-specific methods for JSON array searchif dify_config.SQLALCHEMY_DATABASE_URI_SCHEME == "postgresql":# PostgreSQL: Use jsonb_array_elements_text to properly handle Unicode/Chinese text+ # Guard with jsonb_typeof to avoid "cannot extract elements from a scalar" error+ # when keywords is null or a non-array JSON value.keywords_condition = func.array_to_string(func.array(select(func.jsonb_array_elements_text(cast(DocumentSegment.keywords, JSONB)))+ .where(func.jsonb_typeof(cast(DocumentSegment.keywords, JSONB)) == "array").correlate(DocumentSegment).scalar_subquery()),