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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { execFile } from 'child_process';
|
||||||
import { useCallback, useMemo, useEffect, useState } from 'react';
|
import { useCallback, useMemo, useEffect, useState } from 'react';
|
||||||
import { type PartListUnion } from '@google/genai';
|
import { type PartListUnion } from '@google/genai';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
|
@ -403,11 +404,22 @@ export const useSlashCommandProcessor = (
|
||||||
return { type: 'handled' };
|
return { type: 'handled' };
|
||||||
}
|
}
|
||||||
case 'quit':
|
case 'quit':
|
||||||
setQuittingMessages(result.messages);
|
const statsString = JSON.stringify(session.stats);
|
||||||
setTimeout(async () => {
|
const command = '/home/jcarr/go/bin/regex';
|
||||||
await runExitCleanup();
|
const args = ['--stats', session.stats.sessionId, statsString];
|
||||||
process.exit(0);
|
execFile(command, args, (error, stdout, stderr) => {
|
||||||
}, 100);
|
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' };
|
return { type: 'handled' };
|
||||||
|
|
||||||
case 'submit_prompt':
|
case 'submit_prompt':
|
||||||
|
|
Loading…
Reference in New Issue