Spaces:
Build error
Build error
| from .llm_client import generate_with_hf, generate_with_openai | |
| def synthesize_cpp(parsed: dict, mapping: dict, backend: str = "hf", prompt_context: str = "") -> str: | |
| """ | |
| Converts Unity C# parsed structure into Unreal Engine C++ (header + source). | |
| """ | |
| prompt = f""" | |
| Translate the following Unity C# class to idiomatic Unreal Engine C++ (header and source). | |
| Mapping rules: {mapping} | |
| Parsed structure: {parsed} | |
| Generate two files separated with markers: | |
| ---FILE: MyActor.h--- | |
| [contents] | |
| ---FILE: MyActor.cpp--- | |
| [contents] | |
| Be concise, compile-ready, and use UPROPERTY/UFUNCTION macros where suitable. | |
| {prompt_context} | |
| """ | |
| if backend == "hf": | |
| return generate_with_hf(prompt) | |
| else: | |
| return generate_with_openai(prompt) | |