File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,21 @@ def third_step_in_optimize_function(server: CodeflashLanguageServer, params: Opt
8989 }
9090
9191
92+ @server .feature ("fourth_step_in_optimize_function" )
93+ def fourth_step_in_optimize_function (server : CodeflashLanguageServer , params : OptimizeFunctionParams ) -> dict [str , str ]:
94+ current_function_optimizer = server .optimizer .current_function_optimizer
95+
96+ if not current_function_optimizer :
97+ return {"functionName" : params .functionName , "status" : "error" , "message" : "No function optimizer found" }
98+
99+ optimized_code = current_function_optimizer .optimize_function ()
100+
101+ if not optimized_code :
102+ return {"functionName" : params .functionName , "status" : "error" , "message" : "Optimization failed" }
103+
104+ return {"functionName" : params .functionName , "status" : "success" , "optimized_code" : optimized_code }
105+
106+
92107if __name__ == "__main__" :
93108 from codeflash .cli_cmds .console import console
94109
You can’t perform that action at this time.
0 commit comments