Add support for replied messages
This commit is contained in:
parent
a4ba2acfcc
commit
ed1a5356f9
3 changed files with 11 additions and 3 deletions
|
|
@ -33,6 +33,7 @@ const onAI = async (
|
|||
roomId: string,
|
||||
sender: string,
|
||||
repliedMessage?: string,
|
||||
repliedSender?: string,
|
||||
) => {
|
||||
const user = getUserById(sender);
|
||||
|
||||
|
|
@ -67,12 +68,15 @@ const onAI = async (
|
|||
} as IAIInstructions;
|
||||
|
||||
const username = getUserName(user);
|
||||
textMod = `${username}: ${textMod}`;
|
||||
let repliedUsername = "";
|
||||
if (repliedSender) {
|
||||
getUserName(getUserById(repliedSender));
|
||||
}
|
||||
|
||||
const responseAI = await getTextGemini(
|
||||
instructions,
|
||||
textMod,
|
||||
repliedMessage,
|
||||
`${username}: ${textMod}`,
|
||||
`${repliedUsername}: ${repliedMessage}`,
|
||||
);
|
||||
|
||||
user.aiCost += responseAI.tokens * prices.text;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue