|
|
@@ -36,7 +36,8 @@ def _build_context(req: GenerateRequest) -> str:
|
|
|
def build_prompt(state: GraphState) -> GraphState:
|
|
|
req = state["request"]
|
|
|
# 优先使用 Java 后端传入的 prompt 模板(可配置),缺省回退内置模板
|
|
|
- template = req.prompt_template or (
|
|
|
+ # getattr 防御:旧版 schema 无 prompt_template 字段时(AttributeError 崩溃),回退内置模板
|
|
|
+ template = getattr(req, "prompt_template", None) or (
|
|
|
PARENT_TEMPLATE if req.relationship_type == "parent" else CHILD_TEMPLATE
|
|
|
)
|
|
|
|