perf(prompt_opt): improve prompt optimization and model output quality

This commit is contained in:
mengyonghao
2025-12-26 17:34:38 +08:00
parent fc15a7793a
commit ca89aba548
5 changed files with 93 additions and 52 deletions

View File

@@ -19,6 +19,7 @@ from app.core.workflow.nodes.llm.config import LLMNodeConfig, MessageConfig
from app.core.workflow.nodes.start.config import StartNodeConfig
from app.core.workflow.nodes.transform.config import TransformNodeConfig
from app.core.workflow.nodes.variable_aggregator.config import VariableAggregatorNodeConfig
from app.core.workflow.nodes.parameter_extractor.config import ParameterExtractorNodeConfig
__all__ = [
# 基础类
@@ -38,4 +39,5 @@ __all__ = [
"HttpRequestNodeConfig",
"JinjaRenderNodeConfig",
"VariableAggregatorNodeConfig",
"ParameterExtractorNodeConfig",
]

View File

@@ -68,10 +68,10 @@ class ParameterExtractorNode(BaseNode):
config = ModelConfigService.get_model_by_id(db=db, model_id=model_id)
if not config:
raise BusinessException("配置的模型不存在", BizCode.NOT_FOUND)
raise BusinessException("Configured model does not exist", BizCode.NOT_FOUND)
if not config.api_keys or len(config.api_keys) == 0:
raise BusinessException("模型配置缺少 API Key", BizCode.INVALID_PARAMETER)
raise BusinessException("Model configuration is missing API Key", BizCode.INVALID_PARAMETER)
api_config = config.api_keys[0]
model_name = api_config.model_name