Target interface document generation method and equipment

By automatically generating application programming interface (API) documentation using a documentation generation model, the inconsistency between API documentation written by non-technical personnel and API documentation implemented by developers is resolved, achieving efficient and accurate API documentation generation.

CN121979567APending Publication Date: 2026-05-05ZHEJIANG GEELY HLDG GRP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG GEELY HLDG GRP CO LTD
Filing Date
2026-01-12
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

The existing application programming interface (API) documentation is usually written manually or generated semi-automatically, which leads to discrepancies between the natural language requirement descriptions written by non-technical personnel and the API documentation implemented by developers, resulting in inefficiency.

Method used

An interface document generation model is used to automatically generate interface documents. Initial interface documents are generated by obtaining natural language requirement documents, and real interface documents matching user requirements are generated based on target code files. The training dataset is used to improve the model's generalization ability and generation efficiency.

Benefits of technology

It improves the efficiency and accuracy of API documentation generation, ensures a high degree of match between API documentation and user needs, and solves the inefficiency problem caused by manual writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121979567A_ABST
    Figure CN121979567A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a target interface document generation method and device, and relates to the technical field of application programming interfaces. The method comprises the steps of obtaining a natural language demand document, inputting the natural language demand document into a first document generation model, outputting an initial interface document, obtaining a target code file generated based on the initial interface document, inputting the target code file into a second document generation model, and generating a target interface document. By adopting the technical scheme, the interface document is automatically generated by using the document generation model, so that the efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of application programming interface (API) technology, and more particularly to a method and apparatus for generating target interface documentation. Background Technology

[0002] With the widespread adoption of microservice architecture, application programming interfaces (APIs) have become the core link for interaction between modern software systems. Consequently, API documentation is especially important for developers.

[0003] However, current application programming interface (API) documentation is either manually written or semi-automatically generated. There's a discrepancy between the natural language requirements descriptions written by non-technical personnel, such as product managers or business analysts, and the precise API documentation that developers need to implement; manually converting these descriptions is inefficient.

[0004] Therefore, there is an urgent need for a method to generate target interface documentation that can automatically generate accurate interface documentation, thereby improving efficiency. Summary of the Invention

[0005] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a method and apparatus for generating target interface documentation.

[0006] A first aspect of this disclosure provides a method for generating target interface documentation, the method comprising: Obtain a natural language requirement document, input the natural language requirement document into a first document generation model, and output an initial interface document; wherein, the natural language requirement document includes text describing the user's requirements; the user's requirements are used to instruct the generation of the interface document; the initial interface document is a structured document describing interface-related information; Obtain the target code file generated based on the initial interface document, input the target code file into the second document generation model, and generate the target interface document, wherein the target interface document is a real interface document that matches the user's needs.

[0007] A second aspect of this disclosure provides a target interface documentation generation apparatus, the apparatus comprising: The first acquisition module is used to acquire a natural language requirement document, input the natural language requirement document into a first document generation model, and output an initial interface document; wherein, the natural language requirement document includes text describing the user's requirements; the user's requirements are used to instruct the generation of the interface document; the initial interface document is a structured document describing interface-related information; The second acquisition module is used to acquire the target code file generated based on the initial interface document, input the target code file into the second document generation model, and generate a target interface document, wherein the target interface document is a real interface document that matches the user's needs.

[0008] A third aspect of this disclosure provides an electronic device comprising: a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the method described in the first aspect.

[0009] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the method of the first aspect described above.

[0010] A fifth aspect of this disclosure provides a computer program product including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0011] This disclosure provides a method and apparatus for generating target interface documentation. The method includes: acquiring a natural language requirements document; inputting the natural language requirements document into a first document generation model to output an initial interface document; acquiring a target code file generated based on the initial interface document; and inputting the target code file into a second document generation model to generate the target interface document. By employing this technical solution, efficiency can be improved because the interface document is automatically generated using a document generation model. Attached Figure Description

[0012] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0013] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a flowchart illustrating a method for generating target interface documentation provided in an embodiment of this disclosure; Figure 2 This is a flowchart illustrating a method for generating target interface documentation provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram of a target interface document generation process provided in an embodiment of this disclosure; Figure 4 This is a schematic diagram of the structure of a target interface document generation device provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. Detailed Implementation

[0015] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0016] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0017] Figure 1 This is a flowchart illustrating a method for generating target interface documentation according to an embodiment of this disclosure. This method can be executed by an electronic device. The electronic device can be exemplarily understood as a device such as a mobile phone, tablet computer, laptop computer, desktop computer, or smart TV. Figure 1 As shown, the method provided in this embodiment includes the following steps: S101. Obtain the natural language requirement document, input the natural language requirement document into the first document generation model, and output the initial interface document; wherein, the natural language requirement document includes text describing the user's requirements; the user's requirements are used to instruct the generation of the interface document; the initial interface document is a structured document describing interface-related information.

[0018] In one example, a natural language requirements document is used to represent user needs, specifically, the text content describing the interface document the user requires. Here, user needs refer to the text content entered by the user, which describes the specific content and format of the interface document. Specifically, user needs can include both the content and the structure of the generated interface document.

[0019] For example, a natural language requirements document could be: "Generate an interface document for a user login system, where the input is username and password, and the output is whether the verification was successful, or if it failed, indicate the reason for the failure."

[0020] In this embodiment, the first document generation model can be a large language model. This first document generation model is used to output an initial interface document that meets the natural language requirement document based on the natural language requirement document. The initial interface document is a structured document describing interface-related information; specifically, the initial interface document is text information.

[0021] Furthermore, the natural language requirements document is input into the first document generation model, which then outputs an initial interface document. This initial interface document contains relevant text information about the interface and is structured text content that can be used to instruct developers to write target code files. The advantage of this setup is that the initial interface document can be synchronized with other departments beforehand, allowing them to perform their work accordingly and thus improving overall work efficiency.

[0022] S102. Obtain the target code file generated based on the initial interface document, input the target code file into the second document generation model, and generate the target interface document, wherein the target interface document is a real interface document that matches the user's needs.

[0023] In one example, the second document generation model is a large language model, which can be the same as or different from the first document generation model.

[0024] Furthermore, after obtaining the target code file, the target code file is input into the second document generation model.

[0025] In one example, the target code file is an accurate code file, and then a target interface document is generated based on the target code file using a second document generation model. This target interface document is text content, specifically, it is associated with the target code file and is a real interface document that matches the user's needs.

[0026] This disclosure provides a method for generating target interface documentation. The method includes: acquiring a natural language requirements document; inputting the natural language requirements document into a first document generation model; firstly generating an initial interface document using the first document generation model to facilitate the writing of a target code file based on the initial interface document; and then generating a target interface document based on the target code file using a second document generation model. Since this target interface document is generated from the target code file, it is an accurate interface document. This technical solution improves efficiency because the target interface document is automatically generated from a model, rather than being written by humans.

[0027] Figure 2 This illustration shows a flowchart of a target interface document generation method provided by an embodiment of the present disclosure. This embodiment is an optimization based on the above embodiments, and can be combined with various optional solutions from one or more of the above embodiments.

[0028] like Figure 2 As shown, the method for generating the target interface documentation may include the following steps: S201. Obtain the natural language requirement document, input the natural language requirement document into the first document generation model, process the natural language requirement document, and obtain interface description information, interface parameter information, and error code information.

[0029] In one example, the interface description information includes at least one of the following: interface function description information, interface request method, interface initial request path information, authentication method, and interface content type.

[0030] For example, if the natural language requirements document is "Generate an interface document for a user login system, where the input is username and password, and the output is whether the verification was successful, or if it failed, the reason for the failure," then the interface function description information could be "Verify user credentials: username + password, return login result and error reason." The interface request method could be POST, the initial request path could be / api / v1 / auth / login, the authentication method could be none (no authentication required before login), and the interface content type could be application / json.

[0031] In this embodiment, the interface parameter information can be request parameters and response parameters. Request parameters can be found in Table 1.

[0032] Table 1 Request Parameters

[0033] The response parameters can be found in Table 2, which shows relevant information about the response parameters.

[0034] Table 2 Response Parameters

[0035] In this embodiment, error code information is used to represent status codes, the code field, and their corresponding meanings. Specifically, see Table 3, which shows one type of error code information.

[0036] Table 3 Error Code Information

[0037] In one example, the natural language requirements document is processed based on the first document generation model to obtain interface description information, interface parameter information, and error code information, including: The natural language requirement document is segmented based on the first document generation model to obtain the segmentation result; The word segmentation results are extracted to obtain interface description information, interface parameter information, and error code information.

[0038] In one example, the semantic understanding algorithm in the first document generation model is used to segment the natural language requirement document to obtain the segmentation result, which includes technical terms and business terms. Then, the segmentation result is extracted to obtain interface description information, interface parameter information and error code information.

[0039] S202. Generate the initial interface document based on the interface description information, interface parameter information, and error code information.

[0040] In one example, based on the first document generation model, the interface description information, interface parameter information, and error code information are combined to generate the initial interface document.

[0041] S203. In response to a trigger operation on the documentation development interface, obtain the target code file generated based on the initial interface documentation from the documentation development interface.

[0042] In one example, the documentation development interface is used to upload the target code file. Users can trigger the documentation development interface to obtain the target code file corresponding to the initial interface documentation; for clarity, we can denote the target code file as D.

[0043] S204. Input the target code file into the second document generation model.

[0044] In one example, the target code file is input into the second document generation model, including: The target code file is stored in the code database, and the target code file is read from the code database and input into the second document generation model; the code database is used to query the target code file.

[0045] In one example, the code database could be a GitHub repository. The target code file D is input into the GitHub repository, then read from the GitHub repository, and finally input into the second document generation model.

[0046] In one example, after obtaining the target code file generated based on the initial interface document, inputting the target code file into the second document generation model, and generating the target interface document, the process also includes: Execution via model generation from second document: A consistency comparison is performed between the target interface document and the initial interface document; and in response to the comparison result indicating that the consistency requirement is not met, the target code file is updated to obtain the updated code file, and a new target interface document is generated based on the updated code file through the second document generation model.

[0047] In one example, if the first document generation model and the second document generation model are different, the initial interface document is input into the second document generation model. Based on the second document generation model, the interface description information in the target interface document is compared with the interface description information in the initial interface document, the interface parameter information in the target interface document is compared with the interface parameter information in the initial interface document, and the error code information in the target interface document is compared with the error code information in the initial interface document for consistency. If the comparison result does not meet the consistency requirements, the target code file needs to be updated to obtain the updated code file. Then, the second document generation model generates a new target interface document based on the updated code file.

[0048] Specifically, updating the target code file yields the updated code file, including: Based on the comparison results, at least one target interface element corresponding to the interface specification difference value and the difference type of the target interface element are determined; wherein, the target interface element includes at least one of target interface description information, target interface parameter information or target error code information; Based on the difference type of the target interface element, update the code corresponding to the target interface element in the target code file.

[0049] In one example, code updates include at least one of the following: adding code, deleting code, modifying code, or changing the code structure.

[0050] In one example, the interface specification difference value refers to a numerical metric calculated using a consistency comparison model, used to represent the degree of inconsistency between the target interface document and the initial interface document in terms of specification elements. The larger the difference value, the more severe the deviation between the two.

[0051] For example, the process of updating the target code file based on the comparison result can be as follows: after comparing the target interface document and the initial interface document for consistency through the second document generation model and obtaining the comparison result representing the interface specification difference value, if the interface specification difference value exceeds a preset threshold, the electronic device can perform an update operation.

[0052] First, based on the comparison results, at least one target interface element corresponding to the interface specification difference value is identified, and the specific difference type of the target interface element is identified. The target interface element is the interface component identified as having inconsistencies during the comparison, and it is selected from at least one of the interface description information, interface parameter information, or error code information defined in the initial interface document. The difference type is used to quantify the specific nature of the inconsistency, such as inconsistent content description, missing parameter definitions, or redundant error code information. Then, according to the determined difference type of the target interface element, the specific code segment corresponding to that element in the target code file is updated accordingly. Update operations include, but are not limited to, at least one of the following: adding a new code segment to compensate for missing information, deleting an existing code segment to eliminate redundancy, or modifying an existing code segment to correct errors. For example, if the difference type is that a parameter in the interface parameter information changes from "optional" to "required," then the code segment in the target code file that validates that parameter is modified; if the difference type is that error code information is missing, then a corresponding error code definition segment is added to the code. This precise update based on difference types ensures that the target code files accurately reflect user needs, resulting in a true and requirement-matched target interface document generated by the second document generation model. This effectively solves the document lag problem caused by code changes during development, improving the automation and accuracy of interface document management.

[0053] In one example, the first document generation model is obtained after training on a training dataset; wherein, the training dataset includes historical natural language requirement documents, historical initial interface documents corresponding to the historical natural language requirement documents, historical target code files, and historical target interface documents corresponding to the historical target code files; and / or The second document generation model is obtained after training on the training dataset; the training dataset includes historical natural language requirement documents, historical initial interface documents corresponding to the historical natural language requirement documents, historical target code files, and historical target interface documents corresponding to the historical target code files.

[0054] For example, the training dataset may include historical natural language requirement documents, historical initial interface documents corresponding to the historical natural language requirement documents, historical target code files, and historical target interface documents corresponding to the historical target code files. The historical natural language requirement documents are used to represent the requirement descriptions of historical users. The historical initial interface documents are the result of structured descriptions and interface standardization of these requirements, and include historical interface description information (such as interface function description information, interface request method, interface initial request path information, and at least one of authentication method and interface content type), historical interface parameter information (such as request parameters and response parameters), and historical error code information (such as status codes and their corresponding meanings).

[0055] By using this comprehensive training dataset, for example, the first document generation model learns the correspondence between historical natural language requirement documents and historical initial interface documents, enabling it to automatically extract interface elements from new natural language requirement documents and generate initial interface documents. The second document generation model, based on the association between historical target code files and historical target interface documents, learns to infer the actual target interface document from the target code file. This training method not only improves the model's generalization ability but also ensures that the generated interface documents highly match user needs, thereby improving the accuracy and generation efficiency of the interface documents.

[0056] In some possible implementations, the training dataset can also be a preprocessed dataset. Preprocessing may include word segmentation of historical natural language requirement documents and extraction of interface information based on the segmentation results. Word segmentation of historical natural language requirement documents is performed using a pre-defined semantic understanding algorithm to divide unstructured natural language text into word segments with independent semantic meaning. For example, "user login interface requires username and password" is segmented into independent lexical units such as "user," "login," "interface," "require," "username," "and," and "password." This step helps the model identify technical terms (such as "interface" and "username") and business terms (such as "login"), laying the foundation for subsequent information extraction. Next, interface information is extracted based on the word segmentation results, that is, the core elements constituting the interface document are identified and extracted from the segmented word sequence.

[0057] Specifically, the extracted information can include historical interface description information (such as identifying the interface function description as "verify user credentials" and the interface request method as "POST" from word segmentation), historical interface parameter information (such as identifying request parameters as "username" and "password" and determining their types and required attributes), and historical error code information (such as identifying status code 401 and its corresponding meaning of authentication failure). The extraction process can be based on rule templates or statistical models to ensure that the extracted information is consistent with the structured content defined in the historical initial interface document. Through the preprocessing described above, the natural language requirements in the training dataset are transformed into standardized, machine-readable feature representations. This enables the model to efficiently learn the mapping relationship from natural language to structured interface documents, or the generation logic from code to interface documents, during training. This not only improves the convergence speed and stability of model training but also enhances the accuracy and standardization of the initial and target interface documents generated by the model.

[0058] For a clearer explanation, please refer to [link to relevant documentation]. Figure 3 This diagram illustrates a process for generating a target interface document.

[0059] This disclosure provides a method for generating target interface documentation. The method includes: acquiring a natural language requirement document; inputting the natural language requirement document into a first document generation model; processing the natural language requirement document based on the first document generation model to obtain interface description information, interface parameter information, and error code information; generating an initial interface document based on the interface description information, interface parameter information, and error code information using the first document generation model; and then, in response to a trigger operation for developing an interface in the document, acquiring a target code file corresponding to the initial interface document. Next, generating a target interface document based on the target code file using a second document generation model and outputting the target interface document. The initial interface document is then input into the second document generation model, and a consistency comparison is performed between the target interface document and the initial interface document based on the second document generation model to obtain a comparison result. Using this technical solution, when the target code file changes, the system can automatically detect and update the associated interface document, ensuring that the document is consistent with the source of the requirement in real time.

[0060] Figure 4 This is a schematic diagram of a target interface documentation generation device provided in an embodiment of this disclosure. This target interface documentation generation device can be understood as the aforementioned electronic device or a functional module within the aforementioned electronic device. For example... Figure 4 As shown, the target interface documentation generation device 40 includes: The first acquisition module 401 is used to acquire a natural language requirement document, input the natural language requirement document into the first document generation model, and output an initial interface document; wherein, the natural language requirement document includes text describing the user's requirements; the user's requirements are used to instruct the generation of the interface document; the initial interface document is a structured document describing interface-related information.

[0061] The second acquisition module 402 is used to acquire the target code file generated based on the initial interface document, input the target code file into the second document generation model, and generate the target interface document, wherein the target interface document is a real interface document that matches the user's needs.

[0062] In one example, the first acquisition module 401 is used for: The natural language requirement document is input into the first document generation model, and the natural language requirement document is processed to obtain interface description information, interface parameter information and error code information. Generate an initial interface document based on the interface description information, interface parameter information, and error code information.

[0063] In one example, the interface description information includes at least one of the following: interface function description information, interface request method, interface initial request path information, authentication method, and interface content type.

[0064] The second acquisition module 402 is used to acquire the target code file generated based on the initial interface document from the document development interface in response to a trigger operation on the document development interface; Input the target code file into the second document generation model.

[0065] In one example, the second acquisition module 402 is used for: The target code file is stored in the code database, and the target code file is read from the code database and input into the second document generation model; the code database is used to query the target code file.

[0066] In one example, after obtaining the target code file generated based on the initial interface document, inputting the target code file into the second document generation model, and generating the target interface document, the process also includes: Execution module 403 is used to: generate a model from a second document and execute: Perform a consistency comparison between the target interface document and the initial interface document; and In response to the inconsistency requirement of the comparison results, the target code file is updated to obtain the updated code file. A new target interface document is then generated based on the updated code file using the second document generation model.

[0067] In one example, execution module 403 is used to: determine, based on the comparison result, at least one target interface element corresponding to the interface specification difference value and the difference type of the target interface element; wherein, the target interface element includes at least one of target interface description information, target interface parameter information or target error code information; Based on the difference type of the target interface element, update the code corresponding to the target interface element in the target code file.

[0068] In one example, code updates include at least one of the following: adding code, deleting code, modifying code, or changing the code structure.

[0069] In one example, the first document generation model is obtained after training on a training dataset; wherein, the training dataset includes historical natural language requirement documents, historical initial interface documents corresponding to the historical natural language requirement documents, historical target code files, and historical target interface documents corresponding to the historical target code files; and / or The second document generation model is obtained after training on the training dataset; the training dataset includes historical natural language requirement documents, historical initial interface documents corresponding to the historical natural language requirement documents, historical target code files, and historical target interface documents corresponding to the historical target code files.

[0070] The apparatus provided in this embodiment can execute the methods of any of the above embodiments, and its execution method and beneficial effects are similar, so they will not be described again here.

[0071] This disclosure also provides an electronic device, which includes: a memory storing a computer program; and a processor for executing the computer program, wherein when the computer program is executed by the processor, it can implement the methods of any of the above embodiments.

[0072] Example, Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. See below for details. Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device 1000 in the embodiments of this disclosure. The electronic device 1000 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0073] like Figure 5 As shown, the electronic device 1000 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. The RAM 1003 also stores various programs and data required for the operation of the electronic device 1000. The processing unit 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0074] Typically, the following devices can be connected to the I / O interface 1005: input devices 1006 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 1007 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1008 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows electronic device 1000 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 1000 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.

[0075] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure 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 1009, or installed from storage device 1008, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of embodiments of this disclosure.

[0076] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, 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 disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can 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, RF (radio frequency), etc., or any suitable combination thereof.

[0077] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) 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 of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

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

[0079] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire a natural language requirement document, input the natural language requirement document into a first document generation model, and output an initial interface document; wherein the natural language requirement document includes text describing the user's requirements; the user's requirements are used to instruct the generation of the interface document; the initial interface document is a structured document describing interface-related information; acquire a target code file generated based on the initial interface document, input the target code file into a second document generation model, and generate a target interface document, wherein the target interface document is a real interface document matching the user's requirements.

[0080] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed 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 can 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 can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0081] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. 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 a 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, can 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.

[0082] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0083] 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 arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.

[0084] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0085] This disclosure also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.

[0086] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

[0087] The above are merely specific embodiments of this disclosure, enabling those skilled in the art to understand or implement this disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to these embodiments, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating target interface documentation, characterized in that, The method includes: Obtain a natural language requirement document, input the natural language requirement document into a first document generation model, and output an initial interface document; wherein, the natural language requirement document includes text describing the user's requirements; the user's requirements are used to instruct the generation of the interface document; the initial interface document is a structured document describing interface-related information; Obtain the target code file generated based on the initial interface document, input the target code file into the second document generation model, and generate the target interface document, wherein the target interface document is a real interface document that matches the user's needs.

2. The method according to claim 1, characterized in that, The step of inputting the natural language requirement document into the first document generation model and outputting the initial interface document includes: The natural language requirement document is input into the first document generation model, and the natural language requirement document is processed to obtain interface description information, interface parameter information and error code information. The initial interface document is generated based on the interface description information, the interface parameter information, and the error code information.

3. The method according to claim 2, characterized in that, The interface description information includes at least one of the following: interface function description information, interface request method, interface initial request path information, authentication method, and interface content type.

4. The method according to claim 1, characterized in that, The step of obtaining the target code file generated based on the initial interface document and inputting the target code file into the second document generation model includes: In response to a trigger operation on the documentation development interface, the target code file generated based on the initial interface documentation is obtained from the documentation development interface; The target code file is input into the second document generation model.

5. The method according to claim 1, characterized in that, The step of inputting the target code file into the second document generation model includes: The target code file is stored in a code database, and the target code file is read from the code database and input into the second document generation model; wherein, the code database is used to query the target code file.

6. The method according to any one of claims 1-4, characterized in that, After obtaining the target code file generated based on the initial interface document, inputting the target code file into the second document generation model, and generating the target interface document, the process further includes: Execute using the model generated from the second document: A consistency comparison is performed between the target interface document and the initial interface document; and In response to the comparison result indicating that the consistency requirement is not met, the target code file is updated to obtain an updated code file, and a new target interface document is generated based on the updated code file by the second document generation model.

7. The method according to claim 6, characterized in that, The process of updating the target code file to obtain the updated code file includes: Based on the comparison results, at least one target interface element corresponding to the interface specification difference value and the difference type of the target interface element are determined; wherein, the target interface element includes at least one of target interface description information, target interface parameter information, or target error code information; Based on the difference type of the target interface element, update the code corresponding to the target interface element in the target code file.

8. The method according to claim 7, characterized in that, The code update includes at least one of the following: adding code, deleting code, modifying code, or changing the code structure.

9. The method according to claim 1, characterized in that, The first document generation model is obtained after training on a training dataset; wherein, the training dataset includes historical natural language requirement documents, historical initial interface documents corresponding to the historical natural language requirement documents, historical target code files, and historical target interface documents corresponding to the historical target code files; and / or The second document generation model is obtained after training on a training dataset; wherein, the training dataset includes historical natural language requirement documents, historical initial interface documents corresponding to the historical natural language requirement documents, historical target code files, and historical target interface documents corresponding to the historical target code files.

10. An electronic device, characterized in that, include: A processor and a memory, wherein the memory stores a computer program that, when executed by the processor, performs the method of any one of claims 1-9.