Generate task processing methods, devices, equipment, media and program products

By determining the baseline message sequence number and real-time channel readiness status during asynchronous task generation and submitting the request, and retrieving results through historical query channels in case of anomalies, the problem of duplicate submissions and result loss caused by communication anomalies is solved, and the task result recovery capability is improved.

CN123114979APending Publication Date: 2026-11-17SHANGHAI HODE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611470600.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-20
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In asynchronous task generation, communication anomalies make it difficult for the task initiator to determine whether the generation request has been received by the remote processing service, which may lead to duplicate task processing or result loss. Existing technologies are unable to effectively coordinate request status and result acquisition.

Method used

By determining the baseline message sequence number before generating the request, establishing a real-time message channel, and submitting the request after detecting the ready state, recovery information is generated when the real-time channel is abnormal, and the results are obtained through the historical query channel without resubmitting the request.

Benefits of technology

It reduces duplicate submissions caused by communication anomalies, ensures that asynchronous generation tasks can continue to obtain results, and improves result recovery capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114979A_ABST
    Figure CN123114979A_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, computer device, computer-readable storage medium, and computer program product for generating tasks, relating to computer networks and task scheduling technology. The method includes: acquiring historical messages for a target generation object and determining a baseline message sequence number; establishing a real-time message channel and sending a generation request after the channel is ready, with the generation request submitted at most once within the same generation round; after sending the generation request, acquiring and processing messages through the real-time message channel to determine a target result message; in response to an anomaly in the real-time message channel after the generation request is submitted, generating recovery information; without resubmitting the generation request, performing a read operation based on the recovery information through the historical query channel to obtain the target result message from the historical query channel. This reduces duplicate generation requests caused by communication anomalies and improves the result recovery capability of asynchronous generation tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer networks and task scheduling technology, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for generating task processing. Background Technology

[0002] In some asynchronous generation tasks, the task initiator can submit a generation request to a remote processing service and subsequently obtain the asynchronously generated results. Since the submission of the generation request and the acquisition of the generation result may occur at different times, and the corresponding processing may be affected by different communication states, when connection interruptions, timeouts, or other communication anomalies occur during the result acquisition process, the task initiator may find it difficult to determine whether the generation request has been received or executed by the remote processing service based solely on the current communication state. In this case, resubmitting the generation request may result in duplicate task processing, while stopping subsequent result acquisition may result in the already generated results not being retrieved. Therefore, there is room for improvement in how asynchronous generation tasks coordinate request status and result acquisition in the event of communication anomalies.

[0003] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the Invention

[0004] This application provides a method, apparatus, computer device, computer-readable storage medium, and computer program product for generating task processing, in order to solve or alleviate one or more of the technical problems mentioned above.

[0005] One aspect of this application provides a method for generating task processing, the method comprising: For the target generated object, historical messages are obtained through the historical query channel, and the baseline message sequence number is determined based on the historical messages; Establish a real-time message channel corresponding to the target generated object, and detect whether the real-time message channel is in a ready state; In response to the real-time message channel being in the ready state, a generation request corresponding to the target generation object is submitted to the generation service, wherein the generation request is submitted at most once within the same generation round; After the generation request is submitted, the message is obtained through the real-time message channel, and the obtained message is processed based on the baseline message sequence number to determine the target result message corresponding to the generation request; In response to an anomaly occurring in the real-time message channel after the generation request is submitted, recovery information is generated, which includes the object identifier of the target generation object and the baseline message sequence number. Without resubmitting the generation request, a read operation is performed based on the recovery information through the historical query channel to obtain the target result message from the historical query channel.

[0006] Another aspect of this application provides a task generation processing apparatus, the apparatus comprising: The determination module is used to generate a target object, obtain historical messages through a historical query channel, and determine the baseline message sequence number based on the historical messages; The module is used to establish a real-time message channel corresponding to the target generated object and to detect whether the real-time message channel is in a ready state. The submission module is used to submit a generation request corresponding to the target generation object to the generation service in response to the real-time message channel being in the ready state, wherein the generation request is submitted at most once in the same generation round; The processing module is used to obtain a message through the real-time message channel after the generation request is submitted, and to process the obtained message based on the baseline message sequence number to determine the target result message corresponding to the generation request. The generation module is used to generate recovery information in response to an anomaly occurring in the real-time message channel after the generation request is submitted. The recovery information includes the object identifier of the target generation object and the baseline message sequence number. The reading module is used to perform a reading operation based on the recovery information through the historical query channel without resubmitting the generation request, so as to obtain the target result message from the historical query channel.

[0007] Another aspect of this application provides a computer device, including: At least one processor; and A memory that is communicatively connected to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method as described above.

[0008] Another aspect of this application provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the method described above.

[0009] Another aspect of this application provides a computer program product including a computer program that, when executed by a processor, implements the method described above.

[0010] The embodiments of this application employing the above technical solution may include the following advantages: By determining the baseline message sequence number before sending the generation request and submitting the generation request to the generation service only after the real-time message channel is in a ready state, a message reception foundation corresponding to the current generation round is established before the generation request is submitted; by limiting the generation request to be submitted only once within the same generation round, and generating recovery information when an anomaly occurs in the real-time message channel before determining the target result message, and performing a read operation through the historical query channel based on the recovery information, without resubmitting the generation request to the generation service, the task writing process and the result recovery process after the anomaly are distinguished. Therefore, duplicate submissions of generation requests caused by communication anomalies can be reduced, and already submitted asynchronous generation tasks can continue to obtain corresponding results through historical messages, improving the result recovery capability of asynchronous generation tasks. Attached Figure Description

[0011] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0012] Figure 1 The diagram illustrates the operating environment of the task generation processing method according to Embodiment 1 of this application. Figure 2 A flowchart illustrating the task generation processing method according to Embodiment 1 of this application is shown schematically; Figure 3 This schematically illustrates a detailed flowchart of the steps for recording the task status of the generation task corresponding to the current generation round in Embodiment 1 of this application; Figure 4 A schematic diagram of the task state machine of Embodiment 1 of this application is shown. Figure 5 This illustration shows a detailed flowchart of the steps in Embodiment 1 of this application to process the acquired message based on the baseline message sequence number to determine the target result message corresponding to the generation request; Figure 6 This illustration shows a detailed flowchart of the steps in Embodiment 1 of this application to perform a read operation based on the recovery information through the historical query channel to obtain the target result message from the historical query channel; Figure 7 A flowchart illustrating a new step in the task generation processing method according to Embodiment 1 of this application is shown schematically. Figure 8 This schematically illustrates a flowchart of another additional step in the task generation processing method according to Embodiment 1 of this application; Figure 9The schematic diagram illustrates a process for obtaining target result messages through dual channels according to Embodiment 1 of this application; Figure 10 A block diagram of a task generation processing apparatus according to Embodiment 2 of this application is schematically shown; and Figure 11 A schematic diagram of the hardware architecture of a computer device according to Embodiment 3 of this application is shown. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0014] It should be noted that the descriptions involving "first," "second," etc., in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0015] It should be noted that, in any stage of this application involving the collection, storage, use, transmission, and processing of data, each stage strictly adheres to the laws, regulations, industry standards, and regulatory requirements of the data source, usage location, and relevant countries and regions to ensure the legality and compliance of data activities. In the collection stage, the purpose, method, and scope of collection are clearly communicated to the data subject in a prominent manner. Collection is conducted only after obtaining the data subject's legal authorization, ensuring that the collection process follows the "minimum necessary" principle and does not exceed the scope of data collection. In the storage stage, storage periods are limited, and data is promptly deleted or anonymized / encrypted after the storage purpose is achieved. In the usage stage, a strict data security protection mechanism is implemented, using field-level desensitization technology and processing the original data according to preset desensitization rules. For different types of data, multiple desensitization strategies, such as data generalization, data anonymization, and data encryption, are employed to effectively mitigate the risk of sensitive information leakage and ensure that all data used is securely processed and desensitized, comprehensively protecting the rights and interests of data subjects and data security. In the transmission and processing stages, the confidentiality and security of data are ensured during transmission and processing.

[0016] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order of the steps, but are only used to facilitate the description of this application and to distinguish each step, and therefore should not be construed as a limitation of this application.

[0017] First, a definition of the terminology used in this application is provided: A target generation object can be a technical object used to define the processing context of a generation task. Target generation objects can be distinguished by an object identifier. In some embodiments, a target generation object can be a virtual idol, an audio generation context, an image generation context, a session context, a project context, or other data objects that can be associated with a generation task and its processing messages.

[0018] A generation round can be defined as the processing cycle in which a client device initiates a generation task for a target generation object and continuously obtains the corresponding results. The same target generation object can correspond to different generation rounds at different times. When the same target generation object corresponds to different generation rounds at different times, the target result message corresponding to different generation rounds can be determined by adding a round identifier (request_id / round ID) and combining it with the baseline message sequence number.

[0019] The baseline message sequence number (h0, water level) can be the sequence number of the last existing message of the target generation object, retrieved from the historical query channel before the generation request is submitted. It serves as a dividing water level to distinguish between messages that existed before the generation request was submitted and messages generated after the submission. In some embodiments, the baseline message sequence number can also be referred to as a message water level, message cursor, or message checkpoint.

[0020] A real-time messaging channel can be a communication channel used by a client device to receive real-time events or messages related to a target generated object. In some embodiments, a real-time messaging channel can be implemented through a long-lived connection, server-sent events, message subscription, or other communication methods that can asynchronously push messages to the client device.

[0021] A historical query channel can be a communication channel through which client devices can read and request historical messages that have been persisted or can be queried. In some embodiments, messages obtained by the real-time message channel and messages obtained by the historical query channel may belong to the same logical message space, or at least have message sequence numbers that can be compared with each other.

[0022] A target result message can be a message containing the generated result content corresponding to the current generation round. A target result message can include one or more generation candidate contents.

[0023] Recovery information can be a data set generated when a communication anomaly occurs in the real-time message channel after the generation request has been submitted, used to continue querying the processing results of the current generation round. Recovery information may include the object identifier of the target generation object, baseline message sequence number, task type, last status (current task status), and recoverable flag required to recover the target result message of the current generation round. Recovery information may not include authentication credentials.

[0024] Candidate validity conditions can be used to determine whether generated candidate content in the target result message can enter the subsequent selection or processing process. In some embodiments, candidate validity conditions may include having a stable candidate identifier, having a resource address that can access the candidate resource, or having other data required for subsequent processing.

[0025] A unified idempotent key is a globally unique identifier assigned by the server. No matter how many times the client retryes the same business task, it carries the same key. The server uses this key to determine whether the task has been completed, ensuring that the same task is executed at most once, thereby preventing the repeated execution of the same task.

[0026] Secondly, to facilitate understanding of the technical solutions provided in the embodiments of this application by those skilled in the art, the relevant technologies are described below: Generative content tasks are typically characterized by long processing times, numerous candidates, generation of results on a per-task basis, and asynchronous return of results. Clients often initiate an HTTP write request first, then wait for the result via WebSocket, SSE (Server-SentEvents), message queues, or polling. If the real-time connection fails before or after submitting the generation request, the client can hardly determine whether the server has received the generation request based solely on the connection error; directly retrying might duplicate the generation task, while not retrying at all might result in the loss of already generated task results.

[0027] Therefore, this application provides a technical solution for generating task processing. In this technical solution, (1) in application scenarios where the server's unified idempotent key cannot be obtained, the target result message can be obtained by performing a read operation through the historical query channel based on the recovery information, without resubmitting the generation request to the generation service, thereby reducing the risk of repeated execution of generation tasks caused by the client device's retry behavior; (2) when the real-time message channel is unreliable, the target result message can be stored in the storage location of the historical message, supporting the same task to obtain the target result message from the storage location through the historical query channel, so as to realize cross-channel recovery of the target result message; (3) by performing deterministic isolation processing on the current processing result and the historical result, crosstalk between candidate data of different tasks and different sessions is avoided; (4) when the real-time message channel is in an abnormal state, recovery information carrying complete information without credential information is generated to support the subsequent recovery of the target result message based on the recovery information; (5) by setting the generation submission, candidate selection, and release confirmation operations to be distinct authorization scopes, improper expansion of the confirmation permission scope is prevented. See below for details.

[0028] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0029] like Figure 1 As shown, the operating environment may include client device 2, generation service 4, real-time message service 6, and historical message service 8. Client device 2 is communicatively connected to generation service 4, real-time message service 6, and historical message service 8, respectively.

[0030] Client device 2 can be a computing device running a generation task processing program, or it can be a generation task processing instance in a service platform. Client device 2 is the executing entity of the method of this application, and it can perform operations such as reading historical messages, establishing real-time message channels, sending generation requests, recording generation round status, determining target result messages, and resuming queries.

[0031] Generation service 4 can be used to receive generation requests sent by client device 2 and execute generation tasks according to the generation requests. The specific model, generation algorithm, or content generation method used by generation service 4 to execute generation tasks is not intended to limit this application.

[0032] Real-time messaging service 6 can be used to establish a real-time messaging channel with client device 2 and send new messages related to the target generated object to client device 2. Historical messaging service 8 can respond to read requests from client device 2 and return historical messages related to the target generated object.

[0033] Real-time message service 6 and historical message service 8 can be provided by different interfaces of the same service system, or by different service components, as long as the client device 2 can establish a comparable relationship between messages obtained from the two channels based on the corresponding message information. Generation service 4, real-time message service 6, and historical message service 8 can also be deployed on different service instances in a server cluster.

[0034] In some embodiments, client device 2 can orchestrate write operations for the generation task through a local command program. The local command program can be used to perform operations related to the generation context, such as draft processing, image resource processing, voice resource processing, audio generation, cover generation, and publishing. Client device 2 can also cooperate with a structured selection service to perform structured selection processing on multiple candidates returned by the generation task. After the target audio is determined, the target audio and verified character materials can be further handed over to a local video processing component for offline video generation. The local command program, structured selection service, and local video processing component can be implemented separately or combined in the same computing device depending on the actual deployment method.

[0035] It should be noted that the above-mentioned devices, services, and quantities are merely examples and can be added, removed, split, merged, or replaced according to actual needs in different embodiments. The single-side execution entity of the method in this application is still the client device 2, and the remote service mainly serves as a data interaction object for generating requests, real-time messages, or historical messages.

[0036] The technical solution of this application will be described below using client device 2 as the execution subject through embodiments. It should be noted that this embodiment can be implemented in many different forms and should not be construed as being limited to the implementation methods described herein.

[0037] Example 1 Figure 2 A flowchart illustrating a task generation processing method according to Embodiment 1 of this application is shown schematically.

[0038] like Figure 2 As shown, the task generation method may include steps S200~S210, wherein: Step S200: For the target generated object, obtain historical messages through the historical query channel, and determine the baseline message sequence number based on the historical messages.

[0039] Step S202: Establish a real-time message channel corresponding to the target generated object, and detect whether the real-time message channel is in a ready state.

[0040] Step S204: In response to the real-time message channel being in the ready state, submit a generation request corresponding to the target generation object to the generation service, wherein the generation request is submitted at most once within the same generation round.

[0041] Step S206: After the generation request is submitted, a message is obtained through the real-time message channel, and the obtained message is processed based on the baseline message sequence number to determine the target result message corresponding to the generation request.

[0042] Step S208: In response to an anomaly occurring in the real-time message channel after the generation request is submitted, recovery information is generated.

[0043] Step S210: Without resubmitting the generation request, perform a read operation based on the recovery information through the historical query channel to obtain the target result message from the historical query channel.

[0044] In this embodiment, by determining the baseline message sequence number before sending the generation request and submitting the generation request to the generation service only after the real-time message channel is in a ready state, a message reception foundation corresponding to the current generation round is established before the generation request is submitted. By limiting the generation request to only one submission within the same generation round, and generating recovery information when an anomaly occurs in the real-time message channel before determining the target result message, and performing a read operation through the historical query channel based on the recovery information without resubmitting the generation request to the generation service, the task writing process and the result recovery process after the anomaly are distinguished. Therefore, duplicate submissions of generation requests caused by communication anomalies can be reduced, and already submitted asynchronous generation tasks can continue to obtain corresponding results through historical messages, improving the result recovery capability of asynchronous generation tasks.

[0045] The following combination Figure 2 The steps in steps S200 to S210, as well as other optional steps, are described in detail.

[0046] Step S200 For the target generated object, historical messages are obtained through the historical query channel, and the baseline message sequence number is determined based on the historical messages.

[0047] Historical messages can be messages associated with the target generated object that were already available through the historical query channel before the current generation request was submitted. The client device can form a read request based on the object identifier of the target generated object and obtain the corresponding historical messages.

[0048] In some embodiments, each historical message has a globally incrementing message ID (message sequence number), which represents the position of each message within the historical messages. The client device can query the message IDs of each historical message and record the maximum message sequence number in the historical messages as the baseline message sequence number for the current generation round. For example, if the maximum message sequence number in the historical messages is 4817, 4817 can be used as the baseline message sequence number for the current generation round. It should be noted that the baseline message sequence number can be stored in a field describing the historical message reading position. Specific field names are merely illustrative.

[0049] It should be noted that when the target generated object does not have historical messages, the default initial message ID can be used as the baseline message sequence number.

[0050] Since the baseline message sequence number is determined before the generation request is sent, subsequent real-time message processing and historical message recovery can both be based on this baseline message sequence number to determine whether the message was generated after the current generation request was submitted.

[0051] Step S202 Establish a real-time message channel corresponding to the target generated object, and detect whether the real-time message channel is in a ready state.

[0052] Specifically, real-time messaging channels can be implemented using WebSocket channels, server-sent event channels, long-lived connection channels, or message subscription channels, etc. It should be noted that the specific communication methods described above do not constitute a limitation on the scope of protection of this application.

[0053] In this embodiment, the client device can initiate a connection request to the real-time messaging service to establish a real-time messaging channel corresponding to the target generated object. After the real-time messaging channel is established, the client device will read the connection status of the real-time messaging channel again to detect whether the real-time messaging channel is still in a ready state.

[0054] In an optional embodiment, for step S202, establishing a real-time message channel corresponding to the target generated object includes: establishing the real-time message channel based on authentication information and the object identifier of the target generated object.

[0055] Regarding step S202, detecting whether the real-time message channel is in a ready state includes: After completing the handshake operation corresponding to the real-time message channel, the current connection status of the real-time message channel is read again; if the current connection status is still connected, the real-time message channel is determined to be in a ready state.

[0056] Specifically, the client device can initiate a connection request to the real-time messaging service based on the object identifier of the target generated object and the authentication information required to establish a connection. The authentication information is used to establish an authorized communication connection, but it does not need to be permanently stored as information required for generation round recovery. After the connection handshake is completed, the client device can read the connection status of the real-time messaging channel again. In response to the connection status indicating that the real-time messaging channel has been connected, it can be determined that the real-time messaging channel is in a ready state.

[0057] In this embodiment, after the real-time message channel handshake operation is completed, the channel's connection status is read again. The channel is only considered ready if it is confirmed to be connected. This can identify false connection states where the handshake is complete but the underlying link is actually faulty, avoiding the submission of generation requests based on unavailable real-time message channels. Furthermore, this embodiment establishes a real-time message channel by combining authentication information and the target generation object identifier, achieving access authentication and task message isolation.

[0058] In some embodiments, the real-time message channel can also be associated with the baseline message sequence number determined in step S200. For example, when establishing a real-time message channel, the baseline message sequence number can be used as a connection parameter or the channel context information of the current generation round, so that subsequent messages received by the real-time message channel are associated with the message checkpoint used in the current generation round. Thus, the real-time message receiving path and the subsequent historical query recovery path can determine the message range corresponding to the current generation round based on the same message checkpoint.

[0059] In some embodiments, when establishing a real-time message channel, the underlying network request can carry authentication information through URL query parameters to complete server authentication. Furthermore, the connection descriptor used for external output can be processed to remove query parameters and hash fragments from the URL, outputting only the desensitized interface endpoint address. This prevents authentication information from being leaked along with connection metadata and log information, thereby improving data security without altering the real-time channel authentication logic.

[0060] Step S204 In response to the real-time message channel being in the ready state, a generation request corresponding to the target generation object is submitted to the generation service, wherein the generation request is submitted at most once within the same generation round.

[0061] Specifically, a generation request may include generation parameters required for a remote generation service to perform the corresponding generation task. As an example, when the generation task is an audio generation task, the generation parameters may include content description information, generation conditions, and optional reference audio; when the generation task is an image generation task, the generation parameters may include generation conditions for the target image.

[0062] In this embodiment, the pre-write ready gate only allows the generation request when the real-time message channel is in a ready state, and then submits the generation request corresponding to the target generation object to the generation service. After the generation request is successfully submitted, the task status of the generation task corresponding to the current generation round is recorded as the generation request submitted status, and the same generation request will not be allowed again after subsequent exception recovery.

[0063] It should be noted that whether a generation request has been successfully submitted can be determined by checking whether a definitive response (or confirmation) has been received from the generation service. If a definitive response is received, the generation request is considered successfully submitted; otherwise, it is considered unsuccessfully submitted.

[0064] In some embodiments, requests for reading data and write requests for changing the state of remote tasks can employ different network exception handling strategies. For example, if a read-only request sent through the historical query channel experiences a temporary network exception or a temporary remote service exception, it can be resent a limited number of times; generation requests and other write requests can be set to a single attempt without automatic retrying at the network layer. For instance, a read-only GET request can be retried a maximum of three times, while write requests such as POST, PUT, DELETE, upload, or publish can be retried only once. The specific number of retryes mentioned above is not used to limit the generation request to be sent at most once within the same generation round.

[0065] In some embodiments, different task processing stages may correspond to different operation confirmation ranges. The task submission stage may have a first operation confirmation range corresponding to the current write operation; after the candidate is determined, the candidate selection stage can be entered; after the content to be published is determined, a second operation confirmation range corresponding to the write operation can be established. The first operation confirmation range, the candidate selection state, and the second operation confirmation range each act on their respective processing stages, and the confirmation state or selection state formed in the previous stage is not automatically used as the confirmation basis for the write operation in the next stage.

[0066] Taking audio generation as an example, a first operation confirmation can be obtained before the generation request is submitted, allowing the current generation write operation to proceed. After determining the target audio from multiple generation candidates, a cover resource corresponding to the target audio can be further formed. After the final title, target audio, and cover resource are all determined, a second operation confirmation is obtained to allow the publication write operation to proceed. By giving the state information at different stages its own scope of application, the reuse of confirmation states between different write operations can be limited.

[0067] In an optional embodiment, the method may further include: recording the task status of the generation task corresponding to the current generation round; See Figure 3The task status of the generation task corresponding to the current generation round may include: Step S300: In response to an anomaly occurring in the real-time message channel before the generation request is submitted, the task status is marked as unsubmitted, wherein the current generation round is terminated when the task status is unsubmitted. Step S302: In response to submitting the generation request, mark the task status as submitted. Step S304: In response to an anomaly occurring in the real-time message channel after the generation request is submitted, the task status is marked as recoverable. When the task status is recoverable, the generation request is not resubmitted for the current generation round.

[0068] Specifically, by recording the task status of the generation task corresponding to the current generation round during the execution of the generation task, and differentiating task statuses based on the timing of different anomalies in the real-time message channel, differentiated task processing logic is achieved. Specifically, before initiating a generation request, the client device pre-establishes a real-time message channel corresponding to the target generation object and checks the readiness status of the real-time message channel. If an anomaly is detected in the real-time message channel before the generation request is submitted, such as network disconnection, handshake failure, or connection reset, the task status corresponding to the current generation round is marked as unsubmitted. When the task status is unsubmitted, the current generation round is terminated, and the submission operation of the generation request is not executed; if the generation requirement needs to be executed again, the complete task initialization process needs to be re-executed: re-acquiring the baseline message sequence number, rebuilding the real-time message channel and verifying the channel readiness status, and then initiating a new round of generation requests.

[0069] After the client device successfully submits a generation request to the generation service, it marks the task status corresponding to the current generation round as "submitted". While in the submitted state, the client device can continuously receive messages pushed by the server through the real-time message channel, waiting for the target result message corresponding to this generation round to be returned.

[0070] If network jitter, connection interruption, or other issues cause an anomaly in the real-time message channel after the request has been submitted and the task status is "submitted," the task status will be marked as "recoverable."

[0071] When the task status is recoverable, the client device does not resubmit the generation request for the current generation round to avoid repeatedly triggering the generation service and causing repeated execution of the generation task. The client device can perform a read operation through the historical query channel based on the locally stored recovery information, poll the historical messages, filter and obtain the target result message corresponding to the current round, and realize task breakpoint recovery.

[0072] As an example, see Figure 4 The task status of the generation task corresponding to the current generation round can include the following states: BASELINED (baseline recorded), CHANNEL_READY (channel ready), SUBMITTED (request submitted), WAITING (waiting for results), ABORT_UNSUBMITTED (failed before submission), RESUMABLE (recoverable), POLL_READ_ONLY (read-only polling), and COMPLETED (completed). If an exception occurs before the generation request is submitted, the current generation round can be terminated, and a new generation round can be manually initiated, allowing the user to resubmit the generation request. If an exception occurs after the generation request has been submitted, the task can sequentially progress from the WAITING state to the recoverable state and then to the read-only query state, but it is not allowed to return to the write request submitted state.

[0073] In this optional embodiment, different task states are defined based on whether the real-time message channel anomaly occurs before or after the generation request is submitted. An anomaly before submission is marked as unsubmitted and the current round terminates; an anomaly after submission is marked as recoverable, and resubmission of the same round of generation requests is prohibited. This fine-grained distinction of task states avoids unnecessary waiting and prevents duplicate request submissions in disconnection recovery scenarios, mitigating the problem of duplicate generation and ensuring the reliable operation of the generation task breakpoint recovery mechanism.

[0074] In some embodiments, the method may further include: displaying a prompt message and terminating the current generation round in response to an anomaly occurring in the real-time message channel before the generation request is submitted; wherein the prompt message is used to indicate that the generation request was not successfully submitted. Specifically, if an anomaly occurs in the real-time message channel before the generation request is submitted, a prompt message indicating that the generation request for the current generation round has not been successfully submitted may be displayed, and the current generation round may be terminated. For example, for a song generation task, the client device may throw an error message "No song generation request sent" and mark "resumable=false". In this embodiment, by displaying a prompt message when an anomaly occurs in the real-time message channel before the generation request is submitted, the user can promptly understand the current status of the real-time message channel.

[0075] Step S206 After the generation request is submitted, the message is obtained through the real-time message channel, and the obtained message is processed based on the baseline message sequence number to determine the target result message corresponding to the generation request.

[0076] The generation service can asynchronously execute generation tasks upon receiving a generation request and generate corresponding messages after the generation results are formed. After receiving the message from the real-time message channel, the client device can identify the target result message corresponding to the current generation round by combining it with the baseline message sequence number. A message can include a message sequence number, message type, and message content. The message sequence number indicates the message's position in the corresponding message space; the message type distinguishes between generation result messages, error messages, and other types of messages; and the message content can carry one or more generation candidates.

[0077] In an optional embodiment, see [link to relevant documentation] Figure 5 Regarding step S206, the process of processing the acquired message based on the baseline message sequence number to determine the target result message corresponding to the generation request includes: Step S500: Obtain the message sequence number and message type corresponding to the message to be processed, wherein the message to be processed is a message obtained through the real-time message channel; Step S502: Filter out messages from the messages to be processed whose message sequence number is greater than the baseline message sequence number; Step S504: Determine messages whose message type matches the target result type from the filtered messages, and use them as the target result messages; Specifically, the client device can first process the messages to be processed in ascending order according to their message sequence numbers, allowing only messages with sequence numbers greater than the baseline message sequence number to proceed to the next processing stage of the current generation round. Messages with sequence numbers not greater than the baseline message sequence number can be excluded from the target result range of the current generation round. For messages with sequence numbers greater than the baseline message sequence number, error messages can be processed first. If no error message prevents the current generation round from continuing processing, messages matching the target result type are then filtered based on their message type. For example, if the baseline message sequence number is 4817, historical messages with sequence numbers 4700 or 4800 do not belong to the current generation round; messages with sequence numbers greater than 4817 proceed to further processing. If message 4818 is a non-target message type while message 4819 is a target result type, message 4818 can be skipped, and message 4819 can be identified as the target result message for the current generation round.

[0078] Taking audio generation as an example, the target result type can be a message type used to represent the audio generation result, such as "type=generate_song", where type=generate_song is used to indicate that the type is "generate song".

[0079] In this embodiment, the baseline message sequence number is used for initial screening, and then the message type is used for further screening to obtain the target result message. This can reduce the possibility of historical messages existing before the generation request or non-target messages generated after the generation request being incorrectly identified as the result of the current generation round.

[0080] Step S208 In response to an anomaly occurring in the real-time message channel after the generation request is submitted, recovery information is generated.

[0081] Specifically, after the client device submits a generation request, if an anomaly occurs in the real-time message channel, such as network jitter, client disconnection, or server connection reset, the client device will be unable to continue receiving messages via the real-time message channel. In this case, the client device will generate recovery information.

[0082] The recovery information includes at least two of the following: the object identifier of the target generated object, the baseline message sequence number, the task type, the current task status, and the recoverable flag. The recovery information does not include authentication credentials used to access remote services.

[0083] In this embodiment, the recovery information is used to carry the minimum task context required to recover the current generation round. The object identifier of the target generated object is used to relocate the message space or recover the object; the baseline message sequence number is used to maintain consistency of message checkpoints before and after recovery; the task type is used to enable the recovery process to adopt the result parsing method corresponding to the original task; the current task status is used to indicate the processing status such as the generation request has been sent or is waiting for the result; the recoverable flag is used to indicate whether the current exception allows continued entry into the read-only result query process. For example, the recovery information can be represented as K=(target_object_id, h0, task_type, last_state, resumable=true). Wherein, target_object_id is the object identifier of the target generated object, h0 is the baseline message sequence number, task_type is the task type, last_state is the current task status, and resumable=true indicates that entry into the read-only result query process is allowed, that is, the recovery process is allowed to be executed. In a specific song generation implementation, target_object_id can be mapped to singer_id (singer identifier), and h0 can be mapped to after_message_id (baseline message sequence number).

[0084] In some embodiments, the recovery information does not carry the authentication credentials used to access the remote generation service, nor does it carry the complete live connection address containing the authentication signature. When a subsequent recovery operation requires establishing a read request, the client device can retrieve the currently valid credentials from a secure authentication information management location, rather than relying on the exception object or the credentials carried in the recovery information.

[0085] In this embodiment, by storing only the object identifier, message checkpoint, and task status in the recovery information, and separating the authentication information from the recovery status, the scope of authentication credentials entering abnormal information, recovery records, or other persistent data can be reduced while continuing to recover tasks across sessions or processing stages, thereby further reducing the risk of sensitive information exposure during the task recovery process.

[0086] Step S210 Without resubmitting the generation request, a read operation is performed through the historical query channel based on the recovery information to obtain the target result message from the historical query channel.

[0087] Specifically, after confirming that the generation request has been submitted, the client device will not re-invoke the generation write interface during the recovery task; that is, it will not submit the generation request to the generation service again. Instead, it will retain the baseline message sequence number corresponding to the current generation round and perform a read operation through the historical query channel. When the generation result is subsequently stored in the historical message storage, the client device can use the message checkpoint with the same real-time path to re-determine the target result message.

[0088] The read operation can be performed periodically. If the current read has not yet obtained the target result message that meets the conditions of the current generation round, the current generation round can remain in a recoverable state and continue to wait for subsequent historical messages.

[0089] In an optional embodiment, the recovery information includes the object identifier of the target generated object and the baseline message sequence number, see below. Figure 6 Regarding step S210, the step of performing a read operation based on the recovery information through the historical query channel to obtain the target result message from the historical query channel includes: Step S600: Based on the object identifier of the target generated object carried in the recovery information, obtain the historical messages of the target generated object through the historical query channel; Step S602: Based on the baseline message sequence number carried in the recovery information, filter out messages with message sequence numbers greater than the baseline message sequence number from the historical messages; Step S604: Determine messages whose message type matches the target result type from the filtered messages, and use them as the target result messages.

[0090] Specifically, during the task recovery process, the client device does not resubmit the generation request to the generation service; instead, it directly reads the locally stored recovery information. During this reading process, the object identifier of the target generated object is first retrieved from the recovery information. The historical query channel is then invoked, and the object identifier is passed to the historical query channel to retrieve the complete set of historical messages corresponding to the target generated object. This historical message set contains multiple messages that have been persistently stored under the target generated object, each message carrying a unique message sequence number and message type field.

[0091] Subsequently, the client device reads the baseline message sequence number from the recovery information and filters the acquired historical message set, retaining messages with sequence numbers greater than the baseline message sequence number. Messages with sequence numbers greater than the baseline message sequence number indicate that the batch of messages was generated after the baseline message sequence number was determined, belonging to messages produced after this generation round. Baseline and earlier historical messages are excluded to avoid reusing old generation results from the previous round of tasks.

[0092] Finally, in the filtered message set, a second matching is performed based on the message type field to find messages whose message type matches the target result type; the successfully matched messages are determined as the target result messages corresponding to this generation request.

[0093] As an example, the target generated object's object identifier is singer_id=123, and the baseline message sequence number is "H0=120". The historical query channel returns multiple historical messages with sequence numbers 118, 119, 121, 122, and 123. First, messages with sequence numbers greater than 120 are filtered out, and messages with sequence numbers 121, 122, and 123 are retained. Then, the message types are compared. Assuming the target result type is "type=generate_song", the three messages are traversed, and the message with the message type equal to "generate_song" is taken as the target result message.

[0094] In some embodiments, if no message of the matching message type is found after filtering, the recoverable state is maintained, and historical messages are read through the historical query channel in a polling manner, waiting for the server to write new messages to the persistent database until the target result message is matched, or the polling reaches the timeout threshold and the recovery process is terminated.

[0095] In this embodiment, by carrying the object identifier and baseline message sequence number in the recovery information, the generation request does not need to be resubmitted during the disconnection recovery phase. Historical messages are first filtered by the baseline message sequence number, and then the target result message is located by matching the message type. This not only isolates the interference of historical old task messages, but also accurately locates the valid result message of the current round, avoiding the retrieval of historical expired results. Task breakpoint recovery is completed without repeatedly triggering the generation task, thus avoiding the problem of repeated generation.

[0096] In some embodiments, the target generated object and the baseline message sequence number can also be used as recovery checkpoints to continue to be used between different processing processes or different sessions, so that subsequent processing can continue to perform read-only queries from the same message boundary without requiring the original real-time communication connection to remain valid at all times.

[0097] In some embodiments, when generating external description information for the real-time channel, the client device can remove the query and hash portions from the connection address, outputting only the anonymized endpoint information. For structured output, runtime logs, and error text, the client device can also recursively remove token, authorization, cookie, bearer text, and other sensitive fields.

[0098] In some embodiments, if the client device receives an authentication exception indicating that the current authentication credentials have expired, such as a response corresponding to an unauthorized access status, it can delete the locally stored expired credentials so that subsequent requests will no longer use the expired credentials. The above security handling is used to limit the exposure and erroneous reuse of authentication information without altering the main recovery process of the generation task.

[0099] In some embodiments, the client device can also establish a local recovery log for the current generation round. The local recovery log may record at least one of the following: request_fingerprint (generation request identifier), target_object_id (object identifier of the target generated object), baseline message sequence number, operation confirmation range, generation request submission time, submission_state (commit status), last_message_id (message sequence number of the last message), and final candidate digest. The recovery log can save the submission_state using atomic write or atomic state update methods, ensuring consistency between the "uncommitted" and "committed" state transitions at the local storage layer.

[0100] In some embodiments, a generation_attempt_id (generation attempt identifier) ​​can be generated for each generation round to distinguish different generation attempts corresponding to the same target generation object. If the remote generation service can provide a generation transaction identifier, a server_generation_id (server-side generation identifier), or an idempotent identifier, the local generation attempt identifier, request content summary, baseline message sequence number, or corresponding status can also be associated with the transaction identifier. The above enhancement mechanisms are used to further improve the ability to distinguish generation rounds in multi-process, cross-session, or concurrent generation scenarios.

[0101] In some embodiments, fault injection verification can be performed on the task generation process. For example, communication exceptions can be injected before the real-time channel handshake, during the generation request sending process, after the generation request is sent, before the arrival of the first result event, and during the processing of result events containing multiple candidates. The number of generation write requests, result retrieval status, candidate misattribution status, and recovery time are recorded. This test implementation is only used to verify the task status and recovery logic and does not indicate that this application has obtained any specific numerical test results.

[0102] In an optional embodiment, the target result message includes multiple candidate generated content, see below. Figure 7 The method further includes: Step S700: Determine the candidate content that meets the candidate validity conditions from the target result message; Step S702: All generated candidate contents that meet the candidate validity conditions are determined as the set of generated candidate contents.

[0103] Specifically, the target result message can include multiple candidate content items at once. The client device can traverse the candidate data in the target result message and determine whether each candidate content item meets the candidate validity condition.

[0104] Taking audio generation as an example, candidate validity conditions can include generating candidates having both a stable candidate identifier and an accessible resource address. The stable candidate identifier can be used to identify the corresponding candidate, and the resource address can be used to obtain the corresponding audio resource. When a target result message includes two generating candidate contents that both meet the candidate validity conditions, the client device adds both generating candidate contents to the generating candidate content set, instead of ending candidate extraction after obtaining the first generating candidate content.

[0105] In this embodiment, by performing validity processing on each candidate in the target result message and outputting all valid candidate content, multiple usable results generated by a single generation task can be used as a complete candidate set to enter the subsequent selection or processing process, thereby reducing the omission of the result set due to reading only the first candidate content and improving the completeness of the asynchronously generated results.

[0106] In an optional embodiment, see [link to relevant documentation] Figure 8 If the generation task corresponding to the generation request is an asynchronous image generation task, the method further includes: Step S800: If the target result message contains multiple image candidates, perform local storage processing for the multiple image candidates. Step S802: In response to the successful storage of all the multiple image candidates, output the local image candidate set formed by the multiple image candidates; In step S804, in response to the failure to store at least one image candidate, the stored image candidate is deleted, and the read operation is re-executed based on the task identifier corresponding to the asynchronous image generation task, without submitting the generation request for initiating the asynchronous image generation task again.

[0107] Specifically, for remote asynchronous image generation tasks, the generation service can first generate multiple image candidates, and then the client device can obtain the resources corresponding to each image candidate based on the existing task results and store these resources locally.

[0108] For example, the client device can first create a local temporary storage directory, and then download multiple candidate images sequentially via HTTPS or other reading methods. As an example, the temporary directory can be configured to allow only the directory owner to access it, such as 0700; the downloaded local candidate files can be configured to allow only the file owner to read and write them, such as 0600.

[0109] The client device does not immediately expose each image candidate to the subsequent selection module after obtaining it. Instead, it outputs the local candidate set only after all image candidates have been successfully stored. If any image candidate fails during download or local storage, some of the stored candidates can be deleted, ensuring that the subsequent selection module does not receive an incomplete set missing some candidates. Image storage failure does not cause the client device to resend the original asynchronous image generation request. The client device can retain the task_id or other task identifier of the asynchronous image generation task and then re-execute the read operation based on the task identifier to obtain the candidate resources already generated remotely.

[0110] This embodiment further applies "writing generation tasks" and "reading generation results" to asynchronous image candidate processing, and outputs the candidate set only after all candidates have been localized. This allows for the retrieval of results from the original task identifier in case of reading failure, eliminating the need to re-execute the generation task. Simultaneously, some local results are cleared upon failure, reducing the number of incomplete candidate sets entering the subsequent selection process and minimizing duplicate generation tasks caused by reading anomalies.

[0111] In an optional embodiment, if the target result message corresponds to target audio, the method further includes: Step S900: Obtain the timestamped text corresponding to the target audio, and determine multiple consecutive scene segments on the timeline based on the timestamped text and the audio duration of the target audio; Step S902: Obtain the original pixel anchor point of the background corresponding to the interactive object in the target scene segment, wherein the target scene segment is any scene segment among multiple scene segments; Step S904: Based on the camera translation information corresponding to the target scene segment, convert the original background pixel anchor point into the current display coordinates, and determine the display position of the character relative to the interactive object based on the current display coordinates; Step S906: Perform the same coordinate transformation on the foreground occlusion layer located in front of the character as the background of the target scene segment to form the foreground occlusion relationship of the interactive object relative to the character.

[0112] Specifically, the target audio can be the audio determined from the candidate set included in the aforementioned target result message and entered into the subsequent video generation process. Timestamped text is text data that establishes a correspondence with different time positions of the target audio; it can be used to describe the corresponding time of the text content on the target audio's timeline. For example, timestamped text can be timestamped lyrics, timestamped narration, etc.

[0113] The client device or subsequent video generation and processing components can parse the timestamped text and combine it with the audio duration of the target audio to form multiple scene segments that continuously cover the target audio from the start position to the end position, that is, to determine multiple scene segments that are continuous on the timeline.

[0114] In some embodiments, each scene segment can be bound to at least one of the following: scene semantics, character actions, clothing information, prop information, weather information, and transition information. Multiple scene segments have continuous timelines, allowing adjacent scene segments to be seamlessly connected on the timeline, thus enabling the determination of the current scene segment based on a unified audio timing.

[0115] In some embodiments, for a target scene segment containing a character and fixed interactive objects (background objects), the original background pixel anchor points corresponding to the interactive objects can be pre-recorded in the original background image. For example, when a character needs to be located at a specific position on a seat, ship hull, or other interactive object, the pixel coordinates of that position in the original background image can be used as the original background pixel anchor points.

[0116] When the background in the target scene moves according to the camera's panning information, the original pixel anchor points of the background can undergo a coordinate transformation corresponding to the background to obtain the display coordinates of the interactive object in the current frame. The character's position can be used as a positioning reference based on these current display coordinates, thereby allowing the contact or relative position between the character and the interactive object to change synchronously with the background panning.

[0117] For situations where it is necessary to create a character being occluded by an interactive object in front of the character, the foreground overlay can be transformed using the same camera translation or coordinate transformation as the background image, thereby creating a foreground occlusion relationship between the interactive object and the character, i.e., creating an occlusion effect in front of the character.

[0118] In this optional embodiment, by establishing a correspondence between the target audio time and multiple scene segments, and further transforming the positions of interactive objects in the scene to the current display coordinates using the original pixel anchor points of the background, while ensuring that the foreground occlusion layer and the background use the same coordinate transformation, the character positioning, background movement, and foreground occlusion use a consistent spatial reference. Therefore, in scenes with background translation, the separation of the positional relationship between the character and interactive objects due to background movement can be reduced, and the foreground and background occlusion relationship of interactive objects relative to the character remains consistent with the current scene transformation.

[0119] In an optional embodiment, the method may further include: Step S1000: Obtain multiple materials for generating music videos, and perform material verification on the multiple materials; Step S1002: Record the hash value of the material that passed the verification; Step S1004: Generate a list file to describe the music video generation task. The list file references verified materials through material hash values ​​and records the scene control information corresponding to the music video generation task. Step S1006: Based on the manifest file, control the video generation engine to read the corresponding materials and execute music video generation.

[0120] Specifically, assets can include character assets, background assets, prop assets, weather effect assets, lyric display assets, and other image resources used to create scenes. Each asset can undergo corresponding asset validation before being included in the manifest file.

[0121] In some embodiments, six-panel animation master images with a 3×2 layout can be generated for different actions of the character. Each animation master image can be merged into a unified character asset set after undergoing at least one of the following verifications: layout verification, chroma key verification, scale verification, and foot baseline verification. Through the above verifications, different animation resources in the character asset set can be organized in a mutually usable manner in terms of layout position, image scale, and character foot reference position.

[0122] It should be noted that for other types of materials, such as background materials, prop materials, weather effect materials, and lyrics display materials, only their own independent validation rules need to be executed, without having to follow the processing procedures specific to the character materials mentioned above.

[0123] For verified footage, it can be used for subsequent video generation, and its status can be recorded as "approved," along with its hash value. The hash value can be used to identify specific footage versions, preventing tampering. When referencing footage, the manifest file only references resources that are in an approved state and have the corresponding hash value, ensuring that the footage specified in the manifest file corresponds to the verified footage.

[0124] In some embodiments, the manifest file may record at least one type of scene control information, including background panning information, character motion information, prop layer information, weather information, and lyrics display information. The video generation engine can read the materials and control information in the task directory based on the manifest file, without having to embed all the materials and control logic of the current task into the video generation engine itself.

[0125] In some embodiments, the same general video generation engine can handle different task directories. Different music video tasks are specified by corresponding manifest files that include media references and scene control information. In this way, the video generation engine is mainly responsible for parsing the unified task description and performing rendering, while the differences between tasks are expressed through manifest files.

[0126] In some embodiments, the video generation engine can directly obtain the materials and scene control information referenced by the current task by reading the task directory corresponding to the target music video task and the manifest file, without needing to pre-define or import the corresponding materials for each music video task into the video generation engine. Different music video tasks can have different task directories and manifest files, but are executed by the same video generation engine according to a unified data reading logic. Thus, the organization of materials and scene configuration for different tasks can be separated from the general video generation execution logic.

[0127] In this optional embodiment, by recording the approval status and material hash of the materials entering the video generation process, and ensuring that the manifest file only references materials with the corresponding approval status, a traceable correspondence is established between the material processing results and the final video generation task. Furthermore, by utilizing an external manifest file to describe scene control information and drive the video generation engine to read the corresponding materials, task data and general rendering execution logic can be separated, improving the consistency of material versions and task inputs, and facilitating the repeated execution of the corresponding video generation process according to the same task description.

[0128] In an optional embodiment, the method may further include: Step S1100: Determine the current rendering time based on the number of rendered frames, the target frame rate, and the start time offset; Step S1102: Determine the current scene and current character action based on the current rendering time, and render the corresponding video frame based on the current scene, the current character action and the current rendering time; Step S1104: After the video rendering is completed, obtain the actual number of written frames recorded by the video writing module and the number of container frames recorded by the generated video container, respectively. Step S1106: Perform a frame count consistency check on the generated video based on the actual number of written frames and the number of container frames.

[0129] Specifically, the video generation process can determine the current rendering time based on a fixed frame clock of the number of rendered frames, rather than directly based on the cumulative time increment of the wall clock (the physical clock in the real world) when the video generation program is executed.

[0130] As an example, the current rendering time can be determined according to the following relationship: t = rendered_frame / fps + start_offset; where t represents the current rendering time, rendered_frame represents the number of frames rendered, fps represents the target frame rate, and start_offset represents the start time offset.

[0131] After obtaining the current rendering time, you can query multiple consecutive scene segments on the timeline that contain the current rendering time, and determine the current scene and current character action corresponding to that scene segment. When rendering each frame, you can select the scene and action based on the determined rendering time corresponding to the frame number, so as to reduce the impact of changes in running speed during offline rendering on the scene switching time.

[0132] In some embodiments, the video writing module can count the number of video frames actually submitted to the video encoding or writing process during rendering. After the output video is generated, it can also read the number of container frames recorded in the generated video container. By comparing the actual number of written frames with the number of container frames, a consistency check result for the final number of video frames can be generated.

[0133] In this optional embodiment, a defined time base is established using the number of rendered frames and the target frame rate, allowing the selection of the current scene and the current character's actions to be determined by frame position, rather than directly depending on program execution speed. Furthermore, after rendering is complete, the actual number of frames written by the video writing module and the number of container frames recorded by the video container are simultaneously acquired for consistency verification. This allows for cross-verification of the output frame count from both the rendering writing side and the final file side, improving the timeline determinism of the offline video generation process and the verifiability of the output results.

[0134] To facilitate understanding of the technical solution of this application, the following is combined with... Figure 9 The technical solution of this application is described in detail.

[0135] Step 1: Obtain historical messages and determine the baseline message sequence number.

[0136] For example, read the maximum message sequence number max_id from the historical messages and use it as the baseline message sequence number (water level h0).

[0137] Step 2: Establish a real-time messaging channel.

[0138] Step 3: Check if the real-time message channel is in a ready state.

[0139] If the real-time message channel is in a ready state, proceed to step 4; if the real-time message channel is not in a ready state, proceed to step 5. In this step, it is possible to detect whether the current connection status of the real-time message channel is in a connected state. This step is executed after the handshake operation required to establish the real-time message channel is completed.

[0140] Step 4: Send a generation request. The request can be submitted at most once in the same generation round.

[0141] Step 5: Terminate the current generation round, and keep the task status as unsubmitted.

[0142] Step 6: The task status is updated to "submitted".

[0143] Step 7: Obtain and process messages through the real-time message channel, and determine the target result message based on the baseline message sequence number.

[0144] Step 8: Determine whether the target result message has been determined. If the target result message has been determined, proceed to step 9; otherwise, proceed to step 10.

[0145] Step 9: Output the target result message; the current generation round is complete.

[0146] Step 10: Determine if an anomaly has occurred in the real-time message channel. If an anomaly has occurred, proceed to step 11; otherwise, return to step 7.

[0147] Step 11: Generate recovery information and enter the recoverable state.

[0148] Wherein, the recovery information K=(target_object_id, h0, task_type, last_state, resumable=true); target_object_id is the object identifier of the target generated object, h0 is the baseline message sequence number, task_type is the task type, last_state is the current task status, and resumable=true indicates that the read-only result query process is allowed, that is, the recovery process is allowed.

[0149] Step 12: Based on the same baseline message sequence number in the recovery information, perform a read operation through the historical query channel without sending a generation request again.

[0150] Step 13: Determine whether the target result message has been obtained from the historical query channel. If yes, return to step 9; otherwise, proceed to step 14.

[0151] Step 14: Maintain the recoverable state, continue the read operation, and proceed to step 12.

[0152] In addition, several exemplary applications are provided below to further understand this application.

[0153] Example Application 1: Asynchronous Audio Generation Task.

[0154] S1, the client device receives the generation parameters corresponding to the target generated object.

[0155] For example, the object identifier of the target generated object can be singer_id=123. If the current generation write operation has an independent operation confirmation requirement, the client device can first confirm that the current operation confirmation status only covers this generation write operation.

[0156] S2 reads the historical messages of the target generated object through the historical query channel.

[0157] For example, assuming the maximum message sequence number in the current historical messages is 4817, then 4817 is recorded as the baseline message sequence number h0 of the current generation round, and this checkpoint can be saved through the after_message_id (baseline message sequence number) field.

[0158] S3 establishes a real-time message channel based on the target generated object.

[0159] When using WebSocket, the connection status is read again after the real-time channel completes the handshake.

[0160] When the connection status is connected, the real-time channel meets the pre-write ready condition.

[0161] S4 calls the audio generation and writing interface once and submits the generation parameters.

[0162] The generated parameters can include style-related input, text content, and optional reference audio. The network layer does not automatically retry this generate write request.

[0163] S5: If the real-time channel was closed before S4, the client device terminates the current generation round and records that the current generation request was not sent. The recovery flag can be set to false. Since no write requests have been generated in the current generation round, a new generation round can be initiated after communication conditions are restored.

[0164] S6, if the generation request has been sent, the current generation round enters the state of request submitted and result waiting.

[0165] When the real-time message channel receives a target result event with message.id = 4818 and message.type = generate_song, the client device can parse multiple song_draft_states (candidate song states) from the message. For example, if the target result message includes two candidates, and both candidates have an audio_id and an accessible resource address, both candidates will be returned instead of just the first one.

[0166] S7. If the real-time message channel is disconnected or a timeout occurs after the generation request is sent, the client device will not call the audio generation and write interface again. Instead, it will output recovery information including singer_id = 123, after_message_id = 4817, and a recoverable status. Subsequently, a read-only query will be performed through the historical query channel using the same 4817 as the message boundary.

[0167] S8. In the historical message pollution scenario, assume the query results include the old target message 4700, the old error message 4800, the newly generated non-target message 4818, and the target result message 4819 of the current generation round. The client device can perform current round processing only on messages with message sequence numbers greater than 4817, and further exclude non-target messages based on message type, ultimately determining the target result corresponding to 4819.

[0168] S9. After determining the target audio, if a publishing write operation is required later, a separate second operation confirmation status can be obtained for the content to be published. The operation confirmation status of the aforementioned generation stage is not automatically used as a publishing confirmation.

[0169] In the above example, an exception before submission will not generate a write request; an exception after submission will not regenerate a write request. Instead, it will use the same baseline message sequence number saved before submission to perform historical read recovery, thus forming an exception handling path that matches the actual sending status of the request.

[0170] Example Application 2: Asynchronous Image Candidate Processing.

[0171] S1, the client device initiates an asynchronous image generation task and obtains the task identifier corresponding to the task.

[0172] S2, after the remote task is completed, the client device reads the multiple image candidates corresponding to the task and establishes a local temporary storage directory.

[0173] S3: The client device sequentially saves all candidate images to its local storage. Only after all candidate images have been successfully saved will the complete local candidate set be output to the subsequent selection module.

[0174] S4. If the acquisition or saving of the Nth image candidate fails, delete the locally saved candidates, retain the original task identifier, and re-execute the result reading based on the original task identifier, instead of re-initiating the asynchronous image generation task.

[0175] Therefore, read failures will not be converted into new writes, and some candidates will not enter subsequent processing as incomplete sets.

[0176] Example Application 3: Generation of pixel-based music videos corresponding to target audio.

[0177] S1, the client device obtains the determined target audio and its timestamped text, divides the target audio into multiple scene segments from the start time to the end time, and configures scene semantics, character actions, clothing, props, weather and transition information for the corresponding scene segments.

[0178] S2: The client device generates independent 3×2 six-grid motion master images for different character actions, performs layout, color key, scale, and foot baseline verification, and forms a character atlas from the verified motion resources. For materials allowed to proceed to subsequent processing, the approval status and material hash value are recorded.

[0179] S3: The client device generates a manifest file, which records scene control information such as background panning, character actions, prop layers, weather, and lyrics display, and only uses materials that are in the approved state.

[0180] S4: In scenarios where a character needs to interact with or occlude interactive objects in the background, the client device reads the original pixel anchor points of the interactive objects in the original background image, transforms them to the current display coordinates based on camera translation information, and positions the character according to these display coordinates. The foreground occlusion layer in front of the character undergoes the same coordinate transformation as the background, thus maintaining the foreground occlusion relationship between the object and the character.

[0181] S5: During the video generation process, the client device determines the current rendering time based on the number of rendered frames, the target frame rate, and the start time offset. Based on the current rendering time, it determines the current scene and the current character's actions from multiple consecutive scene segments on the timeline and renders them frame by frame.

[0182] S6: After the client device finishes rendering the video, it reads the actual number of frames written by the video writing module and the number of frames recorded by the generated video container, and performs a frame count consistency check.

[0183] In some embodiments, an exception injection verification process can be constructed for the generation task processing method. For scenarios where a network interruption occurs before the real-time message channel handshake is completed, the number of generation write request calls can be recorded to confirm that the current generation round maintains a state where the generation request has not been sent. For scenarios where the real-time message channel is immediately disconnected after the generation request has been sent, the number of generation write request calls and recovery time can be recorded to verify that the current generation round has entered the read-only recovery path from the result waiting path. For scenarios where the real-time result event is not received by the real-time message channel, but the corresponding result has already entered the historical message storage, the situation where the corresponding result is retrieved through the historical query channel based on the baseline message sequence number can be recorded, and the result retrieval rate can be calculated accordingly. For scenarios where there are multiple historical generation round results in the historical messages, the number of times the current generation round is incorrectly associated with historical results can be counted to obtain the candidate misattribution rate. For scenarios where any image candidate among multiple image candidates fails to be obtained, whether a portion of the candidate set is exposed to subsequent processing can be recorded to count the exposure of incomplete sets. For scenarios where server-side temporary anomalies occur during historical read requests, the number of read request retries and the number of write requests generated can be recorded separately to verify that limited retries of read requests do not cause new write requests to be generated in the current generation round. During the verification phase, multiple rounds of fault injection can also be performed for one or more of the above-mentioned anomaly scenarios. In one verification configuration, at least 1000 rounds of fault injection can be set, and the duplicate write rate, candidate misattribution rate, result retrieval rate, and average recovery time can be statistically analyzed. It should be noted that the number of fault injection rounds and statistical indicators are used to illustrate an optional verification method and do not indicate that this application has obtained a corresponding amount of actual experimental data, nor do they constitute a limitation on the scope of protection of this application.

[0184] Example 2 Figure 10 The diagram schematically illustrates a task processing apparatus according to Embodiment 2 of this application. This apparatus can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiments of this application. The program modules referred to in the embodiments of this application are a series of computer program instruction segments capable of performing specific functions. The following description will specifically introduce the functions of each program module in this embodiment. For example... Figure 10 As shown, the task generation processing device 1000 may include: a determining module 1010, a creating module 1020, a submitting module 1030, a processing module 1040, a generating module 1050, and a reading module 1060, wherein: The determination module 1010 is used to obtain historical messages through a historical query channel for a target generated object, and determine the baseline message sequence number based on the historical messages; The module 1020 is used to establish a real-time message channel corresponding to the target generated object and to detect whether the real-time message channel is in a ready state. The submission module 1030 is used to submit a generation request corresponding to the target generation object to the generation service in response to the real-time message channel being in the ready state, wherein the generation request is submitted at most once in the same generation round; The processing module 1040 is used to obtain a message through the real-time message channel after the generation request is submitted, and process the obtained message based on the baseline message sequence number to determine the target result message corresponding to the generation request. The generation module 1050 is used to generate recovery information in response to an anomaly occurring in the real-time message channel after the generation request is submitted. The recovery information includes the object identifier of the target generation object and the baseline message sequence number. The reading module 1060 is used to perform a reading operation through the historical query channel based on the recovery information without resubmitting the generation request, so as to obtain the target result message from the historical query channel.

[0185] In this embodiment, the determining module 1010, establishing module 1020, submitting module 1030, processing module 1040, generating module 1050, and reading module 1060 can respectively execute the processing corresponding to steps S200~S210 in Embodiment 1. The relevant technical content and further technical details can be found in the description in Embodiment 1, and will not be repeated here.

[0186] Example 3 Figure 11 This illustration schematically shows a hardware architecture diagram of a computer device 10000 suitable for implementing a task generation processing method according to Embodiment 3 of this application. In some embodiments, the computer device 10000 may be a terminal device such as a smartphone, wearable device, tablet computer, personal computer, in-vehicle terminal, game console, virtual device, workbench, digital assistant, set-top box, robot, etc. In other embodiments, the computer device 10000 may be a rack server, blade server, tower server, or cabinet server (including independent servers or server clusters composed of multiple servers), etc. Figure 11 As shown, the computer device 10000 includes, but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate and be linked with each other via a system bus. Wherein: The memory 10010 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as the hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 10000. Of course, the memory 10010 may also include both the internal storage module and the external storage device of the computer device 10000. In this embodiment, the memory 10010 is typically used to store the operating system and various application software installed on the computer device 10000, such as program code for generating task processing methods. In addition, the memory 10010 can also be used to temporarily store various types of data that have been output or will be output.

[0187] In some embodiments, processor 10020 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other chip. Processor 10020 is typically used to control the overall operation of computer device 10000, such as performing control and processing related to data interaction or communication with computer device 10000. In this embodiment, processor 10020 is used to run program code stored in memory 10010 or process data.

[0188] Network interface 10030 may include a wireless network interface or a wired network interface. This network interface 10030 is typically used to establish communication links between computer device 10000 and other computer devices. For example, network interface 10030 is used to connect computer device 10000 to external terminals via a network, establishing data transmission channels and communication links between computer device 10000 and external terminals. The network can be an intranet, the Internet, Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G networks, 5G networks, Bluetooth, Wi-Fi, or other wireless or wired networks.

[0189] It should be pointed out that, Figure 11 Only computer devices with components 10010-10030 are shown; however, it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented instead.

[0190] In this embodiment, the task generation processing method stored in memory 10010 can be further divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of this application.

[0191] Example 4 This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the task generation processing method in the embodiment.

[0192] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device. Of course, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device, such as the program code for generating the task processing method in this embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.

[0193] Example 5 This application also provides a computer program product, including a computer program that, when executed by a processor, implements the methods described in the above embodiments.

[0194] Obviously, those skilled in the art should understand that the modules or steps of the embodiments of this application described above can be implemented using general-purpose computer devices. They can be centralized on a single computer device or distributed across a network of multiple computer devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computer device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of this application are not limited to any particular combination of hardware and software.

[0195] It should be noted that the above are merely preferred embodiments of this application and do not limit the scope of patent protection of this application. Any equivalent structural or procedural changes made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of this application.

Claims

1. A method of generating task processing, characterized by, The method includes: For the target generated object, historical messages are obtained through the historical query channel, and the baseline message sequence number is determined based on the historical messages; Establish a real-time message channel corresponding to the target generated object, and detect whether the real-time message channel is in a ready state; In response to the real-time message channel being in the ready state, a generation request corresponding to the target generation object is submitted to the generation service, wherein the generation request is submitted at most once within the same generation round; After the generation request is submitted, the message is obtained through the real-time message channel, and the obtained message is processed based on the baseline message sequence number to determine the target result message corresponding to the generation request; In response to an anomaly occurring in the real-time message channel after the generation request is submitted, recovery information is generated; Without resubmitting the generation request, a read operation is performed based on the recovery information through the historical query channel to obtain the target result message from the historical query channel.

2. The method of claim 1, wherein, The method further includes: Record the task status of the generated task corresponding to the current generation round; The task status of the generation task corresponding to the current generation round includes: In response to an anomaly occurring in the real-time message channel before the generation request is submitted, the task status is marked as unsubmitted, wherein the current generation round is terminated when the task status is unsubmitted. In response to submitting the generation request, the task status is marked as submitted. In response to an anomaly occurring in the real-time message channel after the generation request is submitted, the task status is marked as recoverable. When the task status is recoverable, the generation request is not resubmitted for the current generation round.

3. The method of claim 1, wherein, The process of processing the acquired message based on the baseline message sequence number to determine the target result message corresponding to the generation request includes: Obtain the message sequence number and message type corresponding to the message to be processed, wherein the message to be processed is a message obtained through the real-time message channel; Filter out messages whose sequence number is greater than the baseline message sequence number from the messages to be processed; The message whose message type matches the target result type from the filtered messages is selected as the target result message.

4. The method of claim 1, wherein, The recovery information includes the object identifier of the target generated object and the baseline message sequence number. The step of performing a read operation based on the recovery information through the historical query channel to obtain the target result message from the historical query channel includes: Based on the object identifier of the target generated object carried in the recovery information, the historical messages of the target generated object are obtained through the historical query channel; Based on the baseline message sequence number carried in the recovery information, messages with message sequence numbers greater than the baseline message sequence number are filtered from the historical messages; The message whose message type matches the target result type from the filtered messages is selected as the target result message.

5. The method according to any one of claims 1 to 4, characterized in that, The target result message includes multiple candidate content to be generated, and the method further includes: From the target result message, determine the generated candidate content that meets the candidate validity conditions; All generated candidate contents that meet the aforementioned candidate validity conditions are determined as the set of generated candidate contents.

6. The method according to any one of claims 1 to 4, characterized in that, The establishment of a real-time message channel corresponding to the target generated object includes: The real-time message channel is established based on the authentication information and the object identifier of the target generated object; The detection of whether the real-time message channel is in a ready state includes: After completing the handshake operation corresponding to the real-time message channel, the current connection status of the real-time message channel is read again; If the current connection status is still connected, the real-time message channel is determined to be in a ready state.

7. The method according to any one of claims 1 to 4, characterized in that, When the generation task corresponding to the generation request is an asynchronous image generation task, the method further includes: If the target result message contains multiple image candidates, local storage processing is performed on the multiple image candidates; In response to the successful storage of all the multiple image candidates, a local image candidate set formed by the multiple image candidates is output; In response to the failure to store at least one image candidate, the stored image candidate is deleted, and the read operation is re-executed based on the task identifier corresponding to the asynchronous image generation task, without submitting the generation request to initiate the asynchronous image generation task again.

8. The method of claim 1, wherein, When the target audio is determined based on the target result message, the method further includes: Obtain the timestamped text corresponding to the target audio, and determine multiple consecutive scene segments on the timeline based on the timestamped text and the audio duration of the target audio; Obtain the original pixel anchor points of the background corresponding to the interactive objects in the target scene segment, wherein the target scene segment is any one of multiple scene segments; Based on the camera translation information corresponding to the target scene segment, the original background pixel anchor points are converted into current display coordinates, and the display position of the character relative to the interactive object is determined based on the current display coordinates; Perform the same coordinate transformation on the foreground occlusion layer located in front of the character as on the background of the target scene segment to form the foreground occlusion relationship of the interactive object relative to the character.

9. The method of claim 8, wherein, The method further includes: Obtain multiple media materials for generating a music video, and perform media verification on the multiple media materials; Record the hash value of the material that passes verification; Generate a manifest file to describe the music video generation task. The manifest file references verified materials through material hash values ​​and records the scene control information corresponding to the music video generation task. Based on the manifest file, the video generation engine reads the corresponding materials and executes music video generation.

10. The method of claim 8, wherein, The method further includes: The current rendering time is determined based on the number of frames already rendered, the target frame rate, and the start time offset. The current scene and the current character's action are determined based on the current rendering time, and the corresponding video frames are rendered based on the current scene, the current character's action, and the current rendering time. After the video rendering is complete, obtain the actual number of frames written by the video writing module and the number of frames in the generated video container. The generated video is subjected to frame count consistency verification based on the actual number of frames written and the number of frames in the container.

11. A task processing apparatus generating means, characterized by, include: The determination module is used to generate a target object, obtain historical messages through a historical query channel, and determine the baseline message sequence number based on the historical messages; The module is used to establish a real-time message channel corresponding to the target generated object and to detect whether the real-time message channel is in a ready state. The submission module, in response to the real-time message channel being in the ready state, submits a generation request corresponding to the target generation object to the generation service, wherein the generation request is submitted at most once within the same generation round; The processing module is used to obtain a message through the real-time message channel after the generation request is submitted, and to process the obtained message based on the baseline message sequence number to determine the target result message corresponding to the generation request. The generation module is used to generate recovery information in response to an anomaly occurring in the real-time message channel after the generation request is submitted. The recovery information includes the object identifier of the target generation object and the baseline message sequence number. The reading module is used to perform a reading operation based on the recovery information through the historical query channel without resubmitting the generation request, so as to obtain the target result message from the historical query channel.

12. A computer device, characterized by include: At least one processor; and A memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method as described in any one of claims 1 to 10.

14. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 10.