Fix assistant messages not being authored by Miku
This commit is contained in:
parent
fb78222a3e
commit
db7fb0f001
@ -62,7 +62,7 @@ async function main() {
|
||||
* USER:
|
||||
* Answer the user query.
|
||||
* [ Langchain JSON structured output instructions ]
|
||||
* { ... "author": "vinso", "content": "message history 1" ... }
|
||||
* { ... "author": "vinso1445", "content": "message history 1" ... }
|
||||
* { ... "author": "f0oby", "content": "message history 2" ... }
|
||||
* { ... "author": "scoliono", "content": "message history 3" ... }
|
||||
*
|
||||
@ -85,7 +85,7 @@ async function main() {
|
||||
* a thought across multiple messages. It's up to the inference code to decide what to do with
|
||||
* this.
|
||||
*/
|
||||
function structurePrompt(msg, cleanContent) {
|
||||
function structurePrompt(msg, cleanContent, isBotMessage = false) {
|
||||
/**
|
||||
* Handle replies by maintaining a sliding window of message references.
|
||||
* If the replied-to message is too old to be part of this conversation, then leave this
|
||||
@ -110,8 +110,8 @@ async function main() {
|
||||
// 'name', 'context', 'reactions' could be undefined, in which case those fields are omitted
|
||||
return JSON.stringify({
|
||||
timestamp: (new Date(msg.timestamp)).toUTCString(),
|
||||
author: msg.author.name,
|
||||
name: REAL_NAMES[msg.author.name],
|
||||
author: isBotMessage ? 'Hatsune Miku#1740' : msg.author.name,
|
||||
name: isBotMessage ? 'Hatsune Miku' : REAL_NAMES[msg.author.name],
|
||||
context: repliedToContent,
|
||||
content: cleanContent,
|
||||
reactions: reactionString
|
||||
@ -175,7 +175,7 @@ async function main() {
|
||||
convoRefs[msg.id] = cleanContent;
|
||||
|
||||
// write a single discord message to the prompt
|
||||
discordMsgs.push(structurePrompt(msg, cleanContent));
|
||||
discordMsgs.push(structurePrompt(msg, cleanContent, botAuthoredMsgSequence));
|
||||
|
||||
if (++counter % 1000 === 0) {
|
||||
console.log(counter + " messages written");
|
||||
|
Loading…
x
Reference in New Issue
Block a user