Skip to content

Commit 7156b88

Browse files
committed
refactor: Simplify ETL processing by removing unused flow and improving configuration error handling
1 parent 7bae186 commit 7156b88

File tree

1 file changed

+8
-8
lines changed
  • sources/gc-qa-rag-etl/etlapp_api/routers

1 file changed

+8
-8
lines changed

sources/gc-qa-rag-etl/etlapp_api/routers/etl.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
def etl_process_single_file(product: str, etl_type: str, filename: str):
1515
"""Process a single file with ETL for the given product."""
1616
from etlapp.common.context import EtlContext
17-
from etlapp.etl.flow import etl_generic_embedding_flow, etl_generic_full_flow
17+
from etlapp.etl.flow import etl_generic_full_flow
1818
from etlapp.etl.etl_generic.generate import start_generate_generic
19+
from etlapp.etl.etl_generic.embedding import start_embedding_generic
1920

2021
# Remove file extension to get the base filename
2122
file_base = os.path.splitext(filename)[0]
@@ -34,7 +35,7 @@ def etl_process_single_file(product: str, etl_type: str, filename: str):
3435
start_generate_generic(context)
3536
elif etl_type == "embedding":
3637
# Full embedding flow (generate, merge, embedding)
37-
etl_generic_embedding_flow(context)
38+
start_embedding_generic(context)
3839
elif etl_type == "full":
3940
# Full answer generation
4041
etl_generic_full_flow(context)
@@ -50,26 +51,25 @@ def etl_start_execution(
5051
):
5152
# 检查配置完整性
5253
config_errors = []
53-
54+
5455
# 检查LLM配置
5556
if not app_config.llm.api_key:
5657
config_errors.append("LLM API密钥未配置")
5758
if not app_config.llm.api_base:
5859
config_errors.append("LLM API基础地址未配置")
5960
if not app_config.llm.model_name:
6061
config_errors.append("LLM模型名称未配置")
61-
62+
6263
# 检查Embedding配置
6364
if not app_config.embedding.api_key:
6465
config_errors.append("Embedding API密钥未配置")
65-
66+
6667
# 如果有配置错误,返回错误信息
6768
if config_errors:
6869
return JSONResponse(
69-
status_code=400,
70-
content={"error": "配置不完整", "details": config_errors}
70+
status_code=400, content={"error": "配置不完整", "details": config_errors}
7171
)
72-
72+
7373
task_id = f"etl_{product}_{etl_type}_{filename}_{int(time.time())}"
7474
etl_progress_status[task_id] = {"status": "running", "progress": 0, "msg": ""}
7575

0 commit comments

Comments
 (0)