Skip to content

[Bug]: systems relied on code in /example #52

@isayahc

Description

@isayahc

Affected component

AI chat agent

What happened?

backend/opencad_agent/prompting.py

@lru_cache(maxsize=1)
def _load_example_scripts() -> str:
    examples_dir = Path(__file__).resolve().parents[2] / "examples"
    example_files = [
        "hardware_mounting_bracket.py",
        "hardware_pcb_carrier.py",
        "software_hmi_panel.py",
    ]
    snippets: list[str] = []
    for filename in example_files:
        path = examples_dir / filename
        if not path.exists():
            continue
        snippet = path.read_text(encoding="utf-8").strip()
        snippets.append(f"examples/{filename}:\n```python\n{snippet}\n```")
    return "\n\n".join(snippets)

This may have been important for helping the LLM know the codebase

Steps to reproduce

N/A

Expected behavior

N/A

OpenCAD version / commit SHA

N/A

How are you running OpenCAD?

Self-hosted (local dev)

Environment

Logs / stack traces

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions