File size: 1,496 Bytes
bdd842c 422213b 897b3f0 6e6dab9 53b13af bcf9644 53b13af af38c19 6e6dab9 bdd842c 8e9147b 897b3f0 8e9147b 6e6dab9 02acd51 2e70541 02acd51 4006506 02acd51 6e6dab9 53b13af af38c19 6e6dab9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
import {
setup_available_models_on_select,
setup_temperature_on_select,
} from "./components/llm_models_loader.js";
import { ButtonsBinder } from "./components/buttons_binder.js";
function auto_resize_user_input() {
// https://stackoverflow.com/questions/37629860/automatically-resizing-textarea-in-bootstrap
document.getElementById("user-input").addEventListener(
"input",
function () {
this.style.height = 0;
this.style.height = this.scrollHeight + 3 + "px";
},
false
);
}
function load_live_js() {
if (window.location.protocol !== "https:") {
var script = document.createElement("script");
script.src = "./common/live.js";
document.head.appendChild(script);
}
}
function setup_interactive_components() {
setup_available_models_on_select();
setup_temperature_on_select();
auto_resize_user_input();
let buttons_binder = new ButtonsBinder();
buttons_binder.bind();
adjust_messagers_container_max_height();
$(window).on("resize", adjust_messagers_container_max_height);
}
function adjust_messagers_container_max_height() {
var user_interaction_height = $("#user-interactions").outerHeight(true);
var page_height = $(window).height();
$("#chat-session-container").css(
"max-height",
page_height - user_interaction_height + "px"
);
}
$(document).ready(function () {
load_live_js();
setup_interactive_components();
});
|