userPromptKeywords.ts 929 B

123456789101112131415161718192021222324252627
  1. /**
  2. * Checks if input matches negative keyword patterns
  3. */
  4. export function matchesNegativeKeyword(input: string): boolean {
  5. const lowerInput = input.toLowerCase()
  6. const negativePattern =
  7. /\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/
  8. return negativePattern.test(lowerInput)
  9. }
  10. /**
  11. * Checks if input matches keep going/continuation patterns
  12. */
  13. export function matchesKeepGoingKeyword(input: string): boolean {
  14. const lowerInput = input.toLowerCase().trim()
  15. // Match "continue" only if it's the entire prompt
  16. if (lowerInput === 'continue') {
  17. return true
  18. }
  19. // Match "keep going" or "go on" anywhere in the input
  20. const keepGoingPattern = /\b(keep going|go on)\b/
  21. return keepGoingPattern.test(lowerInput)
  22. }