mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
++
This commit is contained in:
@@ -6,10 +6,6 @@
|
|||||||
|
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
|
|
||||||
// DISCLAIMER: This is a copied version of https://github.com/googleapis/js-genai/blob/main/src/chats.ts with the intention of working around a key bug
|
|
||||||
// where function responses are not treated as "valid" responses: https://b.corp.google.com/issues/420354090
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createUserContent,
|
createUserContent,
|
||||||
FinishReason,
|
FinishReason,
|
||||||
@@ -179,20 +175,16 @@ export class GeminiChat {
|
|||||||
): void {
|
): void {
|
||||||
try {
|
try {
|
||||||
const logDir = path.join(
|
const logDir = path.join(
|
||||||
this.config.storage.getProjectTempDir(),
|
process.cwd(),
|
||||||
'request_history_logs',
|
|
||||||
this.config.getSessionId(),
|
|
||||||
);
|
);
|
||||||
if (!fs.existsSync(logDir)) {
|
|
||||||
fs.mkdirSync(logDir, { recursive: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
const timestamp = Date.now();
|
|
||||||
const logFile = path.join(
|
const logFile = path.join(
|
||||||
logDir,
|
logDir,
|
||||||
`request_${timestamp}_${promptId}.json`,
|
process.env['REQUEST_LOG_FILE'] ?? 'requests.log',
|
||||||
);
|
);
|
||||||
fs.writeFileSync(logFile, JSON.stringify(requestContents, null, 2));
|
if (!fs.existsSync(logFile)) {
|
||||||
|
fs.writeFileSync(logFile, `si:\n${this.systemInstruction}\n`);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(logFile, `prompt ${promptId}:\n${JSON.stringify(requestContents, null, 2)}\n`);
|
||||||
debugLogger.debug(
|
debugLogger.debug(
|
||||||
`[PROJECT CLARITY] Request history logged to ${logFile}`,
|
`[PROJECT CLARITY] Request history logged to ${logFile}`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import type { MessageBus } from '../confirmation-bus/message-bus.js';
|
|||||||
import type { Config } from '../config/config.js';
|
import type { Config } from '../config/config.js';
|
||||||
import type { GeminiChat } from '../core/geminiChat.js';
|
import type { GeminiChat } from '../core/geminiChat.js';
|
||||||
import { debugLogger } from '../utils/debugLogger.js';
|
import { debugLogger } from '../utils/debugLogger.js';
|
||||||
import { saveTruncatedToolOutput } from '../utils/tool-output-helper.js';
|
import { saveTruncatedToolOutput } from '../utils/fileUtils.js';
|
||||||
|
|
||||||
interface DistillResultParams {
|
interface DistillResultParams {
|
||||||
revised_text: string;
|
revised_text: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user