MGLDZM commited on
Commit
f558ea3
·
1 Parent(s): 5fee269

Dev: multi conversaciones paso 1

Browse files
static/css/app.css CHANGED
@@ -7,7 +7,6 @@ body {
7
  font-family: Monospace;
8
  font-size: 15px;
9
  }
10
-
11
  body {
12
  display: flex;
13
  }
@@ -15,55 +14,18 @@ button{
15
  cursor: pointer;
16
  }
17
  .wrapper {
18
- padding: 20px 20px 80px 20px;
19
- border-bottom: 5px solid #222f3d;
20
  background: #34495e;
21
  margin: 0;
22
  min-width: 320px;
23
  width: 100%;
24
- }
25
- .submenu {
26
- position: fixed;
27
- top: 0;
28
- left: 0;
29
- width: fit-content;
30
- height: fit-content;
31
-
32
- }
33
- .submenu .abrir{
34
- width: 30px;
35
- height: 30px;
36
- background-image: url(/static/img/menu.svg);
37
- background-color: #8093a5;
38
- background-repeat: no-repeat;
39
- background-position: center;
40
- border-radius: 0px 0px 5px 0px;
41
- border-bottom: solid 1px;
42
- border-right: solid 1px;
43
- position: fixed;
44
- }
45
- .submenu .configuracion{
46
- width: calc( 100vw - 20px);
47
- height: 0px;
48
- background: #cbcbcb;
49
- margin-left: 10px;
50
- border-radius: 0px 0px 5px 5px;
51
- top: -2px;
52
- transition: box-shadow 0.5s, height 0.5s, top 0.5s;
53
- }
54
- .submenu .configuracion.desplegado{
55
- top: 0px;
56
- height: 300px;
57
- border: solid 1px;
58
- border-top: none;
59
- box-shadow: 5px 5px 10px 2px #000000ad;
60
  }
61
  .chat {
62
  --textarea: 0px;
63
  border-radius: 5px;
64
  display: block;
65
  width: 100%;
66
- height: calc( 100% - var(--textarea) );
67
  overflow-y: scroll;
68
  overflow-x: hidden;
69
  background: rgb(161, 161, 161);
 
7
  font-family: Monospace;
8
  font-size: 15px;
9
  }
 
10
  body {
11
  display: flex;
12
  }
 
14
  cursor: pointer;
15
  }
16
  .wrapper {
 
 
17
  background: #34495e;
18
  margin: 0;
19
  min-width: 320px;
20
  width: 100%;
21
+ display: grid;
22
+ grid-template-rows: 40px auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
  .chat {
25
  --textarea: 0px;
26
  border-radius: 5px;
27
  display: block;
28
  width: 100%;
 
29
  overflow-y: scroll;
30
  overflow-x: hidden;
31
  background: rgb(161, 161, 161);
static/css/tabs.css ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .tabs {
2
+ display: flex;
3
+ scrollbar-color: #34373d #ffffff00;
4
+ scrollbar-width: 5px;
5
+ overflow-x: scroll;
6
+ padding-bottom: 4px;
7
+ user-select: none;
8
+ }
9
+
10
+ .tabs::-webkit-scrollbar {
11
+ height: 5px;
12
+ }
13
+ .tabs::-webkit-scrollbar-track {
14
+ background: #ffffff00;
15
+ }
16
+ .tabs::-webkit-scrollbar-thumb {
17
+ background-color: #34373d;
18
+ border: none;
19
+ }
20
+
21
+ .tab {
22
+ padding: 4px 20px;
23
+ display: none;
24
+ }
25
+ .tab.active{
26
+ display: grid;
27
+ grid-template-rows: auto 50px;
28
+ }
29
+
30
+ .tab-switch, .tab-add {
31
+ display: none;
32
+ }
33
+ .tab-label{
34
+ display: flex;
35
+ }
36
+ .tab-label-add {
37
+ background: #3b74ad;
38
+ display: flex;
39
+ }
40
+ .tab-label > div, .tab-label-add > div{
41
+ display: flex;
42
+ align-items: center;
43
+ padding: 0 10px;
44
+ text-wrap: nowrap;
45
+ }
46
+ .tab-label:hover {
47
+ /* top: -0.25rem;
48
+ transition: top 0.25s; */
49
+ }
50
+
51
+ .tab-label:has(.tab-switch:checked) {
52
+ background: #fff;
53
+ /* color: #2c3e50;
54
+ border-bottom: 0;
55
+ border-right: 0.125rem solid #fff;
56
+ transition: all 0.35s;
57
+ z-index: 1;
58
+ top: -0.0625rem; */
59
+ }
60
+ .template{
61
+ display: none;
62
+ }
static/js/chatHandler.js CHANGED
@@ -6,41 +6,20 @@ class ChatGPT{
6
  "Knowledge cutoff: 2021-09-01\nCurrent date: {date}";
7
  constructor(token){
8
 
9
- $("#input-delete").click(()=> $(document).trigger("chat:limpiar"))
10
-
11
  let fecha = new Date().toJSON().slice(0, 10);
12
  this.definicion = this.definicion.replace("{date}", fecha)
13
  this.definicion = {role: "system", content: this.definicion, tokens: 100};
14
-
15
- if (localStorage.getItem("convesacion") !== null) {
16
- this.convesacion = JSON.parse(localStorage.getItem("convesacion"));
17
- $(document).trigger("chat:cargar", this.convesacion);
18
- }else{
19
- this.convesacion = [this.definicion];
20
- }
21
-
22
- if (localStorage.getItem("config") !== null) {
23
- this.config = JSON.parse(localStorage.getItem("config"));
24
- }else{
25
- this.config = {
26
- temperature: 1.0,
27
- frequency_penalty: 0.0,
28
- presence_penalty: 0.0
29
- };
30
- }
31
 
32
  this.execStart = 0;
33
 
34
  this.endpointChat = "/chat_async";
35
  this.token = token
36
- // this.evCtx = document
37
  this.reintentos = 0
38
- $(document).on("chat:limpiar", () => {
39
- this.limpiarConfig()
40
- });
41
  $(document).on("chat:enviar", (event, params) => {
42
  this.reintentos = 0;
43
- this.enviar(params);
44
  });
45
  $(document).on("chat:reenviar", (event, params) => {
46
  this.reintentos++;
@@ -49,7 +28,38 @@ class ChatGPT{
49
 
50
  $(document).on("enviar:error", (event, params) => this.reenviar(params));
51
 
 
 
 
 
 
 
 
 
 
 
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  limpiarConfig(){
@@ -60,33 +70,34 @@ class ChatGPT{
60
  frequency_penalty: 0.0,
61
  presence_penalty: 0.0
62
  };
63
- this.convesacion = [this.definicion];
64
 
65
  }
66
 
67
- reenviar(params){
68
- if(params.status==404){
69
- $(document).trigger("precarga:error",{jqXHR:params.jqXHR, status:params.status, error:params.error, execTime:params.execTime, mensaje:params.detail});
70
- return
71
- }
72
- if(this.reintentos < 3 ){
73
- $(document).trigger("chat:reenviar",{jqXHR:params.jqXHR, status:params.status, error:params.error, execTime:params.execTime, mensaje:params.mensaje});
74
 
75
- }else{
76
- $(document).trigger("precarga:error", {status: rstat, mensaje: data.detail});
77
- }
78
- }
79
 
80
- enviar(mensaje){
 
81
  let tempMensajes = [];
82
- for(let actMsg of this.convesacion){
83
  tempMensajes.push({role: actMsg.role, content: actMsg.content})
84
  }
85
 
86
  console.log("Enviando: ", mensaje);
87
  tempMensajes.push({role: "user", content: mensaje});
88
- this.convesacion.push({role: "user", content: mensaje});
89
- $(document).trigger("precarga:inicio", mensaje);
90
  let self = this;
91
  let primertick = true;
92
  $.ajax({
@@ -102,7 +113,7 @@ class ChatGPT{
102
  xhrFields: {
103
  onprogress: function(e){
104
  if(primertick){
105
- $(document).trigger("precarga:iniciada");
106
  primertick=false;
107
  }
108
  }
@@ -110,14 +121,14 @@ class ChatGPT{
110
  success: function (response) {
111
  self.token = response.token;
112
  delete response.token
113
- self.convesacion.push(response)
114
- localStorage.setItem("convesacion", JSON.stringify(self.convesacion))
115
- $(document).trigger("precarga:mensaje", response.content);
116
  console.log("terminado")
117
  console.log(response)
118
  },
119
  error: function (response) {
120
- $(document).trigger("precarga:error", response);
121
  console.log("Error: ", response)
122
  }
123
  });
 
6
  "Knowledge cutoff: 2021-09-01\nCurrent date: {date}";
7
  constructor(token){
8
 
 
 
9
  let fecha = new Date().toJSON().slice(0, 10);
10
  this.definicion = this.definicion.replace("{date}", fecha)
11
  this.definicion = {role: "system", content: this.definicion, tokens: 100};
12
+ this.cargarHistorial()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  this.execStart = 0;
15
 
16
  this.endpointChat = "/chat_async";
17
  this.token = token
 
18
  this.reintentos = 0
19
+
 
 
20
  $(document).on("chat:enviar", (event, params) => {
21
  this.reintentos = 0;
22
+ this.enviar(params.mensaje, params.ctx);
23
  });
24
  $(document).on("chat:reenviar", (event, params) => {
25
  this.reintentos++;
 
28
 
29
  $(document).on("enviar:error", (event, params) => this.reenviar(params));
30
 
31
+ $(document).on("chat:crear", ()=>this.crearChat())
32
+
33
+ }
34
+
35
+ cargarHistorial(){
36
+ if (localStorage.getItem("conversaciones") !== null) {
37
+ this.conversaciones = JSON.parse(localStorage.getItem("conversaciones"));
38
+ }else{
39
+ this.conversaciones = [[this.definicion]];
40
+ }
41
 
42
+ this.wHand = []
43
+ for(let conversacion of this.conversaciones){
44
+ this.wHand.push(new WindowHandler(conversacion, this.wHand.length));
45
+ }
46
+
47
+
48
+ if (localStorage.getItem("config") !== null) {
49
+ this.config = JSON.parse(localStorage.getItem("config"));
50
+ }else{
51
+ this.config = {
52
+ temperature: 1.0,
53
+ frequency_penalty: 0.0,
54
+ presence_penalty: 0.0
55
+ };
56
+ }
57
+
58
+ }
59
+
60
+ crearChat(){
61
+ this.conversaciones.push([this.definicion])
62
+ this.wHand.push(new WindowHandler(this.conversaciones[this.conversaciones.length-1], this.wHand.length));
63
  }
64
 
65
  limpiarConfig(){
 
70
  frequency_penalty: 0.0,
71
  presence_penalty: 0.0
72
  };
73
+ this.conversaciones = [this.definicion];
74
 
75
  }
76
 
77
+ // reenviar(params){
78
+ // if(params.status==404){
79
+ // this.ctx.trigger("precarga:error",{jqXHR:params.jqXHR, status:params.status, error:params.error, execTime:params.execTime, mensaje:params.detail});
80
+ // return
81
+ // }
82
+ // if(this.reintentos < 3 ){
83
+ // this.ctx.trigger("chat:reenviar",{jqXHR:params.jqXHR, status:params.status, error:params.error, execTime:params.execTime, mensaje:params.mensaje});
84
 
85
+ // }else{
86
+ // this.ctx.trigger("precarga:error", {status: rstat, mensaje: data.detail});
87
+ // }
88
+ // }
89
 
90
+ enviar(mensaje, ctx){
91
+ let conversacion = this.conversaciones[$(".tab-label input:checked").val()]
92
  let tempMensajes = [];
93
+ for(let actMsg of conversacion){
94
  tempMensajes.push({role: actMsg.role, content: actMsg.content})
95
  }
96
 
97
  console.log("Enviando: ", mensaje);
98
  tempMensajes.push({role: "user", content: mensaje});
99
+ conversacion.push({role: "user", content: mensaje});
100
+ ctx.trigger("precarga:inicio", mensaje);
101
  let self = this;
102
  let primertick = true;
103
  $.ajax({
 
113
  xhrFields: {
114
  onprogress: function(e){
115
  if(primertick){
116
+ ctx.trigger("precarga:iniciada");
117
  primertick=false;
118
  }
119
  }
 
121
  success: function (response) {
122
  self.token = response.token;
123
  delete response.token
124
+ conversacion.push(response)
125
+ localStorage.setItem("conversaciones", JSON.stringify(self.conversaciones))
126
+ ctx.trigger("precarga:mensaje", response.content);
127
  console.log("terminado")
128
  console.log(response)
129
  },
130
  error: function (response) {
131
+ ctx.trigger("precarga:error", response);
132
  console.log("Error: ", response)
133
  }
134
  });
static/js/tabsHandler.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $(document).ready(function() {
2
+ $(document).on("chat:creado",function(event){
3
+ $(".tab-switch").off("change")
4
+ $(".tab-switch").on("change", radioChanged)
5
+ radioChanged()
6
+ });
7
+
8
+ $("#nuevoChat").on("click", (event) => {
9
+ $(document).trigger("chat:crear");
10
+ })
11
+
12
+ })
13
+
14
+ function radioChanged(){
15
+ $(".tab").removeClass("active")
16
+ $($(".tab")[$(".tab-label input:checked").val()]).addClass("active")
17
+ }
static/js/windowHandler.js CHANGED
@@ -1,61 +1,109 @@
1
  class WindowHandler{
2
- constructor(){
3
- this.chatbox = $("#chat");
4
  this.template = $('<div class="message"><div><p></p></div></div>');
5
  this.active = false;
6
  this.mensaje = "";
7
 
8
- $(document).on("chat:enviar", (event, params) => this.recalcularTextarea());
9
- $(document).on("chat:limpiar", () => this.limpiarChat());
10
 
11
- $("#input-text").keypress((event) => {
 
 
 
 
12
  if (!event.shiftKey && event.keyCode === 13) {
13
  this.manejadorEnviar();
14
  }});
15
- $("#input-send").click(() => this.manejadorEnviar());
16
- $("#input-text").keypress(() => this.recalcularTextarea());
17
- $("#input-text").keyup(() => this.recalcularTextarea());
18
- $("#input-text").keydown(() => this.recalcularTextarea());
19
- this.cargarChat(chatH.convesacion);
20
-
21
- $(document).on("precarga:inicio", (event, params) => {
 
22
  this.respuestaInicio(params)
23
  });
24
- $(document).on("precarga:iniciada", (event, params) => {
25
  this.respuestaIniciada()
26
  });
27
- $(document).on("precarga:mensaje", (event, params) => {
28
  this.respuestaMensaje(params)}
29
  );
30
- $(document).on("precarga:fin", (event, params) => {
31
  this.respuestaFin()
32
  });
33
- $(document).on("precarga:error", (event, params) => {
34
  this.respuestaError(params)
35
  });
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
 
39
  limpiarChat(){
40
- $("#input-text").val("");
41
  this.recalcularTextarea();
42
- $("#chat").html("");
43
  }
44
 
45
  manejadorEnviar(){
46
- let mensaje = $("#input-text").val();
47
  if(mensaje==""){
48
  return false;
49
  }
50
- $(document).trigger("chat:enviar", mensaje);
51
  }
52
 
53
  recalcularTextarea(){
54
- $(".input-box").css("height", "30px");
55
- let height = parseInt(($(".input-text").prop('scrollHeight')+15)/15)*15;
56
- $(".input-box").css("height", height+"px");
57
  height -= 30;
58
- $(".chat").css("--textarea", height+"px");
59
  }
60
 
61
  procesarTexto(texto){
@@ -78,31 +126,12 @@ class WindowHandler{
78
  return resultado
79
  }
80
 
81
- cargarChat(mensajes){
82
- mensajes.forEach((mensaje) => {
83
- if(mensaje.role!="system"){
84
- let clone = this.template.clone();
85
- let texto = mensaje.content;
86
- if(mensaje.role=="user") {
87
- clone.addClass("me");
88
- clone.find("div p").text(texto.replace(/\n/g, "<br>"));
89
- }else{
90
- texto = this.procesarTexto(texto);
91
- clone.find("div p").html(texto);
92
- }
93
- this.chatbox.append(clone);
94
- this.active = clone;
95
- Prism.highlightAllUnder(this.active[0])
96
- this.active = false;
97
- this.chatbox.scrollTop(this.chatbox[0].scrollHeight);
98
- }
99
- });
100
- }
101
 
102
  respuestaInicio(mensaje){
103
- $("#input-text").val("");
104
- $("button").prop("disabled", true);
105
- $("textarea").prop("disabled", true);
106
  this.mensaje = ""
107
  let clone = this.template.clone();
108
  clone.addClass("me");
@@ -126,9 +155,9 @@ class WindowHandler{
126
  this.active.find("div p").html(mensaje);
127
  Prism.highlightAllUnder(this.active[0]);
128
  this.active = false;
129
- $("button").prop("disabled", false);
130
- $("textarea").prop("disabled", false);
131
- $("textarea").focus();
132
 
133
  this.chatbox.scrollTop(this.chatbox[0].scrollHeight);
134
  }
@@ -136,9 +165,9 @@ class WindowHandler{
136
  respuestaFin(){
137
  let msgProcesado = this.procesarTexto(this.mensaje);
138
  this.mensaje = "";
139
- $("button").prop("disabled", false);
140
- $("textarea").prop("disabled", false);
141
- $("textarea").focus();
142
  this.active.find("div p").html(msgProcesado);
143
  Prism.highlightAllUnder(this.active[0]);
144
  this.active = false;
@@ -146,9 +175,9 @@ class WindowHandler{
146
  }
147
 
148
  respuestaError(error){
149
- $("button").prop("disabled", false);
150
- $("textarea").prop("disabled", false);
151
- $("textarea").focus();
152
  this.active.find("div p").html(error.responseJSON.detail)
153
  switch(error.status){
154
  case 404:
 
1
  class WindowHandler{
2
+ constructor(conversacion, index){
3
+ this.index = index
4
  this.template = $('<div class="message"><div><p></p></div></div>');
5
  this.active = false;
6
  this.mensaje = "";
7
 
8
+ this.cargarChat(conversacion)
 
9
 
10
+
11
+ this.ctx.on("chat:enviar", (event, params) => this.recalcularTextarea());
12
+ this.ctx.on("chat:limpiar", () => this.limpiarChat());
13
+
14
+ this.ctx.find(".input-text").keypress((event) => {
15
  if (!event.shiftKey && event.keyCode === 13) {
16
  this.manejadorEnviar();
17
  }});
18
+ this.ctx.find(".input-send").click(() => this.manejadorEnviar());
19
+ this.ctx.find(".input-text").keypress(() => this.recalcularTextarea());
20
+ this.ctx.find(".input-text").keyup(() => this.recalcularTextarea());
21
+ this.ctx.find(".input-text").keydown(() => this.recalcularTextarea());
22
+ this.ctx.find(".input-delete").click(()=> this.ctx.trigger("chat:limpiar"))
23
+ //this.cargarChat(chatH.convesacion);
24
+
25
+ this.ctx.on("precarga:inicio", (event, params) => {
26
  this.respuestaInicio(params)
27
  });
28
+ this.ctx.on("precarga:iniciada", (event, params) => {
29
  this.respuestaIniciada()
30
  });
31
+ this.ctx.on("precarga:mensaje", (event, params) => {
32
  this.respuestaMensaje(params)}
33
  );
34
+ this.ctx.on("precarga:fin", (event, params) => {
35
  this.respuestaFin()
36
  });
37
+ this.ctx.on("precarga:error", (event, params) => {
38
  this.respuestaError(params)
39
  });
40
 
41
+ }
42
+
43
+ cargarChat(conversacion){
44
+ let tempTabSel = $(".tab-label-template").clone();
45
+ tempTabSel.removeClass("tab-label-template")
46
+ tempTabSel.addClass("tab-label")
47
+ tempTabSel.find("div").text("Tab "+this.index);
48
+ tempTabSel.find("input").val(this.index);
49
+ if(this.index==0){
50
+ tempTabSel.find("input").attr("checked", true)
51
+ }
52
+ $(".tabs").append(tempTabSel)
53
+
54
+ let tempTab = $(".tab-template").clone();
55
+ tempTab.removeClass("tab-template")
56
+ tempTab.addClass("tab")
57
+ $(".wrapper").append(tempTab)
58
+ this.ctx = tempTab
59
+ this.chatbox = this.ctx.find(".chat");
60
+
61
+
62
+ for(let mensaje of conversacion){
63
+ if(mensaje.role!="system"){
64
+ let clone = this.template.clone();
65
+ let texto = mensaje.content;
66
+ if(mensaje.role=="user") {
67
+ clone.addClass("me");
68
+ clone.find("div p").text(texto.replace(/\n/g, "<br>"));
69
+ }else{
70
+ texto = this.procesarTexto(texto);
71
+ clone.find("div p").html(texto);
72
+ }
73
+ this.chatbox.append(clone);
74
+ this.active = clone;
75
+ Prism.highlightAllUnder(this.active[0])
76
+ this.active = false;
77
+ this.chatbox.scrollTop(this.chatbox[0].scrollHeight);
78
+ }
79
+ }
80
+ $(document).trigger("chat:creado");
81
+
82
+
83
+
84
+
85
  }
86
 
87
  limpiarChat(){
88
+ this.ctx.find(".input-text").val("");
89
  this.recalcularTextarea();
90
+ this.ctx.find(".chat").html("");
91
  }
92
 
93
  manejadorEnviar(){
94
+ let mensaje = this.ctx.find(".input-text").val();
95
  if(mensaje==""){
96
  return false;
97
  }
98
+ $(document).trigger("chat:enviar", {mensaje:mensaje, ctx:this.ctx});
99
  }
100
 
101
  recalcularTextarea(){
102
+ this.ctx.find(".input-box").css("height", "30px");
103
+ let height = parseInt((this.ctx.find(".input-text").prop('scrollHeight')+15)/15)*15;
104
+ this.ctx.find(".input-box").css("height", height+"px");
105
  height -= 30;
106
+ this.ctx.find(".chat").css("--textarea", height+"px");
107
  }
108
 
109
  procesarTexto(texto){
 
126
  return resultado
127
  }
128
 
129
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  respuestaInicio(mensaje){
132
+ this.ctx.find(".input-text").val("");
133
+ this.ctx.find("button").prop("disabled", true);
134
+ this.ctx.find("textarea").prop("disabled", true);
135
  this.mensaje = ""
136
  let clone = this.template.clone();
137
  clone.addClass("me");
 
155
  this.active.find("div p").html(mensaje);
156
  Prism.highlightAllUnder(this.active[0]);
157
  this.active = false;
158
+ this.ctx.find("button").prop("disabled", false);
159
+ this.ctx.find("textarea").prop("disabled", false);
160
+ this.ctx.find("textarea").focus();
161
 
162
  this.chatbox.scrollTop(this.chatbox[0].scrollHeight);
163
  }
 
165
  respuestaFin(){
166
  let msgProcesado = this.procesarTexto(this.mensaje);
167
  this.mensaje = "";
168
+ this.ctx.find("button").prop("disabled", false);
169
+ this.ctx.find("textarea").prop("disabled", false);
170
+ this.ctx.find("textarea").focus();
171
  this.active.find("div p").html(msgProcesado);
172
  Prism.highlightAllUnder(this.active[0]);
173
  this.active = false;
 
175
  }
176
 
177
  respuestaError(error){
178
+ this.ctx.find("button").prop("disabled", false);
179
+ this.ctx.find("textarea").prop("disabled", false);
180
+ this.ctx.find("textarea").focus();
181
  this.active.find("div p").html(error.responseJSON.detail)
182
  switch(error.status){
183
  case 404:
static/main.html CHANGED
@@ -1,38 +1,55 @@
1
  <html>
2
- <head>
3
- <title> Chatbot </title>
4
- <meta name="viewport" content="width=device-width">
5
- <link rel="shortcut icon" href="static/favicon.png" type="image/png">
6
- <link rel="stylesheet" href="static/css/app.css?v={% version %}">
7
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
8
- <link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css" rel="stylesheet" />
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js" integrity="sha512-9khQRAUBYEJDCDVP2yw3LRUQvjJ0Pjx0EShmaQjcHa6AXiOv6qHQu9lCAIR8O+/D8FtaCoJ2c0Tf9Xo7hYH01Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
10
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js" integrity="sha512-SkmBfuA2hqjzEVpmnMt/LINrjop3GKWqsuLSSB3e7iBmYK7JuWw4ldmmxwD9mdm2IRTTi0OxSAfEGvgEi0i2Kw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
11
- <script src="static/js/chatHandler.js?v={% version %}"></script>
12
- <script src="static/js/windowHandler.js?v={% version %}"></script>
13
-
14
- </head>
15
- <body>
16
- <div class="wrapper pag1">
17
- <div class="chat" id="chat"></div>
18
- <div class='input-box'>
19
- <textarea class='input-text' id='input-text' placeholder="Type something" type="text" autofocus=""></textarea>
20
- <button class='input-send' id='input-send' ></button>
21
- <button class='input-delete' id='input-delete' ></button>
22
- </div>
23
- </div>
24
-
25
-
26
-
27
- <script>
28
- let windH = null;
29
- let chatH = null;
30
-
31
- $(document).ready(function() {
32
- chatH = new ChatGPT("{% token %}");
33
- windH = new WindowHandler();
34
- });
35
-
36
- </script>
37
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  </html>
 
1
  <html>
2
+ <head>
3
+ <title> Chatbot </title>
4
+ <meta name="viewport" content="width=device-width">
5
+ <link rel="shortcut icon" href="static/favicon.png" type="image/png">
6
+ <link rel="stylesheet" href="static/css/app.css?v={% version %}">
7
+ <link rel="stylesheet" href="static/css/tabs.css?v={% version %}">
8
+
9
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
10
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css" rel="stylesheet" />
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js" integrity="sha512-9khQRAUBYEJDCDVP2yw3LRUQvjJ0Pjx0EShmaQjcHa6AXiOv6qHQu9lCAIR8O+/D8FtaCoJ2c0Tf9Xo7hYH01Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js" integrity="sha512-SkmBfuA2hqjzEVpmnMt/LINrjop3GKWqsuLSSB3e7iBmYK7JuWw4ldmmxwD9mdm2IRTTi0OxSAfEGvgEi0i2Kw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
13
+ <script src="static/js/tabsHandler.js?v={% version %}"></script>
14
+ <script src="static/js/windowHandler.js?v={% version %}"></script>
15
+ <script src="static/js/chatHandler.js?v={% version %}"></script>
16
+
17
+ </head>
18
+ <body>
19
+
20
+
21
+ <div class="wrapper">
22
+ <div class="tabs">
23
+ <label class="tab-label-add" >
24
+ <div>+</div>
25
+ <input type="button" class="tab-add" id="nuevoChat">
26
+ </label>
27
+ </div>
28
+
29
+
30
+ </div>
31
+
32
+
33
+ <div class="template">
34
+ <label class="tab-label-template">
35
+ <div>Tab </div>
36
+ <input type="radio" name="tabs" class="tab-switch" value=0>
37
+ </label>
38
+ <div class="tab-template">
39
+ <div class="chat"></div>
40
+ <div class='input-box'>
41
+ <textarea class='input-text' placeholder="Type something" type="text" autofocus=""></textarea>
42
+ <button class='input-send' ></button>
43
+ <button class='input-delete' ></button>
44
+ </div>
45
+ </div>
46
+ </div>
47
+
48
+ <script>
49
+ $(document).ready(function() {
50
+ new ChatGPT("{% token %}");
51
+ });
52
+
53
+ </script>
54
+ </body>
55
  </html>