Skip to content

Commit 516bd3b

Browse files
committed
Add mock LLM response for synchronous project generation
1 parent 4c377c7 commit 516bd3b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

app/main.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,34 @@ async def download_project(project_id: str):
490490
media_type="application/zip"
491491
)
492492

493+
USE_MOCK_LLM = os.getenv("USE_MOCK_LLM", "").lower() == "true"
494+
493495
@app.post("/generate-sync")
494496
async def generate_project_sync(request: ProjectRequest):
495497
"""
496498
Generate a Rust project synchronously and return all files in text format.
497499
This endpoint will wait for the full generation process to complete.
498500
"""
501+
if USE_MOCK_LLM:
502+
# Return mock response
503+
return """[filename: Cargo.toml]
504+
[package]
505+
name = "hello_world"
506+
version = "0.1.0"
507+
edition = "2021"
508+
509+
[dependencies]
510+
511+
[filename: src/main.rs]
512+
fn main() {
513+
println!("Hello, World!");
514+
}
515+
516+
[filename: README.md]
517+
# Hello World
518+
519+
This is a simple Rust program that prints "Hello, World!".
520+
"""
499521
try:
500522
# Create temporary directory for generation
501523
with tempfile.TemporaryDirectory() as temp_dir:

0 commit comments

Comments
 (0)