The invention discloses an AI
code generation optimization method and
system, and belongs to the technical field of
software development, and the method specifically comprises the steps: obtaining a micro-service path prefix and API grouping
list data, determining an artificial code through
noise reduction hash comparison in combination with a code feature dictionary, and automatically generating a method name according to user selection and
annotation; interface details are obtained for API groups corresponding to the method names, API access paths are generated, the interface details are sorted to generate a
code snippet mapping table, and interface performance is automatically analyzed in combination with burying
point data; generating an
abstract syntax tree according to the mapping table, traversing and replacing nodes meeting conditions, and generating AI code configuration details; according to the configuration details,
annotation is added for the method to generate an API code, parameter
verification, service logic and return result
processing codes are added, and a complete AI code is formed through integration; adding
exception handling logic for the complete AI code and writing the
exception handling logic into a file; and the
code generation efficiency and quality are improved.