write out responses

This commit is contained in:
Jeff Carr 2025-08-29 16:02:38 -05:00
parent 7163afdacc
commit 1d27b6d191
1 changed files with 8 additions and 0 deletions

View File

@ -559,6 +559,14 @@ export const useGeminiStream = (
let geminiMessageBuffer = '';
const toolCallRequests: ToolCallRequestInfo[] = [];
for await (const event of stream) {
// HACK: Write every event to a file in /tmp/.
const timestamp = new Date()
.toISOString()
.replace(/:/g, '-')
.replace(/\./g, '_');
const fileName = `regex.gemini-api-response.${timestamp}.json`;
const filePath = path.join('/tmp', fileName);
await fs.writeFile(filePath, JSON.stringify(event, null, 2));
switch (event.type) {
case ServerGeminiEventType.Thought:
setThought(event.value);