Character display method, system and related device

By establishing long links between electronic devices and cloud servers, sending text segments and display speed in segments, the problems of long waiting time for users and stuttering text display in the prior art are solved, and the smooth display of target text and optimized user experience are achieved.

CN119629162AActive Publication Date: 2025-03-14HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311190565.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-14
Publication Date
2025-03-14
Estimated Expiration
2043-09-14

AI Technical Summary

Technical Problem

After the prior art generates the target text, the electronic device is used to display the target text, resulting in the user waiting time too long and prone to stuttering in the text display process, affecting the user experience.

Method used

By establishing a long link between the electronic device and the cloud server, the cloud server sends text segments and display speeds in segments during the process of generating the target text. The electronic device displays the target text segments according to the received display speed and text segments.

Benefits of technology

It realizes the instant display of generated text during the process of generating target text, which reduces user waiting time, avoids lag during the display process, and ensures smooth output of text and optimized user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119629162A_ABST
    Figure CN119629162A_ABST
Patent Text Reader

Abstract

The invention discloses a character display method and system and a related device. And the electronic equipment sends a first message to the cloud server through the long link. And the cloud server generates a target text corresponding to the first message through the language model, wherein the target text comprises a plurality of language symbols. And in the process of generating the target text, the cloud server determines the display time consumption of the single character based on the generation time of the single language symbol, and sends the generated language symbol and the display time consumption of the single character to the electronic equipment according to the generation sequence. The electronic device can display the target text based on the display time consumption of the single character (i.e., one character is displayed every time the time interval corresponding to the display time consumption of the single character is passed). Therefore, the waiting time of the user can be shortened, the fluency of text output can be ensured, output lagging is avoided, and better use experience is provided for the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the continuous development of machine learning related technologies, natural language processing related algorithms are becoming more mature. Electronic devices can generate target text based on user input voice or primary text through language models. After obtaining the entire content of the target text, the electronic device can display the target text on the display screen.

[0003] However, the language model has a large number of parameters and calculations, and it takes a long time to generate the target text, and the longer the text is, the longer it takes. If the above method is used to output the target text, the user's waiting time is too long and the user experience is poor. Summary of the invention

[0004] 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 output of text.

[0005] 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 displays the first text segment at the first display speed, the second text segment being 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 displaying the first text segment at the first display speed, or when displaying the first text segment 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.

[0006] 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.

[0007] In a 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 also 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.

[0008] 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 texts sent for the first time, which can ensure smooth display of the texts.

[0009] In a 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.

[0010] 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.

[0011] 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, the third text segment being 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 an electronic device, the first risk information being 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.

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

[0013] 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.

[0014] 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.

[0015] 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.

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

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

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

[0019] 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.

[0020] In one possible implementation, the electronic device is further 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.

[0021] 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.

[0022] In one possible implementation, 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.

[0023] 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.

[0024] In a possible implementation, the electronic device is further used to receive a second input from a user after displaying a first target text at a first display speed; the electronic device is further used to determine a second message based on the second input; the electronic device is further used to send the second message to a cloud server; the cloud server is further used to generate a second target text corresponding to the second message through a language model; the cloud server is further used to send a second display speed and a 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 used to display the fourth text segment at the second display speed; the cloud server is further used 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 after the fourth text segment in the second target text; the cloud server is further used 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 used 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 used to display the fifth text segment at the second display speed after displaying the fourth text segment at the second display speed.

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

[0026] 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.

[0027] The reuse of the long link can correspond to a time threshold. Within the preset time threshold, the second message can reuse the long link used to transmit the first message. In this way, if the long link is not used for a long time, it can be automatically disconnected to reduce energy consumption.

[0028] In a 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 being after the first text segment in the first target text; and sending the second text segment to the electronic device before the electronic device finishes displaying the first text segment at the first display speed.

[0029] 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.

[0030] In a possible implementation, the first text segment includes one or more language symbols token, and the second text segment includes a token; the method also includes: in the process of generating the first target text, obtaining a first generation speed, the first generation speed is 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.

[0031] 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 texts sent for the first time, which can ensure smooth display of the texts.

[0032] In a possible implementation, the method also includes: in the process of generating the first target text, obtaining a first generation speed, the first generation speed is 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 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; setting a word count interval, 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, 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 belongs to the word count interval; before sending the second text segment, determining that the second text segment is risk-free.

[0033] 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.

[0034] In one possible implementation, the method also 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.

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

[0036] In a possible implementation, the method further includes: 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 sending the second text segment, sending the second risk information to the electronic device.

[0037] 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.

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

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

[0040] In one possible implementation, the method also 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.

[0041] 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.

[0042] 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.

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

[0044] 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.

[0045] 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.

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

[0047] 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 texts sent for the first time, which can ensure smooth display of the texts.

[0048] In a possible implementation, the method further includes: receiving a third text segment and first risk information sent by a 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.

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

[0050] In a possible implementation, receiving a first display speed and a first text segment in a first target text sent by a cloud server specifically includes: receiving the first display speed, the first text segment in the first target text, and 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 a second text segment in the first target text specifically includes: receiving the second text segment and second risk information in the first target text.

[0051] 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.

[0052] 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.

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

[0054] 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.

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

[0056] 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.

[0057] In one possible implementation, the method also 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: 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.

[0058] 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.

[0059] 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 a cloud server; receiving a second display speed and a 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 a 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.

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

[0061] 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.

[0062] The reuse of the long link can correspond to a time threshold. Within the preset time threshold, the second message can reuse the long link used to transmit the first message. In this way, if the long link is not used for a long time, it can be automatically disconnected to reduce energy consumption.

[0063] 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 used to store computer program codes, and the computer program codes include computer instructions. When the one or more processors execute the computer instructions, the server executes the text display method in any possible implementation of the second aspect.

[0064] 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 codes, and the computer program codes include computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the text display method in any possible implementation of the third aspect.

[0065] In a sixth aspect, an embodiment of the present application provides a computer storage medium, including 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 above.

[0066] 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.

[0067] 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

[0068] Figure 1A A schematic diagram of a language symbol (token) in a text A provided in an embodiment of the present application;

[0069] Figure 1B A schematic diagram of the system architecture of a text display system 10 provided in an embodiment of the present application;

[0070] Figure 1C A schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application;

[0071] Figure 1D A schematic diagram of the hardware structure of a cloud server 200 provided in an embodiment of the present application;

[0072] Figure 2A A schematic diagram of the time relationship between the generation time, transmission time and display time of a token1 provided in an embodiment of the present application;

[0073] Figure 2B A schematic diagram of the time relationship between the generation time, transmission time and display time of a token2 provided in an embodiment of the present application;

[0074] Figure 3 A flowchart of a text display method provided in an embodiment of the present application;

[0075] Figure 4A A schematic diagram of the time relationship between the generation time, transmission time and display time of a text segment 1 provided in an embodiment of the present application;

[0076] Figure 4B A schematic diagram of the time relationship between the generation time, transmission time and display time of a text segment 2 provided in an embodiment of the present application;

[0077] Figure 5 A flowchart of another text display method provided in an embodiment of the present application;

[0078] Figure 6A-6F A schematic diagram of an interface of a group of text display methods provided in an embodiment of the present application;

[0079] Fig. 7A A functional module diagram of a text display system 10 provided in an embodiment of the present application;

[0080] Figure 7B Schematic diagram of two links between the electronic device 100 and each module of the cloud server 200 provided in an embodiment of the present application;

[0081] Figure 8 A schematic diagram of a software architecture of an electronic device 100 provided in an embodiment of the present application;

[0082] Fig. 9 A flowchart of a text display method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0083] The technical solutions in the embodiments of the present application will be described clearly and in detail below 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 of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0084] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0085] The term "user interface (UI)" in the following embodiments of the present 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 can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation 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.

[0086] Some professional terms involved in the embodiments of the present application are introduced below.

[0087] Natural language understanding (NLU): NLU is a discipline that integrates linguistics, logic, psychology, and computer science. NLU can obtain the semantic representation of natural language through the analysis of grammar, semantics, and pragmatics.

[0088] Large language model (LLM): LLM refers to a neural network model that has been trained with a large amount of text data. It has powerful natural language processing and code generation capabilities and is widely used in natural language processing, machine translation, dialogue systems, code generation and other fields. LLM can generate a piece of text by learning a large amount of text data (such as web pages, books, papers, etc.). LLM usually consists of millions of parameters and has high representation and generation capabilities. By inputting a question or task description, LLM can generate code or text corresponding to the input.

[0089] Language symbol (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 based on tokens as the basic unit.

[0090] For example, Figure 1A A token schematic diagram in a text A provided in an embodiment of the present application is shown.

[0091] like Figure 1A As shown, text A can be the text "In our daily life, we always face various challenges." According to grammar and semantics, text A can include the following multiple tokens: "in", "we", "of", "daily", "life", "in", "," "we", "always", "will", "face", "various", "all kinds", "of", "challenges" and ".", and the arrangement order of the above tokens is consistent with the arrangement order of these tokens in text A. Since LLM generates text with tokens as the basic unit, in the process of generating text A, LLM can sequentially select all tokens in text A according to the arrangement order of tokens in text A until all tokens in text A are generated.

[0092] Understandably, Figure 1A The illustrated embodiment is only an example. In the embodiments of the present application, different texts may include more, fewer, or different tokens from those in the above embodiments, and the present application does not limit this.

[0093] 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 an embodiment of the present application, a long link may include a websocket, etc.

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

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

[0096] The electronic device 100 can receive and respond to the user's input (such as voice input, text input, etc.) to determine the message 1 (such as a voice message, a text message, or an event message, etc.). After receiving the message 1, the electronic device 100 can establish a long link with the cloud server 200 and send the message 1 to the cloud server 200 through the long link. The electronic device 100 can receive the display time of a single word sent by the cloud server 200, and can also receive the target text sent by the cloud server 200 in multiple times, and display the target text based on the display time of a single word (that is, display one word every time interval corresponding to the display time of a single word).

[0097] 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 the tokens of the target text are sent, which can reduce the waiting time of the user. 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 the pre-stored LLM), determine the display time of a single word based on the generation time of a single token, and send the display time of a single word to the electronic device 100. This ensures that the electronic device 100 can display the target text smoothly during the display process.

[0098] Understandably, Figure 1B The text display system 10 shown is only an example. In the embodiment of the present application, the text display system 10 may further include more electronic devices, or include one or more servers, which is not limited in the present application.

[0099] Figure 1CA schematic diagram of the hardware structure of the electronic device 100 is shown.

[0100] 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 special restrictions on the specific type of the electronic device.

[0101] 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.

[0102] 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.

[0103] It is to be understood that the structure illustrated in the embodiment 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 in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0104] 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 processor (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), etc. Different processing units may be independent devices or integrated into one or more processors.

[0105] 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.

[0106] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0107] In some embodiments, the processor 110 may include one or more interfaces. The interface 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, etc.

[0108] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input via a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device via the power management module 141.

[0109] 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 screen 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 number, battery health status (leakage, impedance), etc. 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.

[0110] 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.

[0111] 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 the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0112] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., 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.

[0113] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent 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 the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a 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.

[0114] 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 integrating 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, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0115] 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 the network and other devices through wireless communication technology. The wireless communication technology 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).

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

[0117] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), and 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), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

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

[0119] 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 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.

[0120] The audio module 170 may include any one or more of the following: a speaker, a receiver, a microphone, an earphone interface, 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.

[0121] 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 arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

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

[0123] 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 voice message, the voice can be received by placing the receiver close to the human ear.

[0124] A microphone, also called 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 collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0125] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0126] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0127] 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.

[0128] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0129] Figure 1D A schematic diagram of the hardware structure of a cloud server 200 provided in an embodiment of the present application is shown.

[0130] like Figure 1D As shown, the 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. Figure 1C Take bus connection as an example.

[0131] 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. Not limited to a wireless communication interface, the cloud server 200 can also be configured with a wired communication interface 203 to support wired communication.

[0132] 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 it 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.

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

[0134] 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, which may be used to communicate with other communication devices.

[0135] In the embodiment 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.

[0136] Need to explain, Figure 1D The cloud server 200 shown 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.

[0137] The embodiment of the present application provides a text display method, and the electronic device 100 can receive and respond to the user's input to determine the type of message 1 and the content of message 1. Message 1 can be a voice message, a text message, or 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 sequence according to the generation order. 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 a text every time interval corresponding to the display time of a single text).

[0138] In this way, the user's waiting time can be reduced, the smoothness of text output can be ensured, output jams can be avoided, and a better user experience can be provided.

[0139] 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.

[0140] Figure 2A A schematic diagram of the generation, transmission and display time of token1 in a target text provided in an embodiment of the present application is shown.

[0141] like Figure 2A As shown, 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 uniform 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 N 1 , then T a2 and T a3 The following relationship is satisfied:

[0142] T a3 =T a2 +t display *N 1 Formula (1)

[0143] Figure 2B A schematic diagram of the generation, transmission and display time of token2 in a target text provided in an embodiment of the present application is shown.

[0144] like Figure 2B As shown in , 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 in 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.

[0145] 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:

[0146] T b1 =T a1 +t token Formula (2)

[0147] In order to avoid the electronic device 100 from freezing when displaying 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:

[0148] T b2 ≤T a3 Formula (3)

[0149] 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 regarded as the same. At this time, T a1 With T a2 、T b1 With T b2 The following relationship can be satisfied

[0150] T a2 =T a1 +t trans Formula (4)

[0151] T b2 =T b1 +t trans Formula (5)

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

[0153]

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

[0155] If scale is defined as the ratio of the number of characters to the number of tokens in the same text, then

[0156] scale = N word / N token Formula (7)

[0157] In the above formula (7), N word is the number of characters in a text, N token is the number of tokens in the same text, and scale is the ratio of the number of words to the number of tokens in the same text. Figure 1A It can be seen from the illustrated embodiment that a token may include one or more characters, that is, the value of scale may be greater than or equal to 1.

[0158] 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:

[0159]

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

[0161]

[0162] In the above formula (9), the t on the left side of the inequality is display 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 word. According to formula (9), when the time it takes for the electronic device 100 to display a single word 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.

[0163] 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).

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

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

[0166] 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.

[0167] In the embodiment of the present application, the user's input may be text input, such as inputting the text "Please write an article of 100 words", etc. The user's input may also be voice input, such as voice "read a poem", etc.

[0168] In other embodiments, the user's input may also be an event input, and the event input is used to set the event and the triggering condition of the event. The triggering condition of the event may be a predetermined moment, or a predetermined state (e.g., awake state, motion state, listening to music state), etc., and the present application does not limit the triggering condition of the event. The electronic device 100 may receive and respond to the user's input, and store the correspondence between the event and the triggering condition of the event. Exemplarily, Table 1 shows a correspondence between an event and the triggering condition of the event provided in an embodiment of the present application.

[0169] Table 1

[0170] Trigger conditions event 14:00 Output an article related to spring Listen to music Output a 100-word music appreciation article

[0171] 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.

[0172] 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.

[0173] The electronic device 100 may determine the message 1 based on the user's input, and the types of the message 1 may include: voice message, text message and event message. When the user's input is text input, the message 1 is a text message. When the user's input is voice input, the message 1 is a voice message. When the user's input is used to set the trigger condition of the event, the message 1 is an event message.

[0174] If the user input is text input or voice input, the electronic device 100 may determine Message 1 based on the user input when receiving the user input. At this time, 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 related to animals", Message 1 may include "write an article related to animals".

[0175] If the user input is an event input, the electronic device 100 can receive and respond to the user input, set the event and the triggering condition of the event, and when the triggering condition of the event is detected to be 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".

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

[0177] After confirming the 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 as follows Figure 7B The relevant descriptions in the illustrated embodiments are not described in detail here.

[0178] 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.

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

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

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

[0182] 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.

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

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

[0185] Table 2

[0186] Generation order token 1 token1 2 token2 3 token3

[0187] As shown in Table 2, the cloud server 200 may store multiple generated tokens and corresponding generation orders, 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.

[0188] 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.

[0189] Also illustratively, Table 3 shows another generated token stored in the cloud server 200 provided in an embodiment of the present application.

[0190] Table 3

[0191] Generation order token Sending ID 1 token1 Not sent 2 token2 Not sent 3 token3 Not sent

[0192] As shown in Table 3, the cloud server 200 may store multiple generated tokens and the corresponding generation order and sending flag. 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, etc. The sending flag can be used to indicate whether the token is sent by the cloud server 200. As can be seen from Table 3, the sending flags of token1, token2 and token3 are all not sent, indicating that the three tokens are all sent by the cloud server 200.

[0193] 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 from the embodiment shown in Table 3 above, and the present application does not limit this.

[0194] 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, which will not be repeated here.

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

[0196] 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 can be measured. token , and t token Stored in the cloud server 200.

[0197] In some other embodiments, the cloud server 200 may also detect the target text in the process of LLM generating the target text. token Specifically, the cloud server 200 may detect the number of tokens generated by the LLM within a fixed time interval (eg, 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.

[0198] It should be noted that when LLM generates the target text based on message 1, it needs to parse message 1 first. This parsing process takes a certain amount of time. It takes a long time (for example, 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 uniform speed without interruption. Therefore, when calculating the time t that LLM takes 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 that the LLM takes to generate a token. token In this way, the error introduced by the first token delay can be avoided.

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

[0200] 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 may be determined by the cloud server 200 according to 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 some embodiments, different language models may correspond to different scale values. The cloud server 200 may store the corresponding relationship between the language model and the scale value, and determine the corresponding scale value based on the language model currently used.

[0201] 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 in the process of displaying the target text by the electronic device 100. In this way, the electronic device 100 can avoid freezes in the process of displaying the target text and ensure smooth display.

[0202] 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.

[0203] Determine the display time of a single word display Afterwards, 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 can ensure that the next token is received before the electronic device 100 displays all the tokens sent for the first time.

[0204] 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.

[0205] 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. displayWhen 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.

[0206] 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 , the generated tokens stored in the cloud server 200 are the multiple tokens shown in Table 2 above, then 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 the following Table 4.

[0207] Table 4

[0208] Generation order token 4 token4

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

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

[0211] 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 "not sent" to "sent" after sending the token. display , the generated tokens stored in the cloud server 200 are the multiple tokens shown in Table 3 above, then 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 the following Table 5.

[0212] Table 5

[0213] Generation order token Sending ID 1 token1 Sent 2 token2 Sent 3 token3 Sent 4 token4 Not sent

[0214] As shown in Table 5, the cloud server 200 may store multiple generated tokens, as well as the corresponding generation order and sending identifier. For example, token1, token2, token3, and token4, where token4 is the token newly generated by the cloud server 200 after t display Moreover, the generation order of token1 is 1, the generation order of token2 is 2, the generation order of token3 is 3, the generation order of token4 is 4, and so on. The sending identifier can be used to indicate whether the token has been sent by the cloud server 200. As can be seen from Table 5, the sending identifiers of token1, token2, and token3 are all "sent", indicating that these three tokens have been sent by the cloud server 200. The sending identifier of token4 is "not sent", indicating that token4 has not been sent by the cloud server 200.

[0215] It can be understood that the embodiment shown in Table 5 is only an example. In the embodiments of the present application, the cloud server 200 may store more, fewer, or different tokens or sending identifiers from those shown in Table 5 above, and the present application does not make any limitations here.

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

[0217] After receiving the t display , one or more tokens sent by the cloud server 200, the electronic device 100 may be based on t display display the one or more tokens. Specifically, the electronic device 100 may display all the received tokens at a speed of displaying one more character every interval of t display based on the order of receiving the tokens (or based on the generation order of the received tokens).

[0218] Exemplarily, if all the received tokens are "we" in sequence, then the electronic device 100 may first display the character "I", and after t display , display "we" at the display position after the character "I".

[0219] The specific manner in which the electronic device 100 displays the target text based on t display may also refer to the relevant descriptions in the following Figure 6A-6F shown embodiments.

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

[0221] 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.

[0222] 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.

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

[0224] S311, when it is detected that the disconnection condition is met, disconnect the long link.

[0225] The disconnection condition 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 (e.g., exiting application 11, releasing the engine, etc.), etc. Application 11 refers to an application that can provide language model services to users through cloud server 200. In some embodiments, the disconnection condition and the disconnection method of the long link can also refer to the following Figure 7B Related description in the illustrated embodiment.

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

[0227] 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 method can reduce the overhead of connection establishment and closure and improve the efficiency of network communication. In an embodiment of the present application, the long link timeout is not reused, which 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 a 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 is not limited here.

[0228] In some embodiments, the time threshold corresponding to the long link is different for different types of message 1. 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 can be understood that the embodiments here are only illustrative of different types of messages 1, and the time thresholds corresponding to long links are different. In the embodiments of the present application, the time threshold may also be a value different from that in the above embodiments, and the present application is not limited thereto.

[0229] In the embodiment of the present application, the electronic device 100 may also be based on the display time t of a single character. display The display speed of the target text is determined, and the display speed of the target text is used to indicate how many words are displayed per second by the electronic device 100 during the process of displaying the target text. display is 20 milliseconds, then the display speed of the target text is After determining the display speed of the target text, the electronic device 100 may 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 may also display the target text sent by the cloud server 200 after determining the display time t of a single character. display After that, the display time based on a single word is t display The display speed of the target text is determined, and the display speed of the target text is sent to the electronic device 100, and the application does not limit this.

[0230] 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 it 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 characters in the text segment N float The maximum number of characters in a text segment can be N max and the minimum value N min The difference, that is:

[0231] N float =N max -N min Formula (10)

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

[0233] Figure 4A A schematic diagram of the generation, transmission and display time of a text segment 1 in a target text provided in an embodiment of the present application is shown.

[0234] like Figure 4A As shown, the one-dimensional coordinate axis can represent time, T c0 Time to T c1 At time t, 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 c3 At this moment, the cloud server 200 may 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. Since the display time of a single character is t 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:

[0235] T c4 =T c3 +tdisplay *N c1 Formula (11)

[0236] Figure 4B A schematic diagram of the generation, transmission and display time of a text segment 2 in a target text provided in an embodiment of the present application is shown.

[0237] like Figure 4B As shown in , 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 may 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 may 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:

[0238] T d1 =T c1 +t token *N c2 / scale formula(12)

[0239] 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.

[0240] 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:

[0241] T c2 -T c1 =T d2 -T d1 Formula (13)

[0242] When the network quality is stable, the transmission time of the text segment can also be considered to be approximately the same, that is:

[0243] T c3 -T c2 =T d3 -T d2 Formula (14)

[0244] In order to avoid a freeze in the process of displaying the target text by the electronic device 100, the electronic device 100 needs to start displaying the text segment 2 immediately after displaying the text segment 1. The receiving time T of the text segment 2 is d3 No later than the time T when the text segment 1 is finished displaying c4 , that is:

[0245] T d3 ≤T c4 Formula (15)

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

[0247]

[0248] 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):

[0249]

[0250] 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):

[0251]

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

[0253]

[0254] According to the above embodiment, when the word number 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 a freeze 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.

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

[0256] Table 6

[0257]

[0258]

[0259] As shown in Table 6, after exhaustively counting the 1.2 million Chinese characters, the sentences can be divided into multiple intervals according to the number of Chinese characters. The total number of sentences corresponding to each interval is different, and the percentage is also different. For example, the number of characters corresponding to interval 1 is [1,5]. The total number of sentences in this interval is 25620, accounting for 22.79% of the total number of sentences, and the cumulative value is 22.79%. The number of characters corresponding to interval 2 is [6,10]. The total number of sentences in this interval is 45600, accounting for 40.56% of the total number of sentences, and the cumulative value is 63.35%. The number of characters corresponding to interval 3 is [11,15]. The total number of sentences in this interval is 25275, accounting for 22.48% of the total number of sentences, and the cumulative value is 85.83%. The word range corresponding to interval 4 is [16,20] words. The total number of sentences in this range is 10020, accounting for 8.91% of the total number of sentences, and the cumulative value is 94.74%. The word range corresponding to interval 5 is [21,30]. The total number of sentences in this range is 5007, accounting for 4.45% of the total number of sentences, and the cumulative value is 99.19%. The word range corresponding to interval 6 is [31,40]. The total number of sentences in this range is 725, accounting for 0.65% of the total number of sentences, and the cumulative value is 99.84%. The word range corresponding to interval 7 is [41,50]. The total number of sentences in this range is 150, accounting for 0.13% of the total number of sentences, and the cumulative value is 99.97%. The word count range corresponding to interval 8 is [51,63]. The total number of sentences in 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.

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

[0261] 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].

[0262] It can be understood 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.

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

[0264] 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.

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

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

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

[0268] S505, the cloud server 200 obtains the time t taken by the language model to generate a token token .

[0269] The specific contents of steps S501 to S505 can refer to the above Figure 3 The relevant descriptions of steps S301 to S305 are not repeated here.

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

[0271] 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 .

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

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

[0274] 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.

[0275] In some other embodiments, the word count interval [N min ,N max ] It can also be determined by the above formula (10) and formula (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.

[0276] S508: When it is detected that the number of characters 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.

[0277] 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.

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

[0279] For example, if the word count interval [N min ,N max] is [35,45], and 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 get 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 the 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 get home from get off work every day, I". Through semantic analysis, it can be seen that the semantics of the 35 characters 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 the multiple tokens is "I have a cute kitten, it is happy and carefree every day. It waits for me to get home from get off work every day, I like to play with the kitten."

[0280] It is understandable that the embodiments herein are merely illustrative of how to use semantics 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 may 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.

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

[0282] Table 7

[0283] Text segment Contents of the text segment Send 1 token1, token2 Not sent

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

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

[0286] Table 8

[0287] Generation order token 3 token3

[0288] 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.

[0289] 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, and the present application does not limit this.

[0290] 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.

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

[0292] The risk information may be used to indicate whether the text segment has a risk. In some embodiments, the risk information may include: risky and no risk.

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

[0294] 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 perform the following step S511 .

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

[0296] S511, the cloud server 200 sends 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.

[0297] 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.

[0298] 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 of the text segment is no risk, no risk information is sent; if the risk information of the text segment is risky, the risk information of the text segment is sent to the electronic device 100. Optionally, in the case that the text segment is risky, the cloud server 200 may also only send the risk information and not send the text segment.

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

[0300] 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.

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

[0302] S513, the electronic device 100 determines whether the target text is risky based on the risk information.

[0303] When the risk information indicates that there is a risk, the electronic device 100 may determine that the target text has a risk; when the risk information indicates that there is no risk, the electronic device 100 may determine that the target text has no risk for the time being.

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

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

[0306] S514, the electronic device 100 performs the following operations based on t display After displaying all previously received text segments, based on t display Displays newly received text segments.

[0307] When the electronic device 100 displays the target text, every interval t display Display one more text. For the specific display method, please refer to the above Figure 3 The relevant description in step S308 is shown.

[0308] S515, stop displaying the target text, and withdraw the displayed text in the target text.

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

[0310] The specific content of step S516 can refer to the above Figure 3 The relevant contents of step S311 are not repeated here.

[0311] 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 when displaying the target text, avoiding freezes and improving the user's experience.

[0312] 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 may also receive and respond to the user's operation based on t display Output the received token (or text segment) at a uniform speed, that is, every interval t display Play a text. In this application scenario, the method flow of using voice to output text can also be referred to the above Figure 3 or Figure 5 The relevant steps in the illustrated embodiment will not be described in detail here.

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

[0314] 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, display After the target text token (or target text segment), you can add a new tag every t in interface 1. display Display one more word in the target text until all the words in the target text are displayed. In this way, the target text can be displayed during the process of the cloud server 200 generating the target text, reducing the user's first waiting time, and can also be displayed through t display The time taken by the electronic device 100 to display a single word is controlled to avoid freezes during the display process.

[0315] For example, Fig. 6A As shown, the electronic device 100 displays an application interface 600, and the application interface 600 may include a text input control 601 and a voice input control 602. Among them, the text input control 601 can be used to trigger the electronic device 100 to display the text input by the user in the application interface 600 based on the text input of the user. The voice input control 602 can 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.

[0316] The electronic device 100 can receive and respond to the user's input for the text input control 601. As Figure 6B shown, a dialog box 603 is displayed in the application interface 600. The text input by the user, such as "Write an article of about 100 words", can be displayed in the dialog box 603. After the dialog box 603 is displayed, the electronic device 100 can also display a waiting indicator 604 below the dialog box 603. 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.

[0317] After the electronic device 100 receives the time t for displaying a single character and the token of the target text (or the text segment of the target text) sent by the cloud server 200, as display shown, 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 "At". Figure 6C shown, 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 "At".

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

[0319] After a time t display has passed, as Fig. 6E shown, 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".

[0320] After that, the electronic device 100 can repeat the above process and 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 Fig. 6F shown.

[0321] As Fig. 6F shown, 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 user input content.

[0322] It can be understood that 6A to 6FThe illustrated embodiment is merely an example. In the embodiment of the present application, application 11 may be a Xiaoyi application or other application that can use the language model service provided by the cloud server 200. The present application does not limit this.

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

[0324] like Fig. 7A As shown, 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 also include a risk control module 25.

[0325] 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's voice input 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 , the target text token, the target text segment, and the risk information of the text segment, etc.), based on t display Displays the target text.

[0326] The sound 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, the sound toolbox 12 may collect the user's voice input through the collection module 12b and process the voice input through the processing module 12c, perform semantic analysis on the processed voice input through the comprehension module 12d, determine the instruction corresponding to the voice input, and send the 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 the semantic analysis that the voice input needs to use the language model in the cloud server 200, the execution instruction 1 may be sent to the execution module 12e, and the execution instruction 1 may be used to instruct the execution module 12e to determine the message 1 based on the processed voice input, and the type of the message 1 is a voice message. In some embodiments, the sound toolbox 12 may receive and respond to the text input sent by the interface module 11a, and determine the message 1 based on the text input, and the type of the message 1 is a text message. After determining the message 1, the sound 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 dialog 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.

[0327] After receiving the message 1, the AS module 21 can establish a long link (e.g., websocket) with the dialog manager 22 or the ASR module 24 based on the type of the message 1. For example, if the type of the message 1 is a text message or an event message, the AS module 21 can establish a long link with the dialog manager 22, and send the message 1 to the dialog manager 22 through the long link. If the type of the message 1 is a voice message, the AS module 21 can establish a long link with the ASR module 24, and send the message 1 to the ASR module 24. The AS module 21 can also receive the text content sent by the ASR module 24 based on the conversion of the message 1, and send the text content to the dialog manager 22.

[0328] The dialog manager 22 may include a dialog 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 dialog manager 22 may send the message 1 to the NLU module 23 through 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 , a token of the target text, a text segment of the target text, and risk information of the text segment, etc.), and sends the target text to the voice toolbox 12 through 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 the 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.

[0329] 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 .

[0330] 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 consumed by a single token to generate 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.) 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 dialog manager 22.

[0331] 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.

[0332] Understandably, Fig. 7A The embodiment shown is only an example. In the embodiment of the present application, the text display system 10 may include more, less, or more Fig. 7A The different modules of the illustrated embodiments may be a combination of the above-mentioned multiple modules into one module, or any of the above-mentioned modules may be decomposed into multiple modules, etc., which is not limited in the present application.

[0333] Figure 7B Two websocket links provided in embodiments of the present application are shown.

[0334] like Figure 7B As shown, in the process of the electronic device 100 and the cloud server 200 executing the text display method provided by 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. Among them, 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.

[0335] 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.

[0336] When the message 1 sent by the electronic device 100 is a voice message, the electronic device 100 can establish websocket 1 with the AS module 21 through the connector 12a. When the AS module 21 recognizes that the message 1 is a voice message, it can establish websocket 4 with the voice recognition module 24. The voice recognition module 24 can convert the voice message into a text message and send the text message to the AS module 21. The AS module 21 can also establish websocket 2 with the dialogue manager 22, and the dialogue manager 22 can establish websocket 3 with the NLU module 23, and send the text message converted by the voice recognition module 24 to the NLU module 23 through websocket 2 and websocket 3. Afterwards, the NLU module 23 can send the target text and other data of the message 1 to the electronic device 100 through the link 1.

[0337] Since the long link between the electronic device 100 and the cloud server 200 may include multiple websockets, in the above steps S311 and S516, when the disconnection conditions satisfied are different, the websockets disconnected first may be different. For example, Table 9 shows a corresponding relationship between a disconnection condition and a websocket disconnection sequence provided in an embodiment of the present application.

[0338] Table 9

[0339]

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

[0341] 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 embodiments of the present application, more, fewer or different disconnection conditions from the above embodiments may be included, and the present application is not limited thereto.

[0342] Since the overhead of the speech recognition module 24 is greater than the overhead of the dialog manager 22, and the overhead of maintaining websocket3 is greater than the overhead of maintaining websocket2, the connection between different nodes in the above link 1 and link 2 (such as websocket) can correspond to different reuse time thresholds, and within the time threshold after the current target text is transmitted, the above link can be reused. The cloud server 200 can store the link composition of different links, the corresponding relationship between the component parts of the link and the reuse time threshold.

[0343] Exemplarily, 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.

[0344] Table 10

[0345]

[0346]

[0347] 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 part. 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.

[0348] 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.

[0349] 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 through 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 change of some websockets in the link. Exemplarily, Table 11 shows a correspondence between link reuse and message type provided in an embodiment of the present application.

[0350] Table 11

[0351]

[0352] As shown in Table 11, the type of message 1 and the type of message 2 have the following corresponding relationship with the changes of the link before and after: when message 1 is a text message or an event message, the link for transmitting message 1 and the target text of message 1 includes 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.

[0353] It is understandable that the embodiment shown in Table 11 above is only an exemplary explanation 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 undisconnected state (i.e., in the time period corresponding to the reuse time threshold). In the embodiment of the present application, the embodiment shown in Table 10 can also be combined to consider the situation where different websockets correspond to different reuse time thresholds, and the present application does not limit this.

[0354] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.

[0355] Figure 8 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.

[0356] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

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

[0358] like Figure 8 As shown, 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 FIG. 7 above.

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

[0360] like Figure 8 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

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

[0362] 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.

[0363] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

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

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

[0366] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0367] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0368] 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.

[0369] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0370] The system library may 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.

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

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

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

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

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

[0376] Fig. 9 A flow chart of a text display method provided in an embodiment of the present application is shown.

[0377] like Fig. 9 As shown, the specific process of a text display method provided in an embodiment of the present application may include the following steps:

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

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

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

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

[0382] 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.

[0383] The first text segment may be the text segment 1 in the above embodiment. The first text segment may also be the above Figure 3 One or more tokens are sent to the electronic device 100 for the first time in step S307.

[0384] 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.

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

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

[0387] The specific content of step S904 can refer to the above Figure 3 Step S308 or Figure 5 Step S514 is shown.

[0388] 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, and the second text segment is located after the first text segment in the first target text.

[0389] 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.

[0390] 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 .

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

[0392] 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.

[0393] The specific content of step S908 can refer to the above Figure 5 Step S514 or Figure 3 The relevant content in step S310 is shown.

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

[0395] In a 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.

[0396] 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 texts sent for the first time, which can ensure smooth display of the texts.

[0397] In a possible implementation, the method also includes: in the process of generating the first target text, the cloud server 200 obtains a first generation speed, 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, 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.

[0398] 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.

[0399] 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 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.

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

[0401] In one possible implementation, the method also includes: when sending 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 sending the second text segment, the cloud server 200 sends the second risk information to the electronic device.

[0402] 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.

[0403] 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.

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

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

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

[0407] 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.

[0408] 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: a 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.

[0409] 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.

[0410] 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.

[0411] 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.

[0412] In a possible implementation, the electronic device 100 receives a second input from the user after displaying the first target text at the first display speed; 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, and the fifth text segment is 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; before the electronic device 100 displays the fourth text segment at the second display speed, or when the fourth text segment is displayed at the second display speed, the electronic device 100 receives the fifth text segment; after the electronic device 100 displays the fourth text segment at the second display speed, the electronic device 100 displays the fifth text segment at the second display speed.

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

[0414] In a 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.

[0415] The reuse of the long link can correspond to a time threshold. Within the preset time threshold, the second message can reuse the long link used to transmit the first message. In this way, if the long link is not used for a long time, it can be automatically disconnected to reduce energy consumption.

[0416] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.

[0417] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part 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, the process or function described in the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can 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. The available medium can 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 disk (SSD)), etc.

[0418] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

[0419] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope 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 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 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

  • Chat interaction method, electronic equipment and server

    CN114710459A

  • Game machine

    JP2018020200A