Code processing method, apparatus, device, storage medium, and program product

By combining generative models with integrated development environments (IDEs) and leveraging the semantic gateway to call the IDE's native semantic parsing capabilities, the problem of inaccurate code processing results in existing technologies has been solved, thereby improving the reliability and accuracy of code processing results.

CN122450461APending Publication Date: 2026-07-24DOUYIN VISION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DOUYIN VISION CO LTD
Filing Date
2026-04-28
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing machine learning-based code assistance solutions lack a precise understanding of the true semantics of the code, resulting in inference bias and insufficient reliability of code processing results, and it is difficult to invoke the native semantic parsing capabilities of the integrated development environment.

Method used

By combining generative models with integrated development environments (IDEs), and using a semantic gateway as an intermediate layer, the native semantic parsing capabilities of the IDE are invoked to enhance the accuracy and reliability of code processing.

Benefits of technology

It achieves an organic combination of dialogue interaction and native environment parsing capabilities, improving the accuracy and reliability of code processing results, avoiding the bias of results that rely solely on model inference, and ensuring that code processing results originate from the execution of the real compilation environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122450461A_ABST
    Figure CN122450461A_ABST
Patent Text Reader

Abstract

The present disclosure relates to a code processing method, device, equipment, storage medium and program product. The method comprises: obtaining input content in response to an input operation on a dialogue interface; the input content comprises a code parsing instruction; displaying the input content in the dialogue interface and sending the input content; the input content is used to trigger a generative model to obtain output content; the output content comprises a code processing result and prompt information; the code processing result corresponds to the code parsing instruction; the prompt information is used to represent that the code processing result is a result of executing code semantic analysis by an integrated development environment; and the output content and the prompt information are received and displayed. In this way, on the basis of ensuring the interactive convenience of code processing, the accuracy, completeness and practicality of the result of model-assisted code processing are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This article relates to the field of software development technology, and in particular to a code processing method, apparatus, device, storage medium, and program product. Background Technology

[0002] With the in-depth research and application of machine learning models, they have been used to assist developers in code-related processing. However, these models mostly rely on text statistics and text reasoning for code processing, lacking a precise understanding of the true semantics of the code. This can easily lead to reasoning biases that do not conform to actual logic, and even generate code that cannot be compiled correctly. Furthermore, the reference data relied upon for model inference is often obtained through regular expression matching or lightweight parsing tools. These tools are difficult to adapt to the characteristics of complex programming languages ​​and cannot utilize the native semantic parsing capabilities of integrated development environments (IDEs), resulting in insufficient completeness and accuracy of the reference data, further reducing the reliability of the code processing results. In summary, existing machine learning-based code assistance solutions still have significant shortcomings in terms of accuracy and stability. Summary of the Invention

[0003] To address the aforementioned technical problems, this paper provides a code processing method, apparatus, device, storage medium, and program product.

[0004] Firstly, this article provides a code processing method, which includes: In response to an input operation on the dialog interface, input content is obtained; wherein, the input content includes code parsing instructions; The input content is displayed and sent in the dialog interface; wherein, the input content is used to trigger the generative model to obtain output content; the output content includes code processing results and prompt information; the code processing results correspond to the code parsing instructions; the prompt information is used to indicate that the code processing results are the result of code semantic parsing performed by the integrated development environment; Receive and display the output content.

[0005] Secondly, this article also provides a code processing method, which includes: Receive a semantic parsing request; wherein the semantic parsing request includes a first code and code parsing instructions; the semantic parsing request is generated based on the input content through a generative model; If the integrated development environment is detected to be available, then based on the code parsing instructions, the integrated development environment is invoked to perform semantic parsing processing on the first code to obtain the first parsing result; Send the first parsing result; wherein the first parsing result is used to generate output content through the generative model, the output content including code processing results and prompt information; the prompt information is used to characterize that the code processing result is the result of code semantic parsing performed by the integrated development environment.

[0006] Thirdly, this paper also provides a code processing device, which includes: An input content acquisition module is used to acquire input content in response to an input operation on the dialog interface; wherein, the input content includes code parsing instructions; An input content sending module is used to display the input content in the dialog interface and send the input content; wherein, the input content is used to trigger a generative model to obtain output content; the output content includes code processing results and prompt information; the code processing results correspond to the code parsing instructions; the prompt information is used to indicate that the code processing results are the result of code semantic parsing performed by the integrated development environment; The output content display module is used to receive and display the output content.

[0007] Fourthly, this paper also provides a code processing apparatus, which includes: A semantic parsing request receiving module is used to receive semantic parsing requests; wherein, the semantic parsing request includes first code and code parsing instructions; the semantic parsing request is generated based on the input content through a generative model; The first parsing result acquisition module is used to, if the integrated development environment is detected to be available, invoke the integrated development environment based on the code parsing instructions to perform semantic parsing processing on the first code and obtain the first parsing result; A first parsing result sending module is used to send the first parsing result; wherein, the first parsing result is used to generate output content through the generative model, the output content including code processing results and prompt information; the prompt information is used to indicate that the code processing result is the result of code semantic parsing performed by the integrated development environment.

[0008] Fifthly, this document also provides an electronic device comprising: processor; Memory, used to store executable instructions; The processor is used to read executable instructions from memory and execute the executable instructions to implement the code processing method described in this paper.

[0009] Sixthly, this document also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the code processing methods described herein.

[0010] In a seventh aspect, this document also provides a computer program product for executing the code processing methods described herein.

[0011] The code processing solution presented in this paper can respond to input operations in a dialog interface to obtain input content, including code parsing instructions. The input content is then displayed and sent in the dialog interface. This input content triggers a generative model to obtain output content. The output content includes the code processing result and a prompt message. The code processing result corresponds to the code parsing instruction; the prompt message indicates that the code processing result is the result of code semantic parsing performed by the integrated development environment (IDE). The output content and prompt message are then received and displayed. Thus, by implementing the above-mentioned generative model-based code-assisted processing through dialog interaction, an organic combination of dialog interaction and native environment parsing capabilities is achieved, balancing the convenience of interaction with the accuracy of code processing. Furthermore, by displaying the code processing result obtained from actual execution in the IDE along with the prompt message, it is clearly identified that the code processing result originates from the execution of the real compilation environment, effectively improving the reliability and practicality of the code processing result.

[0012] The code processing scheme presented in this paper receives a semantic parsing request. This request includes first code and code parsing instructions. The semantic parsing request is generated based on the input content using a generative model. If the integrated development environment (IDE) is detected to be available, the IDE is invoked based on the code parsing instructions to perform semantic parsing on the first code, obtaining a first parsing result. This first parsing result is then sent. The first parsing result is used to generate output content through the generative model, including the code processing result and a prompt message. The prompt message indicates that the code processing result is the result of semantic parsing performed by the IDE. In this way, a semantic gateway is added between the generative model and the IDE, serving as a unified entry point for external access to the IDE, providing an effective channel for the code-assisted processing process to invoke the IDE's native semantic parsing capabilities. In addition, the semantic gateway responds to the semantic parsing request sent by the generative model. After confirming that the integrated development environment (IDE) is available, it invokes its native semantic parsing capabilities to perform semantic parsing processing on the first code in the semantic parsing request, corresponding to the code parsing instructions. On the one hand, this avoids the uncertainty introduced by providing semantic capabilities when the IDE is not ready, and improves the accuracy and completeness of the reference data provided by the IDE, thereby improving the reliability of the code processing results to a certain extent. On the other hand, by relying on the real compilation environment to perform code semantic parsing, it avoids the result bias caused by simply relying on model inference, thereby further improving the accuracy and completeness of the results obtained by model-assisted code processing.

[0013] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this article are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse. Attached Figure Description

[0014] The above and other features, advantages, and aspects of the embodiments herein will become more apparent when taken in conjunction with the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.

[0015] Figure 1 This is a schematic diagram of the scenario architecture to which one of the code processing methods provided in this article is applicable; Figure 2 A flowchart illustrating a code processing method provided in this article; Figure 3 A flowchart illustrating another code processing method provided in this article; Figure 4 This article provides a schematic diagram of data interaction during code processing. Figure 5 This paper provides a schematic diagram of the structure of a code processing device; Figure 6 A schematic diagram of another code processing device provided for this article; Figure 7 This is a schematic diagram of the structure of an electronic device provided in this article. Detailed Implementation

[0016] The embodiments described herein will now be described in more detail with reference to the accompanying drawings. While some embodiments are shown in the drawings, it should be understood that this document can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided to provide a more thorough and complete understanding of the document. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of this document.

[0017] It should be understood that the steps described in the method embodiments herein may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this document is not limited in this respect.

[0018] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0019] It should be noted that the concepts of "first" and "second" mentioned in this article are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions performed by these devices, modules or units or their interdependencies.

[0020] It should be noted that the terms "one" and "more" used in this document are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0021] The names of messages or information exchanged between multiple devices in the embodiments herein are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0022] The code processing methods presented in this article are mainly applicable to scenarios that utilize the language understanding and reasoning capabilities of machine learning models to assist in code processing. For example, they can be applied to software development scenarios that rely on generative models and use human-computer dialogue.

[0023] In one situation, Figure 1 This is a schematic diagram illustrating the scenario architecture of a code processing method presented in this article. For example... Figure 1 As shown in the embodiments of this article, the scenario architecture provided includes: a first device corresponding to the server and a second device corresponding to the client.

[0024] The server is configured to communicate with the client and execute core processing flows, implemented in a dialogic manner, to respond to user queries related to code processing. These flows include code generation, communication with the semantic gateway, parsing data returned by the semantic gateway, and code correction. These core processing flows can be implemented based on a generative model or using other algorithms. The first device is used to host and implement the server-side functionality; it can take various forms, such as a server 110 or a server cluster.

[0025] The client is configured as a user-facing terminal, providing a user interface (such as a dialog interface) corresponding to auxiliary code processing functions, and implementing functions such as receiving user operations and displaying information. The second device is used to carry and implement the client functions, and can have various implementation forms, such as hardware or software. When the second device is hardware, it can be various electronic devices with an Integrated Development Environment (IDE) installed and possessing human-computer interaction and display functions, including but not limited to smartphones 121, personal digital assistants (PDAs), tablet computers 122, laptops 123, or desktop computers 124. When the second device 120 is software, it can be installed on the aforementioned electronic devices, and can be implemented as multiple software programs or software modules, or as a single software program or software module. No specific limitations are made here.

[0026] Furthermore, the data interaction process described in this paper involves not only the client and the server corresponding to the generative model, but also a semantic gateway and an integrated development environment (IDE). The IDE and the client are installed on the same second device. In one scenario, the semantic gateway can be an intermediate layer independent of the generative model and the IDE; in this case, it can be configured on the second device where the client resides, or on the first device where the server resides. In another scenario, the semantic gateway can be embedded within the IDE, thus allowing it to be configured on the second device where the client resides.

[0027] Figure 2 A flowchart illustrating a code processing method provided herein is shown. This code processing method can be applied to a client and can be executed by a code processing device configured on the client. This device can be implemented in software and / or hardware and can be integrated into an electronic device with interactive and display functions. This electronic device can be the second device described in the foregoing embodiments.

[0028] like Figure 2 As shown, this code processing method may include the following steps: Step 210: Respond to the input operation on the dialog interface and obtain the input content.

[0029] The dialogue interface is the human-computer interaction interface corresponding to the auxiliary code processing function, which implements the auxiliary code processing function through dialogue. The input content describes the auxiliary requirements for code processing, which can be specifically represented as code parsing instructions. Therefore, the input content includes code parsing instructions. Code parsing instructions are used to instruct the execution of corresponding semantic parsing operations on the code. For example, if the auxiliary requirement for code processing is to generate code for a certain function, then the input content can include a description of the function to be generated and the generation instructions; or, if the auxiliary requirement for code processing is to perform operations such as querying, interpreting, verifying, or correcting a piece of code, then the input content can include the aforementioned code and the corresponding operation instructions, such as query instructions, interpretation instructions, verification instructions, or correction instructions.

[0030] Specifically, the electronic device can display a dialog interface and input controls corresponding to the input functions, such as input boxes and voice buttons. Users can trigger operations (i.e., input operations) on the input controls and input their code processing needs in natural language. The electronic device responds to these input operations, receives the user's input, and obtains the input content accordingly.

[0031] Step 220: Display the input content in the dialog interface and send the input content; the input content is used to trigger the generative model to obtain the output content; the output content includes the code processing result and the prompt information; the code processing result corresponds to the code parsing instruction; the prompt information is used to indicate that the code processing result is the result of code semantic parsing performed by the integrated development environment.

[0032] In this context, the generative model is a pre-selected machine learning model with code processing capabilities, such as a deep learning model, language model, or multimodal model with a certain parameter scale. The output content is the model's output, serving as feedback to the input content. The code processing result is obtained after executing corresponding code processing according to code parsing instructions; for example, it can be generated code, code query results, code verification results, or corrected code. Hints are descriptive information used to identify the source of the code processing result. Hints can be simple source information, such as being generated by the generative model, obtained through code semantic parsing performed by an IDE, or obtained jointly by the generative model and the IDE. Hints can also be more detailed procedural information identifying the code processing, such as the core operation of each processing step, the processing subject (corresponding source), and the processing result. For example, the hints in this paper are used to indicate that the code processing result was obtained at least through code semantic parsing performed by an integrated development environment.

[0033] Specifically, after acquiring the input content, the electronic device displays it in a dialog interface and then sends the input content to the device containing the generative model. Upon receiving the input content, the generative model executes corresponding code processing operations based on the code parsing instructions contained within it. During code processing, to mitigate the inference bias issues that generative models are prone to and improve the accuracy and effectiveness of the output content, the generative model can invoke an Integrated Development Environment (IDE) through an added semantic gateway. Leveraging the IDE's built-in source code semantic engine, it calls the IDE's built-in native semantic parsing capabilities to perform semantic parsing operations corresponding to the code parsing instructions involved in the code processing, and returns the corresponding high-level source code semantic information to the generative model. Based on this high-level source code semantic information, the generative model continues its inference work, ultimately generating output content containing the code processing results and prompts, which is then returned to the electronic device.

[0034] For a detailed explanation of how the semantic gateway calls the IDE to perform semantic parsing processing in the above process, please refer to the detailed description of the following embodiments.

[0035] Step 230: Receive and display the output content.

[0036] Specifically, after receiving the output content returned by the generative model, the electronic device can display it in the area following the input content in the dialog interface.

[0037] The code processing solution provided in the above embodiments can respond to input operations on the dialog interface to obtain input content, which includes code parsing instructions; display the input content in the dialog interface and send the input content; the input content is used to trigger the generative model to obtain output content; the output content includes code processing results and prompt information; the code processing results correspond to the code parsing instructions; the prompt information is used to indicate that the code processing results are the result of code semantic parsing performed by the integrated development environment; and the output content and prompt information are received and displayed. Thus, by implementing the above-mentioned generative model-based code-assisted processing through dialog interaction, an organic combination of dialog interaction and native environment parsing capabilities is achieved, balancing the convenience of interaction with the accuracy of code processing; furthermore, by displaying the code processing results actually obtained through execution in the integrated development environment together with the prompt information, it can be clearly identified that the code processing results originate from the execution of the real compilation environment, effectively improving the reliability and practicality of the code processing results.

[0038] Figure 3 A flowchart illustrating another code processing method provided herein is shown. This code processing method can be applied to a semantic gateway and can be executed by a code processing device configured on the semantic gateway. This device can be implemented in software and / or hardware and can be integrated into an electronic device with certain data processing and communication functions. This electronic device can be the first or second device described in the foregoing embodiments.

[0039] like Figure 3 As shown, this code processing method may include the following steps: Step 310: Receive semantic parsing request.

[0040] The semantic parsing request is generated by the generative model and is used to request the semantic gateway to perform semantic parsing of the code. The semantic parsing request contains at least the code to be parsed (i.e., the first code) and code parsing instructions. The first code can be code generated by the generative model, code contained in the historical content of the dialogue process, or code carried in the user's input, etc.

[0041] Specifically, based on the foregoing description, the generative model can accept input content sent by the client and analyze and reason about the input content (which may also be combined with historical content from the dialogue process). When it is determined that the first code involved requires analysis based on the true semantics of the code, a semantic parsing request can be generated and sent to the semantic gateway. After receiving the semantic parsing request, the semantic gateway can extract the first code and the code parsing instruction. This code parsing instruction can trigger the semantic gateway to call the relevant semantic parsing capabilities of the IDE.

[0042] Step 320: If the integrated development environment is detected to be available, then based on the code parsing instructions, the integrated development environment is invoked to perform semantic parsing processing on the first code and obtain the first parsing result.

[0043] The "available state" refers to the state where the relevant services and semantic parsing components of the integrated development environment (IDE) are in normal operation and can receive and respond to external call requests. The first parsing result is the final structured high-order source code semantic information returned by the IDE after performing semantic parsing processing, which has undergone data format conversion and its specific content is adapted to the code parsing instructions.

[0044] Specifically, generative models require highly deterministic data during inference. If the IDE is in an unready state, such as incomplete indexing or failed project synchronization, resulting in its related services and components not functioning properly, then the semantic capabilities it provides will be missing or uncertain. Therefore, before calling the IDE to obtain the data required by the generative model, the semantic gateway can first call the IDE's state-related services / tools to check its own state and determine whether the IDE is available based on the detection results returned by the IDE (i.e., the state detection results). If the IDE is already available, the semantic gateway can follow the code parsing instructions, using the first code as input parameters, to call the corresponding semantic parsing service / tool ​​in the IDE, triggering the service / tool ​​to perform the corresponding semantic parsing operation on the first code, and using the data obtained after processing as the first parsing result.

[0045] The aforementioned semantic parsing process refers to the process by which an IDE, based on its built-in compiler, parser, and semantic analysis engine, performs syntax checking, type inference, logic verification, symbol resolution, error diagnosis, and repair suggestions on the initial code, generating code structure information, error messages, repair suggestions, or explanations of code meaning. Semantic parsing is related to code parsing instructions. For example, code parsing instructions can include at least one of query instructions, explanation instructions, verification instructions, and correction instructions. Therefore, code semantic parsing can include at least one of the following operations: code syntax checking, code semantic verification, type inference and matching checks, symbol resolution and location of variables / methods / classes, code error diagnosis (syntax errors, semantic errors, dependency errors, type mismatches, etc.), generation of corresponding quick repair suggestions, code logic and meaning parsing (for explaining code functionality), and code structure analysis.

[0046] In one scenario, detecting that the integrated development environment (IDE) is in an available state includes: generating a status query request; based on the status query request, calling the IDE to perform status detection and obtaining the status detection result; if the status detection result meets preset conditions, then the IDE is detected to be in an available state.

[0047] The status query request refers to the request initiated by the semantic gateway to the IDE to query its current status. The status detection result is the status information returned by the IDE after performing status detection, which indicates whether semantic parsing capabilities can be provided externally. The preset conditions are pre-set conditions used to determine whether the IDE is in an available state, and they are adapted to the status representation indicators in the status detection result.

[0048] Specifically, after receiving a semantic parsing request, the semantic gateway generates a status query request. This request includes the status representation metrics to be queried, such as index status, running status, and project synchronization status. Then, the semantic gateway invokes status-related services / tools within the IDE to detect the IDE's own status and obtain the status detection results. These results are then compared with preset conditions. If the status detection results do not meet the preset conditions, the IDE is currently unavailable. If the results meet the preset conditions, the IDE is currently available, confirming that the IDE provides reliable semantic parsing capabilities. This effectively avoids IDE call failures or inaccurate data returns due to missing or unreliable semantic capabilities, thereby improving the accuracy and availability of the initial parsing results returned by the IDE.

[0049] In one scenario, the status detection result meets the following preset conditions: if the status detection result includes an index status, then the index status is in a completed state. The semantic gateway can call index-related services / tools to detect the current status of the IDE scanning source code and building the index. If the IDE is scanning source code and building the index, then the index status is incomplete. At this time, the semantic gateway automatically blocks and polls until the index is completed, that is, the index status is in a completed state, confirming that the IDE is in a usable state.

[0050] In another scenario, the status detection result meets preset conditions, including: if the status detection result includes a project synchronization status, then the project synchronization status is in a successful synchronization state. The semantic gateway can call project synchronization-related services / tools to detect the IDE's project synchronization status. If the IDE has not yet performed project synchronization or is in the process of project synchronization, the semantic gateway automatically blocks and polls until project synchronization is complete. At this time, the IDE can determine whether project synchronization was successful. If it fails (e.g., missing dependencies, configuration errors), the semantic gateway attempts to automatically repair (e.g., automatically triggering synchronization, prompting for missing dependencies, etc.); if it cannot repair, it outputs a structured summary of "environment unavailable," returns it to the generative model for inference and decision-making, and terminates the current process of calling the IDE. If successful, that is, the project synchronization status is in a successful synchronization state, confirming that the IDE is in an available state.

[0051] In another scenario, the status detection result meets preset conditions, including: if the status detection result includes a running status, then the running status is in a working state. The semantic gateway can invoke services / tools related to the running status to detect the current running status of the IDE. If it is confirmed that the IDE has not crashed or is not in offline mode, then the IDE's running status is in a working state, confirming that the IDE is available.

[0052] In another scenario, the status detection results meet preset conditions, including an index status that is complete, a project synchronization status that is successfully synchronized, and a running status that is in operation. This further confirms the current state of the IDE, thereby further improving the stability and accuracy of IDE calls.

[0053] In one scenario, the first code is generated by a generative model based on the input content. The code parsing instruction is a code verification instruction, and the semantic parsing request is generated by the generative model based on the first code and the code verification instruction. This scenario corresponds to the situation where the generative model generates the first code, and the semantic gateway calls the IDE to verify and correct the first code. Therefore, the first code is generated by the generative model through analysis and reasoning on the input content. The code parsing instruction is a code verification instruction, requesting the compilation and verification of the first code and requesting suggestions for fixing the first code.

[0054] Based on the above, the integrated development environment is invoked based on the code parsing instructions to perform semantic parsing processing on the first code and obtain the first parsing result, including: the integrated development environment is invoked based on the code verification instructions to perform verification processing on the first code and obtain the verification result as the first parsing result.

[0055] The validation results include code error information and suggested corrections. Code error information is information about errors present in the initial code, natively output by the IDE; this could include syntax errors, semantic errors, type errors, dependency errors, etc. Suggested corrections are quick fixes for errors in the initial code, natively output by the IDE. The validation results are used to correct the initial code using a generative model, resulting in third-party code and error messages, which are then output. The third-party code is the code obtained after correcting the errors in the initial code.

[0056] Specifically, the semantic gateway takes the first code and code verification instructions as input parameters, calls the code diagnostic or compilation check-related services / tools in the IDE to perform verification processing on the first code, and obtains the verification result as the first parsing result. For example, the semantic gateway calls the compiler, syntax checker, semantic analyzer, etc. in the IDE to perform full code inspection of the first code; calls the syntax check interface in the IDE to detect syntax errors in the first code; calls the semantic analysis interface in the IDE to detect semantic errors in the first code; calls the dependency interface in the IDE to check whether the dependencies referenced in the first code have been imported and whether the versions are compatible; and triggers real-time diagnostics in the IDE to obtain error / warning information and quick repair suggestions (such as automatic package import and variable name correction).

[0057] It should be noted that, to improve verification accuracy, the semantic gateway can also obtain the exact location of the first code within the source code content of the project file (referred to as the second location) before verification. Thus, during the code verification process, the semantic gateway can first insert the first code into the corresponding node in the source code content according to the second location, and then perform the code verification process to obtain a more accurate verification result.

[0058] Step 330: Send the first parsing result; the first parsing result is used to generate output content through the generative model, and the output content includes code processing results and prompt information; the prompt information is used to indicate that the code processing result is the result of code semantic parsing performed by the integrated development environment.

[0059] Specifically, the semantic gateway returns the initial parsing result to the generative model. The generative model can then perform code analysis and reasoning based on this result, obtaining the code processing results and prompts, which serve as the output content corresponding to the input content. The generative model can then return the output content to the client, allowing the client to display it in the dialog interface.

[0060] The code processing scheme presented in this paper receives a semantic parsing request. This request includes first code and code parsing instructions. The semantic parsing request is generated based on the input content using a generative model. If the integrated development environment (IDE) is detected to be available, the IDE is invoked based on the code parsing instructions to perform semantic parsing on the first code, obtaining a first parsing result. This first parsing result is then sent. The first parsing result is used to generate output content through the generative model, including the code processing result and a prompt message. The prompt message indicates that the code processing result is the result of semantic parsing performed by the IDE. In this way, a semantic gateway is added between the generative model and the IDE, serving as a unified entry point for external access to the IDE, providing an effective channel for the code-assisted processing process to invoke the IDE's native semantic parsing capabilities. In addition, the semantic gateway responds to the semantic parsing request sent by the generative model. After confirming that the integrated development environment (IDE) is available, it invokes its native semantic parsing capabilities to perform semantic parsing processing on the first code in the semantic parsing request, corresponding to the code parsing instructions. On the one hand, this avoids the uncertainty introduced by providing semantic capabilities when the IDE is not ready, and improves the accuracy and completeness of the reference data provided by the IDE, thereby improving the reliability of the code processing results to a certain extent. On the other hand, by relying on the real compilation environment to perform code semantic parsing, it avoids the result bias caused by simply relying on model inference, thereby further improving the accuracy and completeness of the results obtained by model-assisted code processing.

[0061] In one scenario, the code processing method applied to a semantic gateway also includes: obtaining the version information corresponding to the integrated development environment; and determining the interaction interface based on the version information.

[0062] Version information refers to version identifiers used to identify the distribution version, kernel version, etc., of the integrated development environment (IDE), such as version numbers. The interaction interface provides a standardized interface for data exchange and capability invocation between the semantic gateway and the IDE. Different IDE versions correspond to different interaction interfaces. Thus, the interaction interface is matched with the IDE, and the interaction interface is used to invoke the IDE.

[0063] Specifically, after detecting that the IDE is in an available state, and before invoking the IDE to perform semantic parsing processing, the semantic gateway obtains the current version information of the IDE through reflection and probing technologies. Then, using preset version and interface adaptation information (such as configuration information, lookup tables, or mapping relationships), it queries the version information to determine the appropriate interaction interface. This masks the interface differences between different IDE versions, ensuring that subsequent semantic parsing operations of the IDE can call the correct interface. This maintains consistency in processing logic and results when calling the same service / tool ​​under different versions, reducing the difficulty of adapting model prompts and further improving the accuracy of the initial parsing result.

[0064] In one scenario, the semantic parsing request may also include a file path. The file path refers to the location of the file within the project corresponding to the code to be parsed (e.g., the first code), used to locate the specific source code file containing the source code content. During the analysis and reasoning process of the input content (which may also incorporate historical content from the dialogue process), the generative model, in addition to determining the first code and the code parsing instructions, can also infer the file path corresponding to the first code.

[0065] Based on the above, before step 320, the code processing method applied to the semantic gateway further includes: loading the file using the integrated development environment based on the file path to obtain the first source code content; and synchronizing the source code using the integrated development environment based on the first source code content to obtain the second source code content.

[0066] The first source code content is the original source code recorded in the project file, which is directly loaded by the IDE based on the file path. The second source code content is the latest source code content obtained after synchronization with the IDE.

[0067] Specifically, generative models can only infer the file path corresponding to the first piece of code; they cannot directly provide the complete source code content of the file corresponding to that path. However, when performing code semantic parsing, the IDE requires the latest and complete source code content to obtain accurate and reliable semantic information. Therefore, after receiving the file path from the generative model, the semantic gateway can invoke the IDE to sequentially perform file loading and source code synchronization operations. This achieves automated warm-up and data consistency synchronization from the plain text file path to IDE-parsable source code content, providing accurate and complete source code content for subsequent semantic parsing.

[0068] In practice, the semantic gateway uses the file path as input and calls the adapted IDE interface for file reading and loading functions. The IDE responds to this call by reading the corresponding source code file from the disk according to the file path and loading its contents into the IDE's memory, thus obtaining the first source code content. Then, the semantic gateway uses the first source code content as input and calls the adapted IDE interface for source code synchronization. The IDE responds to this call by checking if there are any unsaved modifications to the aforementioned source code file in the IDE editor. If so, it synchronizes the modified code from memory to the source code file, ensuring that the file state in memory is aligned with the latest state in the editor, thus obtaining the latest second source code content.

[0069] The second source code content can be used for semantic parsing. Thus, step 320 can be implemented as follows: the semantic gateway, based on the code parsing instructions and the second source code content, invokes the integrated development environment (IDE) to perform semantic parsing on the first code, obtaining a first parsing result. According to the parsing type indicated by the code parsing instructions, the semantic gateway invokes the IDE's native semantic parsing capabilities, using the second source code content as the project context, to perform corresponding semantic parsing on the first code, ultimately obtaining a more accurate and reliable first parsing result.

[0070] In one scenario, after obtaining the second source code content by synchronizing the source code using the integrated development environment based on the first source code content, the code processing method applied to the semantic gateway also includes: constructing a syntax tree based on the second source code content using the integrated development environment to obtain the syntax tree.

[0071] A syntax tree, also known as an abstract syntax tree, is a tree-like representation of the syntactic structure of source code. Each node represents a syntactic structure (such as loops, assignments, methods, etc.). Syntax trees ignore some details in the source code (such as commas, parentheses, etc.), retaining only the logical structure, making semantic analysis easier.

[0072] Specifically, after obtaining the second source code content, the semantic gateway can call the relevant capabilities of the IDE to construct a syntax tree from the second source code content, providing a foundation for subsequent calls to the IDE's native semantic parsing capabilities to achieve semantic-level precise positioning or code verification.

[0073] The syntax tree is used for semantic parsing. Thus, step 320 can be implemented as follows: The semantic gateway, based on the code parsing instructions and the syntax tree, invokes the integrated development environment (IDE) to perform semantic parsing on the first code, obtaining a first parsing result. According to the parsing type specified by the code parsing instructions, the semantic gateway invokes the IDE's native semantic parsing capabilities, using the syntax tree as the project context, to perform corresponding semantic parsing on the first code, ultimately obtaining a first parsing result that more closely resembles the real-world project environment, further improving the accuracy of the first parsing result.

[0074] In one scenario, the semantic parsing request also includes a first location. The first location is a rough or probabilistic position of the first code within the source file, inferred by the generative model from the input content. For example, the first location could be a combination of project identifiers, file paths, and identifiers of functions or logic blocks. Thus, by using the first location, the project containing the first code and the source file within that project can be identified, and the approximate position of the first code within that source file can be roughly determined. This narrows the scope of code processing in semantic parsing, allowing the IDE to understand only a certain range of source code content within the location of the first code, rather than traversing the entire source code during semantic parsing. This significantly reduces the difficulty and improves the efficiency of semantic parsing.

[0075] Based on the above, the code processing method applied to the semantic gateway also includes: based on the first position, performing text matching and noise filtering on the first code in the second source code content to obtain the second code; and performing semantic-based position correction on the second code based on the syntax tree to obtain the second position.

[0076] The second code refers to a code snippet within the second source code content, which corresponds to the first code. In other words, the second code is a code snippet obtained by text matching between the second source code content and the first code, after noise filtering. The second source code content is the code content within the source file corresponding to the first code. The syntax tree is constructed based on the second source code content. The second position is the semantically corrected code location, which is more accurate than the first code.

[0077] Specifically, the first position obtained by generative model inference has a certain positional deviation (such as the row and column numbers falling on the edge of the symbol). This can cause the IDE to select the wrong code segment for semantic parsing, thus affecting the accuracy of the first parsing result. Therefore, this paper proposes to perform robust localization processing on the first position after obtaining the second source code content or constructing the syntax tree, but before performing semantic parsing processing. That is, to perform fault-tolerant matching on the code segment, ignoring non-semantic interference such as indentation, spaces, and comments, and determine the second position of the first code from the source code content.

[0078] In practice, the semantic gateway uses a spiral multi-point scanning method to search for code fragments within the second source code content, starting from the first position and expanding upwards and downwards. It then performs text matching with the first code to obtain the matched code fragments. Next, the semantic gateway filters noise from the matched code fragments, removing non-semantic content such as comments, spaces, indentation, line breaks, and blank lines, thus obtaining the second code. Afterwards, based on the syntax tree, the semantic gateway selects the most representative syntax symbols (such as statement nodes, methods, classes, symbol types, etc.) from the second code to perform semantic correction, obtaining the second position. This corrects the positioning bias of the generative model, improves positioning tolerance and hit rate, and solves the problem of inaccurate positioning by the generative model leading to IDE operation failures or low accuracy, ensuring that subsequent semantic parsing can accurately locate valid code fragments.

[0079] The aforementioned second position is used for semantic parsing. Thus, step 320 can be implemented as follows: the semantic gateway, based on the code parsing instructions, the second position, and the syntax tree, invokes the integrated development environment (IDE) to perform semantic parsing on the first code, obtaining a first parsing result. When performing semantic parsing, the semantic gateway first locates the subtree or set of nodes to be parsed in the syntax tree according to the code region indicated by the second position, thereby narrowing or clarifying the focus of semantic parsing and avoiding errors in parsing objects due to positional offsets. Then, the semantic gateway passes the code parsing instructions, the syntax tree node corresponding to the second position, and the text context of the first code to the IDE's semantic analysis engine. This allows the IDE to utilize its native semantic parsing capabilities to execute the semantic parsing operations indicated by the code parsing instructions on the first code, obtaining a first parsing result based on a real engineering environment. This further improves the accuracy and efficiency of the IDE's semantic parsing, thereby further enhancing the accuracy of the first parsing result.

[0080] In one scenario, step 320 includes: calling an integrated development environment based on code parsing instructions to perform semantic parsing on the first code to obtain a second parsing result; splitting the second parsing result based on a preset semantic granularity to obtain multiple atomic semantic information; encapsulating each atomic semantic information based on a first data format to obtain a third parsing result; and performing flattening transformation and circular reference removal on the third parsing result based on a second data format to obtain a first parsing result.

[0081] The second parsing result is the original, complete, and IDE-compliant high-order source code semantic information directly returned by the integrated development environment (IDE) after semantic parsing. It contains rich project context and syntactic semantic information. The third parsing result is the high-order source code semantic information obtained by performing a data format conversion on the second parsing result. Its data structure conforms to the communication protocol of the generative model. The preset semantic granularity is a pre-defined standard for dividing complex semantic information into independent, understandable, and indivisible fine-grained semantic units. Atomic semantic information is the smallest, single, and indivisible standardized semantic unit obtained after splitting according to the preset semantic granularity, such as variable information, function information, type information, and syntax node information. The first data format is a pre-defined structured data format used for unified encapsulation and standardization of atomic semantic information; for example, it can be a structured data format specified in the communication protocol of the generative model. The second data format is another pre-defined structured data format, a lightweight and general-purpose data format suitable for data transmission and model parsing, supporting a flat structure and not containing circular references.

[0082] Specifically, as described above, after the semantic gateway calls the IDE to perform semantic parsing on the first code, it can directly obtain the second parsing result. The second parsing result includes, but is not limited to, at least one of the following: the syntactic structure information of the source code file (syntactic nodes such as classes, methods, and statements), symbol definitions and reference relationships, variable types, method signatures, inheritance relationships, project dependencies, scope, access permissions, and other high-order source code semantic information. Then, in order to adapt to the data interaction of the generative model, the semantic gateway can atomically segment the second parsing result according to a preset semantic granularity, forming multiple independent and indivisible atomic semantic units. Each atomic semantic unit is then standardized, such as unifying field names, data types, and expression forms, to eliminate semantic structure differences caused by different IDE versions, and obtain the corresponding atomic semantic information. Then, the semantic gateway can adapt the format of each atomic semantic information according to the first data format, construct a semantic data structure that conforms to the protocol specification, filter out atomic semantic information that is irrelevant to the current parsing requirements, and then encapsulate the obtained atomic semantic information to obtain the third parsing result. The third parsing result reduces the model's processing burden and can be directly parsed and used by the model, improving its inference efficiency. Finally, the semantic gateway performs a second structured transformation on the third parsing result according to the second data format. This structured transformation can include flattening and de-circulating reference processing. Flattening can be understood as flattening hierarchical semantic information into a non-nested structure. De-circulating reference processing can be understood as eliminating circular references between objects in semantic information with circular reference relationships, converting them into a structure without circular references. After this structured transformation, the result is the first parsing result. This data structure processing solves the problem of generative models being unable to understand the IDE's native semantic data, aligning the IDE semantic data with the model's format, thus ensuring that the generative model can directly use the first parsing result, such as model hints, for subsequent inference processing.

[0083] In one scenario, the input also includes the integrated development environment's (IDE) first execution policy identifier. This identifier points to a first execution policy that corresponds to lightweight source file operations, meaning the IDE directly reads the source file's content using its source code semantic engine, without involving the IDE's interactive interface. This allows the IDE to return the first parsing result within milliseconds.

[0084] In another scenario, the input also includes a second execution strategy identifier for the integrated development environment (IDE). This second execution strategy corresponds to heavyweight source code file operations. The IDE uses its source code semantic engine to read the contents of the source code file, simultaneously launching the IDE's interactive interface and displaying the execution process in real-time, such as opening the source code file or scrolling through the source code content as it's scanned. This allows the IDE to switch to heavyweight analysis when the model requires in-depth analysis, enabling developers to monitor the IDE's execution status in real time.

[0085] Figure 4 This article provides a schematic diagram of data interaction during code processing. For example... Figure 4 As shown, the code processing involves a client, a generative model, a semantic gateway, and an integrated development environment. Taking the generative model as an example, generating the first piece of code based on code generation requirements, the specific data interaction flow is as follows: Step 401: The client responds to the input operation on the dialog interface, obtains and displays the input content.

[0086] Step 402: The generative model generates the first code, file path, first location, and code verification instructions based on the input content, and generates a semantic parsing request accordingly.

[0087] Step 403: The semantic gateway obtains the version information corresponding to the integrated development environment, and determines the interaction interface adapted to the integrated development environment based on the version information.

[0088] Step 404: The semantic gateway generates a status query request and, based on the generated status query request, calls the integrated development environment through the interactive interface.

[0089] Step 405: The integrated development environment responds to the status query request by performing status detection, obtains the status detection results, and returns them to the semantic gateway.

[0090] Step 406: The semantic gateway determines that the state detection result meets the preset conditions and detects that the integrated development environment is in an available state.

[0091] Step 407: The semantic gateway calls the integrated development environment based on the file path through an interactive interface.

[0092] Step 408: The integrated development environment (IDE) loads a file based on the file path to obtain the first source code content, performs source code synchronization based on the first source code content to obtain the second source code content, and constructs a syntax tree based on the second source code content. The syntax tree is then returned to the semantic gateway. Step 409: Based on the first location, the semantic gateway performs text matching and noise filtering on the first code within the second source code content to obtain the second code.

[0093] Step 410: The semantic gateway performs semantic-based position correction on the second code based on the syntax tree to obtain the second position.

[0094] Step 411: The semantic gateway, based on the first code, the second location, and the code verification instructions, calls the integrated development environment through an interactive interface.

[0095] Step 412: In response to the code verification instruction, the integrated development environment performs verification processing on the first code based on the second location, obtains the verification result, and returns it as the second parsing result to the semantic gateway. The verification result includes code error information and correction suggestions.

[0096] Step 413: The semantic gateway splits the second parsing result based on the preset semantic granularity to obtain multiple atomic semantic information, and encapsulates each atomic semantic information based on the first data format to obtain the third parsing result. Based on the second data format, the third parsing result is flattened and decircular references are removed to obtain the first parsing result, and the first parsing result is returned to the generative model.

[0097] Step 414: Based on the first parsing result, the generative model corrects the first code to obtain the third code and prompt information, and returns them to the client as output.

[0098] Step 415: The client displays the third code and prompt information in the dialog interface.

[0099] In one scenario, a generative model can generate initial code based on the current project. In this case, before generating the initial code based on the input, the generative model can first use a semantic gateway to access the integrated development environment (IDE) to obtain high-order source code semantic information about the project context. Then, using this high-order source code semantic information as prior knowledge, it generates the initial code based on the input. In this scenario, Figure 4 The steps in the process can be executed in the following order: Steps 401, 402 (changed to: the generative model generates a file path and a first location based on the input content, and generates a semantic information retrieval request accordingly), Steps 403, 404, 405, 406, 407, 408, 409, 410, 413, Step 402 (changed to: the generative model generates a first code and code verification instructions based on the input content, second source code content, syntax tree, and second location, and generates a semantic parsing request accordingly), Steps 411, 412, 413, 414, and 415. The aforementioned semantic information retrieval request is used to request the IDE to obtain high-level source code semantic information of the current project.

[0100] This generative model, by fully understanding the real-world environment of the current project during the initial code generation, effectively improves the project adaptability, syntactic accuracy, and semantic consistency of the generated code. It avoids generating code that conflicts with the project environment, has semantic inconsistencies, or cannot be compiled correctly, significantly reducing bias caused by unfounded model inference and improving code generation quality and usability. Furthermore, the first code is validated again through an IDE, and corrections are made based on the validation results. This secondary verification of the first code's compliance and correctness allows for the timely detection and correction of various errors, making the final generated third code more closely aligned with the actual project compilation environment. This further reduces model inference bias and significantly improves the direct executableness and project compatibility of the generated code.

[0101] The following are embodiments of the code processing apparatus provided herein. This apparatus and the code processing methods of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the code processing apparatus, please refer to the embodiments of the above code processing methods.

[0102] Figure 5 A schematic diagram of a code processing device configured on a client side, as provided in this paper, is shown. Figure 5 As shown, the code processing device 500 may include: The input content acquisition module 510 is used to acquire input content in response to input operations on the dialog interface; wherein, the input content includes code parsing instructions; The input content sending module 520 is used to display and send input content in the dialogue interface; wherein, the input content is used to trigger the generative model to obtain output content; the output content includes code processing results and prompt information; the code processing results correspond to code parsing instructions; the prompt information is used to indicate that the code processing results are the results of code semantic parsing performed by the integrated development environment; The output content display module 530 is used to receive and display the output content.

[0103] The code processing device provided in this paper implements the above-mentioned generative model-based code-assisted processing through a dialogue interaction, achieving an organic combination of dialogue interaction and native environment parsing capabilities, balancing the convenience of interaction with the accuracy of code processing; furthermore, by displaying the code processing results obtained from actual execution in the integrated development environment along with prompts, it can clearly identify that the code processing results originate from the execution of the real compilation environment, effectively improving the reliability and practicality of the code processing results.

[0104] Figure 6 A schematic diagram of a code processing device configured in a semantic gateway, as provided in this paper, is shown. Figure 6 As shown, the code processing device 600 may include: The semantic parsing request receiving module 610 is used to receive semantic parsing requests; wherein, the semantic parsing request includes first code and code parsing instructions; the semantic parsing request is generated based on the input content through a generative model; The first parsing result acquisition module 620 is used to, if the integrated development environment is detected to be available, call the integrated development environment based on the code parsing instructions, perform semantic parsing processing on the first code, and obtain the first parsing result; The first parsing result sending module 630 is used to send the first parsing result; wherein, the first parsing result is used to generate output content through a generative model, and the output content includes code processing results and prompt information; the prompt information is used to indicate that the code processing result is the result of code semantic parsing performed by the integrated development environment.

[0105] The code processing device presented in this paper adds a semantic gateway between the generative model and the integrated development environment (IDE), serving as a unified entry point for external access to the IDE. This provides an effective channel for invoking the native semantic parsing capabilities of the IDE during code-assisted processing. Furthermore, in response to semantic parsing requests sent by the generative model, the semantic gateway, after confirming the availability of the IDE, invokes its native semantic parsing capabilities to perform semantic parsing processing corresponding to the code parsing instructions in the first code segment of the request. On the one hand, this avoids the uncertainty introduced by providing semantic capabilities when the IDE is not ready, improving the accuracy and completeness of the reference data provided by the IDE, thereby enhancing the reliability of the code processing results to some extent. On the other hand, relying on the real compilation environment to perform code semantic parsing avoids the biases resulting from solely relying on model inference, further improving the accuracy and completeness of the results obtained from model-assisted code processing.

[0106] In one scenario, the first parsing result acquisition module 620 is specifically used for: Generate a status query request; Based on the status query request, the integrated development environment is invoked to perform status detection and obtain the status detection results. If the status detection result meets the preset conditions, the integrated development environment is detected to be in an available state.

[0107] Furthermore, the state detection result must meet at least one of the following preset conditions: If the status detection result includes the index status, then the index status is in the completed state; If the status detection result includes the project synchronization status, then the project synchronization status is in the synchronization successful state. If the status detection result includes the running status, then the running status is in the working state.

[0108] In one scenario, the semantic parsing request may also include a file path; Accordingly, the code processing device 600 also includes a second source code content acquisition module, used for: Based on the file path, the integrated development environment is invoked to load the file and obtain the first source code content; Based on the first source code content, the integrated development environment is invoked to synchronize the source code and obtain the second source code content; the second source code content is used for semantic parsing processing.

[0109] Furthermore, the code processing device 600 also includes a syntax tree acquisition module for: Based on the second source code, the integrated development environment is invoked to construct a syntax tree, which is then used for semantic parsing.

[0110] In one scenario, the semantic parsing request also includes a first position; Accordingly, the code processing apparatus 600 also includes a second position acquisition module, used for: Based on the first position, text matching and noise filtering are performed on the first code in the second source code content to obtain the second code; wherein, the second code is a code snippet in the second source code content, and the code snippet corresponds to the first code; the second source code content is the code content in the source code file corresponding to the first code; The second code is semantically corrected based on the syntax tree to obtain the second position; the syntax tree is constructed based on the content of the second source code; the second position is used for semantic parsing processing.

[0111] In one scenario, the code processing apparatus 600 further includes an interface determination module, used for: Obtain the version information corresponding to the integrated development environment; Based on the version information, the interaction interface is determined; the interaction interface is used to call the integrated development environment.

[0112] In one scenario, the first parsing result acquisition module 620 is specifically used for: Based on the code parsing instructions, the integrated development environment is invoked to perform semantic parsing on the first code to obtain the second parsing result; Based on the preset semantic granularity, the second parsing result is split to obtain multiple atomic semantic information; Based on the first data format, each atomic semantic information is encapsulated to obtain the third parsing result; Based on the second data format, the third parsing result is flattened and circular references are removed to obtain the first parsing result.

[0113] In one scenario, the first code is generated based on the input content through a generative model, the code parsing instruction is a code verification instruction, and the semantic parsing request is generated based on the first code and the code verification instruction through a generative model. Accordingly, the first parsing result acquisition module 620 is specifically used for: Based on the code verification instruction, the integrated development environment is invoked to verify the first code and obtain the verification result, which serves as the first parsing result. The verification result includes code error information and correction suggestions. The verification result is used to correct the first code through a generative model to obtain the third code and prompt information, which serve as the output content.

[0114] The code processing device provided in this paper can execute the code processing method provided in this paper, and has the corresponding functional modules and beneficial effects of the execution method.

[0115] It is worth noting that in the embodiments of the above-mentioned code processing device, the modules included are divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional module are only for easy differentiation and are not used to limit the scope of protection of this document.

[0116] This document also provides an electronic device that may include a processor and a memory, the memory of which may be used to store executable instructions. The processor may be used to read the executable instructions from the memory and execute the executable instructions to implement the code processing method in any embodiment of this document, possessing the corresponding functional modules and beneficial effects of the execution method.

[0117] Figure 7 A schematic diagram of the structure of an electronic device provided in this article is shown.

[0118] like Figure 7 As shown, the electronic device 700 may include a processing unit 701 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 702 or a program loaded from storage device 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the electronic device 700. The processing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output interface (I / O interface) 705 is also connected to the bus 704.

[0119] Typically, the following devices can be connected to I / O interface 705: input devices 706 including, for example, touch screens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 707 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 708 including, for example, magnetic tapes, hard disks, etc.; and communication devices 709. Communication device 709 allows electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data.

[0120] It should be noted that, Figure 7 The electronic device 700 shown is merely an example and should not impose any limitations on the functionality or scope of this document. That is, although... Figure 7 An electronic device 700 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0121] In particular, according to embodiments herein, the processes described in the above-referenced flowcharts can be implemented as computer software programs. For example, embodiments herein include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 709, or installed from storage device 708, or installed from ROM 702. When the computer program is executed by processing device 701, it performs the functions defined in the code processing methods herein, possessing the corresponding functional modules and beneficial effects of the execution method.

[0122] This article also provides a computer-readable storage medium storing one or more computer programs that, when executed by a processor, enable the processor to implement the code processing methods described herein, possessing the corresponding functional modules and beneficial effects of the execution methods.

[0123] It should be noted that the computer-readable medium mentioned above can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. Computer-readable storage media can be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this document, a computer-readable signal medium can include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, radio frequency (RF), etc., or any suitable combination thereof.

[0124] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol, such as Hypertext Transfer Protocol (HTTP), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include Local Area Networks (LANs), Wide Area Networks (WANs), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0125] The aforementioned computer-readable storage medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0126] In this document, computer program code for performing the operations described herein may be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0127] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of devices, methods, and computer program products according to various embodiments herein. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0128] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), and so on.

[0129] The above description is merely a preferred embodiment and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure herein is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-disclosed concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed herein that have similar functions.

[0130] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in sequential order. Multitasking and parallel processing may be advantageous in certain environments. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this document. Certain features described in the context of a single embodiment may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0131] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A code processing method, comprising: In response to an input operation on the dialog interface, input content is obtained; wherein, the input content includes code parsing instructions; The input content is displayed and sent in the dialog interface; wherein, the input content is used to trigger the generative model to obtain output content; the output content includes code processing results and prompt information; the code processing results correspond to the code parsing instructions; the prompt information is used to indicate that the code processing results are the result of code semantic parsing performed by the integrated development environment; Receive and display the output content.

2. A code processing method, comprising: Receive a semantic parsing request; wherein the semantic parsing request includes a first code and code parsing instructions; the semantic parsing request is generated based on the input content through a generative model; If the integrated development environment is detected to be available, then based on the code parsing instructions, the integrated development environment is invoked to perform semantic parsing processing on the first code to obtain the first parsing result; Send the first parsing result; wherein the first parsing result is used to generate output content through the generative model, the output content including code processing results and prompt information; the prompt information is used to characterize that the code processing result is the result of code semantic parsing performed by the integrated development environment.

3. The method according to claim 2, wherein detecting that the integrated development environment is in an available state includes: Generate a status query request; Based on the status query request, the integrated development environment is invoked to perform status detection and obtain the status detection result. If the status detection result meets the preset conditions, then the integrated development environment is detected to be in the available state.

4. The method according to claim 3, wherein the state detection result satisfies at least one of the following preset conditions: If the status detection result includes an index status, then the index status is in a completed state; If the status detection result includes the project synchronization status, then the project synchronization status is in a successful synchronization state. If the status detection result includes a running status, then the running status is in a working state.

5. The method according to claim 2, wherein the semantic parsing request further includes a file path; The method further includes: Based on the file path, the integrated development environment is invoked to load the file and obtain the first source code content; Based on the first source code content, the integrated development environment is invoked to perform source code synchronization to obtain the second source code content; The second source code content is used for semantic parsing processing.

6. The method according to claim 5, further comprising: Based on the second source code content, the integrated development environment is invoked to construct a syntax tree, thereby obtaining the syntax tree; wherein, the syntax tree is used for semantic parsing processing.

7. The method according to any one of claims 2 to 6, wherein the semantic parsing request further includes a first location; The method further includes: Based on the first position, text matching and noise filtering are performed on the first code in the second source code content to obtain the second code; wherein, the second code is a code fragment in the second source code content, and the code fragment corresponds to the first code; the second source code content is the code content in the source code file corresponding to the first code; The second code is semantically corrected based on the syntax tree to obtain a second position; wherein the syntax tree is constructed based on the content of the second source code; and the second position is used for semantic parsing processing.

8. The method according to any one of claims 2 to 6, wherein the method further comprises: Obtain the version information corresponding to the integrated development environment; Based on the version information, an interaction interface is determined; wherein, the interaction interface is used to call the integrated development environment.

9. The method according to claim 2, wherein the step of calling the integrated development environment based on the code parsing instruction to perform semantic parsing processing on the first code to obtain a first parsing result includes: Based on the code parsing instructions, the integrated development environment is invoked to perform semantic parsing on the first code and obtain a second parsing result; Based on the preset semantic granularity, the second parsing result is split to obtain multiple atomic semantic information; Based on the first data format, the atomic semantic information is encapsulated to obtain the third parsing result; Based on the second data format, the third parsing result is flattened and circular references are removed to obtain the first parsing result.

10. The method according to claim 2, wherein the first code is generated by the generative model based on the input content, the code parsing instruction is a code verification instruction, and the semantic parsing request is generated by the generative model based on the first code and the code verification instruction; The step of invoking the integrated development environment based on the code parsing instructions to perform semantic parsing processing on the first code and obtain a first parsing result includes: Based on the code verification instruction, the integrated development environment is invoked to perform verification processing on the first code, and a verification result is obtained as the first parsing result; wherein, the verification result includes code error information and correction suggestion information; the verification result is used to correct the first code through the generative model to obtain the third code and the prompt information, which are used as the output content.

11. A code processing apparatus, comprising: An input content acquisition module is used to acquire input content in response to an input operation on the dialog interface; wherein, the input content includes code parsing instructions; An input content sending module is used to display the input content in the dialog interface and send the input content; wherein, the input content is used to trigger a generative model to obtain output content; the output content includes code processing results and prompt information; the code processing results correspond to the code parsing instructions; the prompt information is used to indicate that the code processing results are the result of code semantic parsing performed by the integrated development environment; The output content display module is used to receive and display the output content.

12. A code processing apparatus, comprising: A semantic parsing request receiving module is used to receive semantic parsing requests; wherein, the semantic parsing request includes first code and code parsing instructions; the semantic parsing request is generated based on the input content through a generative model; The first parsing result acquisition module is used to, if the integrated development environment is detected to be available, invoke the integrated development environment based on the code parsing instructions to perform semantic parsing processing on the first code and obtain the first parsing result; A first parsing result sending module is used to send the first parsing result; wherein, the first parsing result is used to generate output content through the generative model, the output content including code processing results and prompt information; the prompt information is used to indicate that the code processing result is the result of code semantic parsing performed by the integrated development environment.

13. An electronic device, comprising: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the code processing method according to any one of claims 1-10.

14. A computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the code processing method according to any one of claims 1-10.

15. A computer program product for implementing the code processing method according to any one of claims 1-10.