don't reply when not addressed
This commit is contained in:
17
src/main.ts
17
src/main.ts
@ -42,6 +42,7 @@ export const envConfig = {
|
||||
adHocPostInterval: process.env.RANDOM_POST_INTERVAL
|
||||
? parseInt(process.env.RANDOM_POST_INTERVAL)
|
||||
: 3600000,
|
||||
botAccountId: process.env.PLEROMA_ACCOUNT_ID,
|
||||
};
|
||||
|
||||
const ollamaConfig: OllamaConfigOptions = {
|
||||
@ -58,13 +59,23 @@ const ollamaConfig: OllamaConfigOptions = {
|
||||
const generateOllamaRequest = async (
|
||||
notification: Notification
|
||||
): Promise<OllamaResponse | undefined> => {
|
||||
const { whitelistOnly, ollamaModel, ollamaSystemPrompt, ollamaUrl } =
|
||||
envConfig;
|
||||
const {
|
||||
whitelistOnly,
|
||||
ollamaModel,
|
||||
ollamaSystemPrompt,
|
||||
ollamaUrl,
|
||||
botAccountId,
|
||||
} = envConfig;
|
||||
try {
|
||||
console.log(trimInputData(notification.status.content));
|
||||
if (
|
||||
// striptags(notification.status.content).includes("!prompt") &&
|
||||
!notification.status.account.bot && // sanity check, sort of
|
||||
notification.type === "mention" // &&
|
||||
notification.type === "mention" &&
|
||||
(notification.status.in_reply_to_account_id === botAccountId ||
|
||||
notification.status.in_reply_to_account_id === null) &&
|
||||
trimInputData(notification.status.content).split(" ").includes("Lexi")
|
||||
// only reply to mentions when the bot is the direct recipient or when an @ is at the top level of a conversation chain, or when the AI is @ directly
|
||||
// notification.status.visibility !== "private" // for safety, let's only respond to public messages
|
||||
) {
|
||||
if (whitelistOnly && !isFromWhitelistedDomain(notification)) {
|
||||
|
Reference in New Issue
Block a user