Migration from v1 to v2
CDN Path Change
diff
- <script src="https://web.sdk.klleon.io/1.3.0/klleon-chat.umd.js"></script>
+ <script src="https://klleon.k1.klleon.io/{VERSION}/klleon-sdk.umd.js"></script>Global Variable Change
diff
- window.KlleonChat
+ window.KlleonSDKAPI Changes
Compatible APIs (no changes needed)
<avatar-container>,<chat-container>— Same
init(option) Changes
The init() call itself is the same, but the options have changed.
| v1 Option | v2 Option | Notes |
|---|---|---|
sdk_key | sdk_key | Same |
avatar_id | avatar_id | Same |
enable_microphone | enable_microphone | Same |
log_level | log_level | "silent" added |
voice_code | — | Removed |
subtitle_code | — | Removed. Merged into language |
| — | language | New. Combined TTS voice + subtitle language ("ko_kr", "en_us", "ja_jp", "id_id") |
| — | auto_send | New. When true, server VAD auto-responds |
| — | stt_only | New. When true, returns STT results only |
Removed APIs
| v1 | Replacement |
|---|---|
reconnect() | await destroy() then await init(options) |
changeAvatar(option) | Removed |
wakeUpAvatar() | Removed |
Changed APIs (renamed)
| v1 | v2 | Notes |
|---|---|---|
onChatEvent(cb) | onSignal(cb) | Receives all server signals |
onStatusEvent(cb) | onStatus(cb) | |
onErrorEvent(cb) | onError(cb) | |
destroy() (sync) | await destroy() | Changed to async |
sendTextMessage(text) | sendMessage(text) | |
echo(text) | speak(text) | |
startAudioEcho(audio) | sendSpeakAudio(audio) | |
endAudioEcho() | endSpeakAudio() | |
startStt() | startListening() | |
endStt() | endListening() | |
cancelStt() | cancelListening() | |
stopSpeech() | stopSpeaking() | |
clearMessageList() | clearMessages() |
New APIs
| API | Description |
|---|---|
setVolume(volume) | Volume control (0-100) |
getStatus() | Get current SDK status |
Code Change Example
diff
// Global variable changed
- const SDK = window.KlleonChat;
+ const SDK = window.KlleonSDK;
// destroy changed to async
- SDK.destroy();
+ await SDK.destroy();
// Event names changed + register before init
- SDK.onStatusEvent(cb);
+ SDK.onStatus(cb);
- SDK.onChatEvent(cb);
+ SDK.onSignal(cb);
- SDK.onErrorEvent(cb);
+ SDK.onError(cb);
await SDK.init(option);
// Method names changed
- SDK.sendTextMessage('Hello');
+ SDK.sendMessage('Hello');
- SDK.echo('Text to repeat');
+ SDK.speak('Text to repeat');
- SDK.startStt();
+ SDK.startListening();
- SDK.endStt();
+ SDK.endListening();
- SDK.stopSpeech();
+ SDK.stopSpeaking();Important Notes
- v2 requires ES2018+ environments
- IE11 is not supported
destroy()must be used withawait