Add GENERATION_ENTERED event
| @@ -412,6 +412,7 @@ export const event_types = { | ||
| 412 | 412 | MESSAGE_FILE_EMBEDDED: 'message_file_embedded', |
| 413 | 413 | IMPERSONATE_READY: 'impersonate_ready', |
| 414 | 414 | CHAT_CHANGED: 'chat_id_changed', |
| 415 | + GENERATION_ENTERED: 'generation_entered', | |
| 415 | 416 | GENERATION_STARTED: 'generation_started', |
| 416 | 417 | GENERATION_STOPPED: 'generation_stopped', |
| 417 | 418 | GENERATION_ENDED: 'generation_ended', |
| @@ -3339,6 +3340,9 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3339 | 3340 | setGenerationProgress(0); |
| 3340 | 3341 | generation_started = new Date(); |
| 3341 | 3342 | |
| 3343 | + // Occurs every time, even if the generation is aborted due to slash commands execution | |
| 3344 | + await eventSource.emit(event_types.GENERATION_ENTERED, type, { automatic_trigger, force_name2, quiet_prompt, quietToLoud, skipWIAN, force_chid, signal, quietImage }, dryRun); | |
| 3345 | + | |
| 3342 | 3346 | // Don't recreate abort controller if signal is passed |
| 3343 | 3347 | if (!(abortController && signal)) { |
| 3344 | 3348 | abortController = new AbortController(); |
| @@ -3358,6 +3362,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3358 | 3362 | } |
| 3359 | 3363 | } |
| 3360 | 3364 | |
| 3365 | + // Occurs only if the generation is not aborted due to slash commands execution | |
| 3361 | 3366 | await eventSource.emit(event_types.GENERATION_STARTED, type, { automatic_trigger, force_name2, quiet_prompt, quietToLoud, skipWIAN, force_chid, signal, quietImage }, dryRun); |
| 3362 | 3367 | |
| 3363 | 3368 | if (main_api == 'kobold' && kai_settings.streaming_kobold && !kai_flags.can_use_streaming) { |