Skip to content

Commit 7cb04dc

Browse files
committed
fix: handle env using runtime getSetting function
1 parent 5f923a9 commit 7cb04dc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

packages/core/src/generation.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,22 @@ export async function generateText({
353353
baseURL: endpoint,
354354
fetch: async (url: string, options: any) => {
355355
const fetching = await runtime.fetch(url, options);
356-
if (process.env.ETERNAL_AI_LOG_REQUEST) {
357-
elizaLogger.info("Request data: ", JSON.stringify(options, null, 2));
356+
if (
357+
parseBooleanFromText(
358+
runtime.getSetting("ETERNAL_AI_LOG_REQUEST")
359+
)
360+
) {
361+
elizaLogger.info(
362+
"Request data: ",
363+
JSON.stringify(options, null, 2)
364+
);
358365
const clonedResponse = fetching.clone();
359-
clonedResponse.json().then(data => {
360-
elizaLogger.info("Response data: ", JSON.stringify(data, null, 2));
361-
})
366+
clonedResponse.json().then((data) => {
367+
elizaLogger.info(
368+
"Response data: ",
369+
JSON.stringify(data, null, 2)
370+
);
371+
});
362372
}
363373
return fetching;
364374
},

0 commit comments

Comments
 (0)