From db7fb0f00106cb37156c3389750bfa67eb59fffe Mon Sep 17 00:00:00 2001 From: James S Date: Sat, 18 Jan 2025 18:44:26 -0800 Subject: [PATCH] Fix assistant messages not being authored by Miku --- data/process.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/process.js b/data/process.js index 9ec52cc..6a63921 100644 --- a/data/process.js +++ b/data/process.js @@ -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");