CN117130589A - Code processing method, apparatus, all-in-one machine and computer program product - Google Patents

Code processing method, apparatus, all-in-one machine and computer program product Download PDF

Info

Publication number
CN117130589A
CN117130589A CN202311031434.3A CN202311031434A CN117130589A CN 117130589 A CN117130589 A CN 117130589A CN 202311031434 A CN202311031434 A CN 202311031434A CN 117130589 A CN117130589 A CN 117130589A
Authority
CN
China
Prior art keywords
code
statement
model
requirement description
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311031434.3A
Other languages
Chinese (zh)
Inventor
张明
朱大治
胡凡
汪雄飞
刘聪
胡国平
刘庆峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
iFlytek Co Ltd
Original Assignee
iFlytek Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by iFlytek Co Ltd filed Critical iFlytek Co Ltd
Priority to CN202311031434.3A priority Critical patent/CN117130589A/en
Publication of CN117130589A publication Critical patent/CN117130589A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/10Requirements analysis; Specification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Library & Information Science (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a code processing method, a device, an integrated machine and a computer program product, wherein the method comprises the following steps: acquiring a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes; the method comprises the steps of obtaining and displaying functional codes corresponding to the requirement description sentences, wherein the functional codes are obtained by inputting generated prompt sentences into a code model, the generated prompt sentences are obtained based on the requirement description sentences, the rapid and accurate code obtaining is realized, the defects of high code writing difficulty, low efficiency, long period, large development workload and low development efficiency in the traditional scheme are overcome, the automatic generation of the functional codes is realized by means of the code capacity of the code model, the code writing efficiency is greatly improved, the difficulty and development workload of development tasks are reduced, immersive code generation experience is given to developers, input errors and redundancy are reduced, the development period is shortened, and the rapid and efficient functional development is realized.

Description

Code processing method, apparatus, all-in-one machine and computer program product
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a code processing method, a code processing apparatus, an integrated machine, and a computer program product.
Background
At present, development of new functions mostly needs to consume long time and high cost, wherein the processes of design, writing, operation and maintenance test and the like need to be carried out, and in the code writing process, if a developer writes and inputs the codes manually, a great deal of time and effort need to be consumed, so that the developer tends to more trend to start with the existing code library and function codes when writing the codes, search the needed code fragments through a network, compile, test, modify and the like, so that the codes can adapt to the context, and realize the corresponding functions.
However, this way of post-search modification is a lengthy process, which is only slightly inferior to the former, compared to a completely manual writing of input, although it can reduce the workload to some extent, lighten the development pressure, shorten the development cycle, but the testing, modification, etc. process also takes a long time, and the modification and debugging for the existing code is made to adapt to the current function. Under the condition, how to realize rapid and efficient function development, improve the code writing efficiency of a developer, reduce the development workload, shorten the development period and give the developer immersive experience becomes a current problem to be solved urgently.
Disclosure of Invention
The invention provides a code processing method, a device, an integrated machine and a computer program product, which are used for solving the defects of high code writing difficulty, low efficiency, long development period and large task amount in function development in the prior art, improving the code coding efficiency and realizing rapid and efficient function development.
The invention provides a code processing method, which comprises the following steps:
acquiring a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes;
and acquiring and displaying a functional code corresponding to the requirement description statement, wherein the functional code is obtained by inputting a generated prompt statement into a code model, and the generated prompt statement is obtained based on the requirement description statement.
According to the code processing method provided by the invention, the function code corresponding to the requirement description statement is obtained, and the method comprises the following steps:
transmitting the requirement description statement to a server, so that the server determines the generated prompt statement based on the requirement description statement and inputs the generated prompt statement into the code model;
and receiving the function code returned by the server.
According to the code processing method provided by the invention, the step of sending the requirement description statement to a server so that the server can determine the generated prompt statement based on the requirement description statement and input the generated prompt statement into the code model comprises the following steps:
Determining the area where the requirement description statement is displayed in an interface;
and under the condition that the region is a code editing region and a code to be complemented exists below the requirement description statement, sending the requirement description statement and the code to be complemented to a server, enabling the server to determine the generation prompt statement based on the requirement description statement and the code to be complemented, and inputting the generation prompt statement into the code model.
According to the code processing method provided by the invention, the acquisition requirement description statement comprises the following steps:
acquiring a function analysis statement, wherein the function analysis statement is used for inquiring a function required by a requirement realization;
at least one requirement description statement corresponding to the functional analysis statement is acquired, wherein the requirement description statement is obtained by inputting an analysis extraction statement into a code model, and the analysis extraction statement is obtained based on the functional analysis statement.
The code processing method provided by the invention further comprises the following steps:
acquiring a code to be modified and a modification requirement statement, wherein the code to be modified is part or all of codes displayed in an interface, and the modification requirement statement is used for representing modification requirements of functions of the code to be modified;
And acquiring and displaying the modification codes corresponding to the code to be modified and the modification requirement statement, wherein the modification codes are obtained by inputting modification prompt statements into a code model, and the modification prompt statements are obtained based on the code to be modified and the modification requirement statement.
The code processing method provided by the invention further comprises the following steps:
acquiring a code to be interpreted and/or a code to be corrected, wherein the code to be interpreted and/or the code to be corrected are part or all of codes displayed in an interface;
acquiring a code interpretation text corresponding to the code to be interpreted, wherein the code interpretation text is obtained by inputting an analysis interpretation statement into a code model, the analysis interpretation statement is obtained based on the code to be interpreted, and the code interpretation text comprises at least one of function definition, parameter interpretation and code action; and/or the number of the groups of groups,
and acquiring code error correction information corresponding to the code to be corrected, wherein the code error correction information is obtained by inputting an analysis error correction statement into a code model, the analysis error correction statement is obtained based on the code to be corrected, and the code error correction information comprises at least one of error prompt, correction suggestion and correction code.
The code processing method provided by the invention further comprises the following steps:
determining a code to be tested, wherein the code to be tested is part or all of the code displayed in an interface;
and acquiring and displaying a code test result corresponding to the code to be tested, wherein the code test result is obtained by running a test case by the code model, the test case is obtained by inputting a test prompt statement into the code model, and the test prompt statement is obtained based on the code to be tested.
The invention also provides a code processing device, which comprises:
a statement acquisition unit configured to acquire a requirement description statement for describing a function to be realized by a code;
and the code acquisition unit is used for acquiring and displaying the functional codes corresponding to the requirement description sentences, wherein the functional codes are obtained by inputting the generated prompt sentences into a code model, and the generated prompt sentences are obtained based on the requirement description sentences.
The invention also provides a code processing integrated machine, which comprises a memory, a processor, a code model stored on the memory and a computer program stored on the memory and capable of running on the processor;
The processor, when executing the computer program, invokes the code model to implement a code processing method as described in any one of the preceding claims.
The present invention also provides a computer program product comprising a computer program and/or a code model; alternatively, a non-transitory computer readable storage medium having stored thereon a computer program and/or a code model; the computer program, when executed by a processor, implements a code processing method as described in any of the above.
The code processing method, the device, the integrated machine and the computer program product provided by the invention acquire the requirement description statement describing the function to be realized by the code, and generate the code based on the code capability of the code model, so that the function code corresponding to the requirement description statement generated by the code model is acquired, the quick and accurate code acquisition is realized, the defects of high code writing difficulty, low efficiency, long period, large development workload and low development efficiency in the traditional scheme are overcome, the automatic generation of the function code is realized by means of the code capability of the code model, the code writing efficiency is greatly improved, the difficulty and development workload of development tasks are reduced, the immersive code generation experience is given to developers, the input errors and redundancy are reduced, the development period is shortened, and the quick and efficient function development is realized.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a code processing method provided by the invention;
FIG. 2 is a schematic diagram of a framework of an interaction process provided by the present invention;
FIG. 3 is a schematic diagram of an interface in a terminal provided by the present invention;
FIG. 4 is a schematic diagram of an immersive interaction process provided by the present invention;
FIG. 5 is a schematic illustration of a question-and-answer interaction process provided by the present invention;
FIG. 6 is a schematic diagram of a code processing apparatus according to the present invention;
fig. 7 is a schematic structural diagram of a code processing integrated machine provided by the invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
At present, code writing in new function development depends on manual input of a developer or code searching, debugging, modification and the like based on existing code fragments on a network, which all need to consume a great deal of time and energy, so that the problems of great development difficulty, long period and low efficiency exist in the new function development at present.
In this regard, the invention provides a code processing method, which aims to generate codes based on the code capacity of a code model, and realize the acquisition of corresponding codes based on description sentences of corresponding functions, thereby realizing the corresponding functions, effectively improving the code acquisition efficiency during function development, avoiding the problems of great difficulty, long period and low efficiency when the codes are manually written or are modified after searching to realize new functions at present, realizing rapid and efficient function development, shortening the development period, reducing the development workload and greatly improving the development efficiency.
Fig. 1 is a schematic flow chart of a code processing method provided by the present invention, as shown in fig. 1, an execution body of the method is a terminal, where the terminal may be a mobile phone, a tablet computer, or other devices with input, display and code editing functions, and embodiments of the present invention are not limited in this regard. The method comprises the following steps:
Step 110, obtaining a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes;
specifically, when code function development is performed to acquire a code required for function implementation, the terminal first needs to acquire a description statement corresponding to the function, that is, a requirement description statement, which is a text description for the function implementation that describes the function to be implemented by the code, so that a subsequent code model can perform code generation according to the description, thereby acquiring the corresponding code.
It should be noted that, when the code model generates the code, the code model is not limited to the development of the new function yet, but may be the improvement requirement of the existing function, that is, the requirement description statement may describe the function to be implemented by the code after the improvement of the existing function, for example, the improvement is implemented more accurately on the basis of the existing target detection code a, or the new function to be implemented by the code, for example, the pinch gesture detection in the over-the-air handwriting function, which is not particularly limited in the embodiment of the present invention.
In view of the fact that a relatively complete complex function cannot be realized through a single functional code, a code model learns a large number of sample codes and language specifications during training, and in order to facilitate model learning and understanding, a code segment of a simple function is usually taken as an input for the code model to learn, so that when code processing is performed through the code model, a code segment which is output by the code model and is also usually aimed at a specific function, for example, a camera is turned on to obtain a video stream, hand key point detection, and the like, instead of an overall code aimed at the whole complex function, in this embodiment of the present invention, in order to realize the complex function, and obtain codes corresponding to each function required for realizing the complex function, a requirement description statement corresponding to each function needs to be determined, so that a subsequent model can output codes corresponding to each function accordingly.
It will be understood that, in the practical application process, a new function to be developed or a function formed by the required improvement is often complex and cannot be implemented by a code corresponding to a single function output by a code model, so that in the process of acquiring the requirement description statement, a plurality of requirement description statements acquired by a terminal often correspond to each function required by the complex function implementation, and each function can be represented by a step form, that is, the implementation of the complex function can be split into a plurality of steps (requirement description statements) to describe each function to be implemented by the code.
Here, the requirement analysis statement may be predetermined by the user and directly input, and the terminal may obtain, in response to the user input, each requirement description statement when the user needs to develop/implement the complex function; or may be determined by means of analysis of the code model, i.e. the user may input in the terminal a rough description/analysis statement of the complex function to be implemented, so that the code model can analyze accordingly and correspondingly output the respective requirement description statement implementing the complex function.
The following exemplifies the requirement description statement taking a specific function as an example:
For example, when the complex function to be implemented is "finger kneading track point tracking function of over-the-air handwriting", the implementation process can be split, and the implementation thought is embodied in a step mode, and at this time, the corresponding requirement description statement can be expressed as: 1. obtaining and displaying a video stream; 2. detecting key points of the hands; 3. pinch gesture detection.
For another example, for the complex function "recognition detection of human behavior actions", the corresponding requirement description statement may be expressed as: 1. obtaining and displaying a video stream; 2. target detection and identification; 3. estimating the human body posture; 4. and (5) identifying human behaviors.
According to the embodiment of the invention, through the step-type realization thought displayed by the demand analysis statement, the codes corresponding to all steps can be rapidly output by the subsequent code model when the codes are generated, and the codes output by the model can be gradually learned and verified by the developer corresponding to the terminal, so that the code generation efficiency of the model is ensured, the developer can learn and modify the test conveniently, better experience is provided for the developer, and the development process is more efficient.
Step 120, obtaining and displaying a function code corresponding to the requirement description statement, wherein the function code is obtained by inputting a generated prompt statement into a code model, and the generated prompt statement is obtained based on the requirement description statement.
Specifically, after the requirement description statement is obtained in step 110, step 120 may be executed, where the function code corresponding to the requirement description statement is obtained and displayed, and this process may specifically include:
after the terminal acquires the requirement description statement, the corresponding function code can be acquired according to the requirement description statement and displayed, so that a developer on the terminal side can acquire the function code, the function code corresponding to the requirement description statement is generated through a code model, namely after the requirement description statement is acquired, the code generation can be performed by applying the requirement description statement based on the code model, and the corresponding function code is acquired and displayed.
When the code model is processed based on the requirement description statement, a large number of sample codes and language specifications are learned during the training of the code model, so that the code model has strict requirements on input information, and the code model needs to conform to language forms, specifications and the like which can be received and understood, so that the code model can understand and correspondingly output functional codes, and before the code model is input, the code model needs to be formed into a form which can be understood by the model, for example, language normalization, expansion writing, highlighting key points and the like can be performed on the code model to form prompt statements which can be understood by the code model, so that the code generation and output can be correspondingly performed by the prompt model, and the corresponding functional codes can be obtained.
Specifically, the requirement description statement may be processed first to generate a prompt statement for prompting the code model to generate a code, that is, generate the prompt statement, where the generated prompt statement is essentially a data carrying information contained in the requirement description statement, for example, may be a prompt, which is data that may be received and understood by the code model, and after the data is input into the code model, the code model may automatically perform code processing according to the input information, and output a function code corresponding to the code model, so as to obtain a function code corresponding to the requirement description statement.
For example, for the requirement description sentence "hand keypoint detection", the code model may output a code for detecting the keypoints of the hand region by using the video frame according to the corresponding generation prompt sentence, thereby implementing "hand keypoint detection".
For another example, for the requirement description statement "video stream acquisition", the code model may output a code for opening an external device (such as a video camera, a camera, etc.) to capture a real-time video stream according to the corresponding generation hint statement, thereby implementing "video stream acquisition".
In addition, it should be noted that, in the process of obtaining the function code corresponding to the requirement description statement generated by the code model, the user sometimes writes a small amount of code statement or code fragment in the code editing area of the terminal interface, at this time, the process of generating the code by the code model is not the process of generating the requirement description statement from zero to one, but the process of renewing the code based on the requirement description statement on the basis of the code statement or code fragment, the process may be to generate the generated prompt statement carrying the prompt message according to the requirement description statement and the code statement or code fragment, and input the generated prompt statement into the code model, so that the code model automatically renews the current code statement/code fragment according to the code statement/code fragment carried by the generated prompt statement, the required code language, the code format and the like, and outputs the complete code fragment, thereby obtaining the requirement description statement and the function code corresponding to the code statement/code fragment.
The code model may be deployed in a terminal (chat robot) with a humanoid feature, or a large language model (Large Language Model, LLM) deployed independent of the terminal, for example, a star fire cognition large model, which can be used for talking to a user by understanding and learning the language of the human, and can interact with the user according to the context of the talking, and has a real humanoid communication capability, and in addition to this, has other humanoid capabilities, for example, code capabilities (such as code writing, code complement, code interpretation, code error correction, code modification, code testing, etc.), analysis recognition capabilities (such as semantic understanding, text matching, emotion analysis, intention recognition, etc.), and the like.
Here, the interaction model may be built based on pre-training models such as LLM model, BERT (Bidirectional Encoder Representations from Transformers) model, XLnet (extremu Multi-label Learning Network) model, roBERTa (Robustly Optimized BERT approach) model, T5 (Text-to-Text Transfer Transformer) model, and the like. Here, the training manner for the code model may be obtained by performing fine-tuning training on the pre-training model based on the sample code and the corresponding sample description sentence, where the training objective is to minimize the difference between the model prediction result and the sample label, so that the prediction result and the sample label output by the model are as consistent as possible.
The supervised training process for the code model can take a sample description sentence as input and a sample code as output, or can take a sample code as input and a sample description sentence as output, and the model obtains the code capacity by learning the mapping relation between the input and the output, so that the code capacity can be directly applied in the application process to output the functional code corresponding to the requirement description text. Through the learning of a large number of sample codes and sample description sentences, the model has good code capacity, thereby being beneficial to code writing and function development.
According to the code processing method provided by the invention, the requirement description statement describing the function to be realized by the code is obtained, and the code generation is performed based on the code capability of the code model, so that the functional code corresponding to the requirement description statement generated by the code model is obtained, the quick and accurate code acquisition is realized, the defects of high code writing difficulty, low efficiency, long period, large development workload and low development efficiency in the traditional scheme are overcome, the automatic generation of the functional code is realized by means of the code capability of the code model, the code writing efficiency is greatly improved, the difficulty and development workload of development tasks are reduced, the immersive code generation experience is given to developers, the input errors and redundancy are reduced, the development period is shortened, and the quick and efficient functional development is realized.
Based on the above embodiment, step 120 includes:
transmitting the requirement description statement to a server so that the server can determine to generate a prompt statement based on the requirement description statement, and inputting the generated prompt statement into a code model;
and receiving the function codes returned by the server.
Specifically, in step 120, the process of obtaining the function code corresponding to the requirement description statement may specifically include the following steps:
after the terminal acquires the requirement description statement, if the code model is deployed outside the terminal, the code model is called by a server to generate codes, and the functional codes corresponding to the requirement description statement are acquired through interaction with the server.
Fig. 2 is a schematic diagram of an interaction process provided in the present invention, as shown in fig. 2, a terminal may first send a requirement description sentence to a server, and after receiving the requirement description sentence, the server may analyze the requirement description sentence to generate a generated prompt sentence carrying the requirement description sentence, that is, language normalization, expansion and writing, highlighting key points, format labeling, etc. may be performed on the requirement description sentence to form a prompt sentence that a model may receive and accept understanding, that is, generate the prompt sentence.
Here, the generation hint statement may be "code for generating [ detecting key points of a hand area in a video stream ], code language python ', ' code format a '," code for generating [ opening a camera to acquire a real-time video stream and display ], code language Java ', ' code format B ', "where the content in [ ] is a key point, a specific requirement in '"; other forms with prompting function and capable of being received and understood by the model are also possible, and the embodiment of the invention is not limited in particular.
The server can input the generated prompt sentence into the code model to acquire the function code output by the code model, wherein the code model can automatically generate the code according to the requirement description sentence carried by the input generated prompt sentence, the required code language, the required code format and the like, and output the content corresponding to the generated prompt sentence. And then, the output content can be returned to the server, so that the terminal can acquire the function code corresponding to the requirement description statement returned by the server.
It should be noted that, because the format, form, language expression habit and the like of the content generated and output by the code model are often different from those understood and accepted by the person, the content output by the code model cannot be returned to the terminal directly through the server, but needs to be analyzed and checked at the server to be analyzed to be consistent with the language habit of the person, and then returned to the terminal by the server to enable the terminal to receive the functional code.
Based on this, in the embodiment of the present invention, after the code model returns the output content to the server, the server may parse the output content, and perform user verification, format verification, and the like, so as to obtain the function code. Further, in the case that the verification is passed, the server may return the function code obtained by the analysis to the terminal, and at this time, the terminal may receive the function code returned by the server, that is, the function code corresponding to the requirement description statement is obtained.
Based on the above embodiment, sending the demand description sentence to the server to cause the server to determine a generated hint sentence based on the demand description sentence, and inputting the generated hint sentence to the code model, includes:
determining a region in which the requirement description statement is displayed in the interface;
and under the condition that the region is a code editing region and the to-be-complemented code exists below the requirement description statement, the requirement description statement and the to-be-complemented code are sent to the server, so that the server determines to generate a prompt statement based on the requirement description statement and the to-be-complemented code, and the generated prompt statement is input to the code model.
Specifically, the process of the terminal sending the requirement description statement to the server, so that the server determines to generate the prompt statement based on the requirement description statement, and inputting the generated prompt statement to the code model may specifically include:
In the code writing process in the function development time, a user sometimes writes a small number of code sentences or code fragments in a code editing area of a terminal interface, and if code generation is required through a code model, the process of generating the code according to the code model can be understood as writing complement of the written code so as to obtain a complete function code corresponding to the requirement description sentence.
Specifically, fig. 3 is a schematic diagram of an interface in a terminal provided by the present invention, where, as shown in fig. 3, the interface includes a question and answer area and a code editing area, where, the code editing area provides a code editing function, which can give a developer/user an immersive code writing experience, and fig. 4 is a schematic diagram of an immersive interaction process provided by the present invention, as shown in fig. 4, a user can edit a code in the area, and can also input a natural language comment (such as "display command prompt", "acquire a user command", "execute command", etc.) in the area, and a code (such as print ("please input command:"), "command=input (") "", "command=input (") and "if command in commands:commands ] ()") generated by the code model can be acquired through a trigger key and displayed in the area.
The question-answering area provides an interactive question-answering function, which can give a developer/user a question-answering experience, and the user can perform interactive question-answering in the area, so that the user inputs questions, for example, "i want to develop an application function similar to the tracking of finger pinch track points by handwriting in the air," please provide an implementation idea, "and can obtain output answers corresponding to the questions, for example," good, want to develop such functions, the following are possible implementation ideas: 1. XXXXXXX; 2. XXXXXXX; 3. the method comprises the steps of XXXXXXX 'and for realizing the functions, a code model can output a package which needs to be imported, and is provided with cv2 and mediapipe, numpy', a corresponding command can be generated and displayed in a code editing area of 'import cv2 import mediapipe as mp import numpy as np', the code model provides the functions of understanding, analyzing and outputting in the process, and a terminal can acquire answers of the code model according to the input questions of a user and display the answers, so that question-answer interaction is realized.
It should be noted that, in addition to the function analysis and step answer, the question-answer area may also perform question-answer interactions such as code interpretation, code correction, and code test, and fig. 5 is a schematic diagram of the question-answer interaction procedure provided by the present invention, and as shown in fig. 5, when the code is interpreted, the user may input "interpret XXXX", and the question-answer area may display a code interpretation text corresponding to "xxxxxx" generated by the code model, where the text may include function definitions, parameter definitions, code actions, and the like in the code segment; when the code is corrected, the user can input 'correcting XXXX', and code correction information corresponding to 'XXXX' generated by the code model is displayed in the question-answer area, wherein the code correction information comprises at least one of error prompt, correction suggestion and correction code.
Besides the mode of inputting codes and corresponding requirements by the user, the question-answering area also provides a selective input mode, namely, the user can select the functions of code interpretation, code error correction and code test, and directly input corresponding codes or sentences in an input box of the question-answering area according to the requirements, or select the corresponding codes in a code editing area on the other side so as to acquire text information or codes output by a code model. For example, code interpretation text output by a code model (AICODE) may be obtained by selecting a code interpretation and inputting "defadd_todo ()" (e.g., the code is an implementation of a simple to-do add function, which defines a function named add_todo for adding a new to-do to a to-do list).
Based on this, after the terminal acquires the requirement description sentence, it is first necessary to determine whether the display area of the interface of the requirement description sentence in the terminal is a question-answer area where question-answer interaction is performed or a code editing area where a code editing function is provided. Further, if the display area of the requirement description statement is the code editing area, whether the requirement description statement is incomplete or not can be further judged, and the code statement/code fragment waiting for the completion of the writing can be subjected to the completion of the writing, if yes, the code can be directly generated according to the requirement description statement, and if not, the required function code corresponding to the requirement description statement can be obtained.
Namely, in the case that the region displayed in the interface of the requirement description sentence is a code editing region, and in the case that the to-be-complemented code of the requirement description sentence is an incomplete to-be-complemented code sentence or code fragment, the requirement description sentence and the to-be-complemented code can be subjected to code renewal and complementation according to the to-be-complemented code, specifically, the requirement description sentence and the to-be-complemented code can be sent to the server so as to request the server to analyze the requirement description sentence and the to-be-complemented code to obtain a generated prompt sentence according to the requirement description sentence and the to-be-complemented code, the generated prompt sentence carries content information of the requirement description sentence and the to-be-complemented code in the generated prompt sentence, and then the generated prompt sentence can be input into the code model so that the code model can automatically carry out continuous writing and complementation on the current code to be-complemented according to the information carried by the generated prompt sentence, the required code language, the required code format and the like, and the corresponding functional code is obtained.
Based on the above embodiment, step 110 includes:
acquiring a function analysis statement, wherein the function analysis statement is used for inquiring a function required by the realization of the requirement;
At least one requirement description statement corresponding to the functional analysis statement is acquired, wherein the requirement description statement is obtained by inputting an analysis extraction statement into a code model, and the analysis extraction statement is obtained based on the functional analysis statement.
Specifically, in step 110, the process of obtaining the requirement description statement may specifically include:
because the developer/user often has difficulty in accurately distinguishing/distinguishing several steps required for realizing the function corresponding to the code writing level when developing a new function or improving an existing function, or corresponding to the code modifying level/code rewriting level when improving an existing function, in order to ensure the accuracy of step division in the implementation thought of the function and the consistency of interfacing with a subsequent code model, in the embodiment of the invention, the code model can be used for analyzing to obtain a requirement description statement for realizing the corresponding function.
It will be appreciated that in the process of function development, the developer/user first determines the specific function to be developed and provides a rough description/analysis statement of this specific function, so that the subsequent code model performs analysis and extraction, and outputs the corresponding implementation idea, and the specific steps of division. I.e. the terminal first needs to determine the description statement of the specific function to be implemented, i.e. the function analysis statement, which can be used to obtain the respective functions required to implement the corresponding requirements (specific functions) by means of a code model analysis query, and output in the form of steps, where each step corresponds to a requirement description statement, and display in the terminal internal interface.
For example, the user may input a function analysis sentence in the question-answer area, for "i want to develop an application function similar to the finger kneading track point tracking of the handwriting in the air, please provide an implementation idea", and may obtain an answer corresponding to the function analysis sentence output by the code model, "good, want to develop such a function, the following are possible implementation ideas: 1. XXXXXXX; 2. XXXXXXX; 3. XXXXXXX. Also, for implementation of the "application function for finger pinch trajectory point tracking for over-the-air handwriting" function, the code model may also provide the package required to implement this function, and may generate the corresponding command to import the above-described required package, such as "package to be imported, with cv2, mediapipe, numpy", command "import cv2 import mediapipe as mp import numpy as np".
Specifically, after the terminal obtains the function analysis statement, at least one requirement description statement corresponding to the function analysis statement output by the code model can be obtained in the question-answer area, where the terminal specifically may input the function analysis statement to the server to request the server to analyze the received function analysis statement and generate an analysis extraction statement, where the analysis extraction statement may be an implementation thought of "generate [ application function similar to finger kneading track point tracking of over-the-air handwriting ], the 'dividing step'", the server may input the analysis extraction statement to the code model to enable the code model to accordingly analyze the extraction statement, extract an implementation thought of a function implementing the function described by the function analysis statement, output a specific step (requirement description statement) implementing the function and return to the server, the server may return the specific step output by the code model to the terminal after analysis verification, and the terminal may obtain and display the requirement description statement corresponding to the function analysis statement.
Based on the above embodiment, the method further includes:
acquiring a code to be modified and a modification requirement statement, wherein the code to be modified is part or all of codes displayed in an interface, and the modification requirement statement is used for representing modification requirements of functions of the code to be modified;
and acquiring and displaying the modification codes corresponding to the codes to be modified and the modification requirement sentences, wherein the modification codes are obtained by inputting modification prompt sentences into a code model, and the modification prompt sentences are obtained based on the codes to be modified and the modification requirement sentences.
Specifically, in addition to the above-mentioned functions of code generation, code completion, etc., the code model has a function of code modification, and the code modification process may specifically include:
the terminal firstly needs to determine the code to be modified, namely the code to be modified, and the specific modification requirement, namely the modification requirement statement; the code to be modified may be a part of the code or all of the code displayed in the interface of the terminal, in short, the code to be modified may be part or all of the code displayed in the interface, and the modification requirement statement is a modification requirement for characterizing a function realized by the code to be modified, for example, the color of the track in track drawing realized by the code to be modified may be changed into blue, and the track is connected.
After the code to be modified and the modification requirement statement are obtained, the modification code corresponding to the code to be modified and the modification requirement statement generated through the code model can be obtained and displayed, specifically, the terminal inputs the code to be modified and the modification requirement statement to the server, so that the server can be requested to analyze and generate a modification prompt statement according to the code to be modified and the modification requirement statement after receiving the code to be modified and the modification requirement statement, the modification prompt statement is a statement with prompting function capable of prompting the code model to modify the code to be modified, wherein the content information carrying the code to be modified and the modification description statement can be "modification [ XXXXX (code to be modified) ]", "track color is blue", "track connection", "code language python", "code format A", "track drawing track color is blue", and "track is connected according to the track in the track drawing implemented by the code to be modified [ XXXXXXX (code to code) ]", "code language XXthon", "code format A".
And then, inputting the modification prompt statement into the code model, so that the code model automatically modifies the code to be modified according to the code to be modified and the modification requirement statement carried by the modification prompt statement, the required code language, the required code format and the like, outputting the modified code, namely the modified code, and returning the modified code to the server, wherein the server can return the modified code output by the code model to the terminal after analysis and verification, and the terminal can acquire and display the modified code corresponding to the code to be modified and the modification requirement statement.
In addition, it is noted that after the modified code is obtained, the code before and after the modification can be compared in the interface of the terminal, so that a developer/user learns and understands, that is, the code model can also compare the code to be modified and the modified code, and highlight the modified place so as to view the modified place, and the modified trace can be displayed in the interface.
Based on the above embodiment, the method further includes:
acquiring a code to be interpreted and/or a code to be corrected, wherein the code to be interpreted and/or the code to be corrected are part or all of codes displayed in an interface;
acquiring a code interpretation text corresponding to the code to be interpreted, wherein the code interpretation text is obtained by inputting an analysis interpretation statement into a code model, the analysis interpretation statement is obtained based on the code to be interpreted, and the code interpretation text comprises at least one of function definition, parameter interpretation and code action;
and/or the number of the groups of groups,
the method comprises the steps of obtaining code error correction information corresponding to a code to be corrected, wherein the code error correction information is obtained by inputting an analysis error correction statement into a code model, the analysis error correction statement is obtained based on the code to be corrected, and the code error correction information comprises at least one of error prompt, correction suggestion and correction code.
Specifically, in addition to the above-mentioned functions of code generation, code completion, code modification, etc., the code model has a function of code interpretation and/or code error correction, and the code interpretation and/or code error correction process may specifically include:
the terminal can firstly acquire codes needing to be interpreted and/or corrected, namely codes to be interpreted and/or codes to be corrected; the code to be interpreted and/or the code to be corrected need to be the code displayed in the interface of the terminal, and may be a part of the code or all the codes, that is, the code to be interpreted and/or the code to be corrected may be a part or all the codes displayed in the interface.
Then, the terminal can obtain the code interpretation text output by the code model according to the code to be interpreted and/or obtain the code correction information output by the code model according to the code to be corrected, i.e. the terminal can obtain the code interpretation text corresponding to the code to be interpreted and/or the code correction information corresponding to the code to be corrected.
Specifically, after the code to be interpreted is acquired, the terminal firstly inputs the code to be interpreted to the server to request the server to analyze and generate an analysis interpretation statement according to the code to be interpreted after receiving the code to be interpreted, wherein the analysis interpretation statement carries the code to be interpreted or carries the code to be interpreted and content information required by code interpretation. Here, the code interpretation requirement is a specific requirement for the content of the code to be interpreted, for example, the code action of the code to be interpreted, the function, the parameter, and the like defined in the code to be interpreted may be required to be interpreted. The code interpretation requirements may be determined by the developer/user along with the code to be interpreted and transmitted to the server during the process of code interpretation, or may be preset and stored in the server, or may be fixed during the process of code interpretation by the code model.
The analysis interpretation statement may be "interpretation [ XX (code to be interpreted) ]," code language python, "" code format a '", or" interpretation [ XX (code to be interpreted) ], "code action," "function definition," "parameter meaning," "code language python," "code format a'", or any other form, which is not specifically limited in the embodiment of the present invention.
Then, the analysis interpretation statement can be input into the code model, so that the code model automatically interprets the code to be interpreted according to the code to be interpreted carried by the analysis interpretation statement or the carried code to be interpreted and the code interpretation requirement, the required code language, the code format and the like, and outputs interpretation information of the code to be modified, namely a code interpretation text, and returns the code interpretation text to the server, the server can return the code interpretation text output by the code model to the terminal after analysis and verification, and the terminal can acquire and display the code interpretation text corresponding to the code to be interpreted. The code interpretation text here may be at least one of a function definition (a function named H is defined in the code to be interpreted for use in.+ -.), a parameter interpretation (involving XXX variables) and a code role (the code to be interpreted is an implementation of a XXXX function).
And/or after the terminal acquires the code to be corrected, firstly inputting the code to be corrected into the server so as to request the server to analyze and generate an analysis error correction statement according to the received code to be corrected, wherein the analysis error correction statement carries the code to be corrected or carries the code to be corrected and the content information required by the code error correction. Here, the code error correction requirement is a specific requirement for the content returned by the error correction process of the code to be corrected, for example, it may be required to output a correction code of the code to be corrected, or may be required to return an error prompt, a correction suggestion, or the like, where the code error correction requirement may be determined by a developer/user along with the code to be corrected and sent to the server in the process of performing code error correction, or may be preset and stored in the server, or may be fixed when the code model performs code interpretation.
The analysis error correction statement may be "correction [ xxxx (code to be corrected) ]," correction code ', "code language python'," code format a '", or may be" correction [ xxxx (code to be corrected) ], "error hint'," correction suggestion ', "correction code'," code language python ', "code format a'", or may be any other form, which is not specifically limited in this embodiment of the present invention.
And then, inputting the analysis error correction statement into the code model, so that the code model automatically corrects the error of the code to be corrected according to the code to be corrected carried by the analysis error correction statement or the carried code to be corrected and the code error correction requirement, the required code language, the code format and the like, outputting error correction information of the code to be corrected, namely the code error correction information, and returning the code error correction information to the server, wherein the server can return the code error correction information output by the code model to the terminal after analysis and verification, and the terminal can acquire and display the code error correction information corresponding to the code to be corrected. The code correction information here may be any one or more of error prompt (question 1:. And question 2:. And so on), correction advice (checking XXXX, verifying that XXXX is valid), and correction code (optimized code is XXXX).
Based on the above embodiment, the method further includes:
determining a code to be tested, wherein the code to be tested is part or all of the code displayed in the interface;
and acquiring and displaying a code test result corresponding to the code to be tested, wherein the code test result is obtained by running a test case by a code model, the test case is obtained by inputting a test prompt statement into the code model, and the test prompt statement is obtained based on the code to be tested.
Specifically, in addition to the above-mentioned functions of code generation, code completion, code modification, code interpretation, code error correction, etc., the code model has a function of code test, and the code test process may specifically include:
the terminal can firstly acquire the code to be tested, namely the code to be tested; the code to be tested here needs to be a code displayed in the interface of the terminal, and may be a part of the code or all the codes, which is not particularly limited in the embodiment of the present invention. In short, the code to be tested may be part or all of the code displayed in the interface.
Then, the terminal can obtain and display a code test text output by the code model according to the code to be tested, wherein the code test result is obtained by running a test case by the code model, the test case is generated by the code model according to a test prompt statement, and the test prompt statement is determined according to the code to be tested.
Specifically, after the code to be tested is obtained, the terminal firstly inputs the code to be tested to the server so as to request the server to analyze and generate a test prompt statement after receiving the code to be tested, wherein the test prompt statement is a statement which has a prompt function and can prompt a code model to generate a test case corresponding to the code to be tested, and the test prompt statement carries content information of the code to be tested, and can be ' test [ XXXXX (code to be modified) ], ' code language python ', ' code format A '.
Then, the test prompt statement can be input into the code model, so that the code model automatically generates a test case for testing the code to be tested according to the code to be tested carried by the test prompt statement, the required code language, the code format and the like, operates the test case, outputs an operation result, namely the code test result, and returns the code test result to the server, the server can return the code test result output by the code model to the terminal after analysis and verification, and the terminal can acquire the code test result corresponding to the code to be tested and display the code test result.
The general flow of the code processing method provided by the invention comprises the following steps:
firstly, acquiring a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes;
and then, acquiring and displaying the functional codes corresponding to the requirement description sentences, wherein the functional codes are obtained by inputting the generated prompt sentences into a code model, and the generated prompt sentences are obtained based on the requirement description sentences.
Here, the acquiring the requirement description statement specifically includes: acquiring a function analysis statement, wherein the function analysis statement is used for inquiring a function required by the realization of the requirement; at least one requirement description statement corresponding to the functional analysis statement is acquired, wherein the requirement description statement is obtained by inputting an analysis extraction statement into a code model, and the analysis extraction statement is obtained based on the functional analysis statement.
Wherein, obtain the function code corresponding to the demand description statement, include: transmitting the requirement description statement to a server so that the server can determine to generate a prompt statement based on the requirement description statement, and inputting the generated prompt statement into a code model; and receiving the function codes returned by the server.
Further, sending the demand description statement to the server to cause the server to determine a generated hint statement based on the demand description statement and input the generated hint statement to the code model, comprising: determining a region in which the requirement description statement is displayed in the interface; and under the condition that the region is a code editing region and the to-be-complemented code exists below the requirement description statement, the requirement description statement and the to-be-complemented code are sent to the server, so that the server determines to generate a prompt statement based on the requirement description statement and the to-be-complemented code, and the generated prompt statement is input to the code model.
In addition, the code processing method provided by the embodiment of the invention further comprises the following steps:
acquiring a code to be modified and a modification requirement statement, wherein the code to be modified is part or all of codes displayed in an interface, and the modification requirement statement is used for representing modification requirements of functions of the code to be modified; and acquiring and displaying the modification codes corresponding to the codes to be modified and the modification requirement sentences, wherein the modification codes are obtained by inputting modification prompt sentences into a code model, and the modification prompt sentences are obtained based on the codes to be modified and the modification requirement sentences.
Acquiring a code to be interpreted and/or a code to be corrected, wherein the code to be interpreted and/or the code to be corrected are part or all of codes displayed in an interface; acquiring a code interpretation text corresponding to the code to be interpreted, wherein the code interpretation text is obtained by inputting an analysis interpretation statement into a code model, the analysis interpretation statement is obtained based on the code to be interpreted, and the code interpretation text comprises at least one of function definition, parameter interpretation and code action; and/or acquiring code error correction information corresponding to the code to be corrected, wherein the code error correction information is obtained by inputting an analysis error correction statement into a code model, the analysis error correction statement is obtained based on the code to be corrected, and the code error correction information comprises at least one of error prompt, correction suggestion and correction code.
Determining a code to be tested, wherein the code to be tested is part or all of the code displayed in the interface; and acquiring and displaying a code test result corresponding to the code to be tested, wherein the code test result is obtained by running a test case by a code model, the test case is obtained by inputting a test prompt statement into the code model, and the test prompt statement is obtained based on the code to be tested.
The method provided by the embodiment of the invention obtains the requirement description statement describing the function to be realized by the code, and generates the code based on the code capability of the code model, so that the functional code corresponding to the requirement description statement generated by the code model is obtained, the quick and accurate code acquisition is realized, the defects of high code writing difficulty, low efficiency, long period, large development workload and low development efficiency in the traditional scheme are overcome, the automatic generation of the functional code is realized by means of the code capability of the code model, the code writing efficiency is greatly improved, the difficulty and development workload of development tasks are reduced, the immersive code generation experience is given to developers, the input errors and redundancy are reduced, the development period is shortened, and the quick and efficient functional development is realized.
The code processing apparatus provided by the present invention will be described below, and the code processing apparatus described below and the code processing method described above may be referred to correspondingly to each other.
Fig. 6 is a schematic structural diagram of a code processing apparatus according to the present invention, as shown in fig. 6, the apparatus includes:
a sentence acquisition unit 610 for acquiring a requirement description sentence for describing a function to be implemented by a code;
and a code obtaining unit 620, configured to obtain and display a function code corresponding to the requirement description statement, where the function code is obtained by inputting a generated hint statement into a code model, and the generated hint statement is obtained based on the requirement description statement.
The code processing device provided by the invention acquires the requirement description statement describing the function to be realized by the code, and generates the code based on the code capability of the code model, so that the functional code corresponding to the requirement description statement generated by the code model is acquired, the quick and accurate code acquisition is realized, the defects of high code writing difficulty, low efficiency, long period, large development workload and low development efficiency in the traditional scheme are overcome, the automatic generation of the functional code is realized by means of the code capability of the code model, the code writing efficiency is greatly improved, the difficulty and development workload of development tasks are reduced, the immersive code generation experience is given to developers, the input errors and redundancy are reduced, the development period is shortened, and the quick and efficient functional development is realized.
Based on the above embodiment, the code acquisition unit 620 is configured to:
transmitting the requirement description statement to a server, so that the server determines the generated prompt statement based on the requirement description statement and inputs the generated prompt statement into the code model; and receiving the function code returned by the server.
Based on the above embodiment, the code acquisition unit 620 is configured to:
determining the area where the requirement description statement is displayed in an interface;
and under the condition that the region is a code editing region and a code to be complemented exists below the requirement description statement, sending the requirement description statement and the code to be complemented to a server, enabling the server to determine the generation prompt statement based on the requirement description statement and the code to be complemented, and inputting the generation prompt statement into the code model.
Based on the above embodiment, the sentence acquisition unit 610 is configured to:
acquiring a function analysis statement, wherein the function analysis statement is used for inquiring a function required by a requirement realization; at least one requirement description statement corresponding to the functional analysis statement is acquired, wherein the requirement description statement is obtained by inputting an analysis extraction statement into a code model, and the analysis extraction statement is obtained based on the functional analysis statement.
Based on the above embodiment, the apparatus further comprises a modifying unit for:
acquiring a code to be modified and a modification requirement statement, wherein the code to be modified is part or all of codes displayed in an interface, and the modification requirement statement is used for representing modification requirements of functions of the code to be modified;
and acquiring and displaying the modification codes corresponding to the code to be modified and the modification requirement statement, wherein the modification codes are obtained by inputting modification prompt statements into a code model, and the modification prompt statements are obtained based on the code to be modified and the modification requirement statement.
Based on the above embodiment, the apparatus further comprises an interpretation error correction unit for:
acquiring a code to be interpreted and/or a code to be corrected, wherein the code to be interpreted and/or the code to be corrected are part or all of codes displayed in an interface;
acquiring a code interpretation text corresponding to the code to be interpreted, wherein the code interpretation text is obtained by inputting an analysis interpretation statement into a code model, the analysis interpretation statement is obtained based on the code to be interpreted, and the code interpretation text comprises at least one of function definition, parameter interpretation and code action; and/or the number of the groups of groups,
And acquiring code error correction information corresponding to the code to be corrected, wherein the code error correction information is obtained by inputting an analysis error correction statement into a code model, the analysis error correction statement is obtained based on the code to be corrected, and the code error correction information comprises at least one of error prompt, correction suggestion and correction code.
Based on the above embodiment, the apparatus further comprises a test unit for:
determining a code to be tested, wherein the code to be tested is part or all of the code displayed in an interface; and acquiring and displaying a code test result corresponding to the code to be tested, wherein the code test result is obtained by running a test case by the code model, the test case is obtained by inputting a test prompt statement into the code model, and the test prompt statement is obtained based on the code to be tested.
Fig. 7 illustrates a physical schematic diagram of a code processing integrated machine, and as shown in fig. 7, the code processing integrated machine may include: processor 710, communication interface (Communications Interface) 720, memory 730, and communication bus 740, wherein processor 710, communication interface 720, memory 730 communicate with each other via communication bus 740, and memory 730 stores a code model and a computer program executable on processor 710. Processor 710 may call a code model and a computer program in memory 730 to perform a code processing method comprising: acquiring a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes; and acquiring and displaying a functional code corresponding to the requirement description statement, wherein the functional code is obtained by inputting a generated prompt statement into a code model, and the generated prompt statement is obtained based on the requirement description statement.
Here, the code processing all-in-one may be an all-in-one that privately deploys the code model. The code model and the computer program for calling the code model stored in the memory in the code processing integrated machine can be obtained by downloading and installing based on a computer program installation package or an update package acquired by a model provider, wherein the code model can be placed in the installation package or the update package in the form of a code file.
Further, the logic instructions in the memory 730 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program and/or a code model; or, a non-transitory computer readable storage medium, and a computer program and/or code model stored thereon; a computer program and/or code model may be stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, cause the computer to invoke the code model to perform a code processing method provided by the methods described above, the method comprising: acquiring a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes; and acquiring and displaying a functional code corresponding to the requirement description statement, wherein the functional code is obtained by inputting a generated prompt statement into a code model, and the generated prompt statement is obtained based on the requirement description statement.
It will be appreciated that the user may download the computer program product for installation or update via the model provider, for example, the computer program product may be downloaded from a cloud server and installed, so that the code processing method may be executed at the local terminal to obtain the service provided by the code model.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the code processing method provided by the above methods, the method comprising: acquiring a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes; and acquiring and displaying a functional code corresponding to the requirement description statement, wherein the functional code is obtained by inputting a generated prompt statement into a code model, and the generated prompt statement is obtained based on the requirement description statement.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A code processing method, comprising:
acquiring a requirement description statement, wherein the requirement description statement is used for describing a function to be realized through codes;
and acquiring and displaying a functional code corresponding to the requirement description statement, wherein the functional code is obtained by inputting a generated prompt statement into a code model, and the generated prompt statement is obtained based on the requirement description statement.
2. The code processing method according to claim 1, wherein the acquiring the function code corresponding to the requirement description statement includes:
transmitting the requirement description statement to a server, so that the server determines the generated prompt statement based on the requirement description statement and inputs the generated prompt statement into the code model;
and receiving the function code returned by the server.
3. The code processing method according to claim 2, wherein the sending the demand description statement to a server to cause the server to determine the generation hint statement based on the demand description statement, and input the generation hint statement to the code model, includes:
determining the area where the requirement description statement is displayed in an interface;
And under the condition that the region is a code editing region and a code to be complemented exists below the requirement description statement, sending the requirement description statement and the code to be complemented to a server, enabling the server to determine the generation prompt statement based on the requirement description statement and the code to be complemented, and inputting the generation prompt statement into the code model.
4. A code processing method according to any one of claims 1 to 3, wherein the acquiring a requirement description sentence includes:
acquiring a function analysis statement, wherein the function analysis statement is used for inquiring a function required by a requirement realization;
at least one requirement description statement corresponding to the functional analysis statement is acquired, wherein the requirement description statement is obtained by inputting an analysis extraction statement into a code model, and the analysis extraction statement is obtained based on the functional analysis statement.
5. A code processing method according to any one of claims 1 to 3, further comprising:
acquiring a code to be modified and a modification requirement statement, wherein the code to be modified is part or all of codes displayed in an interface, and the modification requirement statement is used for representing modification requirements of functions of the code to be modified;
And acquiring and displaying the modification codes corresponding to the code to be modified and the modification requirement statement, wherein the modification codes are obtained by inputting modification prompt statements into a code model, and the modification prompt statements are obtained based on the code to be modified and the modification requirement statement.
6. A code processing method according to any one of claims 1 to 3, further comprising:
acquiring a code to be interpreted and/or a code to be corrected, wherein the code to be interpreted and/or the code to be corrected are part or all of codes displayed in an interface;
acquiring a code interpretation text corresponding to the code to be interpreted, wherein the code interpretation text is obtained by inputting an analysis interpretation statement into a code model, the analysis interpretation statement is obtained based on the code to be interpreted, and the code interpretation text comprises at least one of function definition, parameter interpretation and code action; and/or the number of the groups of groups,
and acquiring code error correction information corresponding to the code to be corrected, wherein the code error correction information is obtained by inputting an analysis error correction statement into a code model, the analysis error correction statement is obtained based on the code to be corrected, and the code error correction information comprises at least one of error prompt, correction suggestion and correction code.
7. A code processing method according to any one of claims 1 to 3, further comprising:
determining a code to be tested, wherein the code to be tested is part or all of the code displayed in an interface;
and acquiring and displaying a code test result corresponding to the code to be tested, wherein the code test result is obtained by running a test case by the code model, the test case is obtained by inputting a test prompt statement into the code model, and the test prompt statement is obtained based on the code to be tested.
8. A code processing apparatus, comprising:
a statement acquisition unit configured to acquire a requirement description statement for describing a function to be realized by a code;
and the code acquisition unit is used for acquiring and displaying the functional codes corresponding to the requirement description sentences, wherein the functional codes are obtained by inputting the generated prompt sentences into a code model, and the generated prompt sentences are obtained based on the requirement description sentences.
9. A code processing all-in-one machine, comprising a memory, a processor, a code model stored on the memory, and a computer program stored on the memory and executable on the processor;
The processor, when executing the computer program, invokes the code model to implement the code processing method of any of claims 1 to 7.
10. A computer program product comprising a computer program and/or a code model;
alternatively, a non-transitory computer readable storage medium having stored thereon a computer program and/or a code model;
the computer program, when executed by a processor, implements the code processing method of any of claims 1 to 7.
CN202311031434.3A 2023-08-14 2023-08-14 Code processing method, apparatus, all-in-one machine and computer program product Pending CN117130589A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311031434.3A CN117130589A (en) 2023-08-14 2023-08-14 Code processing method, apparatus, all-in-one machine and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311031434.3A CN117130589A (en) 2023-08-14 2023-08-14 Code processing method, apparatus, all-in-one machine and computer program product

Publications (1)

Publication Number Publication Date
CN117130589A true CN117130589A (en) 2023-11-28

Family

ID=88859255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311031434.3A Pending CN117130589A (en) 2023-08-14 2023-08-14 Code processing method, apparatus, all-in-one machine and computer program product

Country Status (1)

Country Link
CN (1) CN117130589A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117724695A (en) * 2024-02-18 2024-03-19 浙江同花顺智能科技有限公司 Code generation optimization method, device, equipment and medium for large language model

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117724695A (en) * 2024-02-18 2024-03-19 浙江同花顺智能科技有限公司 Code generation optimization method, device, equipment and medium for large language model
CN117724695B (en) * 2024-02-18 2024-04-30 浙江同花顺智能科技有限公司 Code generation optimization method, device, equipment and medium for large language model

Similar Documents

Publication Publication Date Title
US11537793B2 (en) System for providing intelligent part of speech processing of complex natural language
US10545733B2 (en) Code reusability
US11010284B1 (en) System for understanding navigational semantics via hypothesis generation and contextual analysis
US10977155B1 (en) System for providing autonomous discovery of field or navigation constraints
CN116737908A (en) Knowledge question-answering method, device, equipment and storage medium
CN117130589A (en) Code processing method, apparatus, all-in-one machine and computer program product
CN112084317A (en) Method and apparatus for pre-training a language model
CN115587598A (en) Multi-turn dialogue rewriting method, equipment and medium
CN111399629A (en) Operation guiding method of terminal equipment, terminal equipment and storage medium
CN112036146A (en) Comment generation method and device, terminal device and storage medium
CN109492749B (en) Method and device for realizing neural network model online service in local area network
CN112151034B (en) Voice control method and device of equipment, electronic equipment and storage medium
CN117130593A (en) Code processing method, system and electronic equipment
CN117520497A (en) Large model interaction processing method, system, terminal, equipment and medium
CN111158648A (en) Interactive help system development method based on live-action semantic understanding and platform thereof
CN116841519B (en) Code writing teaching evaluation method and system
CN116842143A (en) Dialog simulation method and device based on artificial intelligence, electronic equipment and medium
CN109636619A (en) Quantify returning for platform and surveys method, apparatus, electronic equipment and readable medium
CN111538810B (en) Data generation method, device, electronic equipment and storage medium
CN117149158A (en) Method and device for generating over-the-air handwriting code, all-in-one machine and storage medium
CN111881266A (en) Response method and device
CN111797636B (en) Offline semantic analysis method and system
CN117215962A (en) Code testing method, device, all-in-one machine and computer program product
CN110955433B (en) Automatic deployment script generation method and device
CN113850235B (en) Text processing method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination