31 lines
902 B
JavaScript
31 lines
902 B
JavaScript
frappe.pages["wes-ai"].on_page_load = function(wrapper) {
|
|
var page = frappe.ui.make_app_page({
|
|
parent: wrapper,
|
|
title: "Wes AI Assistant",
|
|
single_column: true
|
|
});
|
|
|
|
// Create iframe that embeds Wes AI
|
|
var $container = $(wrapper).find(".layout-main-section");
|
|
$container.css({
|
|
"position": "relative",
|
|
"overflow": "hidden"
|
|
});
|
|
|
|
// Determine Wes URL based on environment
|
|
var wes_url = "https://wes.advante.ch";
|
|
|
|
// On production VM, Wes runs locally
|
|
if (window.location.hostname === "erpnext.local" || window.location.hostname === "localhost") {
|
|
wes_url = "http://localhost:8082";
|
|
}
|
|
|
|
var $iframe = $('<iframe>', {
|
|
src: wes_url,
|
|
style: "width: 100%; height: calc(100vh - 120px); border: none; border-radius: 4px;",
|
|
id: "wes-ai-iframe"
|
|
});
|
|
|
|
$container.empty().append($iframe);
|
|
};
|