mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 19:52:02 +00:00
feat(cron): add distinct Cron message type and exit summary
- Introduce SendMessageType.Cron to differentiate cron-triggered prompts from user queries - Skip UserPromptSubmit hook for cron messages - Add getExitSummary() to display active loops when session ends - Add tests for exit summary functionality This improves cron loop handling by treating scheduled prompts differently from user-initiated queries and provides better UX when sessions end with active loops running. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
314a9ded78
commit
aa454a5a72
5 changed files with 94 additions and 7 deletions
|
|
@ -1176,7 +1176,10 @@ export const useGeminiStream = (
|
|||
}
|
||||
|
||||
// Check image format support for non-continuations
|
||||
if (submitType === SendMessageType.UserQuery) {
|
||||
if (
|
||||
submitType === SendMessageType.UserQuery ||
|
||||
submitType === SendMessageType.Cron
|
||||
) {
|
||||
const formatCheck = checkImageFormatsSupport(queryToSend);
|
||||
if (formatCheck.hasUnsupportedFormats) {
|
||||
addItem(
|
||||
|
|
@ -1193,7 +1196,10 @@ export const useGeminiStream = (
|
|||
lastPromptRef.current = finalQueryToSend;
|
||||
lastPromptErroredRef.current = false;
|
||||
|
||||
if (submitType === SendMessageType.UserQuery) {
|
||||
if (
|
||||
submitType === SendMessageType.UserQuery ||
|
||||
submitType === SendMessageType.Cron
|
||||
) {
|
||||
// trigger new prompt event for session stats in CLI
|
||||
startNewPrompt();
|
||||
|
||||
|
|
@ -1651,7 +1657,11 @@ export const useGeminiStream = (
|
|||
setCronTrigger((n) => n + 1);
|
||||
});
|
||||
return () => {
|
||||
const summary = scheduler.getExitSummary();
|
||||
scheduler.stop();
|
||||
if (summary) {
|
||||
process.stderr.write(summary + '\n');
|
||||
}
|
||||
};
|
||||
}, [config]);
|
||||
|
||||
|
|
@ -1662,7 +1672,7 @@ export const useGeminiStream = (
|
|||
cronQueueRef.current.length > 0
|
||||
) {
|
||||
const prompt = cronQueueRef.current.shift()!;
|
||||
submitQuery(prompt, SendMessageType.UserQuery);
|
||||
submitQuery(prompt, SendMessageType.Cron);
|
||||
}
|
||||
}, [streamingState, submitQuery, cronTrigger]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue