Text display method and device of electronic equipment and readable storage medium

By detecting and processing the integrity of the text generated by the text generation model, combining target identification and data identification, and embedding the text generation model in the VS Code plug-in, the problem of high resource consumption when displaying text on electronic devices is solved, achieving resource conservation and improving user experience.

CN120654652APending Publication Date: 2025-09-16GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510539179.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

When existing electronic devices display text generated based on a text generation model on a display interface, they consume a lot of resources, resulting in high power consumption.

Method used

By detecting whether the target text is complete, displaying the target text on the display area of ​​the electronic device and stopping acquiring new text, or continuously acquiring and displaying new text, the target identifier and data identifier are combined for rapid detection, parsing and highlighting text with specific attributes, and embedding a text generation model in the VS Code plug-in to filter invalid data.

Benefits of technology

It reduces resource consumption of electronic devices, extends battery life, ensures users can view complete text, improves user experience and system stability, and reduces development costs and complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120654652A_ABST
    Figure CN120654652A_ABST
Patent Text Reader

Abstract

The invention provides a text display method and device of electronic equipment and a readable storage medium, the method is applied to the technical field of text processing, and the method comprises the following steps: when a target text generated based on a text generation model is obtained, detecting whether the target text is a complete text; under the condition that the target text is the complete text, displaying the target text on a first display area of the electronic equipment, and stopping obtaining the new text; and under the condition that the target text is the incomplete text, displaying the target text on the first display area, continuously obtaining a new text, and continuously displaying the new text on the first display area. According to the method, when the electronic equipment displays the target text on the display screen, the resource consumption of the electronic equipment is reduced, so that the power consumption of the electronic equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text processing technology, and more specifically, to a text display method, device and readable storage medium of an electronic device in the field of text processing technology. Background Art

[0002] With the widespread application of artificial intelligence technology in text processing, text output based on text generation models (such as large language models) has become a core interactive feature of electronic devices (such as computers and terminal devices). However, when current electronic devices display text generated based on text generation models on their display interfaces, they consume significant resources (such as processors and memory), resulting in high power consumption.

[0003] Therefore, how to reduce resource consumption of an electronic device when displaying text on a display interface is a technical problem that urgently needs to be solved. Summary of the Invention

[0004] The present application provides a text display method, device and readable storage medium for an electronic device. The method can reduce the resource consumption of the electronic device when the electronic device displays text on a display interface, thereby reducing the power consumption of the electronic device.

[0005] In a first aspect, a text display method for an electronic device is provided, the method comprising: in response to acquiring a target text, detecting whether the target text is a complete text, the target text being obtained based on a text generation model; if the target text is a complete text, displaying the target text on a first display area of ​​the electronic device, and stopping acquiring new text; if the target text is an incomplete text, displaying the target text on the first display area, and continuously acquiring new text and continuing to display the new text on the first display area.

[0006] In the above technical solution, when the target text is acquired, it is detected whether the target text is a complete text, so that when it is detected that the target text is a complete text, the target text is displayed on the first display area of ​​the electronic device and the acquisition of new text is stopped. That is, compared with the prior art in which the electronic device continuously acquires the target text generated by the text generation model until no new text is acquired, the text display method of the electronic device provided in the embodiment of the present application can avoid the electronic device from continuing to acquire new text when a complete text is acquired, thereby reducing unnecessary resource consumption (such as processor and memory) of the electronic device; in addition, since the acquired target text is a complete text, the target text is displayed on the first display area of ​​the electronic device and the acquisition of new text is stopped. In this case, it no longer makes sense to continue acquiring new text. Therefore, stopping acquiring new text in this case will not affect the text content that the user needs to view, and can also help extend the battery life of the electronic device; when it is detected that the target text is incomplete, not only the currently acquired target text is displayed on the first display area, but new text is also continuously acquired and displayed in the same area, so as to ensure that the user can view the complete target text and avoid information loss or interruption; in addition, since the acquired target text is incomplete, the user can view the latest text content without manually refreshing or switching pages, thereby improving user convenience.

[0007] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the target text corresponds to a target identifier, which is used to indicate whether the target text is complete; detecting whether the target text is a complete text includes: when the target identifier is a first identifier, determining that the target text is a complete text, and the first identifier is used to indicate that the target text is a complete text; when the target identifier is a second identifier, determining that the target text is an incomplete text, and the second identifier is used to indicate that the target text is an incomplete text.

[0008] In the above technical solution, since the target text corresponds to a target identifier (i.e., the first identifier or the second identifier), and the target identifier can directly indicate the integrity of the target text, detecting whether the target text is a complete text based on the target identifier can avoid complex analysis or calculation processes. This method is simple and efficient, and can quickly complete the detection task of the target text, thereby reducing system load and resource consumption; in addition, detecting the integrity of the target text through a clear target identifier can also reduce the possibility of misjudgment.

[0009] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, displaying the target text on the first display area of ​​the electronic device includes: parsing the target text, identifying the target subtext in the target text, the target subtext being a preset text with specific attributes; highlighting the format of the target subtext, and integrating the highlighted target subtext into the target text to obtain the highlighted target text; and displaying the highlighted target text on the first display area.

[0010] In the above technical solution, after obtaining the target text, the target text is automatically parsed and text with specific attributes (i.e., target subtext) within the target text is highlighted. The highlighted target subtext is then integrated into the target text to obtain the highlighted target text. The highlighted target text is then displayed in the first display area. This can reduce the time it takes for a user to search for the target subtext, thereby improving the user's work efficiency. In addition, since the preset text with specific attributes, i.e., the target subtext, can be identified and highlighted, the error rate that may occur during manual search can also be reduced.

[0011] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, obtaining the target text includes the following steps: in response to the input target data, detecting whether the type of the target data is a target type, the target type is used to indicate that a request to generate a target text corresponding to the target data is allowed; when the type of the target data is the target type, the target data is input into a text generation model to obtain a target text corresponding to the target data generated by the text generation model, and the text generation model is a text generation model embedded in a VS Code plug-in of an electronic device.

[0012] In the above technical solution, by detecting whether the type of the target data is the target type, if the type of the target data is the target type, the target data is input into the text generation model to generate the target text corresponding to the target data based on the text generation model, thereby effectively filtering out invalid data input into the text generation model, thereby avoiding generation failure or system abnormality caused by erroneous data, and thus improving the stability and reliability of the system; in addition, since the text generation model is embedded in the VS Code plug-in of the electronic device, there is no need to rely on an external platform when generating the target text corresponding to the target data, thereby reducing additional development costs and complexity.

[0013] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the method also includes: before responding to the input target data, detecting whether a target file exists, the target file is used to indicate that the identity of the target object has been verified; if the target file exists, displaying a target window on the second display area of ​​the electronic device, the target window is used to receive the target data; if the target file does not exist, displaying a prompt message, the prompt message is used to prompt whether to jump to the login interface; if it is determined to jump to the login interface, jumping to the login interface, and in response to the input account and password, authenticating the target object based on the account and password, and displaying the target window on the second display area after the identity of the target object is verified.

[0014] In the above technical solution, before responding to the input target data, it is detected whether the target file exists to confirm whether the identity of the target object (i.e., the user) has been verified. This method ensures that only authenticated users can perform subsequent operations, thereby effectively protecting the security of the system and the confidentiality of the data to prevent unauthorized access and data leakage. In addition, when the target file exists (i.e., the user has passed the identity authentication), the target window can be directly displayed on the second display area to receive the target data, thereby simplifying the user's operating process. When the target file does not exist, the user will be actively prompted whether to jump to the login interface. If the user determines to jump to the login interface, the user will be jumped to the login interface to authenticate the user, avoiding mandatory jump interference and improving the user's autonomy and satisfaction.

[0015] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, in response to the input target data, detecting whether the type of the target data is the target type includes: in response to the input target data, parsing the target data, obtaining a data identifier in the target data, and the data identifier is used to indicate whether the target data is the target type; when the data identifier is a first data identifier, determining that the type of the target data is the target type, and the first data identifier is used to indicate that the target data is the target type; when the data identifier is a second data identifier, determining that the type of the target data is not the target type, and the second data identifier is used to indicate that the target data is not the target type.

[0016] In the above technical solution, by parsing the data identifiers in the target data, it is possible to directly determine whether the target data type is the target type, avoiding complex analysis or calculation processes. This method is simple and efficient, and can quickly complete the type detection task, thereby reducing system load and resource consumption. In addition, the use of clear data identifiers (i.e., the first data identifier and the second data identifier) ​​to distinguish the type of the target data reduces the possibility of misjudgment. For example, if the judgment relies on the data content itself, it may lead to incorrect recognition due to format, structure, or other factors.

[0017] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the text generation model includes a text encoder and a text decoder; when the type of the target data is a target type, the target data is input into the text generation model to obtain a target text generated by the text generation model corresponding to the target data, including: when the type of the target data is a target type, calling the application programming interface of the text generation model, inputting the target data into the text encoder based on the application programming interface of the text generation model, obtaining a target semantic feature generated by the text encoder corresponding to the target data, and inputting the target semantic feature into the text decoder to obtain a target text generated by the text decoder corresponding to the target semantic feature.

[0018] In the above technical solution, the target data is input into the text encoder to generate target semantic features corresponding to the target data. Since the text encoder can capture the deep semantic information in the target data, it can provide rich contextual support for subsequent text generation, so that the target text generated by the text decoder based on the target semantic features can be more in line with the actual meaning of the target data.

[0019] In combination with the first aspect and the above implementations, in some possible implementations, the method further includes: when the type of the target data is not the target type, prohibiting the target data from being input into the text generation model.

[0020] In the above technical solution, when the type of the target data is not the target type, it is prohibited to input the target data into the text generation model, which can avoid unnecessary processing of data that does not meet the conditions and save computing resources and time costs.

[0021] In a second aspect, a text display device for an electronic device is provided, the device comprising:

[0022] a detection module, configured to detect whether the target text is a complete text in response to obtaining the target text, wherein the target text is obtained based on the text generation model;

[0023] a control module, configured to display the target text on the first display area of ​​the electronic device and stop acquiring new text when the target text is a complete text;

[0024] The control module is further configured to display the target text on the first display area when the target text is incomplete, and to continuously acquire new text and continue to display the new text on the first display area.

[0025] In a third aspect, an electronic device is provided, comprising a memory and a processor. The memory is configured to store executable program code, and the processor is configured to retrieve and execute the executable program code from the memory, so that the electronic device executes the text display method of the first aspect or any possible implementation of the first aspect.

[0026] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the text display method in the first aspect or any possible implementation of the first aspect.

[0027] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the text display method in the above-mentioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 Schematic diagram of an implementation environment of a text display method for an electronic device provided in an embodiment of the present application;

[0029] Figure 2 is a schematic flow chart of a text display method of an electronic device provided in an embodiment of the present application;

[0030] Figure 3 is a schematic flow chart of another text display method of an electronic device provided in an embodiment of the present application;

[0031] Figure 4 This is a schematic diagram of the display effect of a first display area and a second display area on a display screen provided in an embodiment of the present application;

[0032] Figure 5 This is a schematic diagram of an interactive flow of a text display method for an electronic device provided in an embodiment of the present application;

[0033] Figure 6 This is a structural diagram of a text display device of an electronic device provided in an embodiment of the present application;

[0034] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The following will clearly and thoroughly describe the technical solutions in this application in conjunction with the accompanying drawings. In the description of the embodiments of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more than two.

[0036] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0037] Before introducing the text display method of the electronic device provided by the embodiment of the present application, the implementation environment of the text display method of the electronic device provided by the embodiment of the present application is first introduced. Figure 1 , Figure 1 A schematic diagram of an implementation environment of a text display method for an electronic device provided in an embodiment of the present application.

[0038] For example, Figure 1 As shown, the implementation environment includes: a text processing controller 110 , a display screen controller 120 and a display screen 130 .

[0039] Among them, the text processing controller 110 is an important control unit of the electronic device. The text processing controller 110 can obtain the corresponding text based on the text generation model and control the display screen 130 to perform corresponding operations based on the text. Specifically, the text processing controller 110 can respond to the target text obtained based on the text generation model and detect whether the target text is a complete text, so that when the target text is a complete text, the display screen controller 120 displays the target text on the first display area of ​​the display screen 130 of the electronic device and stops acquiring new text. That is, at this time, the text processing controller 110 will no longer acquire new text based on the text generation model, and the display screen controller 120 will no longer receive new text instruction information sent by the text controller 110; when the target text is incomplete, the display screen controller 120 displays the target text on the first display area of ​​the display screen 130, and continues to acquire new text and continue to display new text on the first display area of ​​the display screen 130. That is, at this time, the text processing controller 110 will continue to acquire new text based on the text generation model and continue to display new text on the first display area of ​​the display screen 130 through the display screen controller 120.

[0040] In one possible embodiment, after obtaining the target text based on the text generation model, the text processing controller 110 generates instruction information corresponding to the target text and sends the instruction information to the display screen controller 120, so that the display screen controller 120 controls the display screen 130 to display the target text on the first display area based on the instruction information.

[0041] It should be noted that Figure 1 This is merely a schematic diagram of an implementation environment. In practice, the devices that interact with the text processing controller may include other controllers in addition to the display controller 120 and the display 130. This embodiment of the present application does not specifically limit this.

[0042] Below through Figure 2 The method of the embodiment of the present application is described in detail.

[0043] Figure 2 This is a schematic flowchart of a text display method for an electronic device provided in an embodiment of the present application.

[0044] For example, Figure 2 As shown, the execution subject is Figure 1 Taking the text processing controller 110 in FIG. 1 as an example, the method 200 includes the following steps 201 to 203.

[0045] Step 201 : In response to obtaining a target text, detecting whether the target text is a complete text, where the target text is obtained based on a text generation model.

[0046] The target text is any type of text data generated based on a text generation model, including but not limited to any of the following forms: natural language text (such as article paragraphs, news reports, story content, etc.), code snippets, structured data (such as tables, JSON format data, XML documents, etc.).

[0047] It can be understood that a text generation model is an algorithmic model trained through machine learning technology (for example, the DeepSeek model), which is used to generate text content that conforms to specific rules or semantic requirements. The model is usually trained based on a large amount of historical data and can generate coherent and logical output results (i.e., target text) based on given input conditions (such as topics, contextual information, etc.).

[0048] It should be noted that in order to facilitate the determination of whether the target text is a complete text, in one possible implementation, the target text corresponds to a target identifier, which is used to indicate whether the target text is complete, that is, whether the target text can meet specific requirements or contain all necessary information.

[0049] Specifically, the target identifier can be a first identifier (e.g., true) or a second identifier (e.g., false). The first identifier is used to indicate that the target text is a complete text, and the second identifier is used to indicate that the target text is an incomplete text. That is, in a possible implementation, when the target identifier is the first identifier, the target text can be determined to be a complete text; when the target identifier is the second identifier, the target text can be determined to be an incomplete text.

[0050] It can be understood that when the target identifier is the first identifier, it indicates that the target text can meet specific requirements or contain all necessary information, so in this case the target text can be determined to be a complete text; when the target identifier is the second identifier, it indicates that the target text has deficiencies or defects in some aspects, that is, the target text may lack key information, contain logical errors or fail to contain all necessary information, so in this case the target text can be determined to be an incomplete text.

[0051] It should be noted that since the target text corresponds to a target identifier (such as the first identifier or the second identifier), and the target identifier can directly indicate the integrity of the target text, complex analysis or calculation processes can be avoided. This method is simple and efficient and can quickly complete the target text detection task, thereby reducing system load and resource consumption; in addition, detecting the integrity of the target text through a clear target identifier can also reduce the possibility of misjudgment.

[0052] Step 202: If the target text is a complete text, the target text is displayed on the first display area of ​​the electronic device, and acquisition of new text is stopped.

[0053] Among them, the electronic device can be any device that can install a text generation model, such as a smart phone, a tablet, a laptop computer, a desktop computer, or a virtual reality terminal, and the embodiments of the present application are not limited to this.

[0054] The first display area is a specific area or the entire area on the display screen of the electronic device preset by the developer. For example, the first display area can be the entire interface of the electronic device, or a specific window on a computer monitor, etc., which is not limited in this embodiment of the present application.

[0055] It should be noted that in order to reduce unnecessary resource (such as processor and memory) consumption, before displaying the target text on the first display area of ​​the electronic device, it is necessary to first detect whether the target text is a complete text, so that when the target text is a complete text, the target text is displayed on the first display area of ​​the electronic device and the acquisition of new text is stopped, thereby reducing unnecessary resource consumption; in addition, since when the acquired target text is a complete text, that is, when the acquired target text can meet specific requirements or contains all necessary information, it is no longer meaningful to continue to acquire new text. Therefore, stopping acquiring new text in this case will not affect the text content that the user needs to view, and will also help to extend the battery life of the electronic device.

[0056] Specifically, when the target text is detected to be complete text, the text processing controller generates instruction information corresponding to the target text and sends the instruction information to the display screen controller 120, so that the display screen controller controls the display screen of the electronic device to display the target text in the first display area based on the instruction information. In addition, to reduce unnecessary resource consumption, the text controller stops acquiring new text at this time. That is, the text processing controller will no longer acquire new text based on the text generation model, and the display screen controller will no longer receive new text instruction information sent by the text controller.

[0057] In order to reduce the need for manual operations by the user and thus improve the user's work efficiency, in one possible implementation, after obtaining the target text, the target text can be first parsed to identify the text with specific attributes preset in the target text, i.e., the target subtext. The format of the target subtext is then highlighted, and the highlighted target subtext is integrated into the target text to obtain the highlighted target text. Finally, the highlighted target text is displayed on the first display area. Since the target text that is ultimately displayed is the text with the specific attributes (i.e., the target subtext) in the target text that has been highlighted, the efficiency of the user in finding the target subtext can be improved, and the error rate that may occur when the user searches can also be reduced.

[0058] The target subtext is a pre-defined text with specific attributes. For example, when the target text is a code snippet, the target subtext can be a statement or Chinese comment; when the target text is a story, the target subtext can be the story title, main character names, and plot summary; when the target text is a scientific article, the target subtext can be the abstract, research methods, experimental results, and conclusions; when the target text is news information, the target subtext can be the date, main event, and related statistics.

[0059] Specifically, after obtaining the target text, the target text can be parsed using regular expressions or a dedicated syntax analyzer (e.g., a Markdown parser). Then, text matching, regular expressions, machine learning models, or other text analysis tools can be used to identify text with specific attributes (i.e., target subtexts) within the target text. For example, if the target subtext is a date, a regular expression can be used to identify subtexts within the parsed target text that conform to the date format, thereby obtaining the target subtext within the target text.

[0060] Furthermore, after obtaining the target subtext, the highlight function can be used to highlight the format of the target subtext to obtain the highlighted target subtext. It should be noted that the developer can pre-set highlight parameters (e.g., highlight color) in the highlight function so that the highlight function highlights the format of the target subtext based on the preset highlight parameters to obtain the highlighted target subtext.

[0061] In one possible implementation, after obtaining the target sub-text, you can first use a string search function (such as the find() or index() function in Python) to find the starting position and ending position of the target sub-text in the target text, so that after obtaining the highlighted target sub-text, use the string operation function to replace the target sub-text at the corresponding starting position and ending position in the target text with the highlighted target sub-text, thereby obtaining the highlighted target text, and displaying the highlighted target text on the first display area.

[0062] Step 203: If the target text is incomplete, the target text is displayed on the first display area, and new text is continuously acquired and displayed on the first display area.

[0063] Specifically, when the target text is detected to be incomplete, the text processing controller first generates instruction information corresponding to the target text, and sends the instruction information to the display screen controller, so that the display screen controller controls the display screen of the electronic device to display the target text on the first display area based on the instruction information; at the same time, the text processing controller will continue to obtain new text based on the text generation model, and continue to display the new text on the first display area of ​​the display screen through the display screen controller.

[0064] Similarly, in order to reduce the need for manual operations by the user and thus improve the user's work efficiency, when the target text is displayed on the first display area, the target text can also be parsed, the target subtext in the target text can be identified, and then the format of the target subtext can be highlighted. The highlighted target subtext is then integrated into the target text to obtain the highlighted target text, so that the highlighted target text is finally displayed on the first display area. The specific implementation of this process can be found in the implementation of step 202 in the above embodiment, and will not be repeated here.

[0065] In summary, the text display method of the electronic device provided by the embodiment of the present application, when acquiring the target text, detects whether the target text is a complete text, so that when it is detected that the target text is a complete text, the target text is displayed on the first display area of ​​the electronic device and the acquisition of new text is stopped. That is, compared with the prior art in which the electronic device continuously acquires the target text generated by the text generation model until no new text is acquired, the text display method of the electronic device provided by the embodiment of the present application can avoid the electronic device from continuing to acquire new text when a complete text is acquired, thereby reducing unnecessary resource consumption of the electronic device; in addition, since the acquired target text is complete, the target text is displayed on the first display area of ​​the electronic device when it is detected that the target text is complete. In the case of an incomplete text, it will no longer make sense to continue acquiring new text. Therefore, stopping acquiring new text in this case will not affect the text content that the user needs to view, and can also help extend the battery life of the electronic device. In the case of detecting that the target text is incomplete, not only the currently acquired target text is displayed on the first display area, but new text is also continuously acquired and displayed in the same area, so as to ensure that the user can view the complete target text and avoid information loss or interruption. In addition, since the acquired target text is incomplete, the user can view the latest text content without manually refreshing or switching pages, which also improves user convenience.

[0066] Figure 3 This is a schematic flowchart of another text display method for an electronic device provided in an embodiment of the present application.

[0067] For example, Figure 3 As shown, the execution subject is Figure 1 Taking the text processing controller 110 in FIG. 3 as an example, the method 300 includes the following steps 301 to 309.

[0068] Step 301: Detect whether a target file exists, where the target file is used to indicate that the identity of the target object has been verified.

[0069] The target file can be considered a token or credential for identity authentication. It should be noted that when the electronic device verifies the identity of the target object (i.e., the user), it will generate a specific file, namely the target file. The existence of this file is used to determine whether the target object has passed the identity authentication.

[0070] It should be noted that in order to prevent data leakage due to unauthorized access, in one possible implementation, before responding to the input target data, it is necessary to detect whether the target file exists at this time to ensure that the input target data is responded to only when the target file exists, that is, when the user has passed the identity authentication, thereby effectively preventing data leakage due to unauthorized access.

[0071] In one possible implementation, os.path.exists(ilepath) can be used to detect whether the target file exists, or the access() or stat() function can be called to detect whether the target file exists, which is not limited in this embodiment of the present application.

[0072] Step 302: If the target file exists, display a target window on the second display area of ​​the electronic device, where the target window is used to receive target data.

[0073] The target data can be understood as data input by the user to instruct the text generation model to generate the target text. The target data can be a question, a paragraph of text, or a group of keywords, etc., which is not limited in the embodiments of the present application. The target window can be understood as a visual component for providing an input interface for the user.

[0074] It is understandable that the first display area and the second display area are located at different positions on the display screen of the electronic device. Figure 4 As shown, the first display area 401 is located above the display screen 402 , and the second display area 403 is located below the first display area 401 .

[0075] It should be noted that when the target file exists, it indicates that the user has passed the identity authentication. In this case, a window for receiving target data, that is, the target window, can be displayed on the second display area of ​​the electronic device, so that the user can interact with the electronic device through the target window, that is, the user can input the target data into the electronic device through the target window.

[0076] Step 303: If the target file does not exist, a prompt message is displayed; if it is determined to jump to the login interface, the interface is jumped to, and in response to the input account and password, the target object is authenticated based on the account and password. After the identity of the target object is verified, the target window is displayed on the second display area.

[0077] It should be noted that if the target file does not exist, it indicates that the user has not passed the identity authentication. In this case, a prompt message can be displayed first to prompt the user whether he agrees to jump to the login interface. If the user decides to jump to the login interface, the interface will be jumped to the login interface, and in response to the account and password entered by the user, the user will be authenticated based on the account and password. After the user's identity is verified, the target window will be displayed on the second display area, so that the user can input the target data into the electronic device through the target window.

[0078] In one possible implementation, after receiving the account number and password entered by the user, the password corresponding to the account number stored in the database can be queried, and the password stored in the database can be compared with the password received at this time. If the two are the same, the identity authentication is passed, otherwise the identity authentication is not passed.

[0079] It should be noted that before responding to the input target data, it is detected whether the target file exists to confirm whether the identity of the target object has been verified. This method ensures that only authenticated users can perform subsequent operations, thereby effectively protecting the security of the system and the confidentiality of the data to prevent unauthorized access and data leakage. In addition, when the target file exists (that is, the user has passed the identity authentication), the target window can be directly displayed on the second display area to receive the target data, thereby simplifying the user's operation process. When the target file does not exist, the user (that is, the target object) will be actively prompted whether to jump to the login interface. If the user decides to jump to the login interface, the system will jump to the login interface to authenticate the user, avoiding mandatory jump interference and improving the user's autonomy and satisfaction.

[0080] Step 304 : In response to the input target data, detecting whether the type of the target data is a target type, where the target type is used to indicate that a request to generate a target text corresponding to the target data is allowed.

[0081] Among them, the target type is used to indicate that a request to generate a target text corresponding to the target data is allowed. It can be understood that only when the target data meets the conditions for generating the target text, that is, only when the type of the target data is the target type, a request to generate a target text corresponding to the target data will be allowed.

[0082] Specifically, when receiving the input target data, it is possible to first detect whether the type of the target data is the target type, so that when the type of the target data is the target type, that is, when the target data indicates that a request to generate a target text corresponding to the target data is allowed, the target data is then input into the text generation model to obtain the target text corresponding to the target data generated by the text generation model, thereby effectively filtering out invalid data input into the text generation model, thereby avoiding generation failures or system abnormalities caused by erroneous data, and thereby improving the stability and reliability of the system.

[0083] The following is divided into two steps to introduce in detail the specific implementation method of detecting whether the type of target data is the target type.

[0084] Step (1) parses the target data to obtain a data identifier in the target data, where the data identifier is used to indicate whether the target data is of the target type.

[0085] In a possible implementation, after receiving the target data, a data parsing library (such as JSON, XML parser, etc.) may be used to read the target data and parse the field values ​​in the target data to obtain a data identifier.

[0086] The data identifier is a first data identifier (eg, chat) or a second data identifier (eg, stop), the first data identifier is used to indicate that the target data is of a target type, and the second data identifier is used to indicate that the target data is not of a target type.

[0087] Step (2): when the data identifier is the first data identifier, determining that the type of the target data is the target type; when the target identifier is the second data identifier, determining that the type of the target data is not the target type.

[0088] It can be understood that when the data identifier is the first data identifier, it indicates that the target data meets the preset conditions or rule set and meets the conditions for generating the target text. In this case, the type of the target data can be determined to be the target type; when the target identifier is the second data identifier, it indicates that the target data does not meet the preset conditions or rule set and does not meet the requirements for generating the target text. In this case, it can be determined that the type of the target data is not the target type.

[0089] It's important to note that by parsing the data identifiers within the target data, it's possible to directly determine whether the target data type is the target type, avoiding complex analysis or calculations. This method is simple and efficient, quickly completing type detection tasks, thereby reducing system load and resource consumption. Furthermore, distinguishing the target data type through explicit data identifiers (i.e., the first and second data identifiers) reduces the possibility of misjudgment. For example, relying on the data content itself for judgment can lead to misidentification due to formatting, structure, or other factors.

[0090] In step 305, when the type of the target data is the target type, the target data is input into the text generation model to obtain the target text corresponding to the target data generated by the text generation model. The text generation model is a text generation model embedded in the VS Code (Visual Studio Code Extensions) plug-in of the electronic device.

[0091] Among them, the VS Code plug-in is an extension program, which is a small program or tool set used to enhance or modify the functions of the VS Code editor. Developers can use the VS Code plug-in to customize the development environment according to their own needs, thereby improving the efficiency of text generation.

[0092] In a possible implementation, the text generation model may also be embedded in a Sublime Text plug-in or a JetBrains IDE plug-in, which is not limited in this embodiment of the present application.

[0093] In one possible implementation, the VS Code plug-in can be activated through a predefined activation event. In addition, developers can also use the VS Code plug-in to create a custom Webview view using Webview, so that the electronic device can display the target text generated by the text generation model on the display screen through the Webview view. The Webview view is an embedded web page that can load external resources and communicate with the VS Code plug-in through the acquireVsCodeApi() function.

[0094] Specifically, the VS Code plug-in can interact with the embedded text generation model through HTTP requests or other communication mechanisms. For example, when the text generation model is encapsulated as a REST API, the VS Code plug-in can communicate with the text generation model through the Fetch API. After the text generation model generates target text corresponding to the target data, the VS Code plug-in can communicate with the text generation model through the Fetch API to obtain the target text generated by the text generation model, and then display the target text generated by the text generation model on the first display area of ​​the display screen through the Webview view.

[0095] Among them, embedding the text generation model in the VS Code plug-in of the electronic device can be understood as integrating the functions of the text generation model into the VS Code plug-in, so that users can use the text generation function of the text generation model based on the VS Code plug-in to avoid relying on external paid plug-ins when generating target text, thereby reducing additional development costs and complexity.

[0096] Specifically, when the type of the target data is the target type, it indicates that the target data meets the conditions for generating the target text. Therefore, in this case, the target data can be input into the text generation model to obtain the target text corresponding to the target data generated by the text generation model based on the input target data.

[0097] It should be noted that by detecting whether the type of the target data is the target type, when the type of the target data is the target type, the target data is input into the text generation model to generate the target text corresponding to the target data based on the text generation model, thereby effectively filtering out invalid data input into the text generation model, thereby avoiding generation failure or system abnormality caused by erroneous data, and thus improving the stability and reliability of the system; in addition, since the text generation model is embedded in the VS Code plug-in of the electronic device, when generating the target text corresponding to the target data based on the input target data, there is no need to rely on an external platform, which can greatly reduce additional development costs and complexity.

[0098] It should be noted that the text generation model can be composed of a text encoder (Encoder) and a text decoder (Decoder), and the two work together to enable the text generation model to complete the text generation task.

[0099] The main function of a text encoder is to convert the input source text (i.e., target data) into an abstract representation, typically a vector or a set of continuous vectors. The text encoder can capture the deep semantic information, contextual relationships, and other features of the target data. Through a multi-layer neural network structure (such as that based on the Transformer architecture), it gradually extracts and integrates this information to obtain the target semantic features of the target data, providing the necessary contextual support for the subsequent decoding process.

[0100] The text decoder corresponds to the text encoder and is primarily responsible for gradually generating the target text based on the abstract representation provided by the encoder (i.e., the target semantic features) and possible other auxiliary information (such as the generated partial target sequence). During the generation process, the text decoder predicts the next word or symbol based on the previously generated content and the contextual information provided by the text encoder, ultimately forming a complete output sequence, that is, the complete target text.

[0101] In one possible implementation, when the type of the target data is a target type, the application programming interface (API) of the text generation model can be called, and the target data can be input into the text encoder based on the API interface of the text generation model to obtain the target semantic features generated by the text encoder corresponding to the target data, and the target semantic features can be input into the text decoder to obtain the target text generated by the text decoder corresponding to the target semantic features.

[0102] Among them, the target semantic feature is an abstract data structure, usually a multidimensional vector or a set of continuous vectors, which contains the semantic information and contextual relationship in the input target data, providing the necessary basis for subsequent decoding operations.

[0103] In one possible implementation, when the type of the target data is a target type, the API interface of the text generation model can be called through an HTTP request, and the target data can be passed to the API interface as an input parameter, so that after receiving the target data, the API interface inputs the target data into the text encoder to obtain the target semantic features generated by the text encoder corresponding to the target data. Furthermore, after generating the target semantic features corresponding to the target data, the text encoder outputs the target semantic features as input data to the text decoder, so that the text decoder generates the target text corresponding to the target semantic features based on the input target semantic features.

[0104] It should be noted that by inputting the target data into the text encoder, target semantic features corresponding to the target data are generated. Since the text encoder can capture the deep semantic information in the target data, it can provide rich contextual support for subsequent target text generation, that is, the target text generated by the text decoder based on the target semantic features can be more in line with the actual meaning of the target data.

[0105] Step 306 : In response to obtaining the target text, detecting whether the target text is a complete text.

[0106] Step 307: If the target text is a complete text, the target text is displayed on the first display area of ​​the electronic device, and acquisition of new text is stopped.

[0107] Step 308: If the target text is incomplete, display the target text on the first display area, and continue to acquire new text and continue to display the new text on the first display area.

[0108] The specific implementation of steps 306 to 308 can be found in the above embodiment and will not be repeated here.

[0109] Step 309: If the type of the target data is not the target type, it is prohibited to input the target data into the text generation model.

[0110] It can be understood that when the type of the target data is not the target type, it indicates that the target data does not meet the conditions for generating the target text. Therefore, in this case, it can be prohibited to input the target data into the text generation model, that is, in this case, calling the API interface of the text generation model is prohibited.

[0111] It should be noted that when the type of the target data is not the target type, it is prohibited to input the target data into the text generation model, which can avoid unnecessary processing of data that does not meet the conditions, thereby saving computing resources of the electronic device.

[0112] Figure 5 This is a schematic diagram of the interactive process of a text display method for an electronic device provided in an embodiment of the present application.

[0113] For example, Figure 5 As shown, the method 500 includes the following steps 501 to 509.

[0114] Step 501 : Upon receiving input target data, the display screen controller sends the target data to the text processing controller.

[0115] Specifically, when the display screen controller receives target data input by the user, it can encapsulate the target data into a data packet according to a predetermined format, and send the data packet as a parameter to the text processing controller through a predefined internal API or function call.

[0116] Step 502: The text processing controller parses the input target data in response to the input target data to obtain a data identifier in the target data, where the data identifier is used to indicate whether the target data is of a target type.

[0117] Step 503 : When the data identifier is the first data identifier, the text processing controller determines that the type of the target data is the target type, inputs the target data into the text generation model, and obtains a target text corresponding to the target data generated by the text generation model.

[0118] Step 504 : In response to acquiring the target text, the text processing controller detects whether the target text is a complete text.

[0119] Step 505 : If the target text is a complete text, the text processing controller generates instruction information corresponding to the target text, sends the instruction information corresponding to the target text to the display screen controller, and stops acquiring new text.

[0120] Step 506: The display screen controller controls the display screen to display the target text in the first display area based on the received instruction information.

[0121] Step 507, when the target text is incomplete, the text processing controller generates instruction information corresponding to the target text, sends the instruction information corresponding to the target text to the display screen controller, and continuously obtains new text, generates instruction information corresponding to the new text, and sends the instruction information corresponding to the new text to the display screen controller.

[0122] Step 508: The display screen controller controls the display screen to display the target text and the new text in the first display area based on the received instruction information.

[0123] Step 509 : When the target identifier is the second data identifier, the text processing controller determines that the type of the target data is not the target type, and prohibits inputting the target data into the text generation model.

[0124] The specific implementation of steps 502 to 509 can be found in the above embodiment and will not be repeated here.

[0125] Figure 6 This is a structural diagram of a text display device of an electronic device provided in an embodiment of the present application.

[0126] For example, Figure 6 As shown, the apparatus 600 includes:

[0127] A detection module 601 is configured to detect whether the target text is a complete text in response to obtaining the target text, wherein the target text is obtained based on a text generation model;

[0128] The control module 602 is configured to display the target text on the first display area of ​​the electronic device and stop acquiring new text when the target text is a complete text;

[0129] The control module 602 is further configured to display the target text on the first display area when the target text is incomplete, and to continuously acquire new text and continue to display the new text on the first display area.

[0130] In one possible implementation, the target text corresponds to a target identifier, which is used to indicate whether the target text is complete. The detection module 601 is specifically used to determine that the target text is a complete text when the target identifier is a first identifier, and the first identifier is used to indicate that the target text is a complete text; when the target identifier is a second identifier, it is determined that the target text is an incomplete text, and the second identifier is used to indicate that the target text is an incomplete text.

[0131] In one possible implementation, the device also includes a recognition module for parsing the target text and identifying the target subtext in the target text, where the target subtext is a preset text with specific attributes; the device also includes a processing module for highlighting the format of the target subtext and integrating the highlighted target subtext into the target text to obtain a highlighted target text; and a control module 602, specifically for displaying the highlighted target text on the first display area.

[0132] In one possible implementation, the detection module 601 is further used to detect whether the type of the target data is a target type in response to the input target data, and the target type is used to indicate that a request to generate a target text corresponding to the target data is allowed; the control module 602 is further used to input the target data into the text generation model when the type of the target data is the target type, and obtain the target text corresponding to the target data generated by the text generation model, and the text generation model is a text generation model embedded in the VS Code plug-in of the electronic device.

[0133] In one possible implementation, the detection module 601 is also used to detect whether a target file exists before responding to the input target data, and the target file is used to indicate that the identity of the target object has been verified; the control module 602 is also used to display a target window on the second display area of ​​the electronic device when the target file exists, and the target window is used to receive the target data; when the target file does not exist, a prompt message is displayed, and the prompt message is used to prompt whether to jump to the login interface; when it is determined to jump to the login interface, the login interface is jumped to, and in response to the input account and password, the target object is authenticated based on the account and password, and the target window is displayed on the second display area after the identity of the target object is verified.

[0134] In one possible implementation, the processing module is further used to respond to the input target data, parse the target data, and obtain a data identifier in the target data, where the data identifier is used to indicate whether the target data is of a target type; the device also includes a determination module, which is used to determine that the type of the target data is a target type when the data identifier is a first data identifier, where the first data identifier is used to indicate that the target data is of a target type; and to determine that the type of the target data is not a target type when the data identifier is a second data identifier, where the second data identifier is used to indicate that the target data is not of a target type.

[0135] In one possible implementation, the text generation model includes a text encoder and a text decoder; the control module 602 is also used to call the application programming interface of the text generation model when the type of the target data is the target type, input the target data into the text encoder based on the application programming interface of the text generation model, obtain the target semantic features generated by the text encoder corresponding to the target data, and input the target semantic features into the text decoder to obtain the target text generated by the text decoder corresponding to the target semantic features.

[0136] In a possible implementation, the control module 602 is further configured to prohibit inputting the target data into the text generation model when the type of the target data is not the target type.

[0137] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of the present application.

[0138] For example, Figure 7 As shown, the electronic device 700 includes: a memory 701 and a processor 702, wherein the memory 701 stores an executable program code 703, and the processor 702 is used to call and execute the executable program code 703 to perform a text display method of an electronic device.

[0139] In addition, an embodiment of the present application also protects a device, which may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to perform a text display method of an electronic device provided in an embodiment of the present application.

[0140] In this embodiment, the device can be divided into functional modules based on the above-described method examples. For example, each functional module can be mapped to a specific functional module, or two or more functions can be integrated into a single processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and represents only a logical functional division. In actual implementation, other division methods may be used.

[0141] In the case of dividing each functional module into corresponding functional modules, the device may further include an identification module, a determination module, a processing module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0142] It should be understood that the apparatus provided in this embodiment is used to execute the above-mentioned text display method of an electronic device, and thus can achieve the same effect as the above-mentioned implementation method.

[0143] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to an electronic device, the processing module may be used to control and manage the operation of the electronic device. The storage module may be used to support the electronic device in executing relevant program codes, etc.

[0144] The processing module may be a processor or controller that implements or executes the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processing system (DSP) and a microprocessor, and the storage module may be a memory.

[0145] In addition, the device provided in the embodiments of the present application can specifically be a chip, component or module, and the chip may include a connected processor and memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a text display method of an electronic device provided in the above embodiment.

[0146] This embodiment also provides a computer-readable storage medium, which stores computer program code. When the computer program code runs on a computer, the computer executes the above-mentioned related method steps to implement a text display method for an electronic device provided in the above embodiment.

[0147] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the text display method of an electronic device provided in the above embodiment.

[0148] Among them, the device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0149] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0150] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0151] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A text display method for an electronic device, characterized in that: The method comprises: In response to acquiring a target text, detecting whether the target text is a complete text, wherein the target text is obtained based on a text generation model; If the target text is a complete text, display the target text on the first display area of ​​the electronic device and stop acquiring new text; In the case that the target text is an incomplete text, the target text is displayed on the first display area, and the new text is continuously acquired and displayed on the first display area.

2. The method according to claim 1, characterized in that The target text corresponds to a target identifier, and the target identifier is used to indicate whether the target text is complete; The detecting whether the target text is a complete text includes: In a case where the target identifier is a first identifier, determining that the target text is a complete text, the first identifier is used to indicate that the target text is a complete text; In a case where the target identifier is the second identifier, it is determined that the target text is an incomplete text, and the second identifier is used to indicate that the target text is an incomplete text.

3. The method according to claim 1, characterized in that The displaying of the target text on the first display area of ​​the electronic device includes: Parsing the target text and identifying a target subtext in the target text, wherein the target subtext is a preset text with specific attributes; Highlighting the format of the target subtext, and integrating the highlighted target subtext into the target text to obtain a highlighted target text; The highlighted target text is displayed on the first display area.

4. The method according to claim 1, wherein Acquiring the target text includes the following steps: In response to input target data, detecting whether a type of the target data is a target type, the target type being used to indicate that a request to generate a target text corresponding to the target data is permitted; When the type of the target data is the target type, the target data is input into a text generation model to obtain a target text corresponding to the target data generated by the text generation model. The text generation model is a text generation model embedded in the VS Code plug-in of the electronic device.

5. The method according to claim 4, characterized in that The method further comprises: Before responding to the input target data, detecting whether there is a target file, the target file being used to indicate that the identity of the target object has been verified; In a case where the target file exists, displaying a target window on the second display area of ​​the electronic device, wherein the target window is used to receive the target data; If the target file does not exist, a prompt message is displayed, and the prompt message is used to prompt whether to jump to the login interface; if it is determined to jump to the login interface, jump to the login interface, and in response to the input account and password, authenticate the target object based on the account and password, and after the identity of the target object is verified, display the target window on the second display area.

6. The method according to claim 4, characterized in that The step of detecting, in response to the input target data, whether the type of the target data is a target type includes: In response to the input target data, parsing the target data to obtain a data identifier in the target data, wherein the data identifier is used to indicate whether the target data is of the target type; In a case where the data identifier is a first data identifier, determining that the type of the target data is the target type, the first data identifier is used to indicate that the target data is the target type; In a case where the data identifier is a second data identifier, it is determined that the type of the target data is not the target type, and the second data identifier is used to indicate that the target data is not the target type.

7. The method according to claim 4, characterized in that The text generation model includes a text encoder and a text decoder; When the type of the target data is the target type, inputting the target data into a text generation model to obtain a target text corresponding to the target data generated by the text generation model includes: When the type of the target data is the target type, the application programming interface of the text generation model is called, and the target data is input into the text encoder based on the application programming interface of the text generation model to obtain the target semantic features generated by the text encoder corresponding to the target data, and the target semantic features are input into the text decoder to obtain the target text generated by the text decoder corresponding to the target semantic features.

8. The method according to claim 4, characterized in that The method further comprises: If the type of the target data is not the target type, inputting the target data into the text generation model is prohibited.

9. A text display device for an electronic device, characterized in that: The device includes a detection module, configured to detect whether the target text is a complete text in response to obtaining the target text, wherein the target text is obtained based on the text generation model; a control module, configured to, when the target text is a complete text, display the target text on the first display area of ​​the electronic device and stop acquiring new text; The control module is further configured to, when the target text is incomplete, display the target text on the first display area, and continuously acquire the new text and continue to display the new text on the first display area.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 8 is implemented.