Character display method and system, and related apparatus

By establishing long links between electronic devices and cloud servers, sending target text in segments and determining the display speed, the problem of user waiting time due to long time to generate target text in the language model is solved, and smooth text output and improved user experience are achieved.

WO2025055994A1PCT designated stage expired Publication Date: 2025-03-20HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/118584
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-14
Filing Date
2024-09-12
Publication Date
2025-03-20

AI Technical Summary

Technical Problem

In the prior art, the time required for the language model to generate the target text is long, resulting in too long waiting time for users, poor user experience, and easy to cause lag during the text display process.

Method used

By establishing a long link between the electronic device and the cloud server, the cloud server sends the generated text fields in segments during the process of generating the target text, and determines the display speed based on the generation speed, ensuring that the electronic device displays text at a smooth speed.

Benefits of technology

It reduces the waiting time for users, avoids lags during text display, ensures smooth output of text, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024118584_20032025_PF_FP_ABST
    Figure CN2024118584_20032025_PF_FP_ABST
Patent Text Reader

Abstract

The present application discloses a character display method and system, and a related apparatus. An electronic device sends a first message to a cloud server by means of a long link. The cloud server generates, by means of a language model, a target text corresponding to the first message, wherein the target text comprises a plurality of language symbols. In the process of generating the target text, the cloud server determines display time consumption of a single character on the basis of the generation time of a single language symbol, and sends the generated language symbols and the display time consumption of the single character to the electronic device according to a generation sequence. The electronic device can display the target text on the basis of the display time consumption of the single character (i.e., displaying one character at each time interval corresponding to the display time consumption of the single character). Therefore, the waiting time of a user can be shortened, and the fluency of text output can also be ensured, thereby avoiding the output lag, and providing better use experience for the user.
Need to check novelty before this filing date? Find Prior Art

Description

A text display method, system and related device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 14, 2023, with application number 202311190565.6 and application name “A text display method, system and related devices”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of machine learning, and in particular to a text display method, system, and related devices. Background Art

[0003] With the continuous development of machine learning technologies, natural language processing algorithms are becoming increasingly mature. Electronic devices can use language models to generate target text based on user input, such as speech or primary text. After obtaining the entire target text, the electronic device can display the target text on the display.

[0004] However, language models require a large number of parameters and computational complexity, and generating the target text takes a long time, especially for longer texts. If the above method is used to output the target text, the user will have to wait too long, resulting in a poor user experience.

[0005] Summary of the Invention

[0006] The present application provides a text display method, system and related devices, which reduce the user's waiting time, avoid freezes during text display, and achieve smooth text output.

[0007] In a first aspect, the present application provides a text display system, comprising: an electronic device and a cloud server; wherein the electronic device is used to send a first message to the cloud server; the cloud server is used to generate a first target text corresponding to the first message through a language model; the cloud server is also used to send a first display speed and a first text segment to the electronic device after generating a first text segment in the first target text; the first display speed is used to indicate the number of characters in the first target text displayed per unit time; the electronic device is also used to display the first text segment at the first display speed; the cloud server is also used to generate a second text segment in the first target text before the electronic device completes displaying the first text segment at the first display speed, the second text segment being located after the first text segment in the first target text; the cloud server is also used to send the second text segment to the electronic device after generating the second text segment of the first target text; the electronic device is also used to receive the second text segment before or when the first text segment is displayed at the first display speed; the electronic device is also used to display the second text segment at the first display speed after displaying the first text segment at the first display speed.

[0008] In this way, not only can the generated text be displayed during the process of generating the target text, reducing the user's waiting time, but it can also avoid freezes in the display process and ensure smooth display of the text.

[0009] In one possible implementation, the first text segment includes at least one language symbol token, and the second text segment includes a token; the cloud server is further used to obtain a first generation speed in the process of generating the first target text, and the first generation speed is used to indicate the number of tokens generated per unit time; the cloud server is also used to determine a first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is less than or equal to the product of the first generation speed and a first scale, and the first scale is the ratio of the number of characters corresponding to the language model to the number of tokens.

[0010] In this way, the number of tokens sent for the first time is greater than or equal to the number of tokens sent each time thereafter, and it takes a longer time to display all the text sent for the first time, which can ensure the smooth display of the text.

[0011] In one possible implementation, the cloud server is further used to obtain a first generation speed during the process of generating the first target text, and the first generation speed is used to indicate the number of tokens generated per unit time; the cloud server is further used to determine a first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is equal to the product of the first generation speed and a first constant, the first constant is less than a first ratio, and the first ratio is the ratio of the number of characters corresponding to the language model to the number of tokens; the cloud server is further used to set a word count interval, and the word count interval is used to indicate the word count range of a single text segment of the first target text; the cloud server is further used to determine the first text segment based on the word count interval during the process of generating the first target text; the cloud server is further used to determine that the first text segment is risk-free before sending the first text segment; the cloud server is further used to determine the second text segment based on the word count interval during the process of generating the first target text, and the number of words in the second text segment belongs to the word count interval; the cloud server is further used to determine that the second text segment is risk-free before sending the second text segment.

[0012] In this way, by setting the floating range of the number of words in the text segment and the display speed of the text, smooth display between two adjacent text segments can be ensured.

[0013] In one possible implementation, the cloud server is further used to determine a third text segment based on a word count range during the process of generating a first target text, where the third text segment is located after the second text segment in the first target text; the cloud server is further used to determine that the third text segment is risky; the cloud server is further used to send the third text segment and first risk information to the electronic device, where the first risk information is used to indicate that the first target text is risky; the electronic device is further used to withdraw all content displayed in the first target text after receiving the first risk information.

[0014] In this way, if the target text is detected to be risky, the electronic device can withdraw the displayed content.

[0015] In one possible implementation, the cloud server is further used to send second risk information to the electronic device when sending the first text segment, and the second risk information is used to indicate that the first target text is temporarily risk-free; the cloud server is further used to send the second risk information to the electronic device when sending the second text segment.

[0016] In this way, when the target text is risk-free, the cloud server can also send risk information to the electronic device, and the risk information is used to notify the electronic device that the current text segment is risk-free.

[0017] In a possible implementation, the electronic device is further configured to establish a long link with the cloud server before sending the first message to the cloud server.

[0018] In this way, data such as the first message and the first target text can be transmitted through the long link.

[0019] In one possible implementation, the electronic device is further configured to receive a first input from a user before establishing a long link with the cloud server; and the electronic device is further configured to determine a first message based on the first input.

[0020] The type of the first input may include: voice input, text input, and event input. The type of the first message may include a voice message, a text message, or an event message.

[0021] Determining the first message based on the first input specifically includes: determining the type of the first message based on the type of the first input; and determining the content of the first message based on the content of the first input. The content of the first message may be the same as the content of the first input.

[0022] In one possible implementation, the electronic device is further used to disconnect the long link with the cloud server when it detects that a first disconnection condition is met; the first disconnection condition includes any one or more of the following: network error, receiving a first operation from the user, and the first operation is used to trigger the electronic device to stop using the language model service.

[0023] In this way, the electronic device can disconnect the long link with the cloud server when it detects that the first disconnection condition is met.

[0024] In one possible implementation, the cloud server is also used to disconnect the long link with the electronic device when it detects that a second disconnection condition is met; the second disconnection condition includes any one or more of the following: network error, the first target text is sent, the first target text is sent and no message sent by the electronic device is received within a first time period after the sending is completed.

[0025] In this way, the cloud server can disconnect the long link with the electronic device when it detects that the second disconnection condition is met.

[0026] In one possible implementation, the electronic device is further configured to receive a second input from the user after displaying the first target text at the first display speed; the electronic device is further configured to determine a second message based on the second input; the electronic device is further configured to send the second message to a cloud server; the cloud server is further configured to generate a second target text corresponding to the second message through a language model; the cloud server is further configured to send the second display speed and the fourth text segment to the electronic device after generating a fourth text segment in the second target text; the second display speed is used to indicate the number of characters in the second target text displayed per unit time; the electronic device is further configured to display the fourth text segment at the second display speed; the cloud server is further configured to generate a fifth text segment in the second target text before the electronic device displays the fourth text segment at the second display speed, the fifth text segment being located after the fourth text segment in the second target text; the cloud server is further configured to send the fifth text segment to the electronic device after generating the fifth text segment of the second target text; the electronic device is further configured to receive the fifth text segment before displaying the fourth text segment at the second display speed, or when displaying the fourth text segment at the second display speed; the electronic device is further configured to display the fifth text segment at the second display speed after displaying the fourth text segment at the second display speed.

[0027] In this way, the second message and the second target text can also be transmitted through the long link.

[0028] In one possible implementation, the electronic device is further used to send a second message to the cloud server, specifically including: the electronic device is further used to send a second message to the cloud server when the time interval between the moment when the first target text is displayed and the moment when the second input is received is less than a second duration.

[0029] The reuse of long links can be timed to a threshold. Within this threshold, a second message can reuse the same long link used to transmit the first message. This way, if a long link is unused for an extended period, it can be automatically disconnected, reducing energy consumption.

[0030] In second aspect, the present application provides a text display method, which is applied to a cloud server, and the method includes: receiving a first message sent by an electronic device; generating a first target text corresponding to the first message through a language model; after generating a first text segment in the first target text, sending a first display speed and the first text segment to the electronic device; the first display speed is used to indicate the number of characters displayed per unit time; generating a second text segment in the first target text, the second text segment is located after the first text segment in the first target text; before the electronic device finishes displaying the first text segment at the first display speed, sending the second text segment to the electronic device.

[0031] In this way, not only can the generated text be displayed during the process of generating the target text, reducing the user's waiting time, but it can also avoid freezes in the display process and ensure smooth display of the text.

[0032] In one possible implementation, the first text segment includes one or more language symbols token, and the second text segment includes a token; the method further includes: in the process of generating the first target text, obtaining a first generation speed, the first generation speed being used to indicate the number of tokens generated per unit time; determining a first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is less than or equal to the product of the first generation speed and a first scale, and the first scale is the ratio of the number of characters corresponding to the language model to the number of tokens.

[0033] In this way, the number of tokens sent for the first time is greater than or equal to the number of tokens sent each time thereafter, and it takes a longer time to display all the text sent for the first time, which can ensure the smooth display of the text.

[0034] In one possible implementation, the method further includes: in the process of generating the first target text, obtaining a first generation speed, the first generation speed being used to indicate the number of tokens generated per unit time; determining a first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship being that the first display speed is equal to the product of the first generation speed and a first constant, the first constant being less than a first ratio, the first ratio being the ratio of the number of characters corresponding to the language model to the number of tokens; setting a word count interval, the word count interval being used to indicate the word count range of a single text segment of the first target text; in the process of generating the first target text, determining the first text segment based on the word count interval; before sending the first text segment, determining that the first text segment is risk-free; in the process of generating the first target text, determining the second text segment based on the word count interval, the number of words in the second text segment belonging to the word count interval; before sending the second text segment, determining that the second text segment is risk-free.

[0035] In this way, by setting the floating range of the number of words in the text segment and the display speed of the text, smooth display between two adjacent text segments can be ensured.

[0036] In one possible implementation, the method further includes: in the process of generating the first target text, determining a third text segment based on the word count range, the third text segment being located after the second text segment in the first target text; determining that the third text segment is risky; and sending the third text segment and first risk information to the electronic device, the first risk information being used to indicate that the first target text is risky.

[0037] In this way, if the target text is detected to be risky, the electronic device can withdraw the displayed content.

[0038] In one possible implementation, the method further includes: when sending the first text segment, sending second risk information to the electronic device, the second risk information being used to indicate that the first target text is temporarily risk-free; when sending the second text segment, sending the second risk information to the electronic device.

[0039] In this way, when the target text is risk-free, the cloud server can also send risk information to the electronic device, and the risk information is used to notify the electronic device that the current text segment is risk-free.

[0040] In a possible implementation, the method further includes: before receiving the first message sent by the electronic device, establishing a long link with the electronic device.

[0041] In this way, data such as the first message and the first target text can be transmitted through the long link.

[0042] In one possible implementation, the method further includes: when it is detected that a second disconnection condition is met, disconnecting the long link with the electronic device; the second disconnection condition includes any one or more of the following: network error, the first target text is sent, the first target text is sent and no message sent by the electronic device is received within a first time period after the sending is completed.

[0043] In this way, the cloud server can disconnect the long link with the electronic device when it detects that the second disconnection condition is met.

[0044] In one possible implementation, the method also includes: after sending the first target text, receiving a second message sent by the electronic device; generating a second target text corresponding to the second message through a language model; after generating a fourth text segment in the second target text, sending a second display speed and a fourth text segment to the electronic device; before the electronic device completes displaying the fourth text segment at the second display speed, generating a fifth text segment in the second target text, the fifth text segment being after the fourth text segment in the second target text; after generating the fifth text segment of the second target text, sending the fifth text segment to the electronic device.

[0045] In this way, the second message and the second target text can also be transmitted through the long link.

[0046] In a third aspect, the present application provides a text display method, which is applied to an electronic device, and the method includes: sending a first message to a cloud server; receiving a first display speed and a first text segment in a first target text sent by the cloud server; the first display speed is used to indicate the number of characters in the first target text displayed per unit time; the first target text is a text generated by the cloud server based on the first message through a language model; displaying the first text segment at a first display speed; before the electronic device completes displaying the first text segment at the first display speed, receiving a second text segment in the first target text, the second text segment being after the first text segment in the first target text; after displaying the first text segment at the first display speed, displaying the second text segment at the first display speed.

[0047] In this way, not only can the generated text be displayed during the process of generating the target text, reducing the user's waiting time, but it can also avoid freezes in the display process and ensure smooth display of the text.

[0048] In a possible implementation, the first text segment includes one or more language symbols tokens, and the second text segment includes one token.

[0049] In this way, the number of tokens sent for the first time is greater than or equal to the number of tokens sent each time thereafter, and it takes a longer time to display all the text sent for the first time, which can ensure the smooth display of the text.

[0050] In one possible implementation, the method further includes: receiving a third text segment and first risk information sent by the cloud server, the first risk information being used to indicate that the first target text is risky; after receiving the first risk information, withdrawing all content displayed in the first target text.

[0051] In this way, if the target text is detected to be risky, the electronic device can withdraw the displayed content.

[0052] In one possible implementation, receiving the first display speed and the first text segment in the first target text sent by the cloud server specifically includes: receiving the first display speed, the first text segment in the first target text and the second risk information sent by the cloud server, the second risk information being used to indicate that the first target text is temporarily risk-free; receiving the second text segment in the first target text specifically includes: receiving the second text segment and the second risk information in the first target text.

[0053] In this way, the electronic device can determine whether the current text segment has risks based on the risk information sent by the cloud server.

[0054] In a possible implementation, the method further includes: before sending the first message to the cloud server, establishing a long link with the cloud server.

[0055] In this way, data such as the first message and the first target text can be transmitted through the long link.

[0056] In a possible implementation, the method further includes: before establishing a long link with the cloud server, receiving a first input from a user; and in response to the first input, determining a first message based on the first input.

[0057] The type of the first input may include: voice input, text input, and event input. The type of the first message may include a voice message, a text message, or an event message.

[0058] Determining the first message based on the first input specifically includes: determining the type of the first message based on the type of the first input; and determining the content of the first message based on the content of the first input. The content of the first message may be the same as the content of the first input.

[0059] In one possible implementation, the method further includes: when it is detected that a first disconnection condition is met, disconnecting the long link with the cloud server; the first disconnection condition includes any one or more of the following: network error, receiving a first operation from the user, and the first operation is used to trigger the electronic device to stop using the language model service.

[0060] In this way, the electronic device can disconnect the long link with the cloud server when it detects that the first disconnection condition is met.

[0061] In one possible implementation, the method also includes: after displaying the first target text at the first display speed, receiving a second input from the user; in response to the second input, determining a second message based on the second input; sending a second message to the cloud server; receiving the second display speed and the fourth text segment in the second target text sent by the cloud server; the second display speed is used to indicate the number of characters in the second target text displayed per unit time; the second target text is the text generated by the cloud server based on the second message through a language model; displaying the fourth text segment at the second display speed; before the electronic device displays the fourth text segment at the second display speed, receiving a fifth text segment in the second target text, the fifth text segment being after the fourth text segment in the second target text; after displaying the fourth text segment at the second display speed, displaying the fifth text segment at the second display speed.

[0062] In this way, the second message and the second target text can also be transmitted through the long link.

[0063] In a possible implementation, sending the second message to the cloud server specifically includes: when the time interval between the moment when the first target text is displayed and the moment when the second input is received is less than a second duration, sending the second message to the cloud server.

[0064] The reuse of long links can be timed to a threshold. Within this threshold, a second message can reuse the same long link used to transmit the first message. This way, if a long link is unused for an extended period, it can be automatically disconnected, reducing energy consumption.

[0065] In a fourth aspect, the present application provides a server comprising: one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are configured to store computer program code, the computer program code comprising computer instructions. When the one or more processors execute the computer instructions, the server executes the text display method of any possible implementation of the second aspect.

[0066] In a fifth aspect, the present application provides an electronic device comprising: one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, wherein the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device performs the text display method of any possible implementation of the third aspect.

[0067] In a sixth aspect, an embodiment of the present application provides a computer storage medium comprising computer instructions. When the computer instructions are executed on a server, the server executes the text display method in any possible implementation of the second aspect.

[0068] In a seventh aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the text display method in any possible implementation of the third aspect above.

[0069] The beneficial effects of the fourth to seventh aspects can refer to the beneficial effects described in the first to third aspects above. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] FIG1A is a schematic diagram of a language token in a text A provided in an embodiment of the present application;

[0071] FIG1B is a schematic diagram of the system architecture of a text display system 10 provided in an embodiment of the present application;

[0072] FIG1C is a schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application;

[0073] FIG1D is a schematic diagram of the hardware structure of a cloud server 200 provided in an embodiment of the present application;

[0074] FIG2A is a schematic diagram showing the temporal relationship between the generation time, transmission time, and display time of a token1 provided in an embodiment of the present application;

[0075] FIG2B is a schematic diagram showing the time relationship among the generation time, transmission time, and display time of a token2 provided in an embodiment of the present application;

[0076] FIG3 is a flow chart of a text display method provided in an embodiment of the present application;

[0077] FIG4A is a schematic diagram showing the temporal relationship among the generation time, transmission time, and display time of a text segment 1 provided in an embodiment of the present application;

[0078] FIG4B is a schematic diagram showing the temporal relationship among the generation time, transmission time, and display time of a text segment 2 provided in an embodiment of the present application;

[0079] FIG5 is a flow chart of another text display method provided in an embodiment of the present application;

[0080] 6A-6F are schematic diagrams of interfaces of a set of text display methods provided in an embodiment of the present application;

[0081] FIG7A is a schematic diagram of functional modules of a text display system 10 provided in an embodiment of the present application;

[0082] FIG7B is a schematic diagram of two links between the electronic device 100 and the modules of the cloud server 200 provided in an embodiment of the present application;

[0083] FIG8 is a schematic diagram of a software architecture of an electronic device 100 provided in an embodiment of the present application;

[0084] FIG9 is a flow chart of a text display method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0085] The following is a clear and detailed description of the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. In the description of the embodiments of the present 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 between related 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 the present application, "multiple" means two or more than two.

[0086] 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 the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.

[0087] The term "user interface (UI)" in the following embodiments of this application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device and finally presented as content that the user can recognize. The commonly used form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.

[0088] The following introduces some professional terms involved in the embodiments of this application.

[0089] Natural language understanding (NLU): NLU is a discipline that integrates linguistics, logic, psychology, and computer science. NLU can obtain semantic representations of natural languages ​​through analysis of syntax, semantics, and pragmatics.

[0090] Large language models (LLMs): LLMs are neural network models trained on large amounts of text data. They possess powerful natural language processing and code generation capabilities and are widely used in natural language processing, machine translation, dialogue systems, and code generation. LLMs can generate text by learning from large amounts of text data (such as web pages, books, and papers). LLMs typically consist of millions of parameters and possess high representational and generative capabilities. Given a question or task description as input, an LLM can generate code or text corresponding to the input.

[0091] Token: A token is the basic unit of natural language. A token can be a word, a phrase, or a character. After receiving input, LLM can generate target text using tokens as the basic unit.

[0092] For example, FIG1A shows a token diagram in a text A provided in an embodiment of the present application.

[0093] As shown in Figure 1A, text A may be the text "In our daily lives, we always face various challenges." Based on grammar and semantics, text A may include the following tokens: "in," "we," "of," "daily," "life," "in," "," "we," "always," "will," "face," "various," "all kinds," "of," "challenges," and ".", and the order of these tokens is consistent with the order of these tokens in text A. Since LLM generates text using tokens as the basic unit, when generating text A, LLM can sequentially search all tokens in text A according to the order of the tokens in text A until all tokens in text A are generated.

[0094] It is understandable that the embodiment shown in FIG1A is only an example. In the embodiments of the present application, different texts may include more, fewer, or different tokens than those in the above embodiments, and the present application does not limit this.

[0095] Long link: A long link is also called a persistent link, which refers to a link that is not disconnected immediately after data transmission is completed. On the contrary, a link that is disconnected immediately after data transmission is completed is a short link. In the embodiment of the present application, a long link may include a network socket (websocket) or the like.

[0096] The following introduces the system architecture of a text display system 10 provided in an embodiment of the present application.

[0097] As shown in FIG. 1B , the text display system 10 may include an electronic device 100 and a cloud server 200 .

[0098] The electronic device 100 can receive and respond to user input (e.g., voice input, text input, etc.) to determine message 1 (e.g., voice message, text message, or event message, etc.). After receiving message 1, the electronic device 100 can establish a long link with the cloud server 200 and send message 1 to the cloud server 200 via the long link. The electronic device 100 can receive the display time of a single character sent by the cloud server 200, and can also receive target text sent by the cloud server 200 multiple times, and display the target text based on the display time of a single character (i.e., display one character every time interval corresponding to the display time of a single character).

[0099] The cloud server 200 may store one or more language models, such as LLM, etc. After receiving message 1, the cloud server 200 may call LLM to generate a target text corresponding to message 1, and send the target text to the electronic device 100 through the long link. It should be noted that the cloud server 200 may continuously send the generated tokens in the target text to the electronic device 100 during the process of generating the target text, until all tokens of the target text are sent, thereby reducing the user's waiting time. In addition, during the process of the cloud server 200 generating the target text, the cloud server 200 may also detect the generation time of a single token during the generation process (or obtain the generation time of a single token corresponding to a pre-stored LLM), determine the display time of a single text based on the generation time of the single token, and send the display time of the single text to the electronic device 100. This ensures that the electronic device 100 can display the target text smoothly during the process of displaying the target text.

[0100] It is understandable that the text display system 10 shown in FIG1B is only an example. In the embodiment of the present application, the text display system 10 may further include more electronic devices, or one or more servers, which is not limited in the present application.

[0101] FIG1C shows a schematic diagram of the hardware structure of the electronic device 100 .

[0102] The electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device, and / or a smart city device. The embodiments of the present application do not impose any particular restrictions on the specific type of the electronic device.

[0103] The electronic device 100 may include a processor 110, an internal memory 121, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, and a display screen 194. Optionally, the electronic device 100 may further include any one or more of the following: an external memory interface 120, a button 190, a motor 191, an indicator 192, and the like.

[0104] The sensor module 180 may include one or more sensors, such as a touch sensor 180K, etc. In some embodiments, the sensor module 180 may also include any one or more of the following: a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, an ambient light sensor, a bone conduction sensor, etc.

[0105] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0106] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0107] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0108] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0109] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

[0110] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via a wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device through the power management module 141.

[0111] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 and provides power to the processor 110, the internal memory 121, the display 194, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0112] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0113] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0114] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0115] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0116] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0117] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0118] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0119] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display panel can also be made of an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 can include one or N display screens 194, where N is a positive integer greater than 1.

[0120] The internal memory 121 may include one or more random access memories (RAMs) and one or more non-volatile memories (NVMs). The RAM can be directly read and written by the processor 110 and can be used to store executable programs (e.g., machine instructions) of the operating system or other running programs, as well as user and application data. The NVM can also store executable programs and user and application data, and can be pre-loaded into the RAM for direct reading and writing by the processor 110.

[0121] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory.

[0122] The audio module 170 may include any one or more of the following: a speaker, a receiver, a microphone, and an earphone jack, etc. The electronic device 100 may implement audio functions such as music playback and recording through the audio module 170 and an application processor, etc.

[0123] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0124] The speaker, also called a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.

[0125] The receiver, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver close to the ear to receive the voice.

[0126] A microphone, also known as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can put their mouth close to the microphone and speak to input the sound signal into the microphone. The electronic device 100 can be provided with at least one microphone. In other embodiments, the electronic device 100 can be provided with two microphones, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones to realize sound signal collection, noise reduction, and identification of sound sources, and realize directional recording function, etc.

[0127] The touch sensor 180K is also called a "touch-sensitive device." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a location different from that of the display screen 194.

[0128] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0129] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0130] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0131] FIG1D shows a schematic diagram of the hardware structure of a cloud server 200 provided in an embodiment of the present application.

[0132] As shown in FIG1D , cloud server 200 may include: one or more network device processors 201, memory 202, communication interface 203, transmitter 205, receiver 206, coupler 207, and antenna 208. These components may be connected via bus 204 or other means. FIG1C uses bus connection as an example.

[0133] The communication interface 203 can be used for the cloud server 200 to communicate with other communication devices, such as electronic devices used by consumers of the project. Specifically, the communication interface 203 can be a 3G communication interface, a long-term evolution (LTE) (4G) communication interface, a 5G communication interface, a WLAN communication interface, a WAN communication interface, etc. In addition to being limited to wireless communication interfaces, the cloud server 200 can also be configured with a wired communication interface 203 to support wired communication.

[0134] In some embodiments of the present application, the transmitter 205 and the receiver 206 can be regarded as a wireless modem. The transmitter 205 can be used to transmit and process the signal output by the network device processor 201. The receiver 206 can be used to receive the signal. In the cloud server 200, the number of transmitters 205 and receivers 206 can be one or more. The antenna 208 can be used to convert electromagnetic energy in the transmission line into electromagnetic waves in free space, or to convert electromagnetic waves in free space into electromagnetic energy in the transmission line. The coupler 207 can be used to divide the mobile communication signal into multiple paths and distribute them to multiple receivers 206. It can be understood that the antenna 208 of the network device can be implemented as a large-scale antenna array.

[0135] Memory 202 is coupled to network device processor 201 and is configured to store various software programs and / or multiple sets of instructions. Specifically, memory 202 may include high-speed random access memory and may also include non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.

[0136] The memory 202 may store an operating system (hereinafter referred to as system), such as an embedded operating system such as uCOS, VxWorks, RTLinux, etc. The memory 202 may also store a network communication program that can be used to communicate with other communication devices.

[0137] In the embodiments of the present application, the network device processor 201 can be used to read and execute computer-readable instructions. Specifically, the network device processor 201 can be used to call a program stored in the memory 202, such as an implementation program of the text display method provided in one or more embodiments of the present application, and execute the instructions contained in the program.

[0138] It should be noted that the cloud server 200 shown in FIG1D is only one implementation of the embodiment of the present application. In actual applications, the cloud server 200 may also include more or fewer components, which is not limited here.

[0139] An embodiment of the present application provides a text display method, in which the electronic device 100 can receive and respond to the user's input to determine the type and content of message 1. Message 1 can be a voice message, a text message, an event message, etc. The electronic device 100 establishes a long link with the cloud server 200 and sends message 1 to the cloud server 200 through the long link. After receiving message 1, the cloud server 200 can generate a target text corresponding to message 1 through a language model. In the process of generating the target text, the cloud server 200 can send the language symbols (tokens) generated in the target text to the electronic device 100 in the order of generation. Moreover, the cloud server 200 can also determine the display time of a single text based on the generation time of a single token, and send the display time of a single text to the electronic device 100. The electronic device 100 can display the target text based on the display time of a single text (that is, display one text every time interval corresponding to the display time of a single text).

[0140] This can reduce the user's waiting time, ensure the smoothness of text output, avoid output jams, and provide users with a better user experience.

[0141] The following describes the relationship between the generation time and display time of adjacent tokens in a target text provided by an embodiment of the present application.

[0142] FIG2A shows a schematic diagram of the generation, transmission, and display time of token1 in a target text provided by an embodiment of the present application.

[0143] As shown in FIG2A , the one-dimensional coordinate axis can represent time, T a0 Time to T a1 At this moment, the cloud server 200 can generate token1, T a1 Time to T a2 At this moment, the cloud server 200 can send token1 to the electronic device 100. a2 At this moment, the electronic device 100 can start to display the text in token1 at a constant speed. a3 At this moment, the electronic device 100 can display all the characters in token1. display is fixed. If the number of Chinese characters in token1 is N1, then T a2 and T a3 The following relationship is satisfied: a3 =T a2 +t sisplay *N1 formula (1)

[0144] FIG2B shows a schematic diagram of the generation, transmission, and display time of token2 in a target text provided in an embodiment of the present application.

[0145] As shown in Figure 2B, the one-dimensional coordinate axis can represent time. Since token2 and token1 are two adjacent tokens in the target text, and the generation order of token1 is earlier than the generation order of token2, then at T a1 At this moment, the cloud server 200 can start generating token2. a1 Time to T b1 At this moment, the cloud server 200 can generate token2. b1 Time to T b2 At this moment, the cloud server 200 can send token2 to the electronic device 100. b2 The time is the time when the electronic device 100 receives token2. b2 When the time comes, the electronic device 100 can display all the text in token2 at a uniform speed.

[0146] When the cloud server 200 starts to generate multiple tokens of the target text, it can be considered that the speed of generating tokens is uniform, that is, the time consumed by the cloud server 200 to generate a single token is t token Therefore, T a1 and T b1 The following relationship is satisfied:b1 =T a1 +t token Formula (2)

[0147] In order to avoid the electronic device 100 from freezing during the display of the target text, the electronic device 100 needs to start displaying token2 immediately after displaying token1. The receiving time of token2 is T b2 No later than the time T when token1 is displayed a3 , that is: T b2 ≤T a3 Formula (3)

[0148] When the network quality is stable, the data volume of a single token does not vary much, and the time t taken to transmit a single token is trans can be considered the same, at this time, T a1 With T a2 、T b1 With T b2 The following relationship T can be satisfied a2 =T a1 +t trans Formula (4) T b2 =T b1 +t trans Formula (5)

[0149] Combining the above formulas (1)-(5), we can get:

[0150] In the above formula (6), t word It represents the time it takes for the cloud server 200 to generate a single character. Therefore, under stable network conditions, when the time it takes for the electronic device 100 to display a single character is greater than or equal to the average time it takes for the cloud server 200 to generate a single character (i.e., the speed at which the electronic device 100 displays the character is less than the speed at which the cloud server 200 generates the character), the electronic device 100 can avoid lags during the display process and ensure smooth text display.

[0151] If scale is defined as the ratio of the number of characters to the number of tokens in the same text, then scale = N word / N token Formula (7)

[0152] In the above formula (7), N word is the number of characters in a text, N tokenis the number of tokens in the same text, and scale is the ratio of the number of characters to the number of tokens in the same text. According to the embodiment shown in FIG1A , a token can include one or more characters, that is, the value of scale can be greater than or equal to 1.

[0153] The time t it takes for the cloud server 200 to generate a token token The average time t taken to generate a text word The following relationships can exist:

[0154] Combined with formula (8), the above formula (6) can be equivalent to the following formula (9):

[0155] In the above formula (9), the t on the left side of the inequality is display It can represent the time for the electronic device 100 to display a single character. It can represent the time it takes for the cloud server 200 to generate a single character. According to formula (9), when the time it takes for the electronic device 100 to display a single character is greater than or equal to the ratio of the time it takes for the cloud server 200 to generate a single token to scale, the electronic device 100 can avoid freezes during the display process and ensure smooth text display.

[0156] It is understandable that in the embodiment of the present application, there may be a certain time interval between the time when the token is generated and the time when it is sent. In this case, as long as the time interval is fixed, the electronic device 100 can still avoid freezes during the display process and ensure smooth display of text under the condition of satisfying the above formula (9).

[0157] The following describes a specific process of a text display method provided in an embodiment of the present application.

[0158] As shown in FIG3 , the specific process of a text display method provided in an embodiment of the present application may include the following steps:

[0159] S301, the electronic device 100 receives and responds to a user's input to determine a message 1, where the message 1 may be a voice message, a text message, or an event message.

[0160] In the embodiment of the present application, the user input may be text input, such as inputting the text "Please write a 100-word article", etc. The user input may also be voice input, such as voice "read a poem", etc.

[0161] In other embodiments, the user's input may also be an event input, which is used to set events and trigger conditions for events. The trigger condition for an event may be a predetermined moment, or a predetermined state (such as awake state, motion state, listening to music state), etc. This application does not limit the trigger condition for an event. The electronic device 100 may receive and respond to the user's input, and store the correspondence between the event and the trigger condition of the event. For example, Table 1 shows a correspondence between an event and the trigger condition of an event provided in an embodiment of the present application.

[0162] Table 1

[0163] As shown in Table 1, the electronic device 100 can store events and trigger conditions of events based on user input. For example, the trigger condition of the event "output an article related to spring" is the time "14:00"; the trigger condition of the event "output a 100-word music appreciation article" is listening to music, etc.

[0164] It is understandable that the embodiment shown in Table 1 is only an example. In the embodiment of the present application, the electronic device 100 may also store more, fewer, or different events and trigger conditions than the embodiment shown in Table 1, and the present application does not limit this.

[0165] Electronic device 100 may determine Message 1 based on user input. Message 1 may be a voice message, a text message, or an event message. If the user input is text, Message 1 is a text message. If the user input is voice, Message 1 is a voice message. If the user input is used to set a trigger condition for an event, Message 1 is an event message.

[0166] If the user input is text input or voice input, the electronic device 100 may determine Message 1 based on the user input upon receiving the user input. In this case, the content of Message 1 may include the content of the user input (text input or voice input). For example, if the user input is "write an article about animals", Message 1 may include "write an article about animals".

[0167] If the user input is an event input, the electronic device 100 may receive and respond to the user input, set an event and the triggering conditions of the event, and upon detecting that the triggering conditions of the event are met, determine Message 1. The content of Message 1 may include the content of the event. For example, if the event is "output an article related to spring", Message 1 may include "output an article related to spring".

[0168] S302, the electronic device 100 establishes a long link with the cloud server 200.

[0169] After confirming Message 1, the electronic device 100 can establish a long link with the cloud server 200. In some embodiments, the long link can be a websocket. The specific content of the long link between the electronic device 100 and the cloud server 200 can be referred to the relevant description of the embodiment shown in Figure 7B below, and will not be described in detail here.

[0170] In other embodiments, if a long link has been established between the electronic device 100 and the cloud server 200, step S302 may not be executed. In this case, the electronic device 100 can communicate with the cloud server 200 through the established long link.

[0171] S303, the electronic device 100 sends a message 1 to the cloud server 200 via a long link.

[0172] S304, the cloud server 200 starts to generate a target text based on the message 1 through the language model, and the target text includes multiple tokens.

[0173] The cloud server 200 may store one or more language models, such as LLM.

[0174] In some embodiments, after receiving the message 1, the cloud server 200 may use the message 1 as the input of the LLM and generate the target text corresponding to the message 1 through the LLM.

[0175] In the process of generating multiple tokens of the target text, the cloud server 200 may store the multiple tokens in the order of generation.

[0176] For example, Table 2 shows a generated token stored in a cloud server 200 provided in an embodiment of the present application.

[0177] Table 2

[0178] As shown in Table 2, the cloud server 200 may store multiple generated tokens and their corresponding generation order, for example, token1, token2, and token3, where the generation order of token1 is 1, the generation order of token2 is 2, the generation order of token3 is 3, and so on.

[0179] It is understandable that the embodiment shown in Table 2 is only an example. In the embodiment of the present application, the cloud server 200 may store more, fewer, or different tokens from the embodiment shown in Table 2 above, and the present application does not limit this.

[0180] As another example, Table 3 shows another generated token stored in the cloud server 200 provided in an embodiment of the present application.

[0181] Table 3

[0182] As shown in Table 3, cloud server 200 can store multiple generated tokens and their corresponding generation order and send flags. For example, token1, token2, and token3, where the generation order of token1 is 1, the generation order of token2 is 2, and the generation order of token3 is 3, etc. The send flag can be used to indicate whether the token has been sent by cloud server 200. As can be seen from Table 3, the send flags for token1, token2, and token3 are all not sent, indicating that all three tokens have been sent by cloud server 200.

[0183] It is understandable that the embodiment shown in Table 3 is only an example. In the embodiment of the present application, the cloud server 200 may store more, fewer, or different tokens or sending identifiers than those in the embodiment shown in Table 3 above, and the present application does not limit this.

[0184] In other embodiments, in the process of generating multiple tokens of the target text, the cloud server 200 may also store the generated text in the target text and the order in which the text is generated in the order of generation. The specific storage format can refer to the embodiments shown in Table 2 or Table 3 above, and will not be repeated here.

[0185] S305: The cloud server 200 obtains the time t it takes for the language model to generate a token. token .

[0186] In some embodiments, the cloud server 200 may store the time it takes for the LLM to generate a token. It should be noted that after the language model training is completed, the speed at which the language model generates tokens is determined, that is, after the LLM training is completed, the time it takes for the LLM to generate a token, t token , and t token Stored in the cloud server 200.

[0187] In other embodiments, the cloud server 200 may also detect t in the process of LLM generating the target text. token Specifically, the cloud server 200 can detect the number of tokens generated by the LLM within a fixed time interval (for example, 100 milliseconds), and determine the t based on the fixed time interval and the number of tokens generated. token . The fixed time interval may be a preset time interval.

[0188] It should be noted that, since LLM needs to parse message 1 before generating the target text based on message 1, this parsing process takes a certain amount of time. It takes a long time (e.g., 250 milliseconds) for LLM to generate the first token of the target text from receiving message 1. This time can be called the first token delay. After generating the first token, LLM can generate subsequent tokens at a constant speed without interruption. Therefore, when calculating the time t it takes for LLM to generate a token, token When the cloud server 200 selects a fixed interval time period within the time period after the LLM generates the first token, detects the number of tokens generated in the fixed interval time period, and determines the time t it takes for the LLM to generate a token. token In this way, the error introduced by the first token delay can be avoided.

[0189] S306, the cloud server 200 is based on t token Determine the display time of a single text display .

[0190] The cloud server 200 may store a scale (e.g., 1.25, 1.20, etc.), which is used to indicate the ratio of the number of characters in the text to the number of tokens in the same text. The preset scale value may be set by the administrator of the cloud server 200, or it may be determined by the cloud server 200 based on the ratio of the number of characters in a large amount of text stored internally to the number of tokens. The present application does not limit the value of scale and the method for determining the value. In certain embodiments, different language models may correspond to different scale values. The cloud server 200 may store a corresponding relationship between a language model and a scale value, and determine the corresponding scale value based on the language model currently in use.

[0191] The cloud server 200 can be based on t token and scale are obtained by the above formula (9): display . t display It can be used to indicate the number of characters displayed per unit time during the process of displaying the target text by the electronic device 100. In this way, the electronic device 100 can avoid lag during the process of displaying the target text and ensure smooth display.

[0192] S307, after determining t display Afterwards, the cloud server 200 sends t to the electronic device 100 via the long link. display and the generated token.

[0193] Determine the display time of a single character displayAfterwards, the cloud server 200 may send the generated one or more tokens to the electronic device 100. It is understood that, when the number of tokens sent for the first time is greater than or equal to 1, and the number of tokens sent subsequently is 1, the time taken to display all the tokens sent for the first time is greater than or equal to the time required to generate the next token, which ensures that the next token is received before the electronic device 100 displays all the tokens sent for the first time.

[0194] In some embodiments, when the cloud server 200 sends a generated token to the electronic device 100, it can also send the generation order of the token. For example, when sending token1 and token2 shown in Table 2 above, the generation order 1 of token1 and the generation order 2 of token2 are sent to the electronic device 100 together.

[0195] In other embodiments, the cloud server 200 may also send the one or more tokens to the electronic device 100 in sequence according to the order in which the tokens are generated. display When the tokens generated by the cloud server 200 are multiple tokens shown in Table 2 above, the cloud server 200 can first send token1 to the electronic device 100, then send token2, and then send token3.

[0196] In some embodiments, after the cloud server 200 sends a token to the electronic device 100, the cloud server 200 may delete the sent token from the stored multiple generated tokens. display When the generated token stored in the cloud server 200 is a plurality of tokens shown in Table 2 above, the cloud server 200 will display After token1, token2 and token3 are sent to the electronic device 100, the token stored in the cloud server 200 can refer to the embodiment shown in Table 4 below.

[0197] Table 4

[0198] As shown in Table 4, the cloud server 200 may store newly generated tokens and corresponding generation orders. For example, token 4, the generation order of token 4 is 4. Among them, token 4 is the token generated by the cloud server 200. display The newly generated token. In addition, Table 4 does not include token1, token2, and token3 that have been sent.

[0199] It is understandable that the embodiment shown in Table 4 is only an illustrative example of how the cloud server 200 can delete the sent token from the multiple stored tokens. In the embodiment of the present application, the tokens stored by the cloud server 200 during the process of sending tokens may also include more, fewer, or different tokens from Table 4, and the present application does not limit this.

[0200] In other embodiments, if the cloud server 200 stores a sending flag corresponding to a generated token, the cloud server 200 may change the sending flag of the token from "unsent" to "sent" after sending the token. display When the generated token stored in the cloud server 200 is a plurality of tokens shown in Table 3 above, the cloud server 200 will display After token1, token2 and token3 are sent to the electronic device 100, the token stored in the cloud server 200 can refer to the embodiment shown in Table 5 below.

[0201] Table 5

[0202] As shown in Table 5, the cloud server 200 may store multiple generated tokens and the corresponding generation order and sending identifier. For example, token1, token2, token3 and token4, where token4 is the token generated by the cloud server 200. display Newly generated tokens are generated later, with token1's generation order being 1, token2's generation order being 2, token3's generation order being 3, token4's generation order being 4, and so on. The send flag can be used to indicate whether the token has been sent by cloud server 200. As can be seen from Table 5, the send flags for token1, token2, and token3 are all "sent," indicating that these three tokens have been sent by cloud server 200. The send flag for token4 is "not sent," indicating that token4 has not yet been sent by cloud server 200.

[0203] It is understandable that the embodiment shown in Table 5 is only an example. In the embodiment of the present application, the cloud server 200 may store more, fewer, or different tokens or sending identifiers than those in the embodiment shown in Table 5 above, and the present application does not limit this.

[0204] S308, the electronic device 100 is based on t display Displays the received token.

[0205] After receiving the t sent by the cloud server 200display , one or more tokens, the electronic device 100 can be based on t display Specifically, the electronic device 100 may display the one or more tokens based on the order in which the tokens are received (or based on the order in which the received tokens are generated) at intervals of t. display Display one more word at a time and display all received tokens.

[0206] For example, if all received tokens are "we" in the order of t, the electronic device 100 may first display the word "I" and then display Afterwards, “we” is displayed at the display position after the word “I”.

[0207] The electronic device 100 is based on t display For the specific method of displaying the target text, please refer to the relevant description in the embodiments shown in Figures 6A to 6F below.

[0208] S309, when a newly generated token is detected, the cloud server 200 sends the token to the electronic device 100 via a long link.

[0209] In some embodiments, after sending t display Afterwards, if the cloud server 200 detects a newly generated token, the cloud server 200 can send the token to the electronic device 100. That is, the new token can be sent to the electronic device 100 after it is generated.

[0210] It should be noted that steps S309 to S310 are repeatable steps. When the cloud server 200 detects a newly generated token, steps S309 and S310 can be executed again.

[0211] S310, after displaying all tokens received previously, the electronic device 100 display Display the newly received token.

[0212] S311: When it is detected that the disconnection condition is met, the long link is disconnected.

[0213] The disconnection conditions may include any one or more of the following: network error, cloud server 200 detecting that the target text has been sent, cloud server 200 detecting that the target text has been sent and no message sent by electronic device 100 has been received within a preset time threshold after the sending is completed, electronic device 100 detecting that the user has ended the use of the language model service (for example, the operation of exiting application 11, the operation of releasing the engine, etc.), etc. Among them, application 11 refers to an application that can provide language model services to users through cloud server 200. In some embodiments, the disconnection conditions and the disconnection method of the long link can also refer to the relevant description in the embodiment shown in Figure 7B below.

[0214] The text display method provided in the embodiment of the present application can reduce the user's waiting time and avoid the occurrence of freezes during the text display process, ensuring that the text can be displayed smoothly.

[0215] In some embodiments, the long link between the electronic device 100 and the cloud server 200 can be reused by other messages (such as message 2) generated by the electronic device 100. Long link reuse means that the long link between the electronic device 100 and the cloud server 200 always maintains a connection state between multiple requests and responses, so that the long link can be reused in subsequent requests without having to establish a new long link each time. This approach can reduce the overhead of connection establishment and closing and improve the efficiency of network communication. In an embodiment of the present application, the long link timeout and non-reuse means that after the target text of message 1 is sent, the electronic device 100 does not initiate a request to use the long link within a preset time threshold. The request to use the long link can be message 2 determined by the electronic device 100 based on another input of the user, etc. It should be noted that in the case of long link reuse, the type of message 2 can be the same as the type of message 1, or it can be different from the type of message 1, and this application does not limit it here.

[0216] In some embodiments, the type of message 1 is different, and the time threshold corresponding to the long link is different. For example, when message 1 is a voice message, the time threshold corresponding to the long link may be 3 seconds, that is, after the target text of message 1 is sent, if the long link is not reused within 3 seconds, the long link is disconnected. For another example, when message 1 is a text message or an event message, the time threshold corresponding to the long link may be 60 seconds, that is, after the target text of message 1 is sent, if the long link is not reused within 60 seconds, the long link is disconnected. It is understandable that the embodiment here is only an example of different types of messages 1, and the time thresholds corresponding to long links are different. In the embodiment of the present application, the time threshold may also be a value different from that in the above embodiment, and the present application does not limit it here.

[0217] In the embodiment of the present application, the electronic device 100 may also be based on the display time t of a single character. displayThe display speed of the target text is determined. The display speed of the target text is used to indicate how many characters are displayed per second by the electronic device 100 during the display of the target text. For example, if t display is 20 milliseconds, the target text display speed is After determining the display speed of the target text, the electronic device 100 can display the target text sent by the cloud server 200 based on the display speed of the target text. It is understood that in some embodiments, the cloud server 200 can also determine the display time t of a single word. display After that, the display time based on a single word is t display The display speed of the target text is determined and sent to the electronic device 100 , which is not limited in the application.

[0218] In some application scenarios, the cloud server 200 also needs to perform risk control detection on the generated target text (hereinafter referred to as risk control detection). Risk control detection can be to divide the target text into multiple text segments, and perform risk control detection on each text segment in turn. Each text segment can include one or more tokens. Since risk control detection needs to ensure the semantic integrity of the text segment, and the lengths of different sentences are different, the number of characters in the text segment (or the number of tokens) cannot be a fixed value. In the process of dividing the text segments, the number of words in the text segment cannot be a fixed value, but can correspond to a certain interval, that is, the number of words in the text segment can have a minimum value N min and the maximum value N max , the maximum number of floating words in the text segment N float The maximum number of words in the text segment can be N max and the minimum value N min The difference, that is: N float =N max -N min Formula (10)

[0219] The following describes a method for determining the word count interval of a text segment provided by an embodiment of the present application.

[0220] FIG4A shows a schematic diagram of the generation, transmission, and display time of a text segment 1 in a target text provided by an embodiment of the present application.

[0221] As shown in FIG4A , the one-dimensional coordinate axis can represent time, T c0 Time to T c1 At this moment, the cloud server 200 can generate text segment 1, T c1 Time to T c2 At this moment, the cloud server 200 can perform risk control detection on the text segment 1. c2 Time to T c3At this moment, the cloud server 200 can send the text segment 1 to the electronic device 100. c3 At this moment, the electronic device 100 can start to display all the words in the text segment 1 at a uniform speed. c4 At this moment, the electronic device 100 can display all the characters in the text 1. display is fixed. If the number of characters in text segment 1 is N c1 , then T c3 With T c4 The following relationship is satisfied: c4 =T c3 +t display *N c1 Formula (11)

[0222] FIG4B shows a schematic diagram of the generation, transmission, and display time of a text segment 2 in a target text provided by an embodiment of the present application.

[0223] As shown in FIG4B , the one-dimensional coordinate axis can represent time. Since text segment 2 and text segment 1 are two adjacent text segments in the target text, and the generation order of text segment 1 is earlier than the generation order of text segment 2, then in T c1 At this moment, the cloud server 200 can start generating text segment 2. c1 Time to T d1 At this moment, the cloud server 200 can generate text segment 2. d1 Time to T d2 At this moment, the cloud server 200 can perform risk control detection on the text segment 2. d2 Time to T d3 At this moment, the cloud server 200 can send the text segment 2 to the electronic device 100. d3 The time may be the time when the electronic device 100 receives the text segment 2. d3 When the time comes, the electronic device 100 can display all the characters in the text segment 2 at a uniform speed. c2 , then T c1 With T d1 The following relationship is satisfied: d1 =T c1 +t token *N c2 / scale formula(12)

[0224] In the above formula (12), t token The average time it takes for the cloud server 200 to generate a single token. Scale is the ratio of the number of characters to the number of tokens in the same text.

[0225] Since the data volume between text segments is not much different, and risk control detection is based on the semantics of the text segments, the time spent on risk control detection of text segments can be considered to be the same, that is: T c2 -T c1 =T d2 -T d1 Formula (13)

[0226] When the network quality is stable, the transmission time of the text segment can also be considered to be approximately the same, that is: T c3 -T c2 =T d3 -T d2 Formula (14)

[0227] In order to avoid the electronic device 100 from freezing during the display of the target text, the electronic device 100 needs to start displaying the text segment 2 immediately after displaying the text segment 1. The receiving time of the text segment 2 is T d3 No later than the time T when text segment 1 is finished displaying c4 , that is: T d3 ≤T c4 Formula (15)

[0228] Combining the above formulas (11) to (15), we can obtain:

[0229] If the number of words in text segment 1 is N min , the number of words in text segment 2 is N max , then formula (16) can be replaced by the following formula (17):

[0230] From the above formula (9), we can see that If the equal sign in formula (9) holds, the display time of a single character is the same as the generation time of a single character. In this case, the above formula (17) does not hold. Therefore, consider the case where the greater than sign in formula (9) holds. If there is a constant prop, and prop <scale,t display The value of can refer to the following formula (18):

[0231] Combined with formula (18), the above formula (17) can be replaced by the following formula (19):

[0232] According to the above embodiment, when the word count fluctuation of two adjacent text segments is the largest, if N float and N minIf formula (19) is satisfied, the electronic device 100 can avoid the occurrence of jamming between text segments when displaying the target text. float , in N float and N min When formula (19) is satisfied, the above formula (16) can obviously be satisfied, and the electronic device 100 can also avoid jamming between text segments when displaying the target text.

[0233] Table 6 shows the interval distribution of sentence lengths provided in an embodiment of the present application.

[0234] Table 6

[0235] As shown in Table 6, after exhaustively counting the 1.2 million-character Chinese corpus, sentences can be divided into multiple intervals based on the number of Chinese characters. Each interval corresponds to a different total number of sentences and a different percentage. For example, interval 1, which corresponds to the character count range [1, 5], has 25,620 sentences, accounting for 22.79% of the total number of sentences, with a cumulative value of 22.79%. Interval 2, which corresponds to the character count range [6, 10], has 45,600 sentences, accounting for 40.56% of the total number of sentences, with a cumulative value of 63.35%. Interval 3, which corresponds to the character count range [11, 15], has 25,275 sentences, accounting for 22.48% of the total number of sentences, with a cumulative value of 85.83%. Interval 4 corresponds to the word count range [16, 20]. The total number of sentences within this range is 10,020, accounting for 8.91% of the total number of sentences, with a cumulative value of 94.74%. Interval 5 corresponds to the word count range [21, 30]. The total number of sentences within this range is 5,007, accounting for 4.45% of the total number of sentences, with a cumulative value of 99.19%. Interval 6 corresponds to the word count range [31, 40]. The total number of sentences within this range is 725, accounting for 0.65% of the total number of sentences, with a cumulative value of 99.84%. Interval 7 corresponds to the word count range [41, 50]. The total number of sentences within this range is 150, accounting for 0.13% of the total number of sentences, with a cumulative value of 99.97%. The word count range for interval 8 is [51, 63]. The total number of sentences within this range is 34, accounting for 0.03% of the total number of sentences, and the cumulative value is 100%. According to Table 6 above, most sentences have 6-10 words.

[0236] When selecting the word length of a text segment, you can refer to the content shown in Table 6. Since the text in the text segment needs to ensure semantic integrity, and the length of most sentences falls within the interval 2 and interval 3 shown in Table 6, the maximum floating word length N of the text segment is float The value can be within interval 2 and interval 3 shown in Table 6 above.

[0237] For example, N float You can take 10, It can be taken as 1.2857. At this time, according to the above formula (19), the word count interval corresponding to the text segment can be [35, 45].

[0238] It is understandable that the embodiment here is only an example. In the embodiment of the present application, N float Other numerical values ​​may also be used, and the word count interval corresponding to the text segment may also be other intervals, as long as the above formula (19) is satisfied. This application does not limit the specific value of the word count interval of the text segment.

[0239] The following describes the specific process of another text display method provided by an embodiment of the present application.

[0240] S501, the electronic device 100 receives and responds to a user's input to determine a message 1, where the message 1 may be a voice message, a text message, or an event message.

[0241] S502, the electronic device 100 establishes a long link with the cloud server 200.

[0242] S503, the electronic device 100 sends a message 1 to the cloud server 200 via a long link.

[0243] S504, the cloud server 200 starts to generate a target text based on the message 1 through the language model, and the target text includes multiple tokens.

[0244] S505: The cloud server 200 obtains the time t it takes for the language model to generate a token. token .

[0245] The specific contents of steps S501 to S505 may refer to the relevant descriptions of steps S301 to S305 shown in FIG3 , and will not be repeated here.

[0246] S506, the cloud server 200 is based on t token Determine the display time of a single text display .

[0247] The cloud server 200 can be based on t token The display time t of a single character is determined by the above formula (18): display .

[0248] Here, prop can be a real number greater than 0 and less than scale. prop can be a preset constant. In other embodiments, if the value of scale is related to the language model used, prop can also be determined in real time based on the value of scale.

[0249] S507, the cloud server 200 obtains the word count interval of the text segment [N min ,N max ].

[0250] In some embodiments, the word count interval [N min ,N max ] can be a preset interval, such as [35,45], or [20,26], etc. N min and N max The relationship shown in the above formula (10) and formula (19) needs to be satisfied. The value of prop is the same as that in step S506.

[0251] In other embodiments, the word count interval of the text segment [N min ,N max ] can also be determined by the above formulas (10) and (19) based on the values ​​of scale and prop after determining the language model to be used (such as LLM), and this application does not limit this.

[0252] S508, when it is detected that the number of words in the generated token is greater than N max When the cloud server 200 is based on the semantics and word count interval [N min ,N max ]Identify a text segment.

[0253] The text segment can include one or more generated tokens, and the number of words in the text segment falls within the word count range [N min ,N max ]Inside.

[0254] The cloud server 200 can determine whether the word count falls within the word count interval [N min ,N max ] text segment.

[0255] For example, if the word count interval [N min ,N max] is [35,45]. The text composed of the generated multiple tokens is "I have a cute kitten. It is happy and carefree every day. It waits for me to come home from get off work every day. I like to play with the kitten, and the kitten also likes to play with me." When determining the text segment based on these multiple tokens, you can first take the first 35 words, that is, "I have a cute kitten. It is happy and carefree every day. It waits for me to come home from get off work every day. I like to play with the kitten." Through semantic analysis, it can be seen that the semantics of these 35 words are incomplete, so continue to take values ​​until the semantics of the text are complete, or until the number of words in the text reaches 45. Therefore, the text segment determined based on these multiple tokens is "I have a cute kitten. It is happy and carefree every day. It waits for me to come home from get off work every day. I like to play with the kitten."

[0256] It is understandable that the embodiment herein is merely an example of how to use the semantic and word count intervals [N min ,N max ] Determine the text segment. In the embodiment of the present application, the multiple tokens generated by the cloud server 200 can also be tokens different from those in the above embodiment, and the word count interval [N min ,N max ] can also have different values, which are not limited in this application.

[0257] In some embodiments, after determining a text segment, cloud server 200 may store the text segment and delete all tokens (or text) included in the text segment from the generated token table. For example, if cloud server 200 determines token 1 and token 2 in Table 2 as a text segment, the text segment stored by cloud server 200 may be the content shown in Table 7.

[0258] Table 7

[0259] As shown in Table 7, cloud server 200 may store a confirmed text segment, such as text segment 1. The content of text segment 1 may include token 1 and token 2. Optionally, cloud server 200 may also store a send flag for the text segment, used to determine whether the text segment has been sent. The send flag for text segment 1 shown in Table 7 is "Not Sent," indicating that text segment 1 has not yet been sent.

[0260] In the above case, the multiple generated tokens stored by the cloud server 200 may be the contents shown in Table 8 below.

[0261] Table 8

[0262] As shown in Table 8, the multiple tokens generated by the cloud server 200 may include token3, and the generation order of token3 is 3.

[0263] It is understandable that the embodiments shown in Table 7 and Table 8 are merely examples. In the embodiments of the present application, the text segments stored in the cloud server 200 may also include more, fewer, or different text segments from the embodiments shown in Table 7, and the multiple generated tokens stored in the cloud server 200 may also be tokens different from the embodiments shown in Table 8. This application does not limit this.

[0264] It should be noted that step S508 to step S515 are steps that can be executed repeatedly. When the cloud server 200 detects that the number of characters in the generated and unsent token is greater than N max When the cloud server 200 executes step S508 and subsequent steps again.

[0265] S509: The cloud server 200 performs risk detection on the newly determined text segment to obtain risk information of the text segment.

[0266] The risk information can be used to indicate whether the text segment is risky. In some embodiments, the risk information can include: risky and no risk.

[0267] S510 , the cloud server 200 determines whether the text segment of the target text has been sent to the electronic device 100 .

[0268] In the case where it is determined that the text segment of the target text has not been sent to the electronic device 100 , the cloud server 200 may execute the following step S511 .

[0269] In the case of determining that the text segment of the target text has been sent to the electronic device 100 , the cloud server 200 may execute the following step S512 .

[0270] S511, the cloud server 200 will display , the newly determined text segment and the risk information of the text segment are sent to the electronic device 100 via a long link.

[0271] t display It can be used to indicate the number of characters displayed per unit time when the electronic device 100 is displaying the target text.

[0272] In some embodiments, the cloud server 200 may also determine whether to send risk information to the electronic device 100 based on whether the text segment is risky. If the risk information for the text segment indicates no risk, no risk information is sent; if the risk information for the text segment indicates risk, the risk information for the text segment is sent to the electronic device 100. Alternatively, if the text segment is risky, the cloud server 200 may only send the risk information without sending the text segment.

[0273] After step S511, the electronic device 100 may perform the following step S513.

[0274] S512: The cloud server 200 sends the newly determined text segment and the risk information of the text segment to the electronic device 100 via a long link.

[0275] After step S512, the electronic device 100 may perform the following step S513.

[0276] S513: The electronic device 100 determines whether the target text is risky based on the risk information.

[0277] When the risk information indicates that the target text has risk, the electronic device 100 may determine that the target text has risk; when the risk information indicates that the target text has no risk, the electronic device 100 may determine that the target text has no risk.

[0278] If it is determined that the target text is risk-free, the electronic device 100 may execute step S514 described below.

[0279] If it is determined that the target text is risky, the electronic device 100 may execute step S515 described below.

[0280] S514, the electronic device 100 is based on t display After displaying all the previously received text segments, based on t display Displays newly received text segments.

[0281] When the electronic device 100 displays the target text, every time interval t display One more character is displayed. For the specific display method, please refer to the relevant description in step S308 shown in FIG. 3 .

[0282] S515: Stop displaying the target text and withdraw the displayed text in the target text.

[0283] S516: When it is detected that the disconnection condition is met, disconnect the long link.

[0284] The specific content of step S516 can refer to the relevant content of step S311 shown in Figure 3 above, and will not be repeated here.

[0285] The text display method provided in the embodiment of the present application can not only reduce the user's waiting time, but also perform risk control detection on the target text generated by the cloud server 200, and can also ensure the smooth display of the electronic device 100 during the display of the target text, avoiding freezes and improving the user experience.

[0286] In some application scenarios, if the user of the electronic device 100 chooses to output the target text sent by the cloud server 200 by voice, the electronic device 100 can also receive and respond to the user's operation based on t display Output the received token (or text segment) at a constant speed, that is, every interval t display In this application scenario, the method of outputting text by voice can also be analogously referred to the relevant steps in the embodiment shown in FIG3 or FIG5 above, and will not be repeated here.

[0287] The following is an interface diagram of a set of text display methods provided in an embodiment of the present application.

[0288] When the electronic device 100 displays the interface 1 of the application 11, the electronic device 100 can receive and respond to the user's input (such as voice input, text input, etc.), display the content of the user input in the interface 1, and determine the message 1 based on the user's input, and send the message 1 to the cloud server 200. When the electronic device 100 receives the time t to display a single text sent by the cloud server 200, the time t to display a single text is displayed. display After the target text token (or target text segment), you can enter the target text token every t interval in interface 1. display Display one more character in the target text until all the characters in the target text are displayed. In this way, the target text can be displayed while the cloud server 200 is generating the target text, reducing the user's first waiting time and also allowing the user to display Control the time it takes for the electronic device 100 to display a single character to avoid freezes during the display process.

[0289] For example, as shown in FIG6A , the electronic device 100 displays an application interface 600, which may include a text input control 601 and a voice input control 602. The text input control 601 may be used to trigger the electronic device 100 to display the text input by the user in the application interface 600 based on the user's text input. The voice input control 602 may be used to trigger the electronic device 100 to display the text content corresponding to the user's voice input in the application interface 600 based on the user's voice input.

[0290] The electronic device 100 can receive and respond to the user's input for the text input control 601. As shown in FIG. 6B, a dialog box 603 can be displayed in the application interface 600, and the text input by the user, such as "Write an article of about 100 words", can be displayed in the dialog box 603. After displaying the dialog box 603, the electronic device 100 can also display a waiting indicator 604 below the dialog box 603, and the waiting indicator 604 can be used to prompt the user to wait for the text corresponding to the dialog box 603 to be generated.

[0291] After the electronic device 100 receives the time t for displaying a single character sent by the cloud server 200 display and the token of the target text (or the text segment of the target text), as shown in FIG. 6C, the electronic device 100 can display a dialog box 605 in the application interface 600 and display the first character in the received token (or text segment) in the dialog box 605, such as "In".

[0292] After a time t display has passed, as shown in FIG. 6D, the electronic device 100 can display the first character "I" after "In" in the dialog box 605. Moreover, the display position of "I" is the display position after the display position of the character "In".

[0293] After a time t display has passed, as shown in FIG. 6E, the electronic device 100 can display the first character "we" after "I" in the dialog box 605. Moreover, the display position of "we" is the display position after the display position of the character "I".

[0294] After that, the electronic device 100 can repeat the above process, display the next character every interval of t display until all the characters in the target text are displayed. Exemplarily, after all the characters of the target text are displayed, the electronic device 100 can display the application interface 600 as shown in FIG. 6F.

[0295] As shown in FIG. 6F, the electronic device 100 displays all the characters of the target text in the dialog box 605, such as "In our daily life, we always face various challenges. Sometimes, these challenges may come from our work, sometimes from our interpersonal relationships, and sometimes from our health conditions.". The target text is the text generated by the cloud server 200 based on the content input by the user.

[0296] It can be understood that the embodiments shown in FIGS. 6A to 6F are only examples. In the embodiments of the present application, the application 11 can be the Xiaoyi application or other applications that can use the language model service provided by the cloud server 200, and the present application does not make any limitations here.

[0297] The following is a functional module diagram of a text display system 10 provided in an embodiment of the present application.

[0298] As shown in FIG7A , the text display system 10 may include an electronic device 100 and a cloud server 200. The electronic device 100 may include an application 11 and a voice kit 12, and the cloud server 200 may include an autonomous system (AS) module 21, a dialogue manager (DM) 22, a natural language understanding (NLU) module 23, and an auto speech recognition (ASR) module 24. In some embodiments, the cloud server 200 may further include a risk control module 25.

[0299] Application 11 may include an interface module 11a and a conversation recording module 11b. The interface module 11a may display the interface and the dynamic effects in the interface (such as the dynamic effects of text display, etc.), and may also display the user's input. The interface module 11a may also be used for user interaction, such as receiving and responding to the user's text input, and determining the text input by the user. After determining the text input by the user, the interface module 11a may send the text input by the user to the sound toolbox 12. The conversation recording module 11b may detect the user's voice input, and when the user input voice is detected, the conversation recording module 11b may send an activation instruction to the sound toolbox 12. The interface module 11a in application 11 may also receive and respond to data sent by the sound toolbox 12 (such as the time t taken to display a single word in the target text). display , target text token, target text segment and risk information of the text segment, etc.), based on t display Displays the target text.

[0300] The voice toolbox 12 may include a connector 12a, a collection module 12b, a processing module 12c, a comprehension module 12d, and an execution module 12e. In some embodiments, upon receiving and responding to an activation instruction from the conversation recording module 11b, the voice toolbox 12 may collect user voice input via the collection module 12b, process the voice input via the processing module 12c, perform semantic analysis on the processed voice input via the comprehension module 12d, determine the instruction corresponding to the voice input, and send an execution instruction to the execution module 12e. The execution module 12e may receive and respond to the execution instruction sent by the comprehension module 12d, and execute the operation indicated by the execution instruction. In some embodiments, when the comprehension module 12d determines, based on semantic analysis, that the voice input requires the use of a language model in the cloud server 200, it may send an execution instruction 1 to the execution module 12e. This execution instruction 1 may instruct the execution module 12e to determine, based on the processed voice input, that Message 1 is a voice message. In some embodiments, the voice toolbox 12 may receive and respond to text input from the interface module 11a, and determine, based on the text input, that Message 1 is a text message. After determining the message 1, the voice toolbox 12 can establish a long link (such as websocket) with the AS module 21 through the connector 12a and send the message 1 to the AS module 21. The connector 12a can also receive data sent by the dialogue manager 22 through the AS module 21 (such as the time t taken to display a single word in the target text). display , the token of the target text, the text segment of the target text and the risk information of the text segment, etc.) and sends the received data to the interface module 11a in the application 11.

[0301] After receiving Message 1, the AS module 21 may establish a persistent connection (e.g., a websocket) with the dialog manager 22 or the ASR module 24 based on the type of Message 1. For example, if Message 1 is a text message or an event message, the AS module 21 may establish a persistent connection with the dialog manager 22 and send Message 1 to the dialog manager 22 via the persistent connection. If Message 1 is a voice message, the AS module 21 may establish a persistent connection with the ASR module 24 and send Message 1 to the ASR module 24. The AS module 21 may also receive text content converted from Message 1 sent by the ASR module 24 and send the text content to the dialog manager 22.

[0302] The dialogue manager 22 may include a dialogue management service module 22a and a streaming proxy service module 22b. After receiving the message 1 (or the text content converted from the voice message), the dialogue manager 22 may send the message 1 to the NLU module 23 via the streaming proxy service module 22b. The streaming proxy service module 22b may also receive data sent by the NLU module 23 (e.g., the time t taken to display a single word in the target text). display , target text token, target text segment, and risk information of the target text segment, etc.), and sends the target text to the voice toolbox 12 via the AS module 21. In some embodiments, the dialogue management service module 22a can receive the text segment sent by the NLU module 23 and send the text segment to the risk control module 25. The dialogue management service module 22a can also receive risk information sent by the risk control module 25 and send the risk information of the text segment to the streaming proxy service module 22b.

[0303] After receiving the voice message 1 , the ASR module 24 may perform voice recognition on the voice message, determine the text content corresponding to the voice message, and send the text content of the voice message to the AS module 21 .

[0304] The NLU module 23 may include one or more service modules, such as a large model service module 23a, and optionally, may also include modules such as an intent service module. Among them, the large model service module 23a may store one or more language models, such as LLM, etc. The large model service module 23a may receive the message 1 (or the text content converted from the voice message) sent by the streaming proxy service module 22b. After receiving the above message 1 (or the content of the message 1), the large model service module 23a may use the received message 1 as the input of the LLM, and generate the target text corresponding to the message 1 through the LLM. In the process of the large model service module 23a generating the target text, the NLU module 23 may also detect the time t taken to generate a single token of the target text. token , and based on the above formula (9) determine the time t consumed to display a single word in the target text display The NLU module 23 can also display data (such as the time t taken by a single word in the target text). display , target text token, target text segment, etc.) is sent to the streaming proxy service module 22b. In some embodiments, the NLU module 23 may also store the word count interval [N min ,N max ], and based on the word count interval [N min ,N max ] and the generated token to determine the text segment. After determining the text segment, the NLU module 23 can send the text segment to the dialogue manager 22.

[0305] The risk control module 25 may receive and respond to the text segment sent by the dialogue management service module 22a, perform risk control detection on the text segment, obtain risk information of the text segment, and send the risk information of the text segment to the dialogue management service module 22a.

[0306] It can be understood that the embodiment shown in Figure 7A is only an example. In the embodiment of the present application, the text display system 10 may include more, fewer or different modules from the embodiment shown in Figure 7A, or combine the above multiple modules into one module, or decompose any of the above modules into multiple modules, etc., and the present application does not limit this.

[0307] FIG7B shows two websocket links provided in an embodiment of the present application.

[0308] As shown in FIG7B , during the process of the electronic device 100 and the cloud server 200 executing the text display method provided in the embodiment of the present application, the network socket (websocket) link between the electronic device 100 and each module in the cloud server 200 can be link 1 or link 2. Link 1 can include websocket 1 between the connector 12a and the AS module 21, websocket 2 between the AS module 21 and the dialogue manager 22, and websocket 3 between the dialogue manager 22 and the NLU module 23. Link 2 can include websocket 1 between the connector 12a and the AS module 21, websocket 4 between the AS module 21 and the speech recognition module 24, websocket 2 between the AS module 21 and the dialogue manager 22, and websocket 3 between the dialogue manager 22 and the NLU module 23.

[0309] When the message 1 sent by the electronic device 100 is a text message or an event message, the electronic device 100 and the relevant modules in the cloud server 200 can establish a link 1 and communicate with the NLU module 23 through the link 1.

[0310] When message 1 sent by electronic device 100 is a voice message, electronic device 100 can establish websocket 1 with AS module 21 via connector 12a. Upon recognizing message 1 as a voice message, AS module 21 can establish websocket 4 with voice recognition module 24. Voice recognition module 24 can convert the voice message into a text message and send the text message to AS module 21. AS module 21 can also establish websocket 2 with dialogue manager 22. Dialogue manager 22 can establish websocket 3 with NLU module 23 and send the text message converted by voice recognition module 24 to NLU module 23 via websockets 2 and 3. NLU module 23 can then send data such as the target text of message 1 to electronic device 100 via link 1.

[0311] Since the long link between the electronic device 100 and the cloud server 200 can include multiple websockets, in the above steps S311 and S516, when different disconnection conditions are met, the websockets that are disconnected first can be different. For example, Table 9 shows a correspondence between a disconnection condition and the order in which websockets are disconnected, provided in an embodiment of the present application.

[0312] Table 9

[0313] As shown in Table 9, when different disconnection conditions are met, the websocket that is disconnected first can be different. For example, when the disconnection condition is that the electronic device 100 receives and responds to the user's operation of exiting application 11 (or the user's operation of releasing the engine, etc.), websocket 1 is disconnected first; when the disconnection condition is a network error, websocket 1 is disconnected first; when the disconnection condition is that the voice recognition module times out (for example, 3 seconds), websocket 4 is disconnected first; when the disconnection condition is that the AS module times out (for example, 60 seconds), websocket 1 is disconnected first; when the disconnection condition is that the LLM finishes outputting the target text, websocket 3 is disconnected first, and so on.

[0314] It can be understood that the embodiment shown in Table 9 above is only an example of illustrating that the websocket that is disconnected first under different disconnection conditions is different. In the embodiment of the present application, more, fewer or different disconnection conditions from the above embodiment may be included, and the present application does not limit this.

[0315] Because the overhead of speech recognition module 24 is greater than that of dialog manager 22, and the overhead of maintaining websocket 3 is greater than that of maintaining websocket 2, the connections (e.g., websockets) between different nodes in link 1 and link 2 can be assigned different reuse time thresholds. Within this time threshold after the current target text is transmitted, the link can be reused. Cloud server 200 can store the link structure of different links, and the corresponding relationship between the link components and the reuse time threshold.

[0316] Illustratively, Table 10 shows the correspondence between a message type, a link composition, and a multiplexing time threshold of a link composition part provided in an embodiment of the present application.

[0317] Table 10

[0318] As shown in Table 10, the cloud server 200 may store the correspondence between the message type, link composition, and the reuse time threshold of the link composition. For example, when the message type is a text message or an event message, the link corresponding to the long link may include websocket1, websocket2, and websocket3, and the reuse time threshold of websocket2 may be 60 seconds, that is, if websocket2 is not reused for more than 60 seconds, websocket2 will be disconnected; when the message type is a voice message, the link corresponding to the long link may include websocket1, websocket4, websocket2, and websocket3, and the reuse time threshold of websocket2 may be 60 seconds, and the reuse time threshold of websocket4 may be 60 seconds, that is, if websocket2 is not reused for more than 60 seconds, websocket2 will be disconnected, and if websocket4 is not reused for more than 3 seconds, websocket4 will be disconnected.

[0319] It can be understood that the embodiment shown in Table 10 above is only an example. In the embodiment of the present application, the link multiplexing time threshold corresponding to different links may also be a time different from the embodiment shown in Table 10 above, and the present application does not limit it here.

[0320] In an embodiment of the present application, if after the target text of message 1 is sent, the electronic device 100 generates message 2 based on the user's input, the electronic device 100 can send the message 2 to the cloud server 200 via the long link between the electronic device 100 and the cloud server 200. The type of message 1 and the type of message 2 do not affect the reuse of the long link, but may affect the changes of some websockets in the link. For example, Table 11 shows a correspondence between link reuse and message type provided in an embodiment of the present application.

[0321] Table 11

[0322] As shown in Table 11, the types of message 1 and message 2 correspond to the changes in the links before and after: when message 1 is a text message or an event message, the links for transmitting message 1 and the target text of message 1 include websocket1, websocket2, and websocket3. At this time, if message 2 is a text message or an event message, the link for transmitting message 2 and the target text of message 2 is the same as the link for transmitting message 1 and the target text of message 1; when message 1 is a text message or an event message, if message 2 is a voice message, the link for transmitting message 2 and the target text of message 2 is the same as the link for transmitting message 1 and the target text of message 1. In comparison, a new connection to websocket4 is required; in the case that message 1 is a voice message, the link for transmitting message 1 and the target text of message 1 includes websocket1, websocket4, websocket2 and websocket3. At this time, if message 2 is a voice message, the link for transmitting message 2 and the target text of message 2 is the same as the link for transmitting message 1 and the target text of message 1; in the case that message 1 is a voice message, if message 2 is a text message or an event message, the link for transmitting message 2 and the target text of message 2 is compared with the link for transmitting message 1 and the target text of message 1, and websocket4 needs to be disconnected.

[0323] It is understandable that the embodiment shown in Table 11 above is only an example to illustrate that the type of message does not affect the reuse of long links. Moreover, the embodiment shown in Table 11 above assumes that all established websockets are in an unconnected state (i.e., within the time period corresponding to the reuse time threshold). In the embodiment of the present application, it is also possible to consider the case where different websockets correspond to different reuse time thresholds in combination with the embodiment shown in Table 10, and this application does not limit this.

[0324] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device 100.

[0325] FIG8 is a block diagram of the software structure of the electronic device 100 according to an embodiment of the present invention.

[0326] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0327] The application layer may include a series of application packages and the voice kit 12 shown in FIG. 7A .

[0328] As shown in FIG8 , the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc. The application package may also include the application 11 shown in FIG7A above.

[0329] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0330] As shown in FIG8 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.

[0331] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.

[0332] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0333] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0334] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including answering, hanging up, etc.).

[0335] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0336] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.

[0337] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.

[0338] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0339] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0340] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0341] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0342] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0343] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0344] A 2D graphics engine is a drawing engine for 2D drawings.

[0345] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.

[0346] FIG9 shows a flow chart of a text display method provided in an embodiment of the present application.

[0347] As shown in FIG9 , the specific process of a text display method provided in an embodiment of the present application may include the following steps:

[0348] S901, the electronic device 100 sends a first message to the cloud server 200.

[0349] The first message may be message 1 in the above embodiment.

[0350] S902, the cloud server 200 generates a first target text corresponding to the first message through a language model.

[0351] The first target text may be the target text corresponding to message 1 in the above embodiment.

[0352] S903, after generating the first text segment in the first target text, the cloud server 200 sends a first display speed and the first text segment to the electronic device, where the first display speed is used to indicate the number of characters in the first target text displayed per unit time.

[0353] The first text segment may be the text segment 1 in the above embodiment. The first text segment may also be one or more tokens sent to the electronic device 100 for the first time in step S307 shown in FIG3 .

[0354] The first display speed may refer to the number of characters displayed per unit time. In the embodiment of the present application, the number of characters may also be referred to as the number of words (in the embodiment of the present application, words may include punctuation marks). The first display speed may also refer to the display time t of a single word in the above embodiment. display , based on t display The number of characters displayed per unit time can be determined.

[0355] t display The determination method can refer to the relevant description in the above embodiment and will not be repeated here.

[0356] S904: The electronic device 100 displays the first text segment at a first display speed.

[0357] For the specific content of step S904, reference may be made to step S308 shown in FIG. 3 or step S514 shown in FIG. 5 .

[0358] S905 , the cloud server 200 generates a second text segment in the first target text before the electronic device 100 finishes displaying the first text segment at the first display speed, where the second text segment is located after the first text segment in the first target text.

[0359] The first text segment and the second text segment are two adjacent text segments in the first target text. In the embodiment of the present application, the second text segment may be the text segment 2 in the above embodiment.

[0360] S906 , after generating the second text segment of the first target text, the cloud server 200 sends the second text segment to the electronic device 100 .

[0361] S907 : The electronic device 100 receives a second text segment before or when the first text segment is displayed at the first display speed.

[0362] S908 , after displaying the first text segment at the first display speed, the electronic device 100 displays the second text segment at the first display speed.

[0363] For the specific content of step S908 , reference may be made to the relevant content of step S514 shown in FIG5 or step S310 shown in FIG3 .

[0364] The text display method provided in the embodiment of the present application can not only display the generated text during the process of generating the target text, reducing the user's waiting time, but also avoid freezes during the display process, ensuring smooth display of the text.

[0365] In one possible implementation, the first text segment includes at least one language symbol token, and the second text segment includes a token; the method also includes: in the process of generating the first target text, the cloud server 200 obtains a first generation speed, and the first generation speed is used to indicate the number of tokens generated per unit time; the cloud server 200 determines a first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is less than or equal to the product of the first generation speed and a first scale, and the first scale is the ratio of the number of characters corresponding to the language model to the number of tokens.

[0366] In this way, the number of tokens sent for the first time is greater than or equal to the number of tokens sent each time thereafter, and it takes a longer time to display all the text sent for the first time, which can ensure the smooth display of the text.

[0367] In one possible implementation, the method also includes: in the process of generating the first target text, the cloud server 200 obtains a first generation speed, and the first generation speed is used to indicate the number of tokens generated per unit time; the cloud server 200 determines a first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is equal to the product of the first generation speed and a first constant, the first constant is less than a first ratio, and the first ratio is the ratio of the number of characters corresponding to the language model to the number of tokens; the cloud server 200 sets a word count interval, and the word count interval is used to indicate the word count range of a single text segment of the first target text; in the process of generating the first target text, the cloud server 200 determines the first text segment based on the word count interval; before sending the first text segment, the cloud server 200 determines that the first text segment is risk-free; in the process of generating the first target text, the cloud server 200 determines the second text segment based on the word count interval, and the number of words in the second text segment belongs to the word count interval; before sending the second text segment, the cloud server 200 determines that the second text segment is risk-free.

[0368] In this way, by setting the floating range of the number of words in the text segment and the display speed of the text, smooth display between two adjacent text segments can be ensured.

[0369] In one possible implementation, the method also includes: the cloud server 200 determines a third text segment based on the word count range in the process of generating the first target text, and the third text segment is located after the second text segment in the first target text; the cloud server 200 determines that the third text segment is risky; the cloud server 200 sends the third text segment and the first risk information to the electronic device, and the first risk information is used to indicate that the first target text is risky; after receiving the first risk information, the electronic device 100 withdraws all the content displayed in the first target text.

[0370] In this way, if the target text is detected to be risky, the electronic device can withdraw the displayed content.

[0371] In one possible implementation, the method also includes: when the cloud server 200 sends the first text segment, the cloud server 200 sends second risk information to the electronic device, and the second risk information is used to indicate that the first target text is temporarily risk-free; when the cloud server 200 sends the second text segment, the cloud server 200 sends the second risk information to the electronic device.

[0372] In this way, when the target text is risk-free, the cloud server can also send risk information to the electronic device, and the risk information is used to notify the electronic device that the current text segment is risk-free.

[0373] In a possible implementation, the method further includes: before the electronic device 100 sends the first message to the cloud server, establishing a long link with the cloud server.

[0374] In this way, data such as the first message and the first target text can be transmitted through the long link.

[0375] In a possible implementation, the method further includes: the electronic device 100 receives a first input from the user before establishing a long link with the cloud server; and the electronic device 100 determines a first message based on the first input.

[0376] The type of the first input may include: voice input, text input, and event input. The type of the first message may include a voice message, a text message, or an event message.

[0377] Determining the first message based on the first input specifically includes: determining the type of the first message based on the type of the first input; and determining the content of the first message based on the content of the first input. The content of the first message may be the same as the content of the first input.

[0378] In one possible implementation, the method also includes: when the electronic device 100 detects that a first disconnection condition is met, the electronic device 100 disconnects the long link with the cloud server; the first disconnection condition includes any one or more of the following: network error, receiving a first operation from the user, and the first operation is used to trigger the electronic device to stop using the language model service.

[0379] In this way, the electronic device can disconnect the long link with the cloud server when it detects that the first disconnection condition is met.

[0380] In one possible implementation, the method also includes: when the cloud server 200 detects that a second disconnection condition is met, the cloud server 200 disconnects the long link with the electronic device; the second disconnection condition includes any one or more of the following: network error, the first target text is sent, the first target text is sent and no message sent by the electronic device is received within a first time period after the sending is completed.

[0381] In this way, the cloud server can disconnect the long link with the electronic device when it detects that the second disconnection condition is met.

[0382] In one possible implementation, after the electronic device 100 displays the first target text at the first display speed, the electronic device 100 receives a second input from the user; the electronic device 100 determines a second message based on the second input; the electronic device 100 sends the second message to the cloud server; the cloud server 200 generates a second target text corresponding to the second message through a language model; after generating a fourth text segment in the second target text, the cloud server 200 sends the second display speed and the fourth text segment to the electronic device; the second display speed is used to indicate the number of characters in the second target text displayed per unit time; the electronic device 100 displays the fourth text segment at the second display speed; before the electronic device displays the fourth text segment at the second display speed, the cloud server 200 generates a fifth text segment in the second target text, the fifth text segment being located after the fourth text segment in the second target text; after generating the fifth text segment of the second target text, the cloud server 200 sends the fifth text segment to the electronic device; the electronic device 100 receives the fifth text segment before or when the fourth text segment is displayed at the second display speed; after displaying the fourth text segment at the second display speed, the electronic device 100 displays the fifth text segment at the second display speed.

[0383] In this way, the second message and the second target text can also be transmitted through the long link.

[0384] In one possible implementation, the electronic device 100 sends a second message to the cloud server, specifically including: when the time interval between the moment when the electronic device 100 displays the first target text and the moment when the second input is received is less than the second duration, the electronic device 100 sends the second message to the cloud server.

[0385] The reuse of long links can be timed to a threshold. Within this threshold, a second message can reuse the same long link used to transmit the first message. This way, if a long link is unused for an extended period, it can be automatically disconnected, reducing energy consumption.

[0386] The various implementation modes of this application can be combined arbitrarily to achieve different technical effects.

[0387] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0388] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0389] In short, the above description is only an embodiment of the technical solution of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of the present invention should be included in the scope of protection of the present invention.

Claims

1. A text display system, characterized in that: The system includes an electronic device and a cloud server; wherein, The electronic device is used to send a first message to the cloud server; The cloud server is used to generate a first target text corresponding to the first message through a language model; The cloud server is further configured to send a first display speed and the first text segment to the electronic device after generating a first text segment in the first target text; the first display speed is used to indicate the number of characters in the first target text displayed per unit time; The electronic device is further configured to display the first text segment at the first display speed; The cloud server is further configured to generate a second text segment in the first target text before the electronic device finishes displaying the first text segment at the first display speed, wherein the second text segment is located after the first text segment in the first target text; The cloud server is further configured to send a second text segment of the first target text to the electronic device after generating the second text segment of the first target text; The electronic device is further configured to receive the second text segment before the first text segment is displayed at the first display speed, or when the first text segment is displayed at the first display speed; The electronic device is further configured to display the second text segment at the first display speed after the first text segment is displayed at the first display speed.

2. The system according to claim 1, characterized in that The first text segment includes at least one language symbol token, and the second text segment includes a token; The cloud server is further used to obtain a first generation speed during the process of generating the first target text, where the first generation speed is used to indicate the number of tokens generated per unit time; The cloud server is also used to determine the first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is less than or equal to the product of the first generation speed and a first scale, and the first scale is the ratio of the number of characters corresponding to the language model to the number of tokens.

3. The system according to claim 1, characterized in that The cloud server is further used to obtain a first generation speed during the process of generating the first target text, where the first generation speed is used to indicate the number of tokens generated per unit time; The cloud server is further used to determine the first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is equal to the product of the first generation speed and a first constant, the first constant is less than a first ratio, and the first ratio is the ratio of the number of characters corresponding to the language model to the number of tokens; The cloud server is further used to set a word count interval, where the word count interval is used to indicate a word count range of a single text segment of the first target text; The cloud server is further configured to determine the first text segment based on the word count interval during the process of generating the first target text; The cloud server is further configured to determine that the first text segment is risk-free before sending the first text segment; The cloud server is further configured to determine the second text segment based on the word count interval during the process of generating the first target text, wherein the number of words in the second text segment belongs to the word count interval; The cloud server is further configured to determine that the second text segment is risk-free before sending the second text segment.

4. The system according to claim 3, characterized in that The cloud server is further configured to determine the third text segment based on the word count interval during the process of generating the first target text, wherein the third text segment is located after the second text segment in the first target text; The cloud server is further used to determine that the third text segment has a risk; The cloud server is further used to send the third text segment and first risk information to the electronic device, where the first risk information is used to indicate that the first target text has a risk; The electronic device is further used to withdraw all contents displayed in the first target text after receiving the first risk information.

5. The system according to claim 3 or 4, characterized in that: The cloud server is further configured to send second risk information to the electronic device when sending the first text segment, wherein the second risk information is used to indicate that the first target text is temporarily risk-free; The cloud server is further configured to send the second risk information to the electronic device when sending the second text segment.

6. The system according to any one of claims 1 to 5, characterized in that: The electronic device is further used to establish a long link with the cloud server before sending the first message to the cloud server.

7. The system according to claim 6, characterized in that The electronic device is further configured to receive a first input from a user before establishing the long link with the cloud server; The electronic device is further configured to determine the first message based on the first input.

8. The system according to claim 6 or 7, characterized in that: The electronic device is also used to disconnect the long link with the cloud server when it is detected that a first disconnection condition is met; the first disconnection condition includes any one or more of the following: a network error, receiving a first operation from a user, and the first operation is used to trigger the electronic device to stop using the language model service.

9. The system according to any one of claims 6 to 8, characterized in that: The cloud server is also used to disconnect the long link with the electronic device when it is detected that a second disconnection condition is met; the second disconnection condition includes any one or more of the following: network error, the first target text is sent, the first target text is sent and no message sent by the electronic device is received within a first time period after the sending is completed.

10. The system according to any one of claims 1 to 9, characterized in that: The electronic device is further configured to receive a second input from a user after displaying the first target text at the first display speed; The electronic device is further configured to determine a second message based on the second input; The electronic device is further configured to send the second message to the cloud server; The cloud server is further configured to generate a second target text corresponding to the second message through a language model; The cloud server is further configured to send the second display speed and the fourth text segment to the electronic device after generating a fourth text segment in the second target text; the second display speed is used to indicate the number of characters in the second target text displayed per unit time; The electronic device is further configured to display the fourth text segment at the second display speed; The cloud server is further configured to generate a fifth text segment in the second target text before the electronic device finishes displaying the fourth text segment at the second display speed, wherein the fifth text segment is located after the fourth text segment in the second target text; The cloud server is further configured to send a fifth text segment of the second target text to the electronic device after generating the fifth text segment; The electronic device is further configured to receive the fifth text segment before the fourth text segment is displayed at the second display speed or when the fourth text segment is displayed at the second display speed; The electronic device is further configured to display the fifth text segment at the second display speed after displaying the fourth text segment at the second display speed.

11. The system according to claim 10, characterized in that The electronic device is further used to send the second message to the cloud server, specifically including: The electronic device is further configured to send the second message to the cloud server when the time interval between the moment when the first target text is displayed and the moment when the second input is received is less than a second duration.

12. A text display method, characterized in that: Applied to a cloud server, the method comprises: Receiving a first message sent by an electronic device; Generate a first target text corresponding to the first message by using a language model; After generating a first text segment in the first target text, sending a first display speed and the first text segment to the electronic device; the first display speed is used to indicate the number of characters displayed per unit time; generating a second text segment in the first target text, wherein the second text segment is located after the first text segment in the first target text; The second text segment is sent to the electronic device before the electronic device finishes displaying the first text segment at the first display speed.

13. The method according to claim 12, characterized in that The first text segment includes one or more language symbols token, and the second text segment includes one token; The method further comprises: In the process of generating the first target text, obtaining a first generation speed, where the first generation speed is used to indicate the number of tokens generated per unit time; The first display speed is determined based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is less than or equal to the product of the first generation speed and a first scale, and the first scale is the ratio of the number of characters corresponding to the language model to the number of tokens.

14. The method according to claim 12, characterized in that The method further comprises: In the process of generating the first target text, obtaining a first generation speed, where the first generation speed is used to indicate the number of tokens generated per unit time; determining the first display speed based on the first generation speed and a first constraint relationship; the first constraint relationship is that the first display speed is equal to the product of the first generation speed and a first constant, the first constant is less than a first ratio, and the first ratio is a ratio of the number of characters corresponding to the language model to the number of tokens; Setting a word count interval, wherein the word count interval is used to indicate a word count range of a single text segment of the first target text; In the process of generating the first target text, determining the first text segment based on the word count interval; Before sending the first text segment, determining that the first text segment is risk-free; In the process of generating the first target text, the second text segment is determined based on the word count range, and the number of words in the second text segment belongs to the word count range; Before sending the second text segment, it is determined that the second text segment is risk-free.

15. The method according to claim 14, characterized in that The method further comprises: In the process of generating the first target text, determining the third text segment based on the word count interval, wherein the third text segment is located after the second text segment in the first target text; determining that the third text segment is risky; The third text segment and first risk information are sent to the electronic device, where the first risk information is used to indicate that the first target text is risky.

16. The method according to claim 14 or 15, characterized in that The method further comprises: When sending the first text segment, sending second risk information to the electronic device, the second risk information is used to indicate that the first target text is temporarily risk-free; When the second text segment is sent, the second risk information is sent to the electronic device.

17. The method according to any one of claims 12 to 16, characterized in that: The method further comprises: Before receiving the first message sent by the electronic device, a long link is established with the electronic device.

18. The method according to claim 17, characterized in that The method further comprises: When it is detected that a second disconnection condition is met, the long link with the electronic device is disconnected; the second disconnection condition includes any one or more of the following: network error, the first target text is sent, the first target text is sent and no message sent by the electronic device is received within a first time period after the sending is completed.

19. The method according to any one of claims 12 to 18, characterized in that: The method further comprises: After sending the first target text, receiving a second message sent by the electronic device; Generate a second target text corresponding to the second message by using a language model; After generating a fourth text segment in the second target text, sending the second display speed and the fourth text segment to the electronic device; Before the electronic device finishes displaying the fourth text segment at the second display speed, generating a fifth text segment in the second target text, the fifth text segment being located after the fourth text segment in the second target text; After generating a fifth text segment of the second target text, the fifth text segment is sent to the electronic device.

20. A text display method, characterized in that: Applied to electronic equipment, the method comprises: Sending a first message to the cloud server; Receiving a first display speed and a first text segment in a first target text sent by the cloud server; the first display speed is used to indicate the number of characters in the first target text displayed per unit time; the first target text is a text generated by the cloud server based on the first message through a language model; displaying the first text segment at the first display speed; Before the electronic device finishes displaying the first text segment at the first display speed, receiving a second text segment in the first target text, the second text segment being located after the first text segment in the first target text; After the first text segment is displayed at the first display speed, the second text segment is displayed at the first display speed.

21. The method according to claim 20, characterized in that The first text segment includes one or more language symbols tokens, and the second text segment includes one token.

22. The method according to claim 20, characterized in that The method further comprises: receiving the third text segment and first risk information sent by the cloud server, wherein the first risk information is used to indicate that the first target text has a risk; After receiving the first risk information, all contents displayed in the first target text are withdrawn.

23. The method according to claim 22, characterized in that The receiving the first display speed and the first text segment in the first target text sent by the cloud server specifically includes: Receiving a first display speed, a first text segment in a first target text, and second risk information sent by the cloud server, wherein the second risk information is used to indicate that the first target text is temporarily risk-free; The receiving the second text segment in the first target text specifically includes: A second text segment in the first target text and the second risk information are received.

24. The method according to any one of claims 20 to 23, characterized in that The method further comprises: Before sending the first message to the cloud server, a long link is established with the cloud server.

25. The method according to claim 24, characterized in that The method further comprises: Before establishing the long link with the cloud server, receiving a first input from a user; In response to the first input, the first message is determined based on the first input.

26. The method according to claim 24 or 25, characterized in that The method further comprises: When it is detected that a first disconnection condition is met, the long link with the cloud server is disconnected; the first disconnection condition includes any one or more of the following: a network error, receiving a first operation from a user, and the first operation is used to trigger the electronic device to stop using the language model service.

27. The method according to any one of claims 20 to 26, characterized in that The method further comprises: After displaying the first target text at the first display speed, receiving a second input from the user; In response to the second input, determining a second message based on the second input; Sending the second message to the cloud server; receiving a second display speed sent by the cloud server and a fourth text segment in a second target text; the second display speed is used to indicate the number of characters in the second target text displayed per unit time; the second target text is a text generated by the cloud server through a language model based on the second message; displaying the fourth text segment at the second display speed; Before the electronic device finishes displaying the fourth text segment at the second display speed, receiving a fifth text segment in the second target text, the fifth text segment being located after the fourth text segment in the second target text; After the fourth text segment is displayed at the second display speed, the fifth text segment is displayed at the second display speed.

28. The method according to claim 27, characterized in that The sending the second message to the cloud server specifically includes: When the time interval between the moment when the first target text is displayed and the moment when the second input is received is less than a second duration, the second message is sent to the cloud server.

29. A server, characterized in that: include: One or more processors and one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the cloud server executes the method described in any one of claims 12-19.

30. An electronic device, characterized in that: include: One or more processors and one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in any one of claims 20-28.

31. A computer-readable storage medium comprising computer instructions, characterized in that: When the computer instructions are executed on the cloud server, the cloud server executes the method described in any one of claims 12 to 19.

32. A computer-readable storage medium comprising computer instructions, characterized in that: When the computer instructions are executed on an electronic device, the electronic device is caused to execute the method described in any one of claims 20 to 28.

Citation Information

Patent Citations

  • Reception device, method for controlling same, distribution device, distribution method, program, and distribution system

    CN103988520A

  • Text generation method and device

    CN109977390A

  • Character input method and device based on all-in-one machine, equipment and readable storage medium

    CN111722730A

  • Method of enhancing the readability of rapidly displayed text

    US6130968A