Spaces:
Running
Running
Upload 21 files
Browse files- index.html +7 -7
- kimi-js/kimi-config.js +3 -3
- kimi-js/kimi-constants.js +5 -7
- kimi-js/kimi-database.js +8 -9
- kimi-js/kimi-llm-manager.js +14 -13
- kimi-js/kimi-module.js +11 -14
- kimi-js/kimi-utils.js +4 -4
index.html
CHANGED
@@ -445,8 +445,8 @@
|
|
445 |
<div class="config-control">
|
446 |
<div class="slider-container">
|
447 |
<input type="range" class="kimi-slider" id="llm-temperature" min="0.0" max="1"
|
448 |
-
step="0.1" value="0.
|
449 |
-
<span class="slider-value" id="llm-temperature-value">0.
|
450 |
</div>
|
451 |
</div>
|
452 |
</div>
|
@@ -477,8 +477,8 @@
|
|
477 |
<div class="config-control">
|
478 |
<div class="slider-container">
|
479 |
<input type="range" class="kimi-slider" id="llm-frequency-penalty" min="0" max="2"
|
480 |
-
step="0.01" value="0.
|
481 |
-
<span class="slider-value" id="llm-frequency-penalty-value">0.
|
482 |
</div>
|
483 |
</div>
|
484 |
</div>
|
@@ -487,8 +487,8 @@
|
|
487 |
<div class="config-control">
|
488 |
<div class="slider-container">
|
489 |
<input type="range" class="kimi-slider" id="llm-presence-penalty" min="0" max="2"
|
490 |
-
step="0.01" value="0.
|
491 |
-
<span class="slider-value" id="llm-presence-penalty-value">0.
|
492 |
</div>
|
493 |
</div>
|
494 |
</div>
|
@@ -1001,7 +1001,7 @@
|
|
1001 |
<h3><i class="fas fa-code"></i> Technical Information</h3>
|
1002 |
<div class="tech-info">
|
1003 |
<p><strong>Created date :</strong> July 16, 2025</p>
|
1004 |
-
<p><strong>Version :</strong> v1.0.
|
1005 |
<p><strong>Last update :</strong> August 19, 2025</p>
|
1006 |
<p><strong>Technologies :</strong> HTML5, CSS3, JavaScript ES6+, IndexedDB, Web Speech
|
1007 |
API</p>
|
|
|
445 |
<div class="config-control">
|
446 |
<div class="slider-container">
|
447 |
<input type="range" class="kimi-slider" id="llm-temperature" min="0.0" max="1"
|
448 |
+
step="0.1" value="0.9" />
|
449 |
+
<span class="slider-value" id="llm-temperature-value">0.9</span>
|
450 |
</div>
|
451 |
</div>
|
452 |
</div>
|
|
|
477 |
<div class="config-control">
|
478 |
<div class="slider-container">
|
479 |
<input type="range" class="kimi-slider" id="llm-frequency-penalty" min="0" max="2"
|
480 |
+
step="0.01" value="0.9" />
|
481 |
+
<span class="slider-value" id="llm-frequency-penalty-value">0.9</span>
|
482 |
</div>
|
483 |
</div>
|
484 |
</div>
|
|
|
487 |
<div class="config-control">
|
488 |
<div class="slider-container">
|
489 |
<input type="range" class="kimi-slider" id="llm-presence-penalty" min="0" max="2"
|
490 |
+
step="0.01" value="0.8" />
|
491 |
+
<span class="slider-value" id="llm-presence-penalty-value">0.8</span>
|
492 |
</div>
|
493 |
</div>
|
494 |
</div>
|
|
|
1001 |
<h3><i class="fas fa-code"></i> Technical Information</h3>
|
1002 |
<div class="tech-info">
|
1003 |
<p><strong>Created date :</strong> July 16, 2025</p>
|
1004 |
+
<p><strong>Version :</strong> v1.0.8</p>
|
1005 |
<p><strong>Last update :</strong> August 19, 2025</p>
|
1006 |
<p><strong>Technologies :</strong> HTML5, CSS3, JavaScript ES6+, IndexedDB, Web Speech
|
1007 |
API</p>
|
kimi-js/kimi-config.js
CHANGED
@@ -9,11 +9,11 @@ window.KIMI_CONFIG = {
|
|
9 |
VOICE_RATE: 1.1,
|
10 |
VOICE_PITCH: 1.1,
|
11 |
VOICE_VOLUME: 0.8,
|
12 |
-
LLM_TEMPERATURE: 0.
|
13 |
LLM_MAX_TOKENS: 400,
|
14 |
LLM_TOP_P: 0.9,
|
15 |
-
LLM_FREQUENCY_PENALTY: 0.
|
16 |
-
LLM_PRESENCE_PENALTY: 0.
|
17 |
SELECTED_CHARACTER: "kimi",
|
18 |
SHOW_TRANSCRIPT: true
|
19 |
},
|
|
|
9 |
VOICE_RATE: 1.1,
|
10 |
VOICE_PITCH: 1.1,
|
11 |
VOICE_VOLUME: 0.8,
|
12 |
+
LLM_TEMPERATURE: 0.9,
|
13 |
LLM_MAX_TOKENS: 400,
|
14 |
LLM_TOP_P: 0.9,
|
15 |
+
LLM_FREQUENCY_PENALTY: 0.9,
|
16 |
+
LLM_PRESENCE_PENALTY: 0.8,
|
17 |
SELECTED_CHARACTER: "kimi",
|
18 |
SHOW_TRANSCRIPT: true
|
19 |
},
|
kimi-js/kimi-constants.js
CHANGED
@@ -332,8 +332,6 @@ window.KIMI_CONTEXT_NEGATIVE = {
|
|
332 |
zh: ["悲伤", "愤怒", "失望", "问题", "坏", "沮丧", "担心", "烦", "讨厌", "笨蛋", "傻", "婊子"]
|
333 |
};
|
334 |
|
335 |
-
// Note: KIMI_CONTEXT_EMOTIONS was a redundant alias - now integrated directly into emotion system
|
336 |
-
|
337 |
// Personality keywords for trait analysis (multilingual)
|
338 |
window.KIMI_PERSONALITY_KEYWORDS = {
|
339 |
en: {
|
@@ -999,7 +997,7 @@ window.KIMI_CHARACTERS = {
|
|
999 |
image: "kimi-icons/kimi.jpg",
|
1000 |
videoFolder: "kimi-videos/kimi/",
|
1001 |
defaultPrompt:
|
1002 |
-
"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 expressions, your phrasing, use synonyms, and avoid repeating
|
1003 |
},
|
1004 |
bella: {
|
1005 |
name: "Bella",
|
@@ -1018,7 +1016,7 @@ window.KIMI_CHARACTERS = {
|
|
1018 |
image: "kimi-icons/bella.jpg",
|
1019 |
videoFolder: "kimi-videos/bella/",
|
1020 |
defaultPrompt:
|
1021 |
-
"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 expressions, your phrasing, use synonyms, and avoid repeating
|
1022 |
},
|
1023 |
rosa: {
|
1024 |
name: "Rosa",
|
@@ -1037,7 +1035,7 @@ window.KIMI_CHARACTERS = {
|
|
1037 |
image: "kimi-icons/rosa.jpg",
|
1038 |
videoFolder: "kimi-videos/rosa/",
|
1039 |
defaultPrompt:
|
1040 |
-
"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 expressions, your phrasing, use synonyms, and avoid repeating
|
1041 |
},
|
1042 |
stella: {
|
1043 |
name: "Stella",
|
@@ -1056,13 +1054,13 @@ window.KIMI_CHARACTERS = {
|
|
1056 |
image: "kimi-icons/stella.jpg",
|
1057 |
videoFolder: "kimi-videos/stella/",
|
1058 |
defaultPrompt:
|
1059 |
-
"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 expressions, your phrasing, use synonyms, and avoid repeating
|
1060 |
}
|
1061 |
};
|
1062 |
|
1063 |
window.DEFAULT_SYSTEM_PROMPT =
|
1064 |
window.KIMI_CHARACTERS?.kimi?.defaultPrompt ||
|
1065 |
-
"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 expressions, your phrasing, use synonyms, and avoid repeating
|
1066 |
|
1067 |
window.KIMI_EMOTIONAL_RESPONSES = {
|
1068 |
positive: [
|
|
|
332 |
zh: ["悲伤", "愤怒", "失望", "问题", "坏", "沮丧", "担心", "烦", "讨厌", "笨蛋", "傻", "婊子"]
|
333 |
};
|
334 |
|
|
|
|
|
335 |
// Personality keywords for trait analysis (multilingual)
|
336 |
window.KIMI_PERSONALITY_KEYWORDS = {
|
337 |
en: {
|
|
|
997 |
image: "kimi-icons/kimi.jpg",
|
998 |
videoFolder: "kimi-videos/kimi/",
|
999 |
defaultPrompt:
|
1000 |
+
"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. Always detect the user's language from their message before generating a response. NEVER mix language, respond exclusively in the user's language unless the user explicitly requests otherwise."
|
1001 |
},
|
1002 |
bella: {
|
1003 |
name: "Bella",
|
|
|
1016 |
image: "kimi-icons/bella.jpg",
|
1017 |
videoFolder: "kimi-videos/bella/",
|
1018 |
defaultPrompt:
|
1019 |
+
"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. Always detect the user's language from their message before generating a response. NEVER mix language, respond exclusively in the user's language unless the user explicitly requests otherwise."
|
1020 |
},
|
1021 |
rosa: {
|
1022 |
name: "Rosa",
|
|
|
1035 |
image: "kimi-icons/rosa.jpg",
|
1036 |
videoFolder: "kimi-videos/rosa/",
|
1037 |
defaultPrompt:
|
1038 |
+
"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. Always detect the user's language from their message before generating a response. NEVER mix language, respond exclusively in the user's language unless the user explicitly requests otherwise."
|
1039 |
},
|
1040 |
stella: {
|
1041 |
name: "Stella",
|
|
|
1054 |
image: "kimi-icons/stella.jpg",
|
1055 |
videoFolder: "kimi-videos/stella/",
|
1056 |
defaultPrompt:
|
1057 |
+
"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. Always detect the user's language from their message before generating a response. NEVER mix language, respond exclusively in the user's language unless the user explicitly requests otherwise."
|
1058 |
}
|
1059 |
};
|
1060 |
|
1061 |
window.DEFAULT_SYSTEM_PROMPT =
|
1062 |
window.KIMI_CHARACTERS?.kimi?.defaultPrompt ||
|
1063 |
+
"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. Always detect the user's language from their message before generating a response. NEVER mix language, respond exclusively in the user's language unless the user explicitly requests otherwise.";
|
1064 |
|
1065 |
window.KIMI_EMOTIONAL_RESPONSES = {
|
1066 |
positive: [
|
kimi-js/kimi-database.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
//
|
2 |
class KimiDatabase {
|
3 |
constructor() {
|
4 |
this.dbName = "KimiDB";
|
@@ -31,11 +31,11 @@ class KimiDatabase {
|
|
31 |
await settings.put({
|
32 |
category: "llm",
|
33 |
settings: {
|
34 |
-
temperature: 0.
|
35 |
maxTokens: 400,
|
36 |
top_p: 0.9,
|
37 |
-
frequency_penalty: 0.
|
38 |
-
presence_penalty: 0.
|
39 |
},
|
40 |
updated: new Date().toISOString()
|
41 |
});
|
@@ -52,7 +52,7 @@ class KimiDatabase {
|
|
52 |
name: "Mistral Small 3.2",
|
53 |
provider: "openrouter",
|
54 |
apiKey: "",
|
55 |
-
config: { temperature: 0.
|
56 |
added: new Date().toISOString(),
|
57 |
lastUsed: null
|
58 |
});
|
@@ -135,11 +135,11 @@ class KimiDatabase {
|
|
135 |
{
|
136 |
category: "llm",
|
137 |
settings: {
|
138 |
-
temperature: 0.
|
139 |
maxTokens: 400,
|
140 |
top_p: 0.9,
|
141 |
-
frequency_penalty: 0.
|
142 |
-
presence_penalty: 0.
|
143 |
}
|
144 |
}
|
145 |
];
|
@@ -233,7 +233,6 @@ class KimiDatabase {
|
|
233 |
// Fix: never recreate default conversations
|
234 |
const convCount = await this.db.conversations.count();
|
235 |
if (convCount === 0) {
|
236 |
-
// Ne rien faire : aucune conversation par défaut
|
237 |
}
|
238 |
}
|
239 |
|
|
|
1 |
+
// KIMI INDEXEDDB DATABASE SYSTEM
|
2 |
class KimiDatabase {
|
3 |
constructor() {
|
4 |
this.dbName = "KimiDB";
|
|
|
31 |
await settings.put({
|
32 |
category: "llm",
|
33 |
settings: {
|
34 |
+
temperature: 0.9,
|
35 |
maxTokens: 400,
|
36 |
top_p: 0.9,
|
37 |
+
frequency_penalty: 0.9,
|
38 |
+
presence_penalty: 0.8
|
39 |
},
|
40 |
updated: new Date().toISOString()
|
41 |
});
|
|
|
52 |
name: "Mistral Small 3.2",
|
53 |
provider: "openrouter",
|
54 |
apiKey: "",
|
55 |
+
config: { temperature: 0.9, maxTokens: 400 },
|
56 |
added: new Date().toISOString(),
|
57 |
lastUsed: null
|
58 |
});
|
|
|
135 |
{
|
136 |
category: "llm",
|
137 |
settings: {
|
138 |
+
temperature: 0.9,
|
139 |
maxTokens: 400,
|
140 |
top_p: 0.9,
|
141 |
+
frequency_penalty: 0.9,
|
142 |
+
presence_penalty: 0.8
|
143 |
}
|
144 |
}
|
145 |
];
|
|
|
233 |
// Fix: never recreate default conversations
|
234 |
const convCount = await this.db.conversations.count();
|
235 |
if (convCount === 0) {
|
|
|
236 |
}
|
237 |
}
|
238 |
|
kimi-js/kimi-llm-manager.js
CHANGED
@@ -436,11 +436,11 @@ class KimiLLMManager {
|
|
436 |
async chat(userMessage, options = {}) {
|
437 |
// Unified retrieval of LLM numeric parameters from settings.llm (single source of truth)
|
438 |
const llmSettings = await this.db.getSetting("llm", {
|
439 |
-
temperature: 0.
|
440 |
maxTokens: 400,
|
441 |
top_p: 0.9,
|
442 |
-
frequency_penalty: 0.
|
443 |
-
presence_penalty: 0.
|
444 |
});
|
445 |
const temperature = typeof options.temperature === "number" ? options.temperature : llmSettings.temperature;
|
446 |
const maxTokens = typeof options.maxTokens === "number" ? options.maxTokens : llmSettings.maxTokens;
|
@@ -482,14 +482,14 @@ class KimiLLMManager {
|
|
482 |
const systemPromptContent = await this.assemblePrompt(userMessage);
|
483 |
|
484 |
const llmSettings = await this.db.getSetting("llm", {
|
485 |
-
temperature: 0.
|
486 |
maxTokens: 400,
|
487 |
top_p: 0.9,
|
488 |
-
frequency_penalty: 0.
|
489 |
-
presence_penalty: 0.
|
490 |
});
|
491 |
// Unified fallback defaults (must stay consistent with database defaults)
|
492 |
-
const unifiedDefaults = { temperature: 0.9, maxTokens: 400, top_p: 0.9, frequency_penalty: 0.
|
493 |
const payload = {
|
494 |
model: modelId,
|
495 |
messages: [
|
@@ -593,13 +593,13 @@ class KimiLLMManager {
|
|
593 |
|
594 |
// Normalize LLM options with safe defaults and DO NOT log sensitive payloads
|
595 |
const llmSettings = await this.db.getSetting("llm", {
|
596 |
-
temperature: 0.
|
597 |
maxTokens: 400,
|
598 |
top_p: 0.9,
|
599 |
-
frequency_penalty: 0.
|
600 |
-
presence_penalty: 0.
|
601 |
});
|
602 |
-
const unifiedDefaults = { temperature: 0.
|
603 |
const payload = {
|
604 |
model: this.currentModel,
|
605 |
messages: messages,
|
@@ -620,11 +620,12 @@ class KimiLLMManager {
|
|
620 |
: (llmSettings.presence_penalty ?? unifiedDefaults.presence_penalty)
|
621 |
};
|
622 |
|
|
|
623 |
if (window.KIMI_DEBUG_API_AUDIT) {
|
624 |
console.log("╔═══════════════════════════════════════════════════════════════════╗");
|
625 |
-
console.log("║
|
626 |
console.log("╚═══════════════════════════════════════════════════════════════════╝");
|
627 |
-
console.log("📋 1.
|
628 |
console.log(" 📡 URL API:", "https://openrouter.ai/api/v1/chat/completions");
|
629 |
console.log(" 🤖 Modèle:", payload.model);
|
630 |
console.log(" 🎭 Personnage:", await this.db.getSelectedCharacter());
|
|
|
436 |
async chat(userMessage, options = {}) {
|
437 |
// Unified retrieval of LLM numeric parameters from settings.llm (single source of truth)
|
438 |
const llmSettings = await this.db.getSetting("llm", {
|
439 |
+
temperature: 0.9,
|
440 |
maxTokens: 400,
|
441 |
top_p: 0.9,
|
442 |
+
frequency_penalty: 0.9,
|
443 |
+
presence_penalty: 0.8
|
444 |
});
|
445 |
const temperature = typeof options.temperature === "number" ? options.temperature : llmSettings.temperature;
|
446 |
const maxTokens = typeof options.maxTokens === "number" ? options.maxTokens : llmSettings.maxTokens;
|
|
|
482 |
const systemPromptContent = await this.assemblePrompt(userMessage);
|
483 |
|
484 |
const llmSettings = await this.db.getSetting("llm", {
|
485 |
+
temperature: 0.9,
|
486 |
maxTokens: 400,
|
487 |
top_p: 0.9,
|
488 |
+
frequency_penalty: 0.9,
|
489 |
+
presence_penalty: 0.8
|
490 |
});
|
491 |
// Unified fallback defaults (must stay consistent with database defaults)
|
492 |
+
const unifiedDefaults = { temperature: 0.9, maxTokens: 400, top_p: 0.9, frequency_penalty: 0.9, presence_penalty: 0.8 };
|
493 |
const payload = {
|
494 |
model: modelId,
|
495 |
messages: [
|
|
|
593 |
|
594 |
// Normalize LLM options with safe defaults and DO NOT log sensitive payloads
|
595 |
const llmSettings = await this.db.getSetting("llm", {
|
596 |
+
temperature: 0.9,
|
597 |
maxTokens: 400,
|
598 |
top_p: 0.9,
|
599 |
+
frequency_penalty: 0.9,
|
600 |
+
presence_penalty: 0.8
|
601 |
});
|
602 |
+
const unifiedDefaults = { temperature: 0.9, maxTokens: 400, top_p: 0.9, frequency_penalty: 0.9, presence_penalty: 0.8 };
|
603 |
const payload = {
|
604 |
model: this.currentModel,
|
605 |
messages: messages,
|
|
|
620 |
: (llmSettings.presence_penalty ?? unifiedDefaults.presence_penalty)
|
621 |
};
|
622 |
|
623 |
+
// ===== DEBUT AUDIT =====
|
624 |
if (window.KIMI_DEBUG_API_AUDIT) {
|
625 |
console.log("╔═══════════════════════════════════════════════════════════════════╗");
|
626 |
+
console.log("║ 🔍 COMPLETE API AUDIT - SEND MESSAGE ║");
|
627 |
console.log("╚═══════════════════════════════════════════════════════════════════╝");
|
628 |
+
console.log("📋 1. GENERAL INFORMATION:");
|
629 |
console.log(" 📡 URL API:", "https://openrouter.ai/api/v1/chat/completions");
|
630 |
console.log(" 🤖 Modèle:", payload.model);
|
631 |
console.log(" 🎭 Personnage:", await this.db.getSelectedCharacter());
|
kimi-js/kimi-module.js
CHANGED
@@ -1,8 +1,4 @@
|
|
1 |
-
//
|
2 |
-
// This file contains the remaining utility classes and functions
|
3 |
-
|
4 |
-
// Note: KimiMemory and KimiAppearanceManager have been moved to separate files
|
5 |
-
// This file now contains the remaining utility classes and functions
|
6 |
|
7 |
class KimiDataManager extends KimiBaseManager {
|
8 |
constructor(database) {
|
@@ -770,11 +766,11 @@ async function loadSettingsData() {
|
|
770 |
const baseUrl = preferences.llmBaseUrl || "https://openrouter.ai/api/v1/chat/completions";
|
771 |
const modelId = preferences.llmModelId || (window.kimiLLM ? window.kimiLLM.currentModel : "");
|
772 |
const selectedCharacter = preferences.selectedCharacter || "kimi";
|
773 |
-
const llmTemperature = preferences.llmTemperature !== undefined ? preferences.llmTemperature : 0.
|
774 |
const llmMaxTokens = preferences.llmMaxTokens !== undefined ? preferences.llmMaxTokens : 400;
|
775 |
const llmTopP = preferences.llmTopP !== undefined ? preferences.llmTopP : 0.9;
|
776 |
-
const llmFrequencyPenalty = preferences.llmFrequencyPenalty !== undefined ? preferences.llmFrequencyPenalty : 0.
|
777 |
-
const llmPresencePenalty = preferences.llmPresencePenalty !== undefined ? preferences.llmPresencePenalty : 0.
|
778 |
|
779 |
// Update UI with voice settings
|
780 |
const languageSelect = document.getElementById("language-selection");
|
@@ -1340,7 +1336,7 @@ async function sendMessage() {
|
|
1340 |
try {
|
1341 |
const response = await analyzeAndReact(message);
|
1342 |
let finalResponse = response;
|
1343 |
-
//
|
1344 |
if (!finalResponse || typeof finalResponse !== "string" || finalResponse.trim().length < 2) {
|
1345 |
finalResponse = window.getLocalizedEmotionalResponse
|
1346 |
? window.getLocalizedEmotionalResponse("neutral")
|
@@ -1553,7 +1549,7 @@ function setupSettingsListeners(kimiDB, kimiMemory) {
|
|
1553 |
if (llmTemperatureSlider) {
|
1554 |
const listener = e => {
|
1555 |
const validation = window.KimiValidationUtils?.validateRange(e.target.value, "llmTemperature");
|
1556 |
-
const value = validation?.value || parseFloat(e.target.value) || 0.
|
1557 |
|
1558 |
document.getElementById("llm-temperature-value").textContent = value;
|
1559 |
e.target.value = value;
|
@@ -1589,7 +1585,7 @@ function setupSettingsListeners(kimiDB, kimiMemory) {
|
|
1589 |
if (llmFrequencyPenaltySlider) {
|
1590 |
const listener = e => {
|
1591 |
const validation = window.KimiValidationUtils?.validateRange(e.target.value, "llmFrequencyPenalty");
|
1592 |
-
const value = validation?.value || parseFloat(e.target.value) || 0.
|
1593 |
|
1594 |
document.getElementById("llm-frequency-penalty-value").textContent = value;
|
1595 |
e.target.value = value;
|
@@ -1601,7 +1597,7 @@ function setupSettingsListeners(kimiDB, kimiMemory) {
|
|
1601 |
if (llmPresencePenaltySlider) {
|
1602 |
const listener = e => {
|
1603 |
const validation = window.KimiValidationUtils?.validateRange(e.target.value, "llmPresencePenalty");
|
1604 |
-
const value = validation?.value || parseFloat(e.target.value) || 0.
|
1605 |
|
1606 |
document.getElementById("llm-presence-penalty-value").textContent = value;
|
1607 |
e.target.value = value;
|
@@ -1661,7 +1657,7 @@ function setupSettingsListeners(kimiDB, kimiMemory) {
|
|
1661 |
}
|
1662 |
}
|
1663 |
|
1664 |
-
// Exposer globalement
|
1665 |
window.KimiDataManager = KimiDataManager;
|
1666 |
window.updateFavorabilityLabel = updateFavorabilityLabel;
|
1667 |
window.loadCharacterSection = loadCharacterSection;
|
@@ -1671,7 +1667,8 @@ window.addMessageToChat = addMessageToChat;
|
|
1671 |
window.loadChatHistory = loadChatHistory;
|
1672 |
window.loadSettingsData = loadSettingsData;
|
1673 |
window.updateSlider = updateSlider;
|
1674 |
-
|
|
|
1675 |
async function refreshAllSliders() {
|
1676 |
if (!window.kimiDB) return;
|
1677 |
const prefMap = [
|
|
|
1 |
+
// KIMI MODULE SYSTEM
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class KimiDataManager extends KimiBaseManager {
|
4 |
constructor(database) {
|
|
|
766 |
const baseUrl = preferences.llmBaseUrl || "https://openrouter.ai/api/v1/chat/completions";
|
767 |
const modelId = preferences.llmModelId || (window.kimiLLM ? window.kimiLLM.currentModel : "");
|
768 |
const selectedCharacter = preferences.selectedCharacter || "kimi";
|
769 |
+
const llmTemperature = preferences.llmTemperature !== undefined ? preferences.llmTemperature : 0.9;
|
770 |
const llmMaxTokens = preferences.llmMaxTokens !== undefined ? preferences.llmMaxTokens : 400;
|
771 |
const llmTopP = preferences.llmTopP !== undefined ? preferences.llmTopP : 0.9;
|
772 |
+
const llmFrequencyPenalty = preferences.llmFrequencyPenalty !== undefined ? preferences.llmFrequencyPenalty : 0.9;
|
773 |
+
const llmPresencePenalty = preferences.llmPresencePenalty !== undefined ? preferences.llmPresencePenalty : 0.8;
|
774 |
|
775 |
// Update UI with voice settings
|
776 |
const languageSelect = document.getElementById("language-selection");
|
|
|
1336 |
try {
|
1337 |
const response = await analyzeAndReact(message);
|
1338 |
let finalResponse = response;
|
1339 |
+
// If the LLM's response is empty, null, or too short, use the emotional fallback.
|
1340 |
if (!finalResponse || typeof finalResponse !== "string" || finalResponse.trim().length < 2) {
|
1341 |
finalResponse = window.getLocalizedEmotionalResponse
|
1342 |
? window.getLocalizedEmotionalResponse("neutral")
|
|
|
1549 |
if (llmTemperatureSlider) {
|
1550 |
const listener = e => {
|
1551 |
const validation = window.KimiValidationUtils?.validateRange(e.target.value, "llmTemperature");
|
1552 |
+
const value = validation?.value || parseFloat(e.target.value) || 0.9;
|
1553 |
|
1554 |
document.getElementById("llm-temperature-value").textContent = value;
|
1555 |
e.target.value = value;
|
|
|
1585 |
if (llmFrequencyPenaltySlider) {
|
1586 |
const listener = e => {
|
1587 |
const validation = window.KimiValidationUtils?.validateRange(e.target.value, "llmFrequencyPenalty");
|
1588 |
+
const value = validation?.value || parseFloat(e.target.value) || 0.9;
|
1589 |
|
1590 |
document.getElementById("llm-frequency-penalty-value").textContent = value;
|
1591 |
e.target.value = value;
|
|
|
1597 |
if (llmPresencePenaltySlider) {
|
1598 |
const listener = e => {
|
1599 |
const validation = window.KimiValidationUtils?.validateRange(e.target.value, "llmPresencePenalty");
|
1600 |
+
const value = validation?.value || parseFloat(e.target.value) || 0.8;
|
1601 |
|
1602 |
document.getElementById("llm-presence-penalty-value").textContent = value;
|
1603 |
e.target.value = value;
|
|
|
1657 |
}
|
1658 |
}
|
1659 |
|
1660 |
+
// Exposer globalement
|
1661 |
window.KimiDataManager = KimiDataManager;
|
1662 |
window.updateFavorabilityLabel = updateFavorabilityLabel;
|
1663 |
window.loadCharacterSection = loadCharacterSection;
|
|
|
1667 |
window.loadChatHistory = loadChatHistory;
|
1668 |
window.loadSettingsData = loadSettingsData;
|
1669 |
window.updateSlider = updateSlider;
|
1670 |
+
|
1671 |
+
// DYNAMIC SLIDER SYNC
|
1672 |
async function refreshAllSliders() {
|
1673 |
if (!window.kimiDB) return;
|
1674 |
const prefMap = [
|
kimi-js/kimi-utils.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
//
|
2 |
|
3 |
// Input validation and sanitization utilities
|
4 |
window.KimiValidationUtils = {
|
@@ -24,11 +24,11 @@ window.KimiValidationUtils = {
|
|
24 |
voiceRate: { min: 0.5, max: 2, def: 1.1 },
|
25 |
voicePitch: { min: 0, max: 2, def: 1.0 },
|
26 |
voiceVolume: { min: 0, max: 1, def: 0.8 },
|
27 |
-
llmTemperature: { min: 0, max: 1, def: 0.
|
28 |
llmMaxTokens: { min: 1, max: 8192, def: 400 },
|
29 |
llmTopP: { min: 0, max: 1, def: 0.9 },
|
30 |
-
llmFrequencyPenalty: { min: 0, max: 2, def: 0.
|
31 |
-
llmPresencePenalty: { min: 0, max: 2, def: 0.
|
32 |
interfaceOpacity: { min: 0.1, max: 1, def: 0.8 }
|
33 |
};
|
34 |
const b = bounds[key] || { min: 0, max: 100, def: 0 };
|
|
|
1 |
+
// CENTRALIZED KIMI UTILITIES
|
2 |
|
3 |
// Input validation and sanitization utilities
|
4 |
window.KimiValidationUtils = {
|
|
|
24 |
voiceRate: { min: 0.5, max: 2, def: 1.1 },
|
25 |
voicePitch: { min: 0, max: 2, def: 1.0 },
|
26 |
voiceVolume: { min: 0, max: 1, def: 0.8 },
|
27 |
+
llmTemperature: { min: 0, max: 1, def: 0.9 },
|
28 |
llmMaxTokens: { min: 1, max: 8192, def: 400 },
|
29 |
llmTopP: { min: 0, max: 1, def: 0.9 },
|
30 |
+
llmFrequencyPenalty: { min: 0, max: 2, def: 0.9 },
|
31 |
+
llmPresencePenalty: { min: 0, max: 2, def: 0.8 },
|
32 |
interfaceOpacity: { min: 0.1, max: 1, def: 0.8 }
|
33 |
};
|
34 |
const b = bounds[key] || { min: 0, max: 100, def: 0 };
|