The invention discloses a
code generation method, which comprises the following steps that: a
code development platform receives input information of a user in a first code file in a project, acquires a context in the file and a first cross-file context according to a
static structure of the project, and acquires a second cross-file context according to behavior characteristics of the user in a development project, obtaining a third cross-file context according to the evolution
coupling degree of at least one second code file in a code warehouse of the project and the first code file, and generating prompt information according to the input information, the context in the file, the first cross-file context, the second cross-file context and the third cross-file context, and inputting the prompt information into the
code generation model for reasoning to obtain at least one group of generation codes, and displaying the at least one group of generation codes to the user. According to the method, the multi-dimensional item-level context and the
user input serve as the input of the
code generation model, the capability of the code generation model for utilizing the cross-file context in the code
generation process is improved, and the code generation effect is improved.