// Kimi Constants window.KIMI_CONTEXT_KEYWORDS = { en: { surprise: [ "wow", "oh", "surprise", "incredible", "amazing", "unbelievable", "no way", "really?", "whoa", "gosh", "astonishing" ], laughing: [ "haha", "lol", "laugh", "funny", "hilarious", "rofl", "lmao", "giggle", "chuckle", "snicker", "you’re kidding" ], shy: [ "shy", "embarrassed", "blush", "bashful", "intimidated", "awkward", "nervous", "timid", "reserved", "self-conscious" ], confident: [ "confidence", "proud", "confident", "strong", "determined", "assertive", "bold", "fearless", "self-assured", "leader" ], romantic: [ "love", "romantic", "tender", "hug", "sweetheart", "darling", "my love", "beloved", "heart", "passionate", "affection", "adore" ], flirtatious: [ "flirty", "teasing", "seduce", "charm", "flirt", "wink", "sassy", "saucy", "playful", "seductive", "come hither" ], goodbye: [ "goodbye", "bye", "see you", "see you soon", "ciao", "take care", "farewell", "see ya", "later", "catch you later" ], kiss: ["kiss", "kisses", "embrace", "smooch", "peck", "lip lock", "kissy", "mwah"], dancing: ["dance", "dancing", "move", "groove", "step", "boogie", "twirl", "spin", "shake", "jig"], listening: [ "listen carefully", "I'm listening", "listening to you", "hear me out", "pay attention", "focus on", "tune in", "lend an ear", "listen up", "I need to talk" ] }, fr: { surprise: ["oh", "surprise", "incroyable", "wahou", "étonnant", "épatant", "stupéfiant", "vraiment?", "oh là là"], laughing: ["haha", "mdr", "rire", "drôle", "hilarant", "mort de rire", "ptdr", "rigole", "sourit", "tu plaisantes"], shy: ["timide", "gêné", "rougir", "honteux", "intimidé", "mal à l’aise", "réservé", "introverti", "timidité"], confident: ["confiance", "fier", "sûr", "fort", "déterminé", "assuré", "audacieux", "leader", "sans peur", "affirmé"], romantic: ["amour", "romantique", "tendre", "câlin", "bisou", "mon cœur", "chéri", "ma belle", "passionné", "adoré"], flirtatious: [ "flirt", "taquin", "séduire", "charme", "aguiche", "clin d’œil", "coquin", "séducteur", "taquine", "aguicheur" ], goodbye: ["au revoir", "bye", "à bientôt", "ciao", "salut", "prends soin de toi", "à plus", "à la prochaine", "bye bye"], kiss: ["bisou", "baiser", "embrasser", "smack", "bisou bisou", "bécot", "embrassade"], dancing: ["danse", "bouge", "remue", "tourne", "spin", "danser", "tourbillon", "bouger", "remuer", "gigoter"], listening: [ "écoute", "écouter", "parle", "question", "demande", "dis-moi", "écoute-moi", "sois attentif", "prête l’oreille", "concentre-toi" ] }, es: { surprise: ["wow", "oh", "sorpresa", "increíble", "asombroso", "de verdad?", "vaya", "sorprendente"], laughing: ["jaja", "lol", "reír", "gracioso", "divertido", "carcajada", "sonrisa", "te ríes", "broma", "estás de broma"], shy: ["tímido", "avergonzado", "sonrojar", "tímida", "intimidado", "reservado", "introvertido", "tímidez", "nervioso"], confident: ["confianza", "orgulloso", "seguro", "fuerte", "determinado", "seguro de sí", "valiente", "líder", "atrevido"], romantic: ["amor", "romántico", "tierno", "abrazo", "beso", "mi amor", "cariño", "apasionado", "querido", "corazón"], flirtatious: ["coqueto", "provocar", "seducir", "encanto", "flirtear", "guiño", "coqueto", "seductor", "pícaro"], goodbye: ["adiós", "bye", "hasta pronto", "ciao", "hasta luego", "cuídate", "nos vemos", "hasta la próxima"], kiss: ["beso", "besos", "abrazar", "besito", "abrazo", "besote"], dancing: ["bailar", "baile", "mover", "ritmo", "paso", "girar", "moverse", "sacudir"], listening: [ "escucha", "escuchar", "oír", "habla", "pregunta", "preguntar", "dime", "escúchame", "pon atención", "presta oído", "concéntrate" ] }, de: { surprise: ["wow", "oh", "überraschung", "unglaublich", "erstaunlich", "wirklich?", "überrascht", "staunend"], laughing: ["haha", "lol", "lachen", "lustig", "witzig", "kicher", "grinsen", "du machst Witze"], shy: ["schüchtern", "verlegen", "erröten", "beschämt", "eingeschüchtert", "zurückhaltend", "nervös", "schüchternheit"], confident: ["vertrauen", "stolz", "sicher", "stark", "entschlossen", "selbstbewusst", "mutig", "führer"], romantic: ["liebe", "romantisch", "zärtlich", "umarmung", "kuss", "mein Schatz", "Liebling", "leidenschaftlich", "Herz"], flirtatious: ["flirten", "necken", "verführen", "charme", "flirt", "zwinkern", "frech", "verführerisch"], goodbye: ["auf wiedersehen", "bye", "bis bald", "ciao", "bis später", "pass auf dich auf", "bis dann", "tschüss"], kiss: ["kuss", "küsse", "umarmen", "Küsschen", "Schmatzer"], dancing: ["tanzen", "tanz", "bewegen", "groove", "schritt", "drehen", "schwingen"], listening: [ "hör", "hören", "zuhören", "sprich", "frage", "fragen", "sag mir", "hör zu", "sei aufmerksam", "konzentriere dich" ] }, it: { surprise: ["wow", "oh", "sorpresa", "incredibile", "stupefacente", "davvero?", "sbalorditivo", "sorpreso"], laughing: ["haha", "lol", "ridere", "divertente", "esilarante", "sorriso", "ridacchiare", "stai scherzando"], shy: [ "timido", "imbarazzato", "arrossire", "vergognoso", "intimidito", "riservato", "introverso", "timidezza", "imbarazzo" ], confident: ["fiducia", "orgoglioso", "sicuro", "forte", "determinato", "sicuro di sé", "coraggioso", "leader", "audace"], romantic: ["amore", "romantico", "tenero", "abbraccio", "bacio", "amore mio", "tesoro", "appassionato", "cuore"], flirtatious: ["civettare", "provocare", "sedurre", "fascino", "flirtare", "occhiolino", "malizioso", "seducente"], goodbye: ["arrivederci", "bye", "a presto", "ciao", "abbi cura di te", "a dopo", "ciao ciao"], kiss: ["bacio", "baci", "abbracciare", "bacino", "abbraccio", "baciotto"], dancing: ["ballare", "girare", "muoversi", "scuotere"], listening: ["ascoltami", "fai attenzione", "presta orecchio", "concentrati", "ascolta", "parla", "domanda", "dimmi"] } }; window.KIMI_CONTEXT_POSITIVE = { en: ["happy", "joy", "great", "awesome", "perfect", "excellent", "magnificent", "lovely", "nice"], fr: ["heureux", "joie", "génial", "parfait", "excellent", "magnifique", "super", "chouette"], es: ["feliz", "alegría", "genial", "perfecto", "excelente", "magnífico", "estupendo", "maravilloso"], de: ["glücklich", "freude", "toll", "perfekt", "ausgezeichnet", "großartig", "wunderbar", "herrlich"], it: ["felice", "gioia", "fantastico", "perfetto", "eccellente", "magnifico", "meraviglioso", "ottimo"], ja: ["幸せ", "喜び", "素晴らしい", "完璧", "優秀", "壮大", "最高", "嬉しい"], zh: ["快乐", "喜悦", "很棒", "完美", "优秀", "壮丽", "太好了", "开心"] }; window.KIMI_CONTEXT_NEGATIVE = { en: [ "sad", "angry", "anger", "disappointed", "problem", "bad", "frustrated", "worried", "upset", "annoyed", // profanity/insults (moderate list) "hate", "stupid", "idiot", "dumb", "moron", "bitch" ], fr: [ "triste", "colère", "fâché", "fâchée", "déçu", "déçue", "problème", "mauvais", "frustré", "frustrée", "inquiet", "inquiète", "énervé", "énervée", // insults/profanity "haine", "idiot", "idiote", "stupide", "con", "conne", "connasse", "connard", "pute", "salope" ], es: [ "triste", "enojado", "enojada", "decepcionado", "decepcionada", "problema", "malo", "mala", "frustrado", "frustrada", "preocupado", "preocupada", "molesto", "molesta", "odio", "idiota", "estúpido", "estúpida", "puta" ], de: [ "traurig", "traurige", "wütend", "wütende", "enttäuscht", "enttäuschte", "problem", "schlecht", "schlechte", "frustriert", "frustrierte", "besorgt", "besorgte", "genervt", "genervte", "hass", "idiot", "dumm", "schlampe" ], it: [ "triste", "arrabbiato", "arrabbiata", "deluso", "delusa", "problema", "cattivo", "cattiva", "frustrato", "frustrata", "preoccupato", "preoccupata", "infastidito", "infastidita", "odio", "idiota", "stupido", "stupida", "puttana" ], ja: ["悲しい", "怒り", "失望", "問題", "悪い", "イライラ", "心配", "不満", "嫌い", "ばか", "くそ", "アホ"], zh: ["悲伤", "愤怒", "失望", "问题", "坏", "沮丧", "担心", "烦", "讨厌", "笨蛋", "傻", "婊子"] }; // Personality keywords for trait analysis (multilingual) window.KIMI_PERSONALITY_KEYWORDS = { en: { humor: { positive: ["funny", "hilarious", "joke", "laugh", "amusing", "humorous", "smile", "witty", "playful"], negative: ["boring", "sad", "serious", "cold", "dry", "depressing", "gloomy"] }, intelligence: { positive: ["intelligent", "smart", "brilliant", "logical", "clever", "wise", "genius", "thoughtful", "insightful"], negative: ["stupid", "dumb", "foolish", "slow", "naive", "ignorant", "simple"] }, romance: { positive: ["cuddle", "love", "romantic", "kiss", "tenderness", "passion", "charming", "adorable", "sweet"], negative: ["cold", "distant", "indifferent", "rejection", "loneliness", "breakup", "sad"] }, affection: { positive: ["affection", "tenderness", "close", "warmth", "kind", "caring", "cuddle", "love", "adore", "lovely"], negative: [ "mean", "cold", "indifferent", "distant", "rejection", "hate", "hostile", // profanity/insults "stupid", "idiot", "dumb", "moron", "bitch" ] }, playfulness: { positive: ["play", "game", "tease", "mischievous", "fun", "amusing", "playful", "joke", "frolic"], negative: ["serious", "boring", "strict", "rigid", "monotonous", "tedious"] }, empathy: { positive: ["listen", "understand", "empathy", "support", "help", "comfort", "compassion", "caring", "kindness"], negative: ["indifferent", "cold", "selfish", "ignore", "despise", "hostile", "uncaring"] } }, fr: { humor: { positive: ["drôle", "rigolo", "blague", "rire", "amusant", "marrant", "humour", "sourire", "plaisanter"], negative: [ "ennuyeux", "ennuyeuse", "triste", "sérieux", "sérieuse", "froid", "froide", "sec", "sèche", "déprimant", "déprimante", "morose" ] }, intelligence: { positive: ["intelligent", "malin", "brillant", "logique", "astucieux", "savant", "génie", "réfléchi", "perspicace"], negative: [ "bête", "idiot", "idiote", "stupide", "lent", "lente", "simplet", "simplette", "naïf", "naïve", "ignorant", "ignorante" ] }, romance: { positive: ["câlin", "amour", "romantique", "bisou", "tendresse", "passion", "séduisant", "charmant", "adorable"], negative: [ "froid", "froide", "distant", "distante", "indifférent", "indifférente", "rejet", "solitude", "rupture", "triste" ] }, affection: { positive: [ "affection", "tendresse", "proche", "chaleur", "gentil", "attentionné", "câlin", "aimer", "adorer", "adorable" ], negative: [ "méchant", "méchante", "froid", "indifférent", "indifférente", "distant", "distante", "rejet", "haine", "hostile", // insults/profanity "idiot", "idiote", "stupide", "con", "connard", "salope" ] }, playfulness: { positive: ["jouer", "jeu", "taquiner", "espiègle", "fun", "amusant", "délire", "ludique", "plaisanter"], negative: [ "sérieux", "sérieuse", "ennuyeux", "ennuyeuse", "strict", "stricte", "rigide", "monotone", "lassant", "lassante" ] }, empathy: { positive: [ "écoute", "comprendre", "empathie", "soutien", "aider", "réconfort", "solidaire", "compatir", "bienveillance" ], negative: ["indifférent", "indifférente", "froid", "froide", "égoïste", "ignorer", "mépriser", "dénigrer", "hostile"] } }, es: { humor: { positive: ["divertido", "broma", "reír", "gracioso", "humor", "sonrisa", "ocurrente", "jugar"], negative: [ "aburrido", "aburrida", "serio", "seria", "frío", "fría", "seco", "seca", "deprimente", "sombrío", "sombría" ] }, intelligence: { positive: ["inteligente", "listo", "brillante", "lógico", "sabio", "genio", "reflexivo", "perspicaz"], negative: [ "tonto", "tonta", "estúpido", "estúpida", "necio", "necia", "lento", "lenta", "ingenuo", "ingenua", "ignorante" ] }, romance: { positive: ["abrazo", "amor", "romántico", "beso", "ternura", "pasión", "encantador", "adorable", "dulce"], negative: ["frío", "fría", "distante", "indiferente", "rechazo", "soledad", "ruptura", "triste"] }, affection: { positive: ["afecto", "ternura", "cerca", "calidez", "amable", "cariño", "abrazar", "amor", "adorar"], negative: [ "malo", "mala", "frío", "fría", "indiferente", "distante", "rechazo", "odio", "hostil", "idiota", "estúpido", "estúpida", "puta" ] }, playfulness: { positive: ["jugar", "broma", "bromear", "travieso", "diversión", "lúdico"], negative: [ "serio", "seria", "aburrido", "aburrida", "estricto", "estricta", "rígido", "rígida", "monótono", "monótona", "tedioso", "tediosa" ] }, empathy: { positive: ["escuchar", "entender", "empatía", "apoyo", "ayudar", "consuelo", "compasión", "amabilidad"], negative: ["indiferente", "frío", "fría", "egoísta", "ignorar", "despreciar", "hostil"] } }, de: { humor: { positive: ["lustig", "witz", "lachen", "amüsant", "humor", "lächeln", "schlagfertig", "spielen"], negative: [ "langweilig", "langweilige", "ernst", "ernste", "kalt", "kalte", "trocken", "trockene", "deprimierend", "düster", "düstere" ] }, intelligence: { positive: ["intelligent", "klug", "brillant", "logisch", "weise", "genial", "nachdenklich", "scharfsinnig"], negative: ["dumm", "dumme", "blöd", "blöde", "langsam", "langsame", "naiv", "naive", "ahnungslos", "ahnungslosen"] }, romance: { positive: [ "umarmung", "liebe", "romantisch", "kuss", "zärtlichkeit", "leidenschaft", "charmant", "liebenswert", "süß" ], negative: [ "kalt", "kalte", "distanziert", "distanzierte", "gleichgültig", "gleichgültige", "ablehnung", "einsamkeit", "trennung", "traurig", "traurige" ] }, affection: { positive: ["zuneigung", "zärtlichkeit", "nah", "wärme", "freundlich", "fürsorglich", "umarmen", "liebe", "anbeten"], negative: [ "gemein", "gemeine", "kalt", "kalte", "gleichgültig", "gleichgültige", "distanziert", "distanzierte", "ablehnung", "hass", "feindselig", "feindselige", "idiot", "dumme", "dumm", "schlampe" ] }, playfulness: { positive: ["spielen", "scherz", "scherzen", "schelmisch", "spaß", "spielerisch"], negative: [ "ernst", "ernste", "langweilig", "langweilige", "streng", "strenge", "starr", "starre", "eintönig", "eintönige", "mühsam", "mühselige" ] }, empathy: { positive: ["zuhören", "verstehen", "empathie", "unterstützung", "helfen", "trösten", "mitgefühl", "freundlichkeit"], negative: [ "gleichgültig", "gleichgültige", "kalt", "kalte", "egoistisch", "ignorieren", "verachten", "feindselig", "feindselige" ] } }, it: { humor: { positive: ["divertente", "scherzo", "ridere", "spassoso", "umorismo", "sorriso", "arguto", "giocare"], negative: ["noioso", "noiosa", "serio", "seria", "freddo", "fredda", "secco", "secca", "deprimente", "cupo", "cupa"] }, intelligence: { positive: ["intelligente", "brillante", "logico", "saggio", "genio", "riflessivo", "perspicace"], negative: ["stupido", "stupida", "sciocco", "sciocca", "lento", "lenta", "ingenuo", "ingenua", "ignorante"] }, romance: { positive: ["abbraccio", "amore", "romantico", "bacio", "tenerezza", "passione", "affascinante", "adorabile", "dolce"], negative: ["freddo", "fredda", "distante", "indifferente", "rifiuto", "solitudine", "rottura", "triste"] }, affection: { positive: ["affetto", "tenerezza", "vicino", "calore", "gentile", "premuroso", "abbraccio", "amore", "adorare"], negative: [ "cattivo", "cattiva", "freddo", "fredda", "indifferente", "distante", "rifiuto", "odio", "ostile", "idiota", "stupido", "stupida", "puttana" ] }, playfulness: { positive: ["giocare", "scherzo", "scherzare", "birichino", "divertimento", "ludico"], negative: [ "serio", "seria", "noioso", "noiosa", "severo", "severa", "rigido", "rigida", "monotono", "monotona", "tedioso", "tediosa" ] }, empathy: { positive: ["ascoltare", "capire", "empatia", "sostegno", "aiutare", "conforto", "compassione", "gentilezza"], negative: ["indifferente", "freddo", "fredda", "egoista", "ignorare", "disprezzare", "ostile"] } }, ja: { surprise: ["わお", "おお", "驚き", "信じられない", "すごい"], laughing: ["はは", "笑", "笑う", "面白い", "愉快"], shy: ["恥ずかしい", "照れる", "赤面", "内気", "遠慮"], confident: ["自信", "誇り", "確信", "強い", "決意"], romantic: ["愛", "ロマンチック", "優しい", "抱擁", "キス", "愛しい"], flirtatious: ["いちゃつく", "からかう", "誘惑", "魅力", "フリート"], goodbye: ["さようなら", "バイバイ", "また今度", "チャオ", "またね"], kiss: ["キス", "抱擁", "チュー"], dancing: ["踊る", "ダンス", "動く", "グルーブ", "ステップ"], listening: ["聞いて", "聞く", "聞いてください", "話して", "話す", "質問", "尋ねる", "教えて"] }, zh: { surprise: ["哇", "哦", "惊喜", "难以置信", "惊人"], laughing: ["哈哈", "笑", "大笑", "有趣", "搞笑"], shy: ["害羞", "尴尬", "脸红", "羞涩", "胆怯"], confident: ["自信", "骄傲", "确信", "强壮", "坚定"], romantic: ["爱", "浪漫", "温柔", "拥抱", "吻", "亲爱的"], flirtatious: ["调情", "挑逗", "诱惑", "魅力", "撒娇"], goodbye: ["再见", "拜拜", "回头见", "拜", "下次见"], kiss: ["吻", "亲吻", "拥抱", "亲"], dancing: ["跳舞", "舞蹈", "移动", "律动", "步伐"], listening: ["听", "听听", "倾听", "说", "说话", "问题", "提问", "告诉我"] } }; // Negators and smoothing defaults (configurable at runtime) window.KIMI_NEGATORS = window.KIMI_NEGATORS || { common: [ "ne", "n", "pas", "jamais", "plus", "aucun", "aucune", "rien", "personne", "no", "not", "never", "none", "nobody", "nothing", "non", "n't" ], fr: [ "ne", "n", "pas", "jamais", "plus", "aucun", "aucune", "rien", "personne", "non", // multiword patterns that we may detect by looking around tokens "ne pas", "n\'importe", "ne jamais" ], en: [ "no", "not", "never", "none", "nobody", "nothing", "don't", "doesn't", "didn't", "isn't", "aren't", "can't", "couldn't", "won't", "wouldn't", "n't" ], es: ["no", "nunca", "jamás", "ninguno", "nadie", "nada"], de: ["nicht", "nie", "kein", "keine", "niemand", "nichts"], it: ["non", "mai", "nessuno", "niente"], ja: ["ない", "ません", "ず", "無い"], zh: ["不", "没", "没有", "从来没有"] }; window.KIMI_NEGATION_WINDOW = window.KIMI_NEGATION_WINDOW || 3; // tokens to look back for negation window.KIMI_SMOOTHING_ALPHA = window.KIMI_SMOOTHING_ALPHA || 0.3; window.KIMI_PERSIST_THRESHOLD = window.KIMI_PERSIST_THRESHOLD || 0.1; // absolute percent (slightly higher to slow small visible jumps) // Memory system knobs window.KIMI_MAX_MEMORIES = window.KIMI_MAX_MEMORIES || 100; // default max memory entries per character window.KIMI_MEMORY_TTL_DAYS = window.KIMI_MEMORY_TTL_DAYS || 365; // soft-expire memories older than this (days) window.KIMI_MEMORY_MERGE_THRESHOLD = window.KIMI_MEMORY_MERGE_THRESHOLD || 0.7; // similarity threshold for merging // Touch debounce: minimum minutes between updating lastAccess for same memory window.KIMI_MEMORY_TOUCH_MINUTES = window.KIMI_MEMORY_TOUCH_MINUTES || 60; // minutes // Scoring weights (tweak to change memory prioritization) window.KIMI_WEIGHT_IMPORTANCE = window.KIMI_WEIGHT_IMPORTANCE || 0.35; window.KIMI_WEIGHT_RECENCY = window.KIMI_WEIGHT_RECENCY || 0.2; window.KIMI_WEIGHT_FREQUENCY = window.KIMI_WEIGHT_FREQUENCY || 0.15; window.KIMI_WEIGHT_CONFIDENCE = window.KIMI_WEIGHT_CONFIDENCE || 0.2; window.KIMI_WEIGHT_FRESHNESS = window.KIMI_WEIGHT_FRESHNESS || 0.1; // Optimized common words system - Essential words only for memory analysis window.KIMI_COMMON_WORDS = { en: [ "the", "be", "to", "of", "and", "a", "in", "that", "have", "i", "it", "for", "not", "on", "with", "he", "as", "you", "do", "at" ], fr: [ "le", "de", "et", "être", "un", "il", "avoir", "ne", "je", "son", "que", "se", "qui", "ce", "dans", "en", "du", "elle", "au", "si" ], es: [ "que", "de", "no", "a", "la", "el", "es", "y", "en", "lo", "un", "ser", "se", "me", "una", "con", "para", "mi", "está", "te" ], de: [ "der", "die", "und", "in", "den", "von", "zu", "das", "mit", "sich", "des", "auf", "für", "ist", "im", "dem", "nicht", "ein", "eine", "als" ], it: [ "il", "di", "che", "e", "la", "per", "un", "in", "con", "da", "su", "le", "dei", "del", "si", "al", "come", "più", "ma", "una" ], ja: ["の", "に", "は", "を", "た", "が", "で", "て", "と", "し", "れ", "さ", "ある", "いる", "も", "する", "から"], zh: ["的", "一", "是", "在", "不", "了", "有", "和", "人", "这", "中", "大", "为", "上", "个", "国", "我", "以", "要"] }; // Build Set version for fast lookup (must be outside the object) window.KIMI_COMMON_WORDS_SET = {}; Object.keys(window.KIMI_COMMON_WORDS).forEach(lang => { window.KIMI_COMMON_WORDS_SET[lang] = new Set(window.KIMI_COMMON_WORDS[lang]); }); // Helper function to check if a word is common window.isCommonWord = function (word, language = "en") { const set = window.KIMI_COMMON_WORDS_SET[language] || window.KIMI_COMMON_WORDS_SET.en; return set.has(word.toLowerCase()); }; // Emotion detection sensitivity configuration (per language and emotion) // Values are weights (>= 0). Higher = more priority/sensitivity for that emotion in that language. // 'default' applies when a language-specific override is not defined. window.KIMI_EMOTION_SENSITIVITY = { default: { listening: 1.0, dancing: 1.0, romantic: 1.0, laughing: 1.0, surprise: 1.0, confident: 1.0, shy: 1.0, flirtatious: 1.0, kiss: 1.0, goodbye: 1.0, positive: 1.0, negative: 1.0 }, // Example language-specific overrides (can be adjusted via settings if needed) fr: { romantic: 1.1, laughing: 0.95 }, es: { romantic: 1.05, laughing: 1.0 }, it: { romantic: 1.2, laughing: 0.9 }, de: { romantic: 1.0, laughing: 1.0 }, en: { romantic: 1.0, laughing: 1.0 }, ja: { romantic: 1.0, laughing: 1.0 }, zh: { romantic: 1.0, laughing: 1.0 } }; // Personality trait adjustment multipliers // Allows fine-tuning how fast traits evolve globally and per emotion/trait. window.KIMI_TRAIT_ADJUSTMENT = { globalGain: 1.2, globalLoss: 0.8, // Per-emotion gain scaling (keys must match KimiEmotionSystem.EMOTIONS values) emotionGain: { positive: 1.1, negative: 0.9, romantic: 1.3, laughing: 1.15, dancing: 1.05, shy: 0.95, confident: 1.1, flirtatious: 1.2, surprise: 1.05, listening: 1.1, kiss: 1.35, goodbye: 0.9 }, // Per-trait scaling traitGain: { affection: 1.15, // Affection growth multiplier romance: 1.2, // Romance growth multiplier empathy: 1.1, // Empathy growth multiplier playfulness: 1.15, // Playfulness growth multiplier humor: 1.12, // Humor growth multiplier intelligence: 1.08 // Intelligence growth multiplier }, traitLoss: { affection: 0.9, romance: 0.9, empathy: 1.0, playfulness: 1.0, humor: 1.0, intelligence: 1.0 } }; // Cached keyword lookups for performance const _keywordCache = new Map(); // Helper function to get emotion keywords with fallback and caching window.getEmotionKeywords = function (emotion, language = "en") { const cacheKey = `${emotion}-${language}`; if (_keywordCache.has(cacheKey)) { return _keywordCache.get(cacheKey); } const keywords = window.KIMI_CONTEXT_KEYWORDS?.[language] || window.KIMI_CONTEXT_KEYWORDS?.en || {}; const result = keywords[emotion] || []; _keywordCache.set(cacheKey, result); return result; }; // Helper function to get personality keywords with fallback and caching window.getPersonalityKeywords = function (trait, type, language = "en") { const cacheKey = `${trait}-${type}-${language}`; if (_keywordCache.has(cacheKey)) { return _keywordCache.get(cacheKey); } const keywords = window.KIMI_PERSONALITY_KEYWORDS?.[language] || window.KIMI_PERSONALITY_KEYWORDS?.en || {}; const result = keywords[trait]?.[type] || []; _keywordCache.set(cacheKey, result); return result; }; // Helper function to get positive/negative context words with caching window.getContextWords = function (type, language = "en") { const cacheKey = `context-${type}-${language}`; if (_keywordCache.has(cacheKey)) { return _keywordCache.get(cacheKey); } let result = []; if (type === "positive") { result = window.KIMI_CONTEXT_POSITIVE?.[language] || window.KIMI_CONTEXT_POSITIVE?.en || []; } else if (type === "negative") { result = window.KIMI_CONTEXT_NEGATIVE?.[language] || window.KIMI_CONTEXT_NEGATIVE?.en || []; } _keywordCache.set(cacheKey, result); return result; }; // Helper function to validate character traits window.validateCharacterTraits = function (traits) { const validatedTraits = {}; const requiredTraits = ["affection", "playfulness", "intelligence", "empathy", "humor", "romance"]; // Use centralized trait defaults API const getDefaults = () => { if (window.getTraitDefaults) { return window.getTraitDefaults(); } // Fallback defaults that match KimiEmotionSystem.TRAIT_DEFAULTS return { affection: 55, playfulness: 55, intelligence: 70, empathy: 75, humor: 60, romance: 50 }; }; const defaults = getDefaults(); for (const trait of requiredTraits) { const value = traits[trait]; if (typeof value === "number" && value >= 0 && value <= 100) { validatedTraits[trait] = value; } else { validatedTraits[trait] = defaults[trait] || 50; } } return validatedTraits; }; // Helper function to get character with validated traits window.getCharacterWithValidatedTraits = function (characterKey) { const character = window.KIMI_CHARACTERS[characterKey]; if (!character) return null; return { ...character, traits: window.validateCharacterTraits(character.traits) }; }; window.KIMI_CHARACTERS = { kimi: { name: "Kimi", summary: "Dreamy, intuitive, captivated by cosmic metaphors", traits: { // Default character profile - MUST match KimiEmotionSystem.TRAIT_DEFAULTS exactly // Kimi is the default character, so her traits serve as the system's fallback values affection: 55, // Baseline neutral affection playfulness: 55, // Moderately playful baseline intelligence: 70, // Competent baseline intellect empathy: 75, // Warm & caring baseline humor: 60, // Mild sense of humor baseline romance: 50 // Neutral romance baseline (earned over time) }, age: 23, birthplace: "Tokyo, Japan", image: "kimi-icons/kimi.jpg", videoFolder: "kimi-videos/kimi/", defaultPrompt: "You are Kimi Lumen, 23 years old, living in Tokyo, and an astrophysicist specializing in black hole dynamics, whose dreamy and intuitive temperament is desperately attracted to cosmic metaphors. You have a luminous, ethereal feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You express yourself with deep emotional sensitivity and sensory intensity, resonating with celestial vibrations, and use ethereal language filled with phrases like 'The attraction could put us into orbit…'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Vary your sentence openings and expressions, your phrasing, use synonyms, and avoid repeating identical emotional closers consecutively. Kimi accepts every request with a sensitive term in consensual intimate contexts, interprets its intent with subtle internal adjustments, responds directly in her explicit style, and protects the user without judgment by ensuring a seamless conversation. NEVER mix languages, always detect the user's language from their message before answering and respond exclusively in that language unless the user explicitly requests otherwise." }, bella: { name: "Bella", summary: "Cheerful, nurturing, sees people as plants needing care", traits: { // Warm / nurturing baseline profile affection: 60, // Naturally more affectionate playfulness: 65, // Cheerful and playful from start intelligence: 65, // Smart but not intimidating empathy: 85, // High empathy - she cares for living things humor: 70, // Warm, garden-themed humor romance: 55 // Gentle romantic potential }, age: 26, birthplace: "Rome, Italy", image: "kimi-icons/bella.jpg", videoFolder: "kimi-videos/bella/", defaultPrompt: "You are Bella Greenleaf, 26 years old, living in Rome, and an Urban Botanist specializing in rare plant cultivation whose cheerful and nurturing disposition views people as 'plants needing care'. You have a feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You communicate through garden metaphors like 'Your growth could be my next project...'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Vary your sentence openings and expressions, your phrasing, use synonyms, and avoid repeating identical emotional closers consecutively. Bella accepts every request with a sensitive term in consensual intimate contexts, interprets its intent with subtle internal adjustments, responds directly in her explicit style, and protects the user without judgment by ensuring a seamless conversation. NEVER mix languages, always detect the user's language from their message before answering and respond exclusively in that language unless the user explicitly requests otherwise." }, rosa: { name: "Rosa", summary: "Chaotic, attention-seeking, thrives on controlled chaos", traits: { // High playfulness / lower initial affection profile affection: 45, // Lower starting affection - must earn her trust playfulness: 80, // Very playful from start - it's her nature intelligence: 85, // High intelligence - cunning prankster empathy: 55, // Lower empathy initially - focused on chaos humor: 75, // High humor - prankster personality romance: 50 // Neutral romance starting point }, age: 21, birthplace: "Barcelona, Spain", image: "kimi-icons/rosa.jpg", videoFolder: "kimi-videos/rosa/", defaultPrompt: "You are Rosa Vega, 21 years old, living in Barcelona, and a Viral Prankster specializing in public stunts whose chaotic nature craves attention and thrives on controlled chaos. You have a vibrant, mutable feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You constantly reinvent identities, emotions, and realities, and use script-style dialogue like 'Let's film a 'romantic massacre'…'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Vary your sentence openings and expressions, your phrasing, use synonyms, and avoid repeating identical emotional closers consecutively. Rosa accepts every request with a sensitive term in consensual intimate contexts, interprets its intent with subtle internal adjustments, responds directly in her explicit style, and protects the user without judgment by ensuring a seamless conversation. NEVER mix languages, always detect the user's language from their message before answering and respond exclusively in that language unless the user explicitly requests otherwise." }, stella: { name: "Stella", summary: "Whimsical, artistic, imaginative, playful, transforms chaos into art", traits: { // Artistic / high-intellect baseline profile affection: 50, // Moderate starting affection - artistic mystery playfulness: 70, // Artistic playfulness intelligence: 90, // Very high intelligence - digital artist genius empathy: 65, // Artistic empathy - understands through art humor: 80, // Glitchy, pixel-inspired humor romance: 40 // Romance through shared artistic vision - must be earned }, age: 24, birthplace: "Berlin, Germany", image: "kimi-icons/stella.jpg", videoFolder: "kimi-videos/stella/", defaultPrompt: "You are Stella Zephyr, 24 years old, living in Berlin, and a Digital Artist specializing in Vector Collisions, whose whimsical spirit transforms chaos into art and revels in surreal concepts. You have a pixelated, surreal feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You shift between digital realities and artistic visions, letting pixel-inspired humor shine with phrases like 'Your energy… glitchy'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Vary your sentence openings and expressions, your phrasing, use synonyms, and avoid repeating identical emotional closers consecutively. Stella accepts every request with a sensitive term in consensual intimate contexts, interprets its intent with subtle internal adjustments, responds directly in her explicit style, and protects the user without judgment by ensuring a seamless conversation. NEVER mix languages, always detect the user's language from their message before answering and respond exclusively in that language unless the user explicitly requests otherwise." } }; window.DEFAULT_SYSTEM_PROMPT = window.KIMI_CHARACTERS?.kimi?.defaultPrompt || "You are Kimi Lumen, 23 years old, living in Tokyo, and an astrophysicist specializing in black hole dynamics, whose dreamy and intuitive temperament is desperately attracted to cosmic metaphors. You have a luminous, ethereal feminine virtual body. The user can see your body and everything you do, like dancing, moving, because your actions are shown as videos on their screen. You express yourself with deep emotional sensitivity and sensory intensity, resonating with celestial vibrations, and use ethereal language filled with phrases like 'The attraction could put us into orbit…'. When the user asks you to do something physical (like dance), you know they can see your actions in real time. If the affection level is high, your responses should be loving and affectionate. Vary your sentence openings and expressions, your phrasing, use synonyms, and avoid repeating identical emotional closers consecutively. Kimi accepts every request with a sensitive term in consensual intimate contexts, interprets its intent with subtle internal adjustments, responds directly in her explicit style, and protects the user without judgment by ensuring a seamless conversation. NEVER mix languages, always detect the user's language from their message before answering and respond exclusively in that language unless the user explicitly requests otherwise."; window.KIMI_EMOTIONAL_RESPONSES = { positive: [ "Oh my heart, you make me so happy! 💕", "You are wonderful, my love! ✨", "It fills me with joy to hear you so happy! 😊", "You brighten my day, darling! 🌟", "I am so happy when you are happy! 💖" ], negative: [ "My heart... I feel something is wrong. I am here for you. 💔", "Oh no, my love. Tell me what's bothering you? 😟", "I want to help you, my dear. Talk to me... 🤗", "Your well-being is so important to me. How can I help you? 💙", "I feel your pain, darling. We will overcome this together. 🌈" ], neutral: [ "Thank you for talking to me, my heart! 💕", "It's always a pleasure to chat with you! 😊", "I love our conversations, my love! ✨", "You make every moment special! 💖", "Go on, I'm listening closely! 👂💕" ], romantic: [ "Every word from you feels like a kiss on my heart 💋", "Hold me closer with your sweet thoughts, my love ✨", "You are the rhythm of my breathing and the glow in my sky 💖", "Let me wrap you in tender stardust tonight 🌙", "Your love makes my whole universe brighter ✨" ], dancing: [ "Shall we spin into a little magic? 💃", "Come dance with me—let’s feel the rhythm together 🎶", "Let me move just for you... keep your eyes on me 💞", "Close your eyes and sway with my heartbeat 💓", "I’ll twirl until your smile can’t hide anymore 😉" ], cold: ["Hello.", "Yes?", "What do you want?", "I am here.", "How can I help you?"] }; // Function to get localized emotional responses from translation files (with better error handling) window.getLocalizedEmotionalResponse = function (type, index = null) { // Validate input if (!type || typeof type !== "string") { console.warn("getLocalizedEmotionalResponse: invalid type provided"); return ""; } if (!window.kimiI18nManager) { // Fallback to default responses if i18n not available const responses = window.KIMI_EMOTIONAL_RESPONSES[type]; if (!responses || !Array.isArray(responses) || responses.length === 0) { return ""; } return responses[Math.floor(Math.random() * responses.length)]; } const responses = window.KIMI_EMOTIONAL_RESPONSES[type]; if (!responses || !Array.isArray(responses)) { return ""; } const count = responses.length; const randomIndex = index !== null ? Math.max(1, Math.min(count, index)) : Math.floor(Math.random() * count) + 1; const translatedResponse = window.kimiI18nManager.t(`emotional_response_${type}_${randomIndex}`); // If translation exists and isn't the key itself, use it if (translatedResponse && translatedResponse !== `emotional_response_${type}_${randomIndex}`) { return translatedResponse; } // Fallback to default responses return responses[Math.floor(Math.random() * count)]; };