The invention discloses an AI dialogue flow control method,
system and device supporting real-time interruption of a user, a medium and a program product. The method comprises the steps that a user request is received, and a flow session is established; based on the
stream session, requesting LLM increment generation, receiving fragments generated by increment, returning the fragments, and pushing the fragments to the
client; when a click stop request of a user is received, an
STOP signal is sent; when the
STOP signal is monitored, sending a mark termination request; after a mark termination request is received, a subsequent generation termination request is sent to the LLM, a STREAMTERMINATED semantic event is published and broadcasted, and generated content and a termination mark are returned to the
client; terminating subsequent generation comprises stopping untriggered subsequent reasoning and tool chain calling; discarding the
tail cache which is not sent; and recording the output token count, and terminating the offset. The AI dialogue flow control method supports real-time interruption of the user, is low in
delay, clear in
semantics and recoverable, and further has the advantages of saving resources, being high in stability, capable of being universally expanded, gaining behavior analysis and the like.