diff --git a/agent/src/index.ts b/agent/src/index.ts index 72a666500c..b4ff2c9aac 100644 --- a/agent/src/index.ts +++ b/agent/src/index.ts @@ -58,9 +58,9 @@ export async function loadCharacters( ?.split(",") .map((path) => path.trim()) .map((path) => { - if (path[0] === '/') return path; // handle absolute paths - // assume relative to the project root where pnpm is ran - return `../${path}`; + if (path[0] === "/") return path; // handle absolute paths + // assume relative to the project root where pnpm is ran + return `../${path}`; }); const loadedCharacters = []; diff --git a/packages/client-discord/src/voice.ts b/packages/client-discord/src/voice.ts index 3099759566..8b41062570 100644 --- a/packages/client-discord/src/voice.ts +++ b/packages/client-discord/src/voice.ts @@ -519,7 +519,7 @@ export class VoiceManager extends EventEmitter { const callback: HandlerCallback = async ( content: Content ) => { - console.log("callback content: ", content); + elizaLogger.debug("callback content: ", content); const { roomId } = memory; const responseMemory: Memory = { @@ -660,8 +660,8 @@ export class VoiceManager extends EventEmitter { } private async _shouldIgnore(message: Memory): Promise { - console.log("message: ", message); - console.log("message.content: ", message.content); + // console.log("message: ", message); + elizaLogger.debug("message.content: ", message.content); // if the message is 3 characters or less, ignore it if ((message.content as Content).text.length < 3) { return true; diff --git a/packages/client-twitter/src/interactions.ts b/packages/client-twitter/src/interactions.ts index f0a97aa73e..79c9a42d58 100644 --- a/packages/client-twitter/src/interactions.ts +++ b/packages/client-twitter/src/interactions.ts @@ -311,8 +311,6 @@ export class TwitterInteractionClient extends ClientBase { twitterShouldRespondTemplate, }); - console.log("composeContext done"); - const shouldRespond = await generateShouldRespond({ runtime: this.runtime, context: shouldRespondContext, diff --git a/packages/plugin-node/src/services/transcription.ts b/packages/plugin-node/src/services/transcription.ts index dd2da54949..cb07f29345 100644 --- a/packages/plugin-node/src/services/transcription.ts +++ b/packages/plugin-node/src/services/transcription.ts @@ -1,4 +1,4 @@ -import { IAgentRuntime, settings } from "@ai16z/eliza"; +import { elizaLogger, IAgentRuntime, settings } from "@ai16z/eliza"; import { Service, ServiceType } from "@ai16z/eliza"; import { exec } from "child_process"; import { File } from "formdata-node"; @@ -116,7 +116,7 @@ export class TranscriptionService extends Service { const probeResult = JSON.parse(stdout); const stream = probeResult.streams[0]; - console.log("Input audio info:", stream); + elizaLogger.log("Input audio info:", stream); let ffmpegCommand = `ffmpeg -i "${inputPath}" -ar ${this.TARGET_SAMPLE_RATE} -ac 1`; @@ -126,7 +126,7 @@ export class TranscriptionService extends Service { ffmpegCommand += ` "${outputPath}"`; - console.log("FFmpeg command:", ffmpegCommand); + elizaLogger.log("FFmpeg command:", ffmpegCommand); await execAsync(ffmpegCommand); @@ -135,7 +135,7 @@ export class TranscriptionService extends Service { fs.unlinkSync(outputPath); return convertedBuffer; } catch (error) { - console.error("Error converting audio:", error); + elizaLogger.error("Error converting audio:", error); throw error; } } @@ -147,7 +147,7 @@ export class TranscriptionService extends Service { const filePath = path.join(this.DEBUG_AUDIO_DIR, filename); fs.writeFileSync(filePath, Buffer.from(audioBuffer)); - console.log(`Debug audio saved: ${filePath}`); + elizaLogger.log(`Debug audio saved: ${filePath}`); } public async transcribeAttachment( @@ -201,7 +201,7 @@ export class TranscriptionService extends Service { private async transcribeWithOpenAI( audioBuffer: ArrayBuffer ): Promise { - console.log("Transcribing audio with OpenAI..."); + elizaLogger.log("Transcribing audio with OpenAI..."); try { await this.saveDebugAudio(audioBuffer, "openai_input_original"); @@ -225,19 +225,22 @@ export class TranscriptionService extends Service { }); const trimmedResult = (result as any).trim(); - console.log(`OpenAI speech to text result: "${trimmedResult}"`); + elizaLogger.log(`OpenAI speech to text result: "${trimmedResult}"`); return trimmedResult; } catch (error) { - console.error("Error in OpenAI speech-to-text conversion:", error); + elizaLogger.error( + "Error in OpenAI speech-to-text conversion:", + error + ); if (error.response) { - console.error("Response data:", error.response.data); - console.error("Response status:", error.response.status); - console.error("Response headers:", error.response.headers); + elizaLogger.error("Response data:", error.response.data); + elizaLogger.error("Response status:", error.response.status); + elizaLogger.error("Response headers:", error.response.headers); } else if (error.request) { - console.error("No response received:", error.request); + elizaLogger.error("No response received:", error.request); } else { - console.error("Error setting up request:", error.message); + elizaLogger.error("Error setting up request:", error.message); } return null; } @@ -247,7 +250,7 @@ export class TranscriptionService extends Service { audioBuffer: ArrayBuffer ): Promise { try { - console.log("Transcribing audio locally..."); + elizaLogger.log("Transcribing audio locally..."); await this.saveDebugAudio(audioBuffer, "local_input_original"); @@ -261,12 +264,12 @@ export class TranscriptionService extends Service { ); fs.writeFileSync(tempWavFile, convertedBuffer); - console.log(`Temporary WAV file created: ${tempWavFile}`); + elizaLogger.debug(`Temporary WAV file created: ${tempWavFile}`); let output = await nodewhisper(tempWavFile, { modelName: "base.en", autoDownloadModelName: "base.en", - verbose: true, + verbose: false, removeWavFileAfterTranscription: false, withCuda: this.isCudaAvailable, whisperOptions: { @@ -281,8 +284,6 @@ export class TranscriptionService extends Service { }, }); - console.log("Raw output from nodejs-whisper:", output); - output = output .split("\n") .map((line) => { @@ -294,17 +295,18 @@ export class TranscriptionService extends Service { }) .join("\n"); - console.log("Processed output:", output); - fs.unlinkSync(tempWavFile); if (!output || output.length < 5) { - console.log("Output is null or too short, returning null"); + elizaLogger.log("Output is null or too short, returning null"); return null; } return output; } catch (error) { - console.error("Error in local speech-to-text conversion:", error); + elizaLogger.error( + "Error in local speech-to-text conversion:", + error + ); return null; } }