Interactive method, device, electronic device and storage medium for assisting in constructing prompt words

By using rich text editing boxes and a tree-nested structure to split subtask nodes in the code requirements document, the problem of ambiguous prompt word definitions was solved, and the accuracy of code generation from large models was improved.

CN119647429BActive Publication Date: 2025-10-28CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

During the task breakdown process in the code requirements document, the accuracy of the code generated by the large model decreased due to the lack of clear definition of the input and output of the prompt words or insufficient structured thinking.

Method used

By obtaining the initial description text of the code requirements document and setting it as the root node, and using a rich text editor and a tree nested structure to split it into sub-task nodes, the description text and input/output parameters of each node are determined. The prompt words are then concatenated using a recursive traversal method to intuitively display the contextual relationship of the node task splitting.

Benefits of technology

It improves the accuracy of code generation from large models, reduces the uncertainty of prompt words, and enhances the clarity of prompt word construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119647429B_ABST
    Figure CN119647429B_ABST
Patent Text Reader

Abstract

This invention provides an interactive method, apparatus, electronic device, and storage medium for assisting in the construction of prompt words. The method includes: obtaining initial description text from a code requirement document; setting the initial description text as a root node, the content area of ​​which is a rich text editing box including the initial description text; when detecting that a user selects at least one operation instruction of the initial description text in the rich text editing box, splitting the selected initial description text into at least one first sub-task node; determining the position of each first sub-task node in a top-down tree-like nested structure; and determining the description text and input / output parameters of each first sub-task node; after the splitting is completed, displaying the background color of the selected initial description text as a set color; and concatenating the root node and a portion of the initial description text and input / output parameters of each first sub-task node using a recursive traversal method to obtain the final prompt word information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to an interactive method, apparatus, electronic device, and computer-readable storage medium that assists in constructing prompt words. Background Technology

[0002] In related technologies, prompts typically include elements such as instructions, context, input data, and output indications. However, when using large models such as the fourth generation of artificial intelligence models (GPT-4o, Generative Pretrained Transformer-four Omni) to generate code snippets, due to the abstract nature of code requirement documents, their strong connection to context, and their large task granularity, the input and output in the prompts may lack clear definitions or structured thinking during the document task decomposition process, resulting in incomplete, unreasonable, or grammatically incorrect answers.

[0003] Therefore, how to assist in building clear, intuitive, and explicit definition prompts during the task decomposition process of code requirements documents in order to improve the accuracy of code generation from large models is a problem that needs to be solved. Summary of the Invention

[0004] This invention provides an interactive method, apparatus, electronic device, and computer-readable storage medium to assist in constructing prompt words, thereby at least solving the problem in related technologies where the accuracy of code generation from large models decreases due to the lack of clear definition of prompt words during document task splitting. The technical solution of this invention is as follows:

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

[0006] Obtain the initial description text from the code requirements document;

[0007] Set the initial description text as the root node, and the content area of ​​the root node is a rich text editing box that includes the initial description text;

[0008] When a user is detected to have selected at least one initial description text in the rich text editing box, the selected initial description text is split into at least one first sub-task node, wherein the selected initial description text is displayed as the function name of the corresponding first sub-task node;

[0009] The position of each first subtask node is determined sequentially according to the top-down tree nesting structure; and the description text and input / output parameters of each first subtask node are determined.

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

[0011] By recursively traversing the root node and the initial description text and input / output parameters of each first subtask node, the prompt words are concatenated to obtain the final prompt word information.

[0012] Optionally, before recursively concatenating the initial description text and input / output parameters of the root node and each first subtask node using prompt words to obtain all prompt word information, the method further includes:

[0013] When a user's operation instruction to select at least one part of the description text of the first subtask node is detected, the selected part of the description text is split into at least one second subtask node, wherein the selected part of the description text is displayed as the function name of the corresponding second subtask node;

[0014] The position of each second subtask node is determined sequentially from top to bottom in a tree-like nested structure 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.

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

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

[0017] By recursively traversing the root node, the partial initial description text and input / output parameters of each first subtask node, and the partial description text and second input / output parameters of each second subtask node, the prompt words are concatenated to obtain all prompt word information.

[0018] Optionally, the method further includes:

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

[0020] Based on the form data of the first sub-task node or the second sub-task node, the first sub-task node or the second sub-task node is modified according to the operation instructions detected by the user input. 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] Based on the detected user input command, delete the corresponding first or second sub-task node; and delete the sub-tasks and related connections associated with the first or second sub-task node; and

[0023] Clear the background color of the text selected in the rich text editing box of the parent node of the deleted first sub-task node or second sub-task node.

[0024] Optionally, the method further includes:

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

[0026] Optionally, determining the position of each first subtask node sequentially according to a top-down tree-like nested structure includes:

[0027] The top left corner of each root node is used as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first child task node is offset to the right by a first fixed value relative to the parent node, and offset downward by the height of the parent node plus a second fixed value. The first fixed value and the second fixed value can be adjusted arbitrarily as needed.

[0028] Determining the description text and first input / output parameters of each first subtask node includes: defining the description text and first input / output parameters of each first subtask node according to the operation instructions input by the user.

[0029] Optionally, determining the position of each second subtask node sequentially according to the top-down tree nesting structure corresponding to the position of the first subtask node includes:

[0030] The top left corner of each first sub-task node is taken as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first sub-task node is offset to the right by a third fixed value relative to the parent node, and offset downward by the height of the parent node plus a fourth fixed value.

[0031] The step of determining the description text and second input / output parameters of each second subtask node includes: defining the description text and second input / output parameters of each second subtask node according to the operation instructions input by the user.

[0032] According to a second aspect of the present invention, an interactive device for assisting in the construction of prompt words is provided, the device being applied to a code requirements document splitting task scenario including:

[0033] The retrieval module is used to retrieve the initial description text from the code requirements document;

[0034] The setting module is used to set the initial description text as the root node, and the content area of ​​the root node is a rich text editing box that includes the initial description text.

[0035] The first splitting module is used to split the selected initial description text into at least one first subtask node when the user detects at least one operation instruction of selecting a portion of the initial description text in the rich text editing box. The selected portion of the initial description text is displayed as the function name of the corresponding first subtask node.

[0036] The first determining module is used to determine the position of each first subtask node in a top-down tree-like nested structure; and to determine the description text and input / output parameters of each first subtask node.

[0037] The first display module is used to display the background color of the initial description text of the selected portion as a set color after each first subtask node is split, and to add a connecting line between each first subtask node and the root node.

[0038] The concatenation module is used to concatenate the root node and a portion of the initial description text and input / output parameters of each first subtask node with prompt words using a recursive traversal method to obtain the final prompt word information.

[0039] Optionally, the device further includes:

[0040] The second splitting module is used to split the selected partial description text into at least one second sub-task node when the user selects at least one operation instruction of the partial description text of the first sub-task node in the concatenation module before the concatenation module performs the prompt word concatenation. The selected partial description text is displayed as the function name of the corresponding second sub-task node.

[0041] The second determining module is used to determine the position of each second subtask node in a tree-like nested structure from top to bottom according to the position of the corresponding first subtask node; and to determine the description text and second input / output parameters of each second subtask node.

[0042] The 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 line between each second subtask node and the corresponding first subtask node.

[0043] The splicing module is further configured to use a recursive traversal method to splice the root node, the partial initial description text and input / output parameters of each first subtask node, and the partial description text and second input / output parameters of each second subtask node into prompt words to obtain the final prompt word information.

[0044] Optionally, the device further includes:

[0045] The first modification module is used to modify the initial description text of the root node based on the rich text edit box of the root node, according to the operation command detected by the user input; and / or

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

[0047] Optionally, the device further includes:

[0048] The deletion module is used to delete the corresponding first subtask node or second subtask node according to the detected user input operation command; and to delete the subtasks and related connections of the first subtask node or second subtask node; and

[0049] The clearing module is used to clear the background color of the text selected in the rich text editing box of the parent node of the first sub-task node or the second sub-task node that has been deleted by the deletion module.

[0050] Optionally, the device further includes:

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

[0052] Optionally, the first determining module includes:

[0053] The first position determination module is used to take the upper left corner of each root node as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first sub-task node is offset to the right by a first fixed value relative to the parent node and offset downward by the height of the parent node plus a second fixed value. The first fixed value and the second fixed value can be adjusted arbitrarily as needed.

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

[0055] Optionally, the second determining module includes:

[0056] The second position determination module is used to take the upper left corner of each first sub-task node as the position of the parent node. The width and height are set according to the actual node content width. The position of each first sub-task node is offset to the right by a third fixed value relative to the parent node and offset downward by the height of the parent node plus a fourth fixed value.

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

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

[0059] processor;

[0060] Memory used to store the processor's executable instructions;

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

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

[0063] According to a fifth aspect of the present invention, a computer program product is provided, comprising a computer program or instructions that, when executed by a processor of an electronic device, implement the interactive method for assisting in the construction of prompt words as described above.

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

[0065] In this embodiment of the invention, the initial description text of the code requirements document is obtained; the initial description text is set as the root node, and the content area of ​​the root node is a rich text editing box including the initial description text; when the user's operation instruction of selecting at least one portion of the initial description text in the rich text editing box is detected, the selected portion of the initial description text is split into at least one first sub-task node, wherein the selected portion of the initial description text is displayed as the function name of the corresponding first sub-task node; the position of each first sub-task node is determined sequentially according to a top-down tree nested structure; and the description text and input / output parameters of each first sub-task node are determined; after each first sub-task node is split, the background color of the selected portion of the initial description text is displayed as a set color, and a line is added between each first sub-task node and the root node; the root node and the portion of the initial description text and input / output parameters of each first sub-task node are concatenated with prompt words using a recursive traversal method to obtain the final prompt word information. In other words, in this embodiment of the invention, users do not need to focus on the specific content of the prompt words, but only on the breakdown of large-granular tasks. By using the rich text editing box and tree layout, the contextual relationships and parameter definitions between the task breakdown nodes can be displayed intuitively, which can better assist in the construction of prompt words, effectively reduce the uncertainty of prompt words in the process of generating code for large models, and thus improve the accuracy of large model code generation.

[0066] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0067] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present invention and, together with the description, serve to explain the principles of the invention. They do not constitute an undue limitation of the invention. To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0068] Figure 1 This is a flowchart of an interactive method for assisting in the construction of prompt words, provided by an embodiment of the present invention.

[0069] Figure 2 This is a schematic diagram of a method for splitting tasks into two sub-task nodes, as provided in an embodiment of the present invention.

[0070] Figure 3This is a schematic diagram of a method for splitting a task into two sub-task nodes and a sub-sub-task node, as provided in an embodiment of the present invention.

[0071] Figure 4 This is a flowchart of an interactive method for assisting in the construction of prompt words, provided by an embodiment of the present invention.

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

[0073] Figure 6 This is another block diagram of an interactive device that assists 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 the construction of prompt words, provided in an embodiment of the present invention.

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

[0076] Figure 9 This is a block diagram of an apparatus for assisting in the construction of interactive prompts, provided by an embodiment of the present invention. Detailed Implementation

[0077] To enable those skilled 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 with reference to the accompanying drawings.

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

[0079] In recent years, significant progress has been made in research on technologies based on artificial intelligence, such as computer vision, deep learning, machine learning, image processing, and image recognition. Artificial intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies, and application systems to simulate and extend human intelligence. AI is a comprehensive discipline involving numerous technologies, including chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, and neural networks. Computer vision, as an important branch of AI, specifically enables machines to recognize the world. Computer vision technologies typically include face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, object detection, 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, and robot navigation and localization. With the research and advancement of artificial intelligence technology, this technology has been applied in numerous fields, such as security, urban management, traffic management, building management, park management, facial recognition access control, facial recognition attendance, logistics management, warehouse management, robotics, intelligent marketing, computational photography, mobile imaging, cloud services, smart homes, wearable devices, autonomous driving, autonomous driving, smart healthcare, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile internet, live streaming, beautification, makeup, medical aesthetics, and intelligent temperature measurement.

[0080] Technical terms:

[0081] Cue words: A cue word is an instruction or message that guides or triggers an AI system to respond. In interactions with AI such as ChatGPT, every time we type a piece of text, whether it's a question, a command, or a statement, that text becomes a cue word.

[0082] GPT-4o is the latest generation of large-scale language models launched by OpenAI. It is an all-in-one model that integrates text, images, videos, and speech, and can respond to user needs in real time and provide real-time answers via speech.

[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] Based on the understanding of the above technical terms, please also refer to the following embodiments.

[0085] Figure 1This is a flowchart illustrating an interactive method for assisting in the construction of prompt words, provided by an embodiment of the present invention. The method is based on the VueFlow framework and is used to implement a task scenario involving the splitting of code requirement documents, such as... Figure 1 As shown, the method includes the following steps:

[0086] Step 101: Obtain the initial description text of the code requirements document.

[0087] Step 102: Set the initial description text as the root node, and the content area of ​​the root node is a rich text editing box that includes the initial description text.

[0088] Step 103: When the system detects that the user has selected at least one initial description text in the rich text editing box, the selected initial description text is split into at least one first sub-task node, wherein the selected initial description text is displayed as the function name of the corresponding first sub-task node.

[0089] Step 104: Determine the position of each first subtask node in a top-down tree-like nested structure; and determine the description text and input / output parameters of each first subtask node, with each first subtask node 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 the set color.

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

[0092] The interactive method for assisting in the construction of prompt words described in this invention can be applied to terminals, servers, etc., without limitation. The terminal implementation device can be an electronic device such as a smartphone, laptop, tablet, desktop computer, personal digital assistant (PDA), and wearable device. The server can be an independent server, a server cluster, or a server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, or big data and artificial intelligence platforms, etc., without limitation.

[0093] The following is combined Figure 1 The specific implementation steps of an interactive method for assisting in the construction of prompt words provided in the embodiments of the present invention will be described in detail.

[0094] In step 101, the initial description text of the code requirements document is obtained.

[0095] In this step, code requirement documents can be obtained locally or remotely, or they can be obtained from user-input code requirement documents. Typically, code requirement documents are characterized by abstractness, strong relevance to the context, and large task granularity, such as generating code documents for a function to calculate mortgage interest rates.

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

[0097] In this embodiment, firstly, two node types are defined based on VueFlow: prompt nodes (which can be understood as root nodes) and function nodes (which can be understood as child nodes or sub-child nodes, i.e., the first child node or second child node, etc., as described in this embodiment); prompt nodes are used to display the initial requirement description text state; function nodes are used to display the subtask state that needs to be split; there are lines between prompt nodes and function nodes with parent-child relationships, and between function nodes and function nodes, which are used to represent the association relationship between nodes.

[0098] In this embodiment, the content area of ​​the prompt node is represented as a rich text editing box, which allows users to select a portion of the text. Of course, different portions of text can be selected multiple times as needed.

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

[0100] In this step, the user can select a portion of text within the rich text editing box. Multiple selections can be made for different portions of text. When the user selects a portion of text within the rich text editing box, i.e., when an operation command is detected indicating that the user has selected a portion of the initial description text within the rich text editing box, the selected portion of the initial description text is split into a first sub-task node, and the selected portion of the initial description text is displayed as the function name of the corresponding first sub-task node. Subsequently, when the user can select another portion of text within the rich text editing box, i.e., when an operation command is detected indicating that the user has selected another portion of the initial description text within the rich text editing box, the selected other portion of the initial description text is split into another first sub-task node, and the selected other portion of the initial description text is displayed as the function name of the corresponding first sub-task node. This process continues in this manner, and multiple first sub-task nodes can be created in this way. These will not be described in detail in this embodiment.

[0101] In other words, in this step, users can select a portion of text using the rich text editing box of the prompt node. After selecting the text, right-clicking will 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, or function node, contains a function name, function description, parameter list configuration, etc. The parameter list configuration uses a form component to define the types and descriptions of the input and output parameters of the function node; the function description area is displayed 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 sequentially according to the top-down tree nesting structure; and the description text and input / output parameters of each first subtask node are determined.

[0104] In this step, the top left corner of each root node is usually taken as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first child task node is offset to the right by a first fixed value (e.g., 50px, 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 (e.g., 20px). The first fixed value and the second fixed value can be adjusted arbitrarily as needed, and this embodiment does not impose any restrictions.

[0105] In other words, in this embodiment, the position of the resulting sub-task nodes is calculated each time a node is split. Taking the top-left corner of each node as its coordinate position as an example, during system initialization, the coordinate position of the root node (i.e., the prompt node) is assumed to be (0px, 0px). The width and height are determined according to the actual width of the node content. Generally, the height and width of each node type are set to fixed values. In the example image, the width is set to 1000px and the height to 100px. To ensure that each node is clearly displayed, the coordinate position of the sub-task node is offset to the right by a first fixed value (e.g., 50px) relative to the parent node, and offset downwards by the height of the parent node plus a second fixed value (e.g., 20px). The offset can be freely adjusted.

[0106] The process of determining the description text and input / output parameters of each first subtask node, wherein each first subtask node is connected to the root node, includes: defining the description text and first input / output parameters of each first subtask node according to the user's input operation instructions.

[0107] In 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, and a line is added between each first subtask node and the root node.

[0108] In this step, after the user creates the first sub-task node (i.e., the function node), the background color of the initial description text in the selected area will be displayed as the set color (e.g., blue or green). Simultaneously, a line will be added between the prompt node and the function node to indicate that they are parent and child nodes. Specifically... Figure 2 As shown, Figure 2 This is a schematic diagram illustrating a splitting of a task into two sub-task nodes, as provided in an embodiment of the present invention. As shown in the figure, this embodiment uses sub-task node A and sub-task node B as an example, but the actual application is not limited to this.

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

[0110] In this step, after the user completes the above splitting operation, they can use recursive traversal to concatenate the descriptive text information and input / output parameter information of each node (including the root node and sub-task nodes) with prompt words to obtain all the prompt word information.

[0111] For example, in this embodiment, taking the generation of code for calculating mortgage interest rates as an example, the prompt word concatenation is performed first. The following is a pre-set prompt word template (the pre-set text does not need to be noticed by the user):

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

[0113] I will give you the following method definition:

[0114] ##Method Definition

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

[0116] Following the steps outlined in this embodiment, and after recursive traversal, the final concatenated prompt word template is obtained as follows:

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

[0118] I will give you the following method definition:

[0119] ##Method Definition

[0120] - Implement the function to calculate the annual mortgage interest rate:

[0121] Input parameter: loan_amount represents the loan amount, and is of type double.

[0122] Output: of type double

[0123] - The function to calculate the annual mortgage interest rate includes the following three methods:

[0124] -Method A is for obtaining base interest rate information:

[0125] Input parameters: None

[0126] Output: of type double

[0127] Method B involves adjusting the base interest rate based on factors such as the loan amount and the recommended loan term.

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

[0129] Output: of type double

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

[0131] In this embodiment of the invention, the initial description text of the code requirements document is obtained; the initial description text is set as the root node, and the content area of ​​the root node is a rich text editing box including the initial description text; when the user's operation instruction of selecting at least one portion of the initial description text in the rich text editing box is detected, the selected portion of the initial description text is split into at least one first sub-task node, wherein the selected portion of the initial description text is displayed as the function name of the corresponding first sub-task node; the position of each first sub-task node is determined sequentially according to a top-down tree nested structure; and the description text and input / output parameters of each first sub-task node are determined; after each first sub-task node is split, the background color of the selected portion of the initial description text is displayed as a set color, and a line is added between each first sub-task node and the root node; the root node and the portion of the initial description text and input / output parameters of each first sub-task node are concatenated with prompt words using a recursive traversal method to obtain the final prompt word information. In other words, in this embodiment of the invention, users do not need to focus on the specific content of the prompt words, but only on the breakdown of large-granular tasks. By using the rich text editing box and tree layout, the contextual relationships and parameter definitions between the task breakdown nodes can be displayed intuitively, which can better assist in the construction of prompt words, effectively reduce the uncertainty of prompt words in the process of generating code for large models, and thus improve the accuracy of large model code generation.

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

[0133] When a user's operation command to select at least one part of the description text of the first subtask node is detected, the selected part of the description text is split into at least one second subtask node, wherein the selected part 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 sequentially according to the tree nesting 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 part of the description text is displayed as the set color, and a line is added between each second subtask node and the corresponding first subtask node; using a recursive traversal, the root node, the partial initial description text and input / output parameters of each first subtask node, and the partial description text and second input / output parameters of each second subtask node are concatenated with prompt words to obtain the 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 based on each first sub-task node.

[0135] In other words, after splitting to obtain a first sub-task node (i.e., a function node), this first sub-task node includes: a function name, function description, parameter table configuration, etc. The parameter table configuration uses form components to define the types and descriptions of the function node's input and output parameters. The function description area is represented as a rich text edit box, which allows the user to select a portion of the text. After the user selects the text and right-clicks, a sub-task (second sub-task) is added to the current function node. This second sub-task is represented as a child function node (i.e., the second sub-task node, also called a sub-child task node), where the selected text is displayed as the function name of the child function node. After the user creates the child function node, the background color of the previously selected text is set to blue. Simultaneously, a connecting line is added between the two functions (the first and second sub-task nodes) to indicate their parent-child relationship. Specifically... Figure 3 As shown, Figure 3 This is a schematic diagram illustrating a splitting of a task into two sub-task nodes (i.e., the first sub-task node) and one sub-sub-task node (i.e., the second sub-task node) according to an embodiment of the present invention. As shown in the figure, this embodiment takes the splitting into sub-task node A and sub-task node B as examples, and sub-sub-task node C as an example, but it is not limited to this in practical applications.

[0136] After the user completes the above splitting operation, they can use recursive traversal to concatenate the descriptive text information and input / output parameter information of each node (including the root node, the first sub-task node, and the second sub-task node) with prompt words to obtain the final prompt word information.

[0137] For example, this embodiment still uses "generating code to calculate mortgage interest rates" as an example for concatenating prompt words. The following prompt word template is preset (the user does not need to pay attention to the preset text):

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

[0139] I will give you the following method definition:

[0140] ##Method Definition

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

[0142] Following the steps outlined in this embodiment, and after recursive traversal, the final concatenated prompt word template is obtained as follows:

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

[0144] I will give you the following method definition:

[0145] ##Method Definition

[0146] - Implement the function to calculate the annual mortgage interest rate:

[0147] Input parameter: loan_amount represents the loan amount, and is of type double.

[0148] Output: of type double

[0149] - The function to calculate the annual mortgage interest rate includes the following three methods:

[0150] -Method A is for obtaining base interest rate information:

[0151] Input parameters: None

[0152] Output: of type double

[0153] Method B involves adjusting the base interest rate based on factors such as the loan amount and the recommended loan term.

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

[0155] Output: of type double

[0156] Method B contains one of the following methods:

[0157] Method C is for obtaining the recommended loan term:

[0158] Input parameters: None

[0159] Output: of type double

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

[0161] In this embodiment of the invention, users do not need to focus on the specific content of the prompt words, but only on the breakdown of large-granular tasks. By using this embodiment of the invention, the contextual relationships and parameter definitions between the node task breakdowns can be displayed intuitively, which can better assist in the construction of prompt words, effectively reduce the uncertainty of prompt words in the process of generating code for large models, and thus improve 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 sub-task node sequentially according to the top-down tree nesting structure corresponding to the position of the first sub-task node includes:

[0163] The top-left corner of each first sub-task node is taken as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first sub-task node is offset to the right by a third fixed value (50px) relative to the parent node, and offset downward by the height of the parent node plus a fourth fixed value (20px). The third and fourth fixed values ​​can be adjusted arbitrarily as needed. The third fixed value may be the same as or different from the first fixed value, and the fourth fixed value may be the same as or different from the second fixed value.

[0164] The step of determining the description text and second input / output parameters of each second subtask node includes: defining the description text and second input / output parameters of each second subtask node according to the operation instructions input by the user.

[0165] Optionally, in another embodiment, based on the above embodiments, the method may further include: modifying the initial description text of the root node according to the detected user input operation instruction based on the rich text editing box of the root node; and / or modifying the first sub-task node or the second sub-task node according to the detected user input operation instruction based on the form data of the first sub-task node or the second sub-task node, wherein the form data includes: a rich text editing 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 editing box, where users can manually modify the initial description text of the prompt node; while the function node or its sub-function nodes include form data such as rich text editing boxes, drop-down selection components, and configuration table components, which users can modify to achieve the modification of the function node or its sub-function nodes.

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

[0168] In other words, in this embodiment of the invention, either the first task node or the second sub-task node obtained after splitting can be deleted, since the root node (prompt node) is unique and cannot be deleted. For sub-task nodes, the user can delete the function node itself by clicking on the function node (or its sub-function node, hereinafter the same). Simultaneously, the sub-tasks and associated connections of that function node will also be deleted; the background color of the selected text in the rich text editor of the parent node of that function node will also be cleared. When the user deletes the selected text information (with a blue background) in the rich text editor of a node, the corresponding sub-task node of the selected text will also be deleted.

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

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

[0171] Please also see Figure 4 This is another flowchart illustrating an interactive method for assisting in constructing prompt words, provided by an embodiment of the present invention. The method includes:

[0172] Step 401: Obtain the initial description text of the code requirements document, set the initial description text as a prompt node, and the content area of ​​the prompt node is displayed as a rich text editing box, which allows users to select part of the text.

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

[0174] In this step, the rich text editing box of the prompt node allows users to select a portion of the text. After selecting the text, right-clicking adds a subtask to the current prompt node. The subtask is represented as a function node, where the selected text is displayed as the function name. 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 prompt node and the function node to indicate that the prompt node and the function node have a parent-child relationship.

[0175] A subtask, or function node, contains a function name, function description, parameter list configuration, etc. The parameter list configuration uses a form component to define the types and descriptions of the input and output parameters of the function node. The function description area is displayed as a rich text edit box, which allows users to select a portion of the text. After selecting, right-clicking adds a subtask to the current function node. The subtask is displayed as a function node, where the selected text is displayed as the function name of the function node. After the user creates a function node, the background color of the previously selected text will be set to blue. At the same time, a connecting line will be added between the two function nodes to indicate that they are parent and child.

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

[0177] Step 404: Repeat step 403 until there are no smaller tasks to break down. 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 (background color is blue) in the rich text edit box of a node, the sub-task node corresponding to the selected text will also be deleted. At this point, the code requirement document splitting work is completed.

[0178] In this step, the content area of ​​the prompt node is an edit box, and users can manually modify the node description; the function node contains rich text edit boxes, drop-down selection components, configuration table components, and other forms, 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 it, and its subtasks and associated connections will also be deleted. Simultaneously, the background color of the selected text in the rich text editor of the parent node of the function node will be cleared. When a user deletes the selected text (with a blue background) in the rich text editor of a node, the corresponding subtask node will also be deleted.

[0180] In this step, each splitting and deletion of a node causes a node rearrangement. The top-left corner of each node is used as its coordinates. During system initialization, the prompt node's coordinates are (0px, 0px). Its width and height depend on the actual width of the node content; generally, the height and width are set to fixed values ​​for each node type. In the example image, the width is set to 1000px and the height to 100px. To ensure clear display of each node, the child node's coordinates are offset 50px to the right and 20px down relative to the parent node's height. These offsets can be adjusted freely.

[0181] Assuming the root node is located at (0px, 0px) and has a width and height of (1000px, 100px), add a child node A to the root node. Node A has a width and height of (1000px, 100px). Then, the x-coordinate of child node A is 0 + 50 = 50px, and the y-coordinate is 0 + 100 + 20 = 120px, resulting in the coordinates of child node A being (50px, 120px). Next, add a child node B to the root node. The position of child node A remains unchanged, and the x-coordinate of child node B is 0 + 50 = 50px, and the y-coordinate is 120 + 100 + 20 = 240px, resulting in the coordinates of child node B being (50px, 240px). The coordinates of other child nodes are determined in the same way.

[0182] Therefore, the coordinates of each task node or sub-task node are calculated from top to bottom according to the nested tree structure, as 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, use recursive traversal to concatenate the descriptions of each node and the corresponding input and output parameters with prompt words to obtain the final prompt word information.

[0192] In this step, after the user completes the above splitting operation, the description information and input / output parameter information of each node are concatenated with prompt words using a recursive traversal method to obtain the final prompt word information, which is then used as input to generate the corresponding code through the output of the large model.

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

[0194] In this embodiment of the invention, an interactive method for assisting in the construction of prompt words is designed by utilizing rich text editing boxes, mouse operations, form components, and tree layout concepts. This method can intuitively display the contextual relationships and parameter definitions between the sub-modules, and can better assist in the construction of prompt words.

[0195] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the present invention.

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

[0197] Module 501 is used to retrieve the initial description text of the code requirements document;

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

[0199] The first splitting module 503 is used to split the selected initial description text into at least one first subtask node when the user detects at least one operation instruction of selecting a portion of the initial description text in the rich text editing box. The selected portion of the initial description text is displayed as the function name of the corresponding first subtask node.

[0200] The first determining module 504 is used to determine the position of each first subtask node in a top-down tree nested structure; and to determine the description text and input / 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 selected portion as a set color after each first subtask node is split, and to add a connecting line between each first subtask node and the root node.

[0202] The splicing module 506 is used to splice the root node and a portion of the initial description text and input / output parameters of each first subtask node with prompt words using a recursive traversal method to obtain the 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, the structural block diagram of which is shown below. Figure 6 As shown, where,

[0204] The second splitting module 601 is used to split the selected partial description text into at least one second sub-task node when the user selects at least one operation instruction of the partial description text of the first sub-task node by boxing the first sub-task node before the splicing module 506 splices the prompt words. The selected partial description text is displayed as the function name of the corresponding second sub-task node.

[0205] The second determining module 602 is used to determine the position of each second subtask node in a tree-like nested structure from top to bottom according to the position of the corresponding first subtask node; and to determine the description text and second input / 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 to add a line between each second subtask node and the corresponding first subtask node.

[0207] The splicing module 506 is further configured to use a recursive traversal method to splice the root node, the partial initial description text and input / output parameters of each first subtask node, and the partial description text and second input / output parameters of each second subtask node into prompt words to obtain the final prompt word information.

[0208] Optionally, the device further includes:

[0209] The first modification module is used to modify the initial description text of the root node based on the rich text edit box of the root node, according to the operation command detected by the user input; and / or

[0210] The second modification module is used to modify the first sub-task node or the second sub-task node based on the form data of the first sub-task node or the second sub-task node, according to the operation instructions detected by the user input. 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, the structural block diagram of which is shown below. Figure 7 As shown, the Figure 7 Therefore Figure 6 For example,

[0212] The deletion module 701 is configured to delete the first sub-task node obtained by the first splitting module or the second sub-task node obtained by the second splitting module according to the detected user input operation command; and to delete the sub-tasks and related connections of the first sub-task node or the second sub-task node; and

[0213] The clearing module 702 is used to clear the background color of the text selected in the rich text editing box of the parent node of the first sub-task node or the second sub-task node that has been deleted by the deletion module 701.

[0214] Optionally, the device further includes:

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

[0216] Optionally, the first determining module includes:

[0217] The first position determination module is used to take the upper left corner of each root node as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first sub-task node is offset to the right by a first fixed value relative to the parent node and offset downward by the height of the parent node plus a second fixed value. The first fixed value and the second fixed value can be adjusted arbitrarily as needed.

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

[0219] Optionally, the second determining module includes:

[0220] The second position determination module is used to take the upper left corner of each first sub-task node as the position of the parent node. The width and height are set according to the actual node content width. The position of each first sub-task node is offset to the right by a third fixed value relative to the parent node and offset downward by the height of the parent node plus a fourth fixed value.

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

[0222] Optionally, embodiments of the present invention also provide an electronic device, comprising:

[0223] processor;

[0224] Memory used to store the processor's executable instructions;

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

[0226] Optionally, embodiments of the present invention also provide a computer-readable storage medium, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the interactive method for assisting in the construction of prompt words as described above.

[0227] Optionally, embodiments of the present invention also provide a computer program product, including a computer program or instructions, which, when executed by a processor of an electronic device, implement the interactive method for assisting in the construction of prompt words as described above.

[0228] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0229] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0230] Figure 8 This is a block diagram of an electronic device 800 provided in an embodiment of the present invention. For example, the electronic device 800 can be a mobile terminal or a server; in this embodiment, a mobile terminal is used as an example for explanation. For example, the electronic device 800 can be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, 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] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.

[0233] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. 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 storage, flash memory, magnetic disk, or optical disk.

[0234] Power supply component 806 provides power to various components of electronic device 800. 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 electronic device 800.

[0235] 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 touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0236] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, 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 buttons, volume buttons, power buttons, and lock buttons.

[0238] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0239] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may 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 perform the interactive method for assisting in constructing prompts as described above.

[0241] In this embodiment, a computer-readable storage medium is also provided, which, when executed by a processor of an electronic device, enables the electronic device 800 to perform the interactive method for assisting in constructing prompts as described above. For example, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.

[0242] In one embodiment, a computer program product is also provided, including a computer program or instructions that, when executed by the processor 820 of the electronic device 800, cause the electronic device 800 to perform the aforementioned interactive method for assisting in constructing prompt words.

[0243] Figure 9 This is a block diagram of an apparatus 900 for assisting in the construction of interactive prompts, provided in an embodiment of the present invention. For example, apparatus 900 may be provided as a server. See also... Figure 9 The apparatus 900 includes a processing component 922, which further includes one or more processors, and memory resources represented by memory 932 for storing instructions, such as application programs, that can be executed by the processing component 922. The application programs stored in memory 932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 922 is configured to execute instructions to perform the methods described above.

[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 can operate on an operating system stored in memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.

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

[0246] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. An interactive method for assisting in the construction of prompt words, characterized in that, The method is applied to code requirement document splitting task scenarios, including: Obtain the initial description text from the code requirements document; Set the initial description text as the root node, and the content area of ​​the root node is a rich text editing box that includes the initial description text; When a user is detected to have selected at least one initial description text in the rich text editing box, the selected initial description text is split into at least one first sub-task node, wherein the selected initial description text is displayed as the function name of the corresponding first sub-task node; The position of each first subtask node is determined sequentially according to the top-down tree nesting structure; and the description text and first input / output parameters of each first subtask node are determined. After each first subtask node is split, the background color of the initial description text of the selected portion is displayed as the set color, and a line is added between each first subtask node and the root node; By recursively traversing the root node and the initial description text of each first subtask node, along with the first input and output parameters, the prompt words are concatenated to obtain the final prompt word information.

2. The interactive method for assisting in the construction of prompt words according to claim 1, characterized in that, Before using recursive traversal to concatenate the initial description text of the root node and a portion of the initial input / output parameters of each first subtask node with prompt words to obtain all prompt word information, the method further includes: When a user is detected to have selected at least one operation instruction of the partial description text of the first subtask node, the selected partial description text is split into at least one second subtask node, wherein the selected partial description text is displayed as the function name of the corresponding second subtask node; The position of each second subtask node is determined sequentially from top to bottom in a tree-like nested structure 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 part of the description text is displayed as the set color, and a line is added between each second subtask node and the corresponding first subtask node; The method of recursively traversing the root node and the initial description text of each first subtask node, along with the first input and output parameters, is used to concatenate prompt words to obtain the final prompt word information, including: By recursively traversing the root node, the partial initial description text and first input / output parameters of each first subtask node, and the partial description text and second input / output parameters of each second subtask node, the prompt words are concatenated to obtain the final prompt word information.

3. The interactive method for assisting in the construction of prompt words according to claim 2, characterized in that, The method further includes: Based on the rich text editing box of the root node, the initial description text of the root node is modified according to the detected user input operation instruction; and / or Based on the form data of the first sub-task node or the second sub-task node, the first sub-task node or the second sub-task node is modified according to the operation instructions detected by the user input. 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 the construction of prompt words according to claim 2, characterized in that, The method further includes: Based on the detected user input command, delete the corresponding first subtask node or second subtask node; and delete the subtasks and related connections associated with the first subtask node or second subtask node; and Clear the background color of the text selected in the rich text editing box of the parent node of the deleted first sub-task node or second sub-task node.

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

6. The interactive method for assisting in the construction of prompt words according to claim 1, characterized in that, The step of determining the position of each first subtask node sequentially according to a top-down tree-like nested structure includes: The top left corner of each root node is used as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first child task node is offset to the right by a first fixed value relative to the parent node, and offset downward by the height of the parent node plus a second fixed value. The first fixed value and the second fixed value can be adjusted arbitrarily as needed. Determining the description text and first input / output parameters of each first subtask node includes: defining the description text and first input / output parameters of each first subtask node according to the operation instructions input by the user.

7. The interactive method for assisting in the construction of prompt words according to claim 2, characterized in that, The step of determining the position of each second subtask node sequentially according to the top-down tree nesting structure corresponding to the position of the first subtask node includes: The top left corner of each first subtask node is taken as the position of the parent node. The width and height are set according to the actual width of the node content. The position of each first subtask node is offset to the right by a third fixed value relative to the parent node, and offset downward by the height of the parent node plus a fourth fixed value. The third fixed value and the fourth fixed value can be adjusted arbitrarily as needed. The step of determining the description text and second input / output parameters of each second subtask node includes: defining the description text and second input / output parameters of each second subtask node according to the operation instructions input by the user.

8. An interactive device for assisting in the construction of prompt words, characterized in that, The device is applied to code requirement document splitting task scenarios, including: The retrieval module is used to retrieve the initial description text from the code requirements document; The setting module is used to set the initial description text as the root node, and the content area of ​​the root node is a rich text editing box that includes the initial description text. The first splitting module is used to split the selected initial description text into at least one first subtask node when the user detects at least one operation instruction of selecting a portion of the initial description text in the rich text editing box. The selected portion of the initial description text is displayed as the function name of the corresponding first subtask node. The first determining module is used to determine the position of each first subtask node in a top-down tree-like nested structure; and to determine the description text and first input / output parameters of each first subtask node. The first display module is used to display the background color of the initial description text of the selected portion as a set color after each first subtask node is split, and to add a connection between each first subtask node and the corresponding root node. The concatenation module is used to concatenate the root node and a portion of the initial description text of each first subtask node with the first input and output parameters using a recursive traversal method to obtain all prompt word information.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the interactive method for assisting in the construction of 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 the processor of the electronic device, the electronic device is enabled to perform the interactive method for assisting in the construction of 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