From 9c4356e9a17e22991225631df866cb6173eac864 Mon Sep 17 00:00:00 2001 From: jyong <718720800@qq.com> Date: Fri, 11 Jul 2025 18:46:22 +0800 Subject: [PATCH] r2 --- api/services/rag_pipeline/rag_pipeline.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/api/services/rag_pipeline/rag_pipeline.py b/api/services/rag_pipeline/rag_pipeline.py index 9d273290bf..1e7cc4c582 100644 --- a/api/services/rag_pipeline/rag_pipeline.py +++ b/api/services/rag_pipeline/rag_pipeline.py @@ -480,11 +480,25 @@ class RagPipelineService: break if not datasource_node_data: raise ValueError("Datasource node data not found") + + variables_map = {} datasource_parameters = datasource_node_data.get("datasource_parameters", {}) for key, value in datasource_parameters.items(): - if not user_inputs.get(key): - user_inputs[key] = value["value"] + if value.get("value") and isinstance(value.get("value"), str): + pattern = r"\{\{#([a-zA-Z0-9_]{1,50}(?:\.[a-zA-Z0-9_][a-zA-Z0-9_]{0,29}){1,10})#\}\}" + match = re.match(pattern, value["value"]) + if match: + full_path = match.group(1) + last_part = full_path.split(".")[-1] + if last_part in user_inputs: + variables_map[key] = user_inputs[last_part] + else: + variables_map[key] = value["value"] + else: + variables_map[key] = value["value"] + else: + variables_map[key] = value["value"] from core.datasource.datasource_manager import DatasourceManager @@ -562,7 +576,7 @@ class RagPipelineService: website_crawl_result: Generator[WebsiteCrawlMessage, None, None] = ( datasource_runtime.get_website_crawl( user_id=account.id, - datasource_parameters=user_inputs, + datasource_parameters=variables_map, provider_type=datasource_runtime.datasource_provider_type(), ) )