Skip to content

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.KlleonSDK

API 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 Optionv2 OptionNotes
sdk_keysdk_keySame
avatar_idavatar_idSame
enable_microphoneenable_microphoneSame
log_levellog_level"silent" added
voice_codeRemoved
subtitle_codeRemoved. Merged into language
languageNew. Combined TTS voice + subtitle language ("ko_kr", "en_us", "ja_jp", "id_id")
auto_sendNew. When true, server VAD auto-responds
stt_onlyNew. When true, returns STT results only

Removed APIs

v1Replacement
reconnect()await destroy() then await init(options)
changeAvatar(option)Removed
wakeUpAvatar()Removed

Changed APIs (renamed)

v1v2Notes
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

APIDescription
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 with await