@@ -114,8 +114,25 @@ def compile_and_fix(code: str, description: str, max_attempts: int = 3) -> Dict[
114114 # Initialize components
115115 llm_client = LlamaEdgeClient (api_key = api_key )
116116 vector_store = QdrantStore (embedding_size = llm_embed_size )
117- vector_store .create_collection ("project_examples" )
118- vector_store .create_collection ("error_examples" )
117+
118+ # Create collections with error handling
119+ try :
120+ vector_store .create_collection ("project_examples" )
121+ print ("Created collection: project_examples" )
122+ except Exception as e :
123+ if "already exists" in str (e ):
124+ print ("Collection project_examples already exists" )
125+ else :
126+ raise
127+
128+ try :
129+ vector_store .create_collection ("error_examples" )
130+ print ("Created collection: error_examples" )
131+ except Exception as e :
132+ if "already exists" in str (e ):
133+ print ("Collection error_examples already exists" )
134+ else :
135+ raise
119136
120137 # Initialize MCP service
121138 mcp_service = RustCompilerMCP (vector_store = vector_store , llm_client = llm_client )
@@ -132,4 +149,6 @@ def compile_and_fix(code: str, description: str, max_attempts: int = 3) -> Dict[
132149 host = os .getenv ("MCP_HOST" , "0.0.0.0" )
133150 port = int (os .getenv ("MCP_PORT" , "3001" ))
134151 print (f"Starting MCP server on { host } :{ port } " )
135- mcp .run (host = host , port = port )
152+ os .environ ["MCP_HOST" ] = host
153+ os .environ ["MCP_PORT" ] = str (port )
154+ mcp .run () # No parameters
0 commit comments