16 lines
830 B
TypeScript
16 lines
830 B
TypeScript
export const CONVERSATION_OUTCOMES = ['engaged', 'declined', 'boundary', 'upsell', 'unknown'] as const;
|
|
export type ConversationOutcome = (typeof CONVERSATION_OUTCOMES)[number];
|
|
|
|
/**
|
|
* Deterministic first-pass outcome classifier. It is deliberately conservative:
|
|
* only replies with no decline, boundary, or sales signal become learning examples.
|
|
*/
|
|
export function classifyConversationOutcome(reply: string): ConversationOutcome {
|
|
const text = reply.toLowerCase();
|
|
if (/\b(onlyfans|fansly|manyvids|link in bio|cash\.?app|venmo)\b/.test(text)) return 'upsell';
|
|
if (/\b(stop|leave me alone|do not message|don't message)\b/.test(text)) return 'boundary';
|
|
if (/\b(no thanks|not interested|nope|don't send|do not send)\b/.test(text)) return 'declined';
|
|
if (text.trim().length > 0) return 'engaged';
|
|
return 'unknown';
|
|
}
|