Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add all the style guidelines to the context #441

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 39 additions & 29 deletions packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,42 +985,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
Loading