- Introduction of dynamic Processors - Introduction of caching system - Introduction of a better template manager - Adaptation of ModelVariables to support dynamic Processors / Retrievers / Specialists - Start adaptation of chat client
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
// static/js/eveai-sdk.js
|
|
class EveAI {
|
|
constructor(tenantId, apiKey, domain, language, languages, serverUrl, specialistId) {
|
|
this.tenantId = tenantId;
|
|
this.apiKey = apiKey;
|
|
this.domain = domain;
|
|
this.language = language;
|
|
this.languages = languages;
|
|
this.serverUrl = serverUrl;
|
|
this.specialistId = specialistId;
|
|
|
|
console.log('EveAI constructor:', { tenantId, apiKey, domain, language, languages, serverUrl, specialistId });
|
|
}
|
|
|
|
initializeChat(containerId) {
|
|
const container = document.getElementById(containerId);
|
|
if (container) {
|
|
container.innerHTML = '<eveai-chat-widget></eveai-chat-widget>';
|
|
customElements.whenDefined('eveai-chat-widget').then(() => {
|
|
const chatWidget = container.querySelector('eveai-chat-widget');
|
|
chatWidget.setAttribute('tenant-id', this.tenantId);
|
|
chatWidget.setAttribute('api-key', this.apiKey);
|
|
chatWidget.setAttribute('domain', this.domain);
|
|
chatWidget.setAttribute('language', this.language);
|
|
chatWidget.setAttribute('languages', this.languages);
|
|
chatWidget.setAttribute('server-url', this.serverUrl);
|
|
chatWidget.setAttribute('specialist-id', this.specialistId);
|
|
});
|
|
} else {
|
|
console.error('Container not found');
|
|
}
|
|
}
|
|
} |