Interaction method and device for assisting in constructing cue word, electronic equipment and storage medium

Through an interactive method that assists in the construction of prompt words, the code requirement document is split into subtask nodes using rich text editing boxes and tree nesting structures, and the prompt word information is recursively spliced, which solves the problem of prompt word uncertainty when generating code in the big model, and improves the accuracy of code generation.

CN119647429AActive Publication Date: 2025-03-18CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411658382.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-18
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

When generating code snippets using big models such as GPT-4o, the abstraction and strong contextual relevance of the code requires the document to be undefined or structured in the input and output in the prompt word, resulting in incomplete, unreasonable or syntax errors generated.

Method used

Provides an interactive method to assist in the construction of prompt words. By obtaining the initial description text of the code requirement document, setting it as the root node, and using a rich text editing box and a tree nested structure, detecting user operation instructions to split the initial description text into subtask nodes, determine the node location and input and output parameters, and recursively traverse the splicing prompt word information.

Benefits of technology

It effectively reduces the uncertainty of prompt words in the process of generating code of the big model, improves the accuracy of code generation, and assists in building clear definition prompt words by intuitively displaying the contextual relationship and parameter definitions between node task splits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119647429A_ABST
    Figure CN119647429A_ABST
Patent Text Reader

Abstract

The invention provides an interaction method and device for assisting in constructing cue words, electronic equipment and a storage medium. The method comprises the steps of obtaining an initial description text of a code demand document; setting the initial description text as a root node, wherein a content area of the root node is a rich text edit box comprising the initial description text; when detecting at least one operation instruction of frame-selecting a part of the initial description text in the rich text edit box by a user, splitting the frame-selected part of the initial description text into at least one first sub-task node; sequentially determining the position of each first subtask node according to a tree-shaped nested structure from top to bottom; determining a description text and input and output parameters of each first subtask node; after splitting is completed, the background color of the initial description text of the frame selection part is displayed as a set color; and performing cue word splicing on the root node and the partial initial description text and the input and output parameters of each first sub-task node in a recursive traversal mode to obtain final cue word information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an interactive method, device, electronic device and computer-readable storage medium for assisting in constructing prompt words. Background Art

[0002] In related technologies, prompt words usually include elements such as instructions, context, input data, and output instructions. In the process of generating code snippets using large models such as the fourth-generation version of the artificial intelligence model (GPT-4o, Generative Pretrained Transformer-four Omni), due to the characteristics of code requirement documents such as abstractness, strong relevance to context, and large task granularity, in the process of document task splitting, the input and output in the prompt words may not have clear definitions or structured thinking, resulting in incomplete, unreasonable, or grammatically incorrect answers.

[0003] Therefore, in the process of task splitting of code requirement documents, how to assist in building clear, intuitive and unambiguous definition prompts to improve the accuracy of code generation for large models is a problem that needs to be solved. Summary of the invention

[0004] The present invention provides an interactive method, device, electronic device and computer-readable storage medium for assisting in constructing prompt words, so as to at least solve the problem in the related art that the accuracy of code generation by a large model is reduced due to the lack of clear definition of prompt words in the process of document task splitting. The technical solution of the present invention is as follows:

[0005] According to a first aspect of an embodiment of the present invention, an interactive method for assisting in constructing prompt words is provided, the method being applied to a code requirement document splitting task scenario, comprising:

[0006] Get the initial description text of the code requirement document;

[0007] The initial description text is set as a root node, and the content area of ​​the root node is a rich text edit box including the initial description text;

[0008] When detecting at least one operation instruction of the user selecting a portion of the initial description text in the rich text edit box, splitting the selected portion of the initial description text into at least one first subtask node, wherein the selected portion of the initial description text is displayed as a function name corresponding to the first subtask node;

[0009] Determine the position of each first subtask node in turn according to the tree-shaped nested structure from top to bottom; and determine the description text and input and output parameters of each first subtask node;

[0010] After each first subtask node is split, the background color of the initial description text of the selected part is displayed as a set color, and a connection line is added between each first subtask node and the root node;

[0011] The root node and part of the initial description text and input and output parameters of each first subtask node are concatenated with prompt words by recursive traversal to obtain final prompt word information.

[0012] Optionally, before obtaining all prompt word information by recursively traversing the root node and part of the initial description text and input and output parameters of each first subtask node, the method further includes:

[0013] When detecting at least one operation instruction of the user selecting a portion of the description text of the first subtask node, splitting the selected portion of the description text into at least one second subtask node, wherein the selected portion of the description text is displayed as a function name corresponding to the second subtask node;

[0014] Determine the position of each second subtask node in turn according to the tree-shaped nested structure from top to bottom corresponding to the position of the first subtask node; and determine the description text and second input and output parameters of each second subtask node;

[0015] After each second subtask node is split, the background color of the selected portion of the description text is displayed as the set color, and a connection line is added between each second subtask node and the corresponding first subtask node;

[0016] The method of recursively traversing the root node and part of the initial description text of each first subtask node and the first input and output parameters is used to perform prompt word splicing to obtain final prompt word information, including:

[0017] The root node, part of the initial description text and input / output parameters of each first subtask node, and part of the description text and second input / output parameters of each second subtask node are concatenated with prompt words by recursive traversal to obtain all prompt word information.

[0018] Optionally, the method further includes:

[0019] Based on the rich text edit box of the root node, modifying the initial description text of the root node according to the operation instruction input by the user detected; and / or

[0020] Based on the form data of the first subtask node or the second subtask node, the first subtask node or the second subtask node is modified according to the operation instruction detected by the user, and the form data includes: a rich text edit box, a drop-down selection component and a configuration table component.

[0021] Optionally, the method further includes:

[0022] According to the operation instruction input by the user, the first subtask node or the second subtask node corresponding to the first subtask node or the second subtask node is deleted; and the subtask and the related connection with the first subtask node or the second subtask node are deleted; and

[0023] Clear the background color of the text selected in the rich text edit box of the parent node of the deleted first subtask node or the second subtask node.

[0024] Optionally, the method further includes:

[0025] The prompt word information is input into an artificial intelligence model, and a generated code is output, wherein the artificial intelligence model includes a GPT4o model.

[0026] Optionally, determining the position of each first subtask node in sequence according to the tree-shaped nested structure from top to bottom includes:

[0027] The upper left corner of each root node is used as the position of the parent node, and the width and height are set according to the actual node content width. The position of each first subtask node is offset to the right by a first fixed value relative to the parent node, and is offset downward by the parent node height plus a second fixed value, wherein the first fixed value and the second fixed value are adjusted arbitrarily as required;

[0028] The determining of the description text and the first input-output parameter of each first subtask node includes: defining the description text and the first input-output parameter of each first subtask node according to the operation instruction input by the user.

[0029] Optionally, determining the position of each second subtask node in turn according to the tree-shaped nested structure from top to bottom according to the position of the corresponding first subtask node includes:

[0030] The upper left corner of each first subtask node is used as the position of the parent node, the width and height are set according to the actual node content width, and the position of each first subtask node is offset to the right by a third fixed value relative to the parent node, and is offset downward by the parent node height plus a fourth fixed value;

[0031] The determining of the description text and the second input-output parameter of each second subtask node includes: defining the description text and the second input-output parameter of each second subtask node according to the operation instruction input by the user.

[0032] According to a second aspect of an embodiment of the present invention, an interactive device for assisting in constructing prompt words is provided, and the device is applied to a code requirement document splitting task scenario and includes:

[0033] The acquisition module is used to obtain the initial description text of the code requirement document;

[0034] A setting module, used to set the initial description text as a root node, wherein the content area of ​​the root node is a rich text editing box including the initial description text;

[0035] A first splitting module is used to detect at least one operation instruction of a user selecting a part of the initial description text in the rich text edit box, split the selected part of the initial description text into at least one first subtask node, wherein the selected part of the initial description text is displayed as a function name corresponding to the first subtask node;

[0036] A first determination module is used to determine the position of each first subtask node in turn according to a tree-shaped nested structure from top to bottom; and determine the description text and input and output parameters of each first subtask node;

[0037] A first display module, used for displaying the background color of the initial description text of the framed part as a set color after each first subtask node is split, and adding a connection line between each first subtask node and the root node;

[0038] The splicing module is used to splice the prompt words of the root node and part of the initial description text and input and output parameters of each first subtask node by recursive traversal to obtain final prompt word information.

[0039] Optionally, the device further comprises:

[0040] A second splitting module is used for, before the splicing module performs prompt word splicing, when detecting at least one operation instruction of a user selecting a part of the description text of the first subtask node, splitting the selected part of the description text into at least one second subtask node, wherein the selected part of the description text is displayed as a function name corresponding to the second subtask node;

[0041] A second determination module is used to determine the position of each second subtask node in turn according to the tree-shaped nested structure from top to bottom corresponding to the position of the first subtask node; and determine the description text and second input and output parameters of each second subtask node;

[0042] A second display module is used to display the background color of the selected part of the description text as the set color after each second subtask node is split, and to add a connection line between each second subtask node and the corresponding first subtask node;

[0043] The splicing module is also used to perform prompt word splicing on the root node, part of the initial description text and input-output parameters of each first subtask node, and part of the description text and the second input-output parameters of each second subtask node by recursive traversal to obtain final prompt word information.

[0044] Optionally, the device further comprises:

[0045] A first modification module is configured to modify the initial description text of the root node based on the rich text edit box of the root node according to an operation instruction input by a user; and / or

[0046] The second modification module is used to modify the first subtask node or the second subtask node based on the form data of the first subtask node or the second subtask node according to the operation instructions detected by the user input, and the form data includes: a rich text edit box, a drop-down selection component and a configuration table component.

[0047] Optionally, the device further comprises:

[0048] a deleting module, configured to delete the first subtask node or the second subtask node corresponding to the first subtask node or the second subtask node according to the operation instruction input by the user; and to delete the subtask and related connection with the first subtask node or the second subtask node; and

[0049] The clearing module is used to clear the background color of the text selected in the rich text edit box of the parent node of the first subtask node or the second subtask node deleted by the deleting module.

[0050] Optionally, the device further comprises:

[0051] A production module is used to input the prompt word information into an artificial intelligence model and output a generated code, wherein the artificial intelligence model includes a GPT4o model.

[0052] Optionally, the first determining module includes:

[0053] A first position determination module is used to use the upper left corner of each root node as the position of the parent node, and the width and height are set according to the actual node content width. The position of each first subtask node is offset to the right by a first fixed value relative to the parent node, and is offset downward by the height of the parent node plus a second fixed value, wherein the first fixed value and the second fixed value are arbitrarily adjusted as required;

[0054] The first parameter determination module is used to define the description text and the first input and output parameters of each first subtask node according to the operation instruction input by the user.

[0055] Optionally, the second determining module includes:

[0056] A second position determination module is used to use the upper left corner position of each first subtask node as the position of the parent node, and the width and height are set according to the actual node content width, and the position of each first subtask node is offset to the right by a third fixed value relative to the parent node, and is offset downward by the parent node height plus a fourth fixed value;

[0057] The second parameter determination module is used to define the description text and second input and output parameters of each second subtask node according to the operation instruction input by the user.

[0058] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:

[0059] processor;

[0060] a memory for storing instructions executable by the processor;

[0061] The processor is configured to execute the instructions to implement the interactive method for assisting in constructing prompt words as described above.

[0062] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the interactive method for assisting in constructing prompt words as described above.

[0063] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program or instructions, which, when executed by a processor of an electronic device, implements the interactive method for assisting in constructing prompt words as described above.

[0064] The technical solution provided by the embodiments of the present invention brings at least the following beneficial effects:

[0065] In an embodiment of the present invention, an initial description text of a code requirement document is obtained; the initial description text is set as a root node, and the content area of ​​the root node is a rich text edit box including the initial description text; when it is detected that a user selects at least one operation instruction of a part of the initial description text in the rich text edit box, the selected part of the initial description text is split into at least one first subtask node, wherein the selected part of the initial description text is displayed as the function name of the corresponding first subtask node; the position of each first subtask node is determined in turn according to a tree nested structure from top to bottom; and the description text and input and output parameters of each first subtask node are determined; after each first subtask node is split, the background color of the selected part of the initial description text is displayed as a set color, and a connection line is added between each first subtask node and the root node; the root node and the part of the initial description text and the input and output parameters of each first subtask node are spliced ​​with prompt words by recursive traversal to obtain the final prompt word information. That is to say, in the embodiment of the present invention, the user does not need to pay attention to the specific content of the prompt words, but only needs to focus on the splitting of large-grained tasks. By adopting the embodiment of the present invention, the contextual association relationship and parameter definition between the node task splitting can be intuitively displayed using the rich text edit box and the tree layout, which can better assist the construction of prompt words and effectively reduce the uncertainty of prompt words in the process of generating code for large models, thereby improving the accuracy of large model code generation.

[0066] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention, and do not constitute an improper limitation of the present invention. In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0068] Figure 1 It is a flow chart of an interactive method for assisting in constructing prompt words provided by an embodiment of the present invention.

[0069] Figure 2 It is a schematic diagram of splitting into two subtask nodes provided by an embodiment of the present invention.

[0070] Figure 3It is a schematic diagram of splitting into two subtask nodes and one sub-subtask node provided by an embodiment of the present invention.

[0071] Figure 4 It is a flow chart of an interactive method for assisting in constructing prompt words provided by an embodiment of the present invention.

[0072] Figure 5 It is a block diagram of an interactive device for assisting in constructing prompt words provided by an embodiment of the present invention.

[0073] Figure 6 It is another block diagram of an interactive device for assisting in constructing prompt words provided by an embodiment of the present invention.

[0074] Figure 7 This is another block diagram of an interactive device for assisting in constructing prompt words provided by an embodiment of the present invention.

[0075] Figure 8 It is a block diagram of an electronic device provided by an embodiment of the present invention.

[0076] Fig. 9 It is a block diagram of an interactive device for assisting in constructing prompt words provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0077] In order to enable ordinary persons in the art to better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.

[0078] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0079] In recent years, research on computer vision, deep learning, machine learning, image processing, image recognition and other technologies based on artificial intelligence has made important progress. Artificial Intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies and application systems for simulating and extending human intelligence. Artificial intelligence is a comprehensive discipline involving many types of technologies such as chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, neural networks, etc. Computer vision, as an important branch of artificial intelligence, specifically allows machines to recognize the world. Computer vision technology usually includes face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, target detection, pedestrian recognition, image processing, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, behavior recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, robot navigation and positioning and other technologies. With the research and advancement of artificial intelligence technology, this technology has been applied in many fields, such as security, urban management, traffic management, building management, park management, facial access, facial attendance, logistics management, warehouse management, robots, intelligent marketing, computational photography, mobile phone imaging, cloud services, smart homes, wearable devices, unmanned driving, automatic driving, smart medical care, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile Internet, live streaming, beauty, makeup, medical beauty, and smart temperature measurement.

[0080] Technical terms:

[0081] Prompt word: A prompt word is an instruction or information that guides or triggers the AI ​​system to respond. In the interaction with AI such as ChatGPT, every time we enter a piece of text, whether it is a question, command or statement, this piece of text is a prompt word.

[0082] GPT-4o is the latest generation of large-scale language model launched by OpenAI. It integrates all-round models of text, pictures, videos, and voice. It can respond to user needs in real time and provide real-time answers through voice.

[0083] vueflow is a flowchart editor based on Vue.js. It provides a series of components and APIs that allow users to easily create and edit flowcharts.

[0084] On the basis of understanding the above technical terms, please refer to the following embodiments.

[0085] Figure 1It is a flowchart of an interactive method for assisting in building prompt words provided by an embodiment of the present invention. The method is based on the vueflow framework and is used to implement the code requirement document splitting task scenario, such as Figure 1 As shown, the method comprises the following steps:

[0086] Step 101: Obtain an initial description text of a code requirement document.

[0087] Step 102: setting the initial description text as a root node, wherein the content area of ​​the root node is a rich text editing box including the initial description text.

[0088] Step 103: When at least one operation instruction of the user to select part of the initial description text in the rich text edit box is detected, the selected part of the initial description text is split into at least one first sub-task node, wherein the selected part of the initial description text is displayed as the function name corresponding to the first sub-task node.

[0089] Step 104: determining the position of each first subtask node in turn according to the tree-shaped nested structure from top to bottom; and determining the description text and input and output parameters of each first subtask node, each first subtask node being connected to the root node.

[0090] Step 105: After each first subtask node is split, the background color of the initial description text of the selected portion is displayed as a set color.

[0091] Step 106: Using a recursive traversal method, the root node and part of the initial description text and input and output parameters of each first subtask node are concatenated with prompt words to obtain all prompt word information.

[0092] The interactive method for assisting in constructing prompt words described in the present invention can be applied to terminals, servers, etc., without limitation herein. The terminal implementation device can be electronic devices such as smart phones, laptops, tablet computers, desktop computers, personal digital assistants (PDAs) and wearable devices. The server can be an independent server or a server cluster, or a server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, intermediate services, domain name services, security services, content distribution networks, or a big data and artificial intelligence platform, etc., without limitation herein.

[0093] Combine the following Figure 1 , the specific implementation steps of an interactive method for assisting in constructing prompt words provided by an embodiment of the present invention are described in detail.

[0094] In step 101, an initial description text of a code requirement document is obtained.

[0095] In this step, the code requirement document can be obtained locally or remotely, or the code requirement document input by the user can be obtained. Generally, the code requirement document is abstract, has a strong relevance to the context, and has a large task granularity. For example, a code document for calculating a mortgage interest rate function is generated.

[0096] In step 102, the initial description text is set as a root node, and the content area of ​​the root node is a rich text editing box including the initial description text.

[0097] In this embodiment, first, two node types are defined based on vueflow: prompt node (which can be understood as root node) and function node (which can be understood as child node or sub-child node, that is, the first child node or second child node mentioned below in this embodiment); prompt node is used to display the status of the initial requirement description text; function node is used to display the status of subtasks that need to be split; there are connections between prompt nodes and function nodes, and between function nodes and function nodes with parent-child relationship, which are used to represent the association relationship between nodes.

[0098] In this embodiment, the prompt node content area is displayed as a rich text edit box, which allows the user to select part of the text. Of course, different parts of the text can be selected multiple times as needed.

[0099] In step 103, when at least one operation instruction of the user to select part of the initial description text in the rich text edit box is detected, the selected part of the initial description text is split into at least one first sub-task node, wherein the selected part of the initial description text is displayed as the function name corresponding to the first sub-task node.

[0100] In this step, the user can select part of the text in the rich text edit box, and multiple selections can be performed for different parts of the text. When the user selects part of the text in the rich text edit box, that is, when an operation instruction of the user selecting part of the initial description text in the rich text edit box is detected, the selected part of the initial description text is split into a first subtask node, and the selected part of the initial description text is displayed as the function name of the corresponding first subtask node; afterwards, when the user can also select another part of the text in the rich text edit box, that is, when an operation instruction of the user selecting another part of the initial description text in the rich text edit box is detected, the selected part of the initial description text is split into another first subtask node, and the selected part of the initial description text is displayed as the function name of another first subtask node, and so on. According to the above method, it can be split into multiple first subtask nodes, and this embodiment will not be described one by one.

[0101] That is to say, in this step, the user can select part of the text in the rich text edit box of the prompt node. After selecting, right-click to add a subtask to the current prompt node. The subtask is represented as a function node, and the selected text is displayed as the function name of the function node.

[0102] A subtask, i.e., a function node, includes a function name, function description, parameter table configuration, etc. The parameter table configuration uses a form component to define the type and description of the input and output parameters of the function node; the function description area is presented as a rich text edit box, which allows users to select part of the text.

[0103] In step 104, the position of each first subtask node is determined in turn according to the tree-shaped nested structure from top to bottom; and the description text and input and output parameters of each first subtask node are determined.

[0104] In this step, the upper left corner of each root node is usually used as the position of the parent node, the width and height are set according to the actual node content width, and the position of each first subtask node is offset to the right by a first fixed value (such as 50px, etc., where px is a pixel value) relative to the parent node, and offset downward by the height of the parent node plus a second fixed value (such as 20px, etc.), wherein the first fixed value and the second fixed value can be adjusted arbitrarily as required, and this embodiment does not impose any restrictions.

[0105] That is to say, in the present embodiment, each time when splitting a node, the position of the subtask node obtained by splitting is calculated. Taking the upper left corner position of each node as the coordinate position of the node as an example, when initializing the system, it is assumed that the coordinate position of the root node (i.e., prompt node) is (0px, 0px), the width and height are determined according to the actual node content width, and the height and width of each node type are generally set to fixed values, and the width set in the example diagram is 1000px, and the height is 100px. In order to make each node display clear, the coordinate position of the subtask node is offset to the right by a first fixed value (such as 50px, etc.) relative to the parent node, and the parent node height is offset downward plus a second fixed value (such as 20px, etc.), wherein the offset can be freely adjusted.

[0106] Among them, determining the description text and input and output parameters of each first subtask node, each first subtask node is connected to the root node, including: defining the description text and first input and output parameters of each first subtask node according to the operation instruction input by the user.

[0107] In step 105, after each first subtask node is split, the background color of the initial description text of the framed portion is displayed as a set color, and a connection line is added between each first subtask node and the root node.

[0108] In this step, after the user creates the first subtask node (i.e., function node), the background color of the selected initial description text will be displayed as the set color (such as blue, or green, etc.), and a line will be added between the prompt node and the function node to indicate that the prompt node and the function node are in a parent-child relationship. Figure 2 As shown, Figure 2 A schematic diagram of splitting into two subtask nodes provided by an embodiment of the present invention. As shown in the figure, this embodiment takes splitting into subtask node A and subtask node B as an example, which is not limited to this in practical applications.

[0109] In step 106, the root node and part of the initial description text and input and output parameters of each first subtask node are concatenated with prompt words by recursive traversal to obtain all prompt word information.

[0110] In this step, after the user completes the above splitting operation, he can use a recursive traversal method to concatenate the description text information of each node (including the root node and the subtask node) and the information of the input and output parameters with prompt words to obtain all the prompt word information.

[0111] For example, in this embodiment, "taking the generation of a code for calculating a mortgage interest rate function" as an example for prompt word splicing, the prompt word template is preset as follows (the user does not need to pay attention to the preset text):

[0112] You are a professional engineer proficient in Java.

[0113] I'll give you the following method definition:

[0114] ##Method definition

[0115] You need to write the Java code according to the definition I gave.

[0116] According to the above steps of this embodiment, the splitting is performed and after recursive traversal, the final spliced ​​prompt word template is obtained as follows:

[0117] You are a professional engineer proficient in Java.

[0118] I'll give you the following method definition:

[0119] ##Method definition

[0120] -Realize the function of calculating the annual interest rate of mortgage loans:

[0121] Input parameter: loan_amount indicates the loan amount, type is double

[0122] Output: type double

[0123] -The function of calculating the annual interest rate of mortgage loans includes the following three methods:

[0124] -Method A is to obtain the base interest rate information:

[0125] Input parameters: None

[0126] Output: type double

[0127] -Method B is to adjust the base interest rate based on factors such as the loan amount and recommended loan term:

[0128] Input parameters: base_rate represents the base interest rate, type is double, loan_amount represents the loan amount, type is double

[0129] Output: type double

[0130] You need to write the Java code according to the definition I gave.

[0131] In an embodiment of the present invention, an initial description text of a code requirement document is obtained; the initial description text is set as a root node, and the content area of ​​the root node is a rich text edit box including the initial description text; when it is detected that a user selects at least one operation instruction of a part of the initial description text in the rich text edit box, the selected part of the initial description text is split into at least one first subtask node, wherein the selected part of the initial description text is displayed as the function name of the corresponding first subtask node; the position of each first subtask node is determined in turn according to a tree nested structure from top to bottom; and the description text and input and output parameters of each first subtask node are determined; after each first subtask node is split, the background color of the selected part of the initial description text is displayed as a set color, and a connection line is added between each first subtask node and the root node; the root node and the part of the initial description text and the input and output parameters of each first subtask node are spliced ​​with prompt words by recursive traversal to obtain the final prompt word information. That is to say, in the embodiment of the present invention, the user does not need to pay attention to the specific content of the prompt words, but only needs to focus on the splitting of large-grained tasks. By adopting the embodiment of the present invention, the contextual association relationship and parameter definition between the node task splitting can be intuitively displayed using the rich text edit box and the tree layout, which can better assist the construction of prompt words and effectively reduce the uncertainty of prompt words in the process of generating code for large models, thereby improving the accuracy of large model code generation.

[0132] Optionally, in another embodiment, based on the above embodiment, before the method uses the recursive traversal method to concatenate the root node and part of the initial description text and input and output parameters of each first subtask node with prompt words to obtain all prompt word information, the method may further include:

[0133] When it is detected that the user has made at least one operation instruction in selecting a portion of the description text of the first subtask node, the selected portion of the description text is split into at least one second subtask node, wherein the selected portion of the description text is displayed as the function name of the corresponding second subtask node; the position of each second subtask node is determined in sequence in a tree-like nested structure from top to bottom according to the position of the corresponding first subtask node; and the description text and second input-output parameters of each second subtask node are determined; after each second subtask node is split, the background color of the selected portion of the description text is displayed as the set color, and a connection line is added between each second subtask node and the corresponding first subtask node; the root node, the portion of the initial description text and the input-output parameters of each first subtask node, and the portion of the description text and the second input-output parameters of each second subtask node are concatenated with prompt words by recursive traversal to obtain final prompt word information.

[0134] In this embodiment, the splitting process is similar to that in the above embodiment, except that the task splitting is performed based on each first subtask node.

[0135] That is to say, after splitting to obtain a first subtask node (i.e., function node), the first subtask node includes: function name, function description, parameter table configuration and other forms, wherein the parameter table configuration uses form components to define the types and descriptions of the input parameters and output parameters of the function node; the function description area is presented as a rich text edit box, which allows the user to select part of the text, and then, after the user selects the text, right-clicking will add a subtask (the second subtask) to the current function node, and the second subtask is presented as a sub-function node (i.e., the second subtask node, also referred to as a sub-subtask node), wherein the selected text is displayed as the function name of the sub-function node; after the user creates the sub-function node, the background color of the previously selected text will be set to blue, and at the same time, a line will be added between the two functions (the first subtask node and the second subtask node) to indicate that the two function nodes are in a parent-child relationship. Specifically, Figure 3 As shown, Figure 3 A schematic diagram of splitting into two subtask nodes (i.e., the first subtask node) and one sub-subtask node (i.e., the second subtask node) provided in an embodiment of the present invention. As shown in the figure, this embodiment takes splitting into subtask node A and subtask node B as an example, and sub-subtask node C as an example, which is not limited to this in practical applications.

[0136] After the user completes the above splitting operation, he can use recursive traversal to concatenate the description text information of each node (including the root node and the first subtask node and the second subtask node) and the input and output parameter information to obtain the final prompt word information.

[0137] For example, in this embodiment, "generating a code for calculating the mortgage interest rate function" is still used as an example to perform prompt word splicing. The prompt word template is preset as follows (the user does not need to pay attention to the preset text):

[0138] You are a professional engineer proficient in Java.

[0139] I'll give you the following method definition:

[0140] ##Method definition

[0141] You need to write the Java code according to the definition I gave.

[0142] According to the above steps of this embodiment, the splitting is performed and after recursive traversal, the final spliced ​​prompt word template is obtained as follows:

[0143] You are a professional engineer proficient in Java language.

[0144] I'll give you the following method definition:

[0145] ##Method definition

[0146] -Realize the function of calculating the annual interest rate of mortgage loans:

[0147] Input parameter: loan_amount indicates the loan amount, type is double

[0148] Output: type double

[0149] -The function of calculating the annual interest rate of mortgage loans includes the following three methods:

[0150] -Method A is to obtain the base interest rate information:

[0151] Input parameters: None

[0152] Output: type double

[0153] -Method B is to adjust the base interest rate based on factors such as the loan amount and recommended loan term:

[0154] Input parameters: base_rate represents the base interest rate, type is double, loan_amount represents the loan amount, type is double

[0155] Output: type double

[0156] -Method B includes one of the following methods:

[0157] Method C is to obtain the recommended loan term:

[0158] Input parameters: None

[0159] Output: type double

[0160] You need to write the Java code according to the definition I gave.

[0161] In the embodiment of the present invention, the user does not need to pay attention to the specific content of the prompt words, but only needs to focus on the splitting of large-grained tasks. By adopting the embodiment of the present invention, the contextual association relationship and parameter definition between the node task splitting can be intuitively displayed, which can better assist the construction of prompt words and effectively reduce the uncertainty of prompt words in the process of generating code for large models, thereby improving the accuracy of large model code generation.

[0162] Optionally, in another embodiment, based on the above embodiment, the step of determining the position of each second subtask node in turn according to the tree-shaped nested structure from top to bottom according to the position of the corresponding first subtask node includes:

[0163] The upper left corner position of each first subtask node is used as the position of the parent node, and the width and height are set according to the actual node content width. The position of each first subtask node is offset to the right by a third fixed value (50px) relative to the parent node, and is offset downward by the height of the parent node plus a fourth fixed value (20px); wherein the third fixed value and the fourth fixed value are adjusted arbitrarily as required, wherein the third fixed value is the same or different from the first fixed value, and the fourth fixed value is the same or different from the second fixed value.

[0164] The determining of the description text and the second input-output parameter of each second subtask node includes: defining the description text and the second input-output parameter of each second subtask node according to the operation instruction input by the user.

[0165] Optionally, in another embodiment, based on the above embodiment, the method may also include: based on the rich text edit box of the root node, modifying the initial description text of the root node according to the operation instructions detected by the user input; and / or based on the form data of the first subtask node or the second subtask node, modifying the first subtask node or the second subtask node according to the operation instructions detected by the user input, the form data including: a rich text edit box, a drop-down selection component and a configuration table component.

[0166] In this step, the content area of ​​the prompt node is a rich text edit box, and the user can manually modify the initial description text of the prompt node in the rich text edit box; and the function node or sub-function node includes: a rich text edit box, a drop-down selection component, a configuration table component and other form data, and the user can modify the function node or sub-function node by modifying the form data.

[0167] Optionally, in another embodiment, based on the above embodiment, the method may also include: deleting the corresponding first subtask node or the second subtask node in accordance with an operation instruction detected by the user; and deleting the subtasks and related connections with the first subtask node or the second subtask node; and clearing the background color of the text selected in the rich text edit box of the parent node of the deleted first subtask node or the second subtask node.

[0168] That is to say, in the embodiment of the present invention, the first task node or the second subtask node obtained after splitting can be deleted, because the root node (prompt node) is unique and cannot be deleted. As for the subtask node, the user can delete the function node itself by clicking the function node (or subfunction node, the same below), and the subtasks and associated connections of the function node will also be deleted; at the same time, the background color of the selected text in the rich text edit box in the parent node of the function node will also be cleared. When the user deletes the selected text information (background color is blue) in the rich text edit box of a node, the subtask node corresponding to the selected text will also be deleted.

[0169] Optionally, in another embodiment, based on the above embodiment, the method may also include: inputting the prompt word information into an artificial intelligence model, and outputting the generated code, wherein the artificial intelligence model includes a GPT4o model.

[0170] In this embodiment, the process of generating codes from the prompt word information through an artificial intelligence model is already a well-known technology for those skilled in the art and will not be described in detail here.

[0171] See also Figure 4 , is another flow chart of an interactive method for assisting in constructing prompt words provided by an embodiment of the present invention. The method comprises:

[0172] Step 401: obtain the initial description text of the code requirement document, set the initial description text to a prompt node, and the prompt node content area is displayed as a rich text edit box, which allows the user to select part of the text.

[0173] Step 402: When the user's instructions to select certain keywords in the text in the rich text edit box and the right-click split command are detected, the task is split into function nodes, and the description and input and output parameters of each function node are defined. After the splitting is completed, the background color of the selected keyword is displayed in blue (this embodiment takes blue as an example, but in actual applications, it is not limited to this), and the node position is calculated according to the tree nested structure from top to bottom, as detailed below.

[0174] In this step, the rich text edit box of the prompt node allows the user to select some text. After selecting, right-click to add a subtask to the current prompt node. The subtask is represented by a function node, in which the selected text is displayed as the function name of the function node. After the user creates the function node, the background color of the previously selected text will be set to blue. At the same time, a connection line will be added between the prompt node and the function node to indicate that the prompt node and the function node are in a parent-child relationship.

[0175] A subtask, i.e., a function node, includes a function name, function description, parameter table configuration, etc. The parameter table configuration uses a form component to define the type and description of the input and output parameters of the function node. The function description area is presented as a rich text edit box, which allows the user to select some text. After selecting, right-click to add a subtask to the current function node. The subtask is presented as a function node, in which the selected text is displayed as the function name of the function node. After the user creates the function node, the background color of the previously selected text will be set to blue. At the same time, a line will be added between the two functions to indicate that the two function nodes are in a parent-child relationship.

[0176] Step 403: If the function node split out in step 402 does not describe the smallest task, split the current function node into sub-function nodes in the same manner as in the previous step, and define the description and input and output parameters of each sub-function node.

[0177] Step 404: Repeat step 403 until there are no smaller tasks to be split. If the prompt node needs to be modified, modify the initial description text of the prompt node; if the function node or sub-function node needs to be modified, modify the form of the function node or sub-function node; if the function node or sub-function node needs to be deleted, the user can delete it by clicking the corresponding node. When the user deletes the selected text information in the rich text edit box of a node (the background color is blue), the sub-task node corresponding to the selected text will also be deleted. At this point, the code requirement document splitting work has been completed.

[0178] In this step, the prompt node content area is an edit box, and users can manually modify the node description; the function node contains forms such as a rich text edit box, a drop-down selection component, and a configuration table component, and users can modify the node by modifying the form data.

[0179] In this step, the prompt node is unique and cannot be deleted; users can delete the function node itself by clicking on it, and the subtasks and associated connections of the function node will also be deleted; at the same time, the background color of the selected text in the rich text edit box of the parent node of the function node will also be cleared. When the user deletes the selected text information (the background color is blue) in the rich text edit box of a node, the subtask node corresponding to the selected text will also be deleted.

[0180] In this step, each time a node is split or deleted, the node will be rearranged. The upper left corner of each node is used as the coordinate of the node. When the system is initialized, the coordinate position of the prompt node is (0px, 0px). The width and height are determined according to the actual node content width. Generally, the height and width of each node type are set to fixed values. The width and height are set to 1000px and 100px in the example diagram. In order to make each node display clearly, the coordinate position of the child node is offset 50px to the right relative to the parent node, and offset downward by the parent node height plus 20px. The offset can be adjusted freely.

[0181] Assuming that the position of the root node is (0px, 0px), and the width and height are (1000px, 100px), add a subtask node A to the root node, and the width and height of node A are (1000px, 100px), then the x coordinate of subtask node A is 0+50=50px, and the y coordinate is 0+100+20=120px, and the coordinates of subtask node A are (50px, 120px); add subtask node B to the root node again, then the position of subtask node A remains unchanged, the x coordinate of subtask node B is 0+50=50px, and the y coordinate is 120+100+20=240px, and the coordinates of subtask node B are (50px, 240px), and the coordinates of other subtask nodes are deduced accordingly.

[0182] Therefore, the coordinates of each task node or subtask node are calculated from top to bottom according to the tree nesting structure, and the code is shown in the calcPosition method:

[0183] const nodeList = [];

[0184] const linkList = [];

[0185] / / x offset distance

[0186] const gapX = 50;

[0187] / / y offset distance

[0188] const gapY = 20;

[0189] / / Maximum height

[0190]

[0191] Step 405: After the above splitting operation is completed, the description of each node and the corresponding input and output parameters are concatenated with prompt words using a recursive traversal method to obtain the final prompt word information.

[0192] In this step, after the user completes the above splitting operation, he uses recursive traversal to concatenate the description information and input and output parameter information of each node with prompt words to obtain the final prompt word information, and uses it as input to generate the corresponding code through the large model output.

[0193] Step 406: Input the final prompt word information into the large model and output the generated code.

[0194] In an embodiment of the present invention, an interactive method for assisting in constructing prompt words is designed using a rich text edit box, mouse operation, form components, and a tree layout concept, which can intuitively display the contextual association relationship and parameter definition between the split sub-modules, and can better assist in the construction of prompt words.

[0195] It should be noted that, for the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that this implementation disclosure is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention.

[0196] Figure 5 The block diagram of an interactive device for assisting in constructing prompt words provided by an embodiment of the present invention. The device is applied to the code requirement document splitting task scenario, and includes: an acquisition module 501, a setting module 502, a first splitting module 503, a first determination module 504, a first display module 505 and a splicing module 506, wherein:

[0197] An acquisition module 501 is used to acquire an initial description text of a code requirement document;

[0198] A setting module 502, used to set the initial description text as a root node, wherein the content area of ​​the root node is a rich text editing box including the initial description text;

[0199] A first splitting module 503 is used to detect at least one operation instruction of the user to select a part of the initial description text in the rich text edit box, split the selected part of the initial description text into at least one first subtask node, wherein the selected part of the initial description text is displayed as a function name corresponding to the first subtask node;

[0200] A first determination module 504 is used to determine the position of each first subtask node in turn according to a tree-shaped nested structure from top to bottom; and determine the description text and input and output parameters of each first subtask node;

[0201] The first display module 505 is used to display the background color of the initial description text of the framed part as a set color after each first subtask node is split, and to add a connection line between each first subtask node and the root node;

[0202] The splicing module 506 is used to splice the prompt word of the root node and part of the initial description text and input and output parameters of each first subtask node by recursive traversal to obtain final prompt word information.

[0203] Optionally, the device further includes: a second splitting module 601, a second determining module 602 and a second display module 603, whose structural block diagram is as follows: Figure 6 As shown,

[0204] The second splitting module 601 is used for detecting, before the splicing module 506 performs prompt word splicing, that the user selects at least one operation instruction of a part of the description text of the first subtask node, splitting the selected part of the description text into at least one second subtask node, wherein the selected part of the description text is displayed as a function name corresponding to the second subtask node;

[0205] The second determination module 602 is used to determine the position of each second subtask node in turn according to the tree-shaped nested structure from top to bottom corresponding to the position of the first subtask node; and determine the description text and second input and output parameters of each second subtask node;

[0206] The second display module 603 is used to display the background color of the selected part of the description text as the set color after each second subtask node is split, and add a connection line between each second subtask node and the corresponding first subtask node;

[0207] The splicing module 506 is also used to perform prompt word splicing on the root node, part of the initial description text and input-output parameters of each first subtask node, and part of the description text and the second input-output parameters of each second subtask node by recursive traversal to obtain final prompt word information.

[0208] Optionally, the device further comprises:

[0209] A first modification module is configured to modify the initial description text of the root node based on the rich text edit box of the root node according to an operation instruction input by a user; and / or

[0210] The second modification module is used to modify the first subtask node or the second subtask node based on the form data of the first subtask node or the second subtask node according to the operation instructions detected by the user input, and the form data includes: a rich text edit box, a drop-down selection component and a configuration table component.

[0211] Optionally, the device further includes: a deletion module 701 and a clearing module 702, whose structural block diagram is shown in FIG. Figure 7 As shown, the Figure 7 So Figure 6 For example,

[0212] The deleting module 701 is used to delete the first subtask node obtained by splitting the first splitting module or the second subtask node obtained by splitting the second splitting module according to the operation instruction input by the user; and delete the subtasks and related connections with the first subtask node or the second subtask node; and

[0213] The clearing module 702 is used to clear the background color of the text selected in the rich text edit box of the parent node of the first subtask node or the second subtask node deleted by the deleting module 701 .

[0214] Optionally, the device further comprises:

[0215] A production module is used to input the prompt word information into an artificial intelligence model and output a generated code, wherein the artificial intelligence model includes a GPT4o model.

[0216] Optionally, the first determining module includes:

[0217] A first position determination module is used to use the upper left corner of each root node as the position of the parent node, and the width and height are set according to the actual node content width. The position of each first subtask node is offset to the right by a first fixed value relative to the parent node, and is offset downward by the height of the parent node plus a second fixed value, wherein the first fixed value and the second fixed value are arbitrarily adjusted as required;

[0218] The first parameter determination module is used to define the description text and the first input and output parameters of each first subtask node according to the operation instruction input by the user.

[0219] Optionally, the second determining module includes:

[0220] A second position determination module is used to use the upper left corner position of each first subtask node as the position of the parent node, and the width and height are set according to the actual node content width, and the position of each first subtask node is offset to the right by a third fixed value relative to the parent node, and is offset downward by the parent node height plus a fourth fixed value;

[0221] The second parameter determination module is used to define the description text and second input and output parameters of each second subtask node according to the operation instruction input by the user.

[0222] Optionally, an embodiment of the present invention further provides an electronic device, including:

[0223] processor;

[0224] a memory for storing instructions executable by the processor;

[0225] The processor is configured to execute the instructions to implement the interactive method for assisting in constructing prompt words as described above.

[0226] Optionally, an embodiment of the present invention further provides a computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the interactive method for assisting in constructing prompt words as described above.

[0227] Optionally, an embodiment of the present invention further provides a computer program product, including a computer program or an instruction, wherein when the computer program or the instruction is executed by a processor of an electronic device, the interactive method for assisting in constructing a prompt word as described above is implemented.

[0228] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0229] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0230] Figure 8 800 is a block diagram of an electronic device 800 provided in an embodiment of the present invention. For example, the electronic device 800 may be a mobile terminal or a server, and the electronic device is a mobile terminal as an example for explanation in the embodiment of the present invention. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a message transceiver device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0231] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0232] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0233] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0234] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0235] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0236] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0237] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0238] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0239] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0240] In an embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the interactive method for assisting in constructing prompt words shown above.

[0241] In an embodiment, a computer-readable storage medium is also provided, and when the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device 800 can execute the interactive method for assisting in constructing the prompt word shown above. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0242] In an embodiment, a computer program product is also provided, including a computer program or instructions. When the computer program or instructions are executed by the processor 820 of the electronic device 800, the electronic device 800 executes the above-mentioned interactive method for assisting in constructing prompt words.

[0243] Fig. 9 900 is a block diagram of an interactive device 900 for assisting in building a prompt word provided by an embodiment of the present invention. For example, the device 900 may be provided as a server. Fig. 9 , the apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions, such as an application, that can be executed by the processing component 922. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute the instructions to perform the above method.

[0244] The device 900 may also include a power supply component 926 configured to perform power management of the device 900, a wired or wireless network interface 950 configured to connect the device 900 to a network, and an input / output (I / O) interface 958. The device 900 may operate based on an operating system stored in the memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0245] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0246] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. An interactive method for assisting in constructing a prompt word, characterized in that: The method is applied to the code requirement document splitting task scenario, including: Get the initial description text of the code requirement document; The initial description text is set as a root node, and the content area of ​​the root node is a rich text editing box including the initial description text; When detecting at least one operation instruction of the user selecting a portion of the initial description text in the rich text edit box, splitting the selected portion of the initial description text into at least one first subtask node, wherein the selected portion of the initial description text is displayed as a function name corresponding to the first subtask node; Determine the position of each first subtask node in turn according to the tree-shaped nested structure from top to bottom; and determine the description text and input and output parameters of each first subtask node; After each first subtask node is split, the background color of the initial description text of the selected part is displayed as a set color, and a connection line is added between each first subtask node and the root node; The root node and part of the initial description text and input and output parameters of each first subtask node are concatenated with prompt words by recursive traversal to obtain final prompt word information.

2. The interactive method for assisting in constructing prompt words according to claim 1, characterized in that: Before the method of concatenating the root node and part of the initial description text and the input and output parameters of each first subtask node with prompt words in a recursive traversal manner to obtain all prompt word information, the method further includes: When detecting at least one operation instruction of the user selecting a portion of the description text of the first subtask node, splitting the selected portion of the description text into at least one second subtask node, wherein the selected portion of the description text is displayed as a function name corresponding to the second subtask node; Determine the position of each second subtask node in turn according to the tree-shaped nested structure from top to bottom corresponding to the position of the first subtask node; and determine the description text and second input and output parameters of each second subtask node; After each second subtask node is split, the background color of the selected portion of the description text is displayed as the set color, and a connection line is added between each second subtask node and the corresponding first subtask node; The method of recursively traversing the root node and part of the initial description text of each first subtask node and the first input and output parameters is used to perform prompt word splicing to obtain final prompt word information, including: The root node, part of the initial description text and input / output parameters of each first subtask node, and part of the description text and second input / output parameters of each second subtask node are concatenated with prompt words by recursive traversal to obtain final prompt word information.

3. The interactive method for assisting in constructing prompt words according to claim 2, characterized in that: The method further comprises: Based on the rich text edit box of the root node, modifying the initial description text of the root node according to the operation instruction input by the user detected; and / or Based on the form data of the first subtask node or the second subtask node, the first subtask node or the second subtask node is modified according to the operation instruction detected by the user, and the form data includes: a rich text edit box, a drop-down selection component and a configuration table component.

4. The interactive method for assisting in constructing prompt words according to claim 2, characterized in that: The method further comprises: According to the operation instruction input by the user, the first subtask node or the second subtask node corresponding to the first subtask node or the second subtask node is deleted; and the subtask and the related connection with the first subtask node or the second subtask node are deleted; and Clear the background color of the text selected in the rich text edit box of the parent node of the deleted first subtask node or the second subtask node.

5. The interactive method for assisting in constructing prompt words according to any one of claims 1 to 4, characterized in that: The method further comprises: The prompt word information is input into an artificial intelligence model, and a generated code is output, wherein the artificial intelligence model includes a GPT4o model.

6. The interactive method for assisting in constructing prompt words according to claim 1, characterized in that: The step of sequentially determining the position of each first subtask node according to the tree-shaped nested structure from top to bottom includes: The upper left corner of each root node is used as the position of the parent node, and the width and height are set according to the actual node content width. The position of each first subtask node is offset to the right by a first fixed value relative to the parent node, and is offset downward by the parent node height plus a second fixed value, wherein the first fixed value and the second fixed value are adjusted arbitrarily as required; The determining of the description text and the first input-output parameter of each first subtask node includes: defining the description text and the first input-output parameter of each first subtask node according to the operation instruction input by the user.

7. The interactive method for assisting in constructing prompt words according to claim 2, characterized in that: The determining the position of each second subtask node in turn according to the tree-shaped nested structure from top to bottom according to the position of the corresponding first subtask node includes: The upper left corner of each first subtask node is used as the position of the parent node, and the width and height are set according to the actual node content width. The position of each first subtask node is offset to the right by a third fixed value relative to the parent node, and is offset downward by the parent node height plus a fourth fixed value, wherein the third fixed value and the fourth fixed value are adjusted arbitrarily according to requirements; The determining of the description text and the second input-output parameter of each second subtask node includes: defining the description text and the second input-output parameter of each second subtask node according to the operation instruction input by the user.

8. An interactive device for assisting in constructing a prompt word, characterized in that: The device is applied to the code requirement document splitting task scenario, including: The acquisition module is used to obtain the initial description text of the code requirement document; A setting module, used to set the description text as a root node, wherein the content area of ​​the root node is a rich text editing box including the initial description text; A first splitting module is used to detect at least one operation instruction of a user selecting a part of the initial description text in the rich text edit box, split the selected part of the initial description text into at least one first subtask node, wherein the selected part of the initial description text is displayed as a function name corresponding to the first subtask node; A first determination module is used to determine the position of each first subtask node in turn according to a tree-shaped nested structure from top to bottom; and determine the description text and input and output parameters of each first subtask node; A first display module is used to display the background color of the initial description text of the framed part as a set color after each first subtask node is split, and to add a connection line between each second subtask node and the corresponding first subtask node; The splicing module is used to splice the prompt words of the root node and part of the initial description text and input and output parameters of each first subtask node by recursive traversal to obtain all prompt word information.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the interactive method for assisting in constructing prompt words as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the interactive method for assisting in constructing prompt words as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Intelligent prompt method, module and system for search

    CN103631929A

  • Code abstract generation method based on large language model and static analysis tool

    CN117873559A

  • Rust language document test automatic generation method and device based on large code model

    CN117951038A

  • Rich text code review method and system based on large language model and medium

    CN118152287A

  • Problem processing method and device, electronic equipment and computer readable medium

    CN118195012A