Skip to content

Commit

Permalink
Merge pull request #441 from o-on-x/main
Browse files Browse the repository at this point in the history
feat:  add all the style guidelines to the context
  • Loading branch information
lalalune authored Nov 20, 2024
2 parents 9db1f63 + 1ae22ee commit b0a0b84
Showing 1 changed file with 39 additions and 29 deletions.
68 changes: 39 additions & 29 deletions packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1000,42 +1000,52 @@ Text: ${attachment.text}
formattedCharacterMessageExamples
)
: "",
messageDirections:
messageDirections:
this.character?.style?.all?.length > 0 ||
this.character?.style?.chat.length > 0
? addHeader(
"# Message Directions for " + this.character.name,
(() => {
const all = this.character?.style?.all || [];
const chat = this.character?.style?.chat || [];
return [...all, ...chat].join("\n");
})()
)
: "",

postDirections:
this.character?.style?.all?.length > 0 ||
this.character?.style?.chat.length > 0
this.character?.style?.post.length > 0
? addHeader(
"# Message Directions for " + this.character.name,
(() => {
const all = this.character?.style?.all || [];
const chat = this.character?.style?.chat || [];
const shuffled = [...all, ...chat].sort(
() => 0.5 - Math.random()
);
const allSliced = shuffled.slice(
0,
conversationLength / 2
);
return allSliced.concat(allSliced).join("\n");
})()
)
"# Post Directions for " + this.character.name,
(() => {
const all = this.character?.style?.all || [];
const post = this.character?.style?.post || [];
return [...all, ...post].join("\n");
})()
)
: "",

//old logic left in for reference
//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?
/*
postDirections:
this.character?.style?.all?.length > 0 ||
this.character?.style?.post.length > 0
? addHeader(
"# Post Directions for " + this.character.name,
(() => {
const all = this.character?.style?.all || [];
const post = this.character?.style?.post || [];
const shuffled = [...all, ...post].sort(
() => 0.5 - Math.random()
);
return shuffled
.slice(0, conversationLength / 2)
.join("\n");
})()
)
: "",
"# Post Directions for " + this.character.name,
(() => {
const all = this.character?.style?.all || [];
const post = this.character?.style?.post || [];
const shuffled = [...all, ...post].sort(
() => 0.5 - Math.random()
);
return shuffled
.slice(0, conversationLength / 2)
.join("\n");
})()
)
: "",*/
// Agent runtime stuff
senderName,
actors:
Expand Down

0 comments on commit b0a0b84

Please sign in to comment.