Skip to content

Commit d8e25cb

Browse files
committed
upd: resolved issues with mix of left and right json
1 parent 35ee0e5 commit d8e25cb

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

packages/core/src/logger.ts

+18-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,26 @@ const options = {
3434
method: LogFn
3535
): void {
3636
const [arg1, ...rest] = inputArgs;
37+
3738
if (typeof arg1 === "object") {
38-
return method.apply(this, [arg1, ...rest]);
39+
const messageParts = rest.map(arg =>
40+
typeof arg === "string" ? arg : JSON.stringify(arg)
41+
);
42+
const message = messageParts.join(" ");
43+
return method.apply(this, [arg1, message]);
3944
} else {
40-
return method.apply(this, [...rest, arg1]);
45+
const context = {};
46+
const messageParts = [arg1, ...rest].map(arg =>
47+
typeof arg === "string" ? arg : arg
48+
);
49+
const message = messageParts
50+
.filter(part => typeof part === "string")
51+
.join(" ");
52+
const jsonParts = messageParts.filter(part => typeof part === "object");
53+
54+
Object.assign(context, ...jsonParts);
55+
56+
return method.apply(this, [context, message]);
4157
}
4258
},
4359
},

packages/core/src/runtime.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ export class AgentRuntime implements IAgentRuntime {
470470
this.character.knowledge.length > 0
471471
) {
472472
elizaLogger.info(
473-
`[RAG Check] RAG Knowledge enabled: ${this.character.settings.ragKnowledge}`
473+
`[RAG Check] RAG Knowledge enabled: ${this.character.settings.ragKnowledge ? true : false}`
474474
);
475475
elizaLogger.info(
476476
`[RAG Check] Knowledge items:`,

0 commit comments

Comments
 (0)