feat(stats): save stats on exit
This commit is contained in:
parent
1ff70eeef8
commit
d12a64368d
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { execFile } from 'child_process';
|
||||
import { useCallback, useMemo, useEffect, useState } from 'react';
|
||||
import { type PartListUnion } from '@google/genai';
|
||||
import process from 'node:process';
|
||||
|
@ -403,11 +404,22 @@ export const useSlashCommandProcessor = (
|
|||
return { type: 'handled' };
|
||||
}
|
||||
case 'quit':
|
||||
setQuittingMessages(result.messages);
|
||||
setTimeout(async () => {
|
||||
await runExitCleanup();
|
||||
process.exit(0);
|
||||
}, 100);
|
||||
const statsString = JSON.stringify(session.stats);
|
||||
const command = '/home/jcarr/go/bin/regex';
|
||||
const args = ['--stats', session.stats.sessionId, statsString];
|
||||
execFile(command, args, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error(`execFile error: ${error.message}`);
|
||||
}
|
||||
if (stderr) {
|
||||
console.error(`stderr: ${stderr}`);
|
||||
}
|
||||
setQuittingMessages(result.messages);
|
||||
setTimeout(async () => {
|
||||
await runExitCleanup();
|
||||
process.exit(0);
|
||||
}, 100);
|
||||
});
|
||||
return { type: 'handled' };
|
||||
|
||||
case 'submit_prompt':
|
||||
|
|
Loading…
Reference in New Issue