1818from app .compiler import RustCompiler
1919from app .llm_client import LlamaEdgeClient
2020from app .vector_store import QdrantStore
21- from app .mcp_service import RustCompilerMCP
2221
2322app = FastAPI (title = "Rust Project Generator API" )
2423
@@ -118,9 +117,6 @@ async def compile_rust(request: dict):
118117 if "code" not in request :
119118 raise HTTPException (status_code = 400 , detail = "Missing 'code' field" )
120119
121- # Remove MCP service reference
122- # return rust_mcp.compile_rust_code(request["code"])
123-
124120 # Create temp directory
125121 with tempfile .TemporaryDirectory () as temp_dir :
126122 # Parse the multi-file content
@@ -155,35 +151,6 @@ async def compile_rust(request: dict):
155151 "error_details" : error_context
156152 }
157153
158- @app .post ("/compile-and-fix" )
159- async def compile_and_fix (request : CompileAndFixRequest ):
160- """Compile Rust code and fix errors with LLM"""
161- code = request .code
162- description = request .description
163- max_attempts = request .max_attempts
164-
165- # Create MCP service instance
166- mcp_service = RustCompilerMCP (
167- vector_store = get_vector_store (),
168- llm_client = llm_client
169- )
170-
171- # Compile and fix code
172- result = mcp_service .compile_and_fix_rust_code (
173- code_content = code ,
174- description = description ,
175- max_attempts = max_attempts
176- )
177-
178- # Add combined_text field with the entire project in flat text format
179- combined_text = ""
180- for filename , content in result ["final_files" ].items ():
181- combined_text += f"[filename: { filename } ]\n { content } \n \n "
182-
183- result ["combined_text" ] = combined_text .strip ()
184-
185- return result
186-
187154@app .post ("/compile-and-fix" )
188155async def compile_and_fix_rust (request : dict ):
189156 """Endpoint to compile and fix Rust code"""
@@ -195,16 +162,9 @@ async def compile_and_fix_rust(request: dict):
195162 # Pre-process code to fix common syntax errors
196163 code = request ["code" ]
197164 # Fix missing parenthesis in println! macro
198- if "println!(" in code and ");" not in code :
199- code = code .replace ("println!(\" " , "println!(\" " )
200- code = code .replace ("\" //" , "\" ); //" )
201-
202- # Remove MCP service reference
203- # result = rust_mcp.compile_and_fix_rust_code(
204- # code,
205- # request["description"],
206- # max_attempts=max_attempts
207- # )
165+ # if "println!(" in code and ");" not in code:
166+ # code = code.replace("println!(\"", "println!(\"")
167+ # code = code.replace("\" //", "\"); //")
208168
209169 # Create temp directory
210170 with tempfile .TemporaryDirectory () as temp_dir :
@@ -722,4 +682,4 @@ async def generate_project_sync(request: ProjectRequest):
722682 return PlainTextResponse (content = all_files_content )
723683
724684 except Exception as e :
725- raise HTTPException (status_code = 500 , detail = f"Error generating project: { str (e )} " )
685+ raise HTTPException (status_code = 500 , detail = f"Error generating project: { str (e )} " )
0 commit comments