Skip to content

Commit 1ae22ee

Browse files
committed
Feature Modification: Add all the stlye guidelines to the context
1 parent df57d56 commit 1ae22ee

File tree

1 file changed

+39
-29
lines changed

1 file changed

+39
-29
lines changed

packages/core/src/runtime.ts

+39-29
Original file line numberDiff line numberDiff line change
@@ -985,42 +985,52 @@ Text: ${attachment.text}
985985
formattedCharacterMessageExamples
986986
)
987987
: "",
988-
messageDirections:
988+
messageDirections:
989+
this.character?.style?.all?.length > 0 ||
990+
this.character?.style?.chat.length > 0
991+
? addHeader(
992+
"# Message Directions for " + this.character.name,
993+
(() => {
994+
const all = this.character?.style?.all || [];
995+
const chat = this.character?.style?.chat || [];
996+
return [...all, ...chat].join("\n");
997+
})()
998+
)
999+
: "",
1000+
1001+
postDirections:
9891002
this.character?.style?.all?.length > 0 ||
990-
this.character?.style?.chat.length > 0
1003+
this.character?.style?.post.length > 0
9911004
? addHeader(
992-
"# Message Directions for " + this.character.name,
993-
(() => {
994-
const all = this.character?.style?.all || [];
995-
const chat = this.character?.style?.chat || [];
996-
const shuffled = [...all, ...chat].sort(
997-
() => 0.5 - Math.random()
998-
);
999-
const allSliced = shuffled.slice(
1000-
0,
1001-
conversationLength / 2
1002-
);
1003-
return allSliced.concat(allSliced).join("\n");
1004-
})()
1005-
)
1005+
"# Post Directions for " + this.character.name,
1006+
(() => {
1007+
const all = this.character?.style?.all || [];
1008+
const post = this.character?.style?.post || [];
1009+
return [...all, ...post].join("\n");
1010+
})()
1011+
)
10061012
: "",
1013+
1014+
//old logic left in for reference
1015+
//food for thought. how could we dynamically decide what parts of the character to add to the prompt other than random? rag? prompt the llm to decide?
1016+
/*
10071017
postDirections:
10081018
this.character?.style?.all?.length > 0 ||
10091019
this.character?.style?.post.length > 0
10101020
? addHeader(
1011-
"# Post Directions for " + this.character.name,
1012-
(() => {
1013-
const all = this.character?.style?.all || [];
1014-
const post = this.character?.style?.post || [];
1015-
const shuffled = [...all, ...post].sort(
1016-
() => 0.5 - Math.random()
1017-
);
1018-
return shuffled
1019-
.slice(0, conversationLength / 2)
1020-
.join("\n");
1021-
})()
1022-
)
1023-
: "",
1021+
"# Post Directions for " + this.character.name,
1022+
(() => {
1023+
const all = this.character?.style?.all || [];
1024+
const post = this.character?.style?.post || [];
1025+
const shuffled = [...all, ...post].sort(
1026+
() => 0.5 - Math.random()
1027+
);
1028+
return shuffled
1029+
.slice(0, conversationLength / 2)
1030+
.join("\n");
1031+
})()
1032+
)
1033+
: "",*/
10241034
// Agent runtime stuff
10251035
senderName,
10261036
actors:

0 commit comments

Comments
 (0)