From 4a56ef254ac65227c42786b77f914e73539504a7 Mon Sep 17 00:00:00 2001 From: "Mr. Stallion" Date: Sat, 24 Dec 2022 12:50:07 -0800 Subject: [PATCH] new scoring; fix autoresponder --- chat/conversations.ts | 7 +++++-- learn/cache-manager.ts | 13 ++++++++++--- learn/matcher-types.ts | 22 +++++++++++----------- learn/matcher.ts | 12 ++++++++++-- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/chat/conversations.ts b/chat/conversations.ts index ad40e11..148ebc9 100644 --- a/chat/conversations.ts +++ b/chat/conversations.ts @@ -690,7 +690,10 @@ export async function testSmartFilterForPrivateMessage(fromChar: Character.Chara await withNeutralVisibilityPrivateConversation( fromChar, - async(p) => core.logs.logMessage(p, logMessage) + async(p) => { + // core.logs.logMessage(p, logMessage) + await p.addMessage(logMessage); + } ); } } @@ -703,7 +706,7 @@ export async function testSmartFilterForPrivateMessage(fromChar: Character.Chara core.state.settings.risingFilter.hidePrivateMessages && firstTime // subsequent messages bypass this filter on purpose ) { - if (core.state.settings.logMessages && originalMessage) { + if (core.state.settings.logMessages && originalMessage && firstTime) { await withNeutralVisibilityPrivateConversation( fromChar, async(p) => core.logs.logMessage(p, originalMessage) diff --git a/learn/cache-manager.ts b/learn/cache-manager.ts index 2816d7e..6a6f15c 100644 --- a/learn/cache-manager.ts +++ b/learn/cache-manager.ts @@ -40,6 +40,8 @@ export class CacheManager { // @ts-ignore private _isVue = true; + private readonly startTime = new Date(); + static readonly PROFILE_QUERY_DELAY = 400; //1 * 1000; adCache: AdCache = new AdCache(); @@ -156,10 +158,15 @@ export class CacheManager { if (char && char.status !== 'offline') { const conv = core.conversations.getPrivate(char, true); - if (conv && conv.messages.length > 0 && Date.now() - _.last(conv.messages)!.time.getTime() < 3 * 60 * 1000) { - const allMessagesFromThem = _.every(conv.messages, (m) => ('sender' in m) && m.sender.name === conv.character.name); + if (conv && conv.messages.length > 0 && Date.now() - _.last(conv.messages)!.time.getTime() < 5 * 60 * 1000) { + const sessionMessages = _.filter(conv.messages, (m) => m.time.getTime() >= this.startTime.getTime()); - if (allMessagesFromThem) { + const allMessagesFromThem = _.every( + sessionMessages, + (m) => ('sender' in m) && m.sender.name === conv.character.name + ); + + if (sessionMessages.length > 0 && allMessagesFromThem) { await testSmartFilterForPrivateMessage(char); } } diff --git a/learn/matcher-types.ts b/learn/matcher-types.ts index 6d33519..7c767c3 100644 --- a/learn/matcher-types.ts +++ b/learn/matcher-types.ts @@ -729,28 +729,28 @@ export const kinkMatchWeights = { export const kinkMatchScoreMap = { favorite: { favorite: 1, - yes: 0.5, - maybe: -0.65, - no: -1.5 + yes: 0.35, + maybe: -0.35, + no: -1 }, yes: { - favorite: 0.5, - yes: 0.5, - maybe: -0.25, - no: -0.5 + favorite: 0.35, + yes: 0.35, + maybe: -0.125, + no: -0.35 }, maybe: { - favorite: -0.5, - yes: -0.25, + favorite: -0.35, + yes: -0.125, maybe: 0, no: 0 }, no: { - favorite: -1.5, - yes: -0.65, + favorite: -1, + yes: -0.35, maybe: 0, no: 0 } diff --git a/learn/matcher.ts b/learn/matcher.ts index 5465688..174d857 100644 --- a/learn/matcher.ts +++ b/learn/matcher.ts @@ -10,7 +10,8 @@ import anyAscii from 'any-ascii'; import { Store } from '../site/character_page/data_store'; import { - BodyType, bodyTypeKinkMapping, + BodyType, + bodyTypeKinkMapping, fchatGenderMap, FurryPreference, Gender, @@ -29,7 +30,10 @@ import { nonAnthroSpecies, Orientation, Position, - PostLengthPreference, postLengthPreferenceMapping, postLengthPreferenceScoreMapping, Scoring, + PostLengthPreference, + postLengthPreferenceMapping, + postLengthPreferenceScoreMapping, + Scoring, Species, SpeciesMap, speciesMapping, @@ -614,6 +618,10 @@ export class Matcher { log.debug('report.score.kink', this.them.name, this.you.name, scores, weighted); + if (scores.favorite.count + scores.yes.count + scores.maybe.count + scores.no.count < 10) { + return new Score(Scoring.NEUTRAL); + } + if (weighted === 0) { return new Score(Scoring.NEUTRAL); }