new scoring; fix autoresponder

This commit is contained in:
Mr. Stallion 2022-12-24 12:50:07 -08:00
parent 203a45a01b
commit 4a56ef254a
4 changed files with 36 additions and 18 deletions

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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
}

View File

@ -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);
}