INNER CODE UNIT · Python

generate_guided_draft

mrwadams/stride-gpt · apps/web/main.py:222

def generate_guided_draft(config, app_type, answers):
    """Turn the guided answers into a polished description plus suggestions.

    Returns ``(description, suggestions)``. The description synthesises the
    user's answers into threat-modelling-ready prose; suggestions name
    security-relevant details still worth adding. Suggestions are guidance only
    and must not be folded into the description that gets threat modelled.
    """
    field_lines = []
    for field in GUIDED_DESCRIPTION_FIELDS:
        value = answers.get(field["key"], "").strip()
        field_lines.append(f"{field['label']}\n{value if value else '(not provided)'}")
    answers_block = "\n\n".join(field_lines)

    system_message = (
        "You are a security architect helping a user write a clear, structured "
        "application description for STRIDE threat modelling. Work only from the "
        "user's answers; never invent facts. Where an answer is missing or thin, "

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…