MGLDZM commited on
Commit
c9dc71a
1 Parent(s): 45d3058

Cambios pueba

Browse files
.gitignore CHANGED
@@ -1 +1,3 @@
1
  .history/
 
 
 
1
  .history/
2
+ .vscode/
3
+ __pycache__/
main.py CHANGED
@@ -1,83 +1,79 @@
1
- from fastapi import FastAPI, Request, staticfiles
2
- from fastapi.responses import HTMLResponse
3
- import os
 
 
 
 
 
4
  import openai
5
- import sqlite3
 
6
 
7
  app = FastAPI()
8
- conn = sqlite3.connect("database.db")
 
9
  app.mount("/static", staticfiles.StaticFiles(directory="static"), name="static")
10
 
11
- supp_langs = [
12
- "markup", "html", "xml", "svg", "mathml", "ssml", "atom", "rss", "css",
13
- "clike", "javascript", "js", "abap", "abnf", "actionscript", "ada", "agda",
14
- "al", "antlr4", "g4", "apacheconf", "apex", "apl", "applescript", "aql",
15
- "arduino", "ino", "arff", "armasm", "arm-asm", "arturo", "art", "asciidoc",
16
- "adoc", "aspnet", "asm6502", "asmatmel", "autohotkey", "autoit", "avisynth",
17
- "avs", "avro-idl", "avdl", "awk", "gawk", "bash", "sh", "shell", "basic",
18
- "batch", "bbcode", "shortcode", "bbj", "bicep", "birb", "bison", "bnf",
19
- "rbnf", "bqn", "brainfuck", "brightscript", "bro", "bsl", "oscript", "c",
20
- "csharp", "cs", "dotnet", "cpp", "cfscript", "cfc", "chaiscript", "cil",
21
- "cilkc", "cilk-c", "cilkcpp", "cilk-cpp", "cilk", "clojure", "cmake", "cobol",
22
- "coffeescript", "coffee", "concurnas", "conc", "csp", "cooklang", "coq",
23
- "crystal", "css-extras", "csv", "cue", "cypher", "d", "dart", "dataweave",
24
- "dax", "dhall", "diff", "django", "jinja2", "dns-zone-file", "dns-zone",
25
- "docker", "dockerfile", "dot", "gv", "ebnf", "editorconfig", "eiffel", "ejs",
26
- "eta", "elixir", "elm", "etlua", "erb", "erlang", "excel-formula", "xlsx", "xls",
27
- "fsharp", "factor", "false", "firestore-security-rules", "flow", "fortran", "ftl",
28
- "gml", "gamemakerlanguage", "gap", "gcode", "gdscript", "gedcom", "gettext", "po",
29
- "gherkin", "git", "glsl", "gn", "gni", "linker-script", "ld", "go", "go-module",
30
- "go-mod", "gradle", "graphql", "groovy", "haml", "handlebars", "hbs", "mustache",
31
- "haskell", "hs", "haxe", "hcl", "hlsl", "hoon", "http", "hpkp", "hsts", "ichigojam",
32
- "icon", "icu-message-format", "idris", "idr", ".ignore", "gitignore", "hgignore",
33
- "npmignore", "inform7", "ini", "io", "j", "java", "javadoc", "javadoclike",
34
- "javastacktrace", "jexl", "jolie", "jq", "jsdoc", "js-extras", "json", "webmanifest",
35
- "json5", "jsonp", "jsstacktrace", "js-templates", "julia", "keepalived", "keyman",
36
- "kotlin", "kt", "kts", "kumir", "kum", "kusto", "latex", "tex", "context", "latte",
37
- "less", "lilypond", "ly", "liquid", "lisp", "emacs", "elisp", "emacs-lisp",
38
- "livescript", "llvm", "log", "lolcode", "lua", "magma", "makefile", "markdown", "md",
39
- "markup-templating", "mata", "matlab", "maxscript", "mel", "mermaid", "metafont",
40
- "mizar", "mongodb", "monkey", "moonscript", "moon", "n1ql", "n4js", "n4jsd",
41
- "nand2tetris-hdl", "naniscript", "nani", "nasm", "neon", "nevod", "nginx", "nim",
42
- "nix", "nsis", "objectivec", "objc", "ocaml", "odin", "opencl", "openqasm", "qasm",
43
- "oz", "parigp", "parser", "pascal", "objectpascal", "pascaligo", "psl", "pcaxis",
44
- "px", "peoplecode", "pcode", "perl", "php", "phpdoc", "php-extras", "plant-uml",
45
- "plantuml", "plsql", "powerquery", "pq", "mscript", "powershell", "processing",
46
- "prolog", "promql", ".properties", "protobuf", "pug", "puppet", "pure", "purebasic",
47
- "pbfasm", "purescript", "purs", "python", "py", "qsharp", "qs", "q", "qml", "qore",
48
- "r", "racket", "rkt", "cshtml", "razor", "jsx", "tsx", "reason", "regex", "rego",
49
- "renpy", "rpy", "rescript", "res", "rest", "rip", "roboconf", "robotframework",
50
- "robot", "ruby", "rb", "rust", "sas", "sass", "scss", "scala", "scheme",
51
- "shell-session", "sh-session", "shellsession", "smali", "smalltalk", "smarty", "sml",
52
- "smlnj", "solidity", "sol", "solution-file", "sln", "soy", "sparql", "rq",
53
- "splunk-spl", "sqf", "sql", "squirrel", "stan", "stata", "iecst", "stylus",
54
- "supercollider", "sclang", "swift", "systemd", "t4-templating", "t4-cs", "t4",
55
- "t4-vb", "tap", "tcl", "tt2", "textile", "toml", "tremor", "trickle", "troy",
56
- "turtle", "trig", "twig", "typescript", "ts", "typoscript", "tsconfig",
57
- "unrealscript", "uscript", "uc", "uorazor", "uri", "url", "v", "vala", "vbnet",
58
- "velocity", "verilog", "vhdl", "vim", "visual-basic", "vb", "vba", "warpscript",
59
- "wasm", "web-idl", "webidl", "wgsl", "wiki", "wolfram", "mathematica", "nb", "wl",
60
- "wren", "xeora", "xeoracube", "xml-doc", "xojo", "xquery", "yaml", "yml", "yang",
61
- "zig"]
62
 
 
 
 
63
  @app.get("/", response_class=HTMLResponse)
64
- async def root(request: Request):
65
- with open(os.path.join("static", "main.html")) as f:
66
- return HTMLResponse(f.read())
 
 
67
 
 
68
  @app.post("/chat")
69
- async def chat(request: Request):
70
- data = await request.json()
71
- messages = data["messages"]
72
  openai.api_key = str(os.getenv("OPENAI_API_KEY"))
73
  model_engine = "gpt-3.5-turbo"
 
74
  response = openai.ChatCompletion.create(
75
  model=model_engine,
76
  messages=messages,
77
  max_tokens=3000,
78
  temperature=1,
79
  frequency_penalty=0,
80
- presence_penalty=0
 
81
  )
82
 
83
  message = response.choices[0].message.content
@@ -93,7 +89,17 @@ async def chat(request: Request):
93
  message = message.replace("```", '<pre>', 1)
94
  message = message.replace("```", "</pre>", 1)
95
 
96
-
97
  message = message.replace("\n", "<br>")
98
  messages.append({"role": "assistant", "content": message})
99
- return messages
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, Request, staticfiles, Depends, HTTPException, status
2
+ from fastapi.responses import HTMLResponse, StreamingResponse
3
+
4
+ from fastapi.security import HTTPBasic, HTTPBasicCredentials
5
+ import os, json
6
+ from datetime import datetime, timedelta
7
+ from typing import Optional
8
+ import jwt
9
  import openai
10
+
11
+ from supported import supp_langs
12
 
13
  app = FastAPI()
14
+ security = HTTPBasic()
15
+
16
  app.mount("/static", staticfiles.StaticFiles(directory="static"), name="static")
17
 
18
+ users = {}
19
+
20
+ JWT_SECRET = "mysecret"
21
+ JWT_ALGORITHM = "HS256"
22
+ JWT_EXPIRATION_TIME_MINUTES = 30
23
+
24
+ def create_jwt_token(data):
25
+ to_encode = {"data": data}
26
+ expire = datetime.utcnow() + timedelta(minutes=JWT_EXPIRATION_TIME_MINUTES)
27
+ to_encode.update({"exp": expire})
28
+ encoded_jwt = jwt.encode(to_encode, JWT_SECRET, algorithm=JWT_ALGORITHM)
29
+ return encoded_jwt
30
+
31
+ async def validate_token(request: Request):
32
+ data = {}
33
+ try:
34
+ data = await request.json()
35
+ token = data.pop("token")
36
+ payload = jwt.decode(token, JWT_SECRET, algorithms=[JWT_ALGORITHM])
37
+ data["token_data"] = payload["data"]
38
+ except:
39
+ raise HTTPException(status_code=404, detail="Datos no válidos")
40
+ return data
41
+
42
+ def authenticate_user(credentials: HTTPBasicCredentials):
43
+ correct_username = "user"
44
+ correct_password = "password"
45
+
46
+ if credentials.username != correct_username or credentials.password != correct_password:
47
+ raise HTTPException(
48
+ status_code=status.HTTP_401_UNAUTHORIZED,
49
+ detail="Incorrect username or password",
50
+ headers={"WWW-Authenticate": "Basic"},
51
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ return True
54
+
55
+
56
  @app.get("/", response_class=HTMLResponse)
57
+ async def root(request: Request, credentials: HTTPBasicCredentials = Depends(security)):
58
+ if authenticate_user(credentials):
59
+ token = create_jwt_token({"user":credentials.username})
60
+ with open(os.path.join("static", "main.html")) as f:
61
+ return HTMLResponse(f.read().replace("{% token %}", token))
62
 
63
+
64
  @app.post("/chat")
65
+ async def chat(data = Depends(validate_token)):
 
 
66
  openai.api_key = str(os.getenv("OPENAI_API_KEY"))
67
  model_engine = "gpt-3.5-turbo"
68
+ messages = data["messages"]
69
  response = openai.ChatCompletion.create(
70
  model=model_engine,
71
  messages=messages,
72
  max_tokens=3000,
73
  temperature=1,
74
  frequency_penalty=0,
75
+ presence_penalty=0,
76
+ # stream=True
77
  )
78
 
79
  message = response.choices[0].message.content
 
89
  message = message.replace("```", '<pre>', 1)
90
  message = message.replace("```", "</pre>", 1)
91
 
92
+
93
  message = message.replace("\n", "<br>")
94
  messages.append({"role": "assistant", "content": message})
95
+ token = create_jwt_token(data.pop("token_data"))
96
+ return {"messages": messages, "token": token}
97
+
98
+ # async def content_iterator():
99
+ # # haz aquí el llamado a la función openai.ChatCompletion() para obtener los datos segmentados
100
+ # # y conviértelos en bytes
101
+ # for chunk in response:
102
+ # data = json.dumps(chunk.to_dict())
103
+ # yield data.encode()
104
+ # headers ={"Transfer-Encoding": "chunked"}
105
+ # return StreamingResponse(content=content_iterator(), headers=headers)
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  fastapi==0.74.*
2
  requests==2.27.*
3
  openai==0.27.*
4
- uvicorn[standard]==0.17.*
 
 
1
  fastapi==0.74.*
2
  requests==2.27.*
3
  openai==0.27.*
4
+ uvicorn[standard]==0.17.*
5
+ jwt==1.3.*
static/css/app.css CHANGED
@@ -14,21 +14,19 @@ body {
14
 
15
  .wrapper {
16
  padding: 20px 20px 80px 20px;
17
- height: 80vh;
18
- border-radius: 10px;
19
  border-bottom: 5px solid #222f3d;
20
  background: #34495e;
21
- margin: auto;
22
- min-width: 400px;
23
- max-width: 650px;
24
- width: 80%;
25
  }
26
 
27
  .chat {
 
28
  border-radius: 5px;
29
  display: block;
30
  width: 100%;
31
- height: 100%;
32
  overflow-y: scroll;
33
  overflow-x: hidden;
34
  background: rgb(161, 161, 161);
@@ -37,8 +35,8 @@ body {
37
 
38
  .chat .message {
39
  display: flex;
40
- margin: 10px 0 0 10px;
41
- filter: opacity(0.5);
42
  }
43
 
44
  .chat .message:last-child {
@@ -72,22 +70,6 @@ body {
72
  padding: 0 8px 0 0;
73
  }
74
 
75
- .chat .message div:before {
76
- position: relative;
77
- float: left;
78
- content: '';
79
- margin: 7px 0 0 -8px;
80
- border-style: solid;
81
- border-width: 8px 8px 8px 0;
82
- border-color: transparent #fff transparent transparent;
83
- }
84
-
85
- .chat .message.me div:before {
86
- float: right;
87
- margin: 7px -8px 0 0;
88
- border-width: 8px 0 8px 8px;
89
- border-color: transparent transparent transparent #fff;
90
- }
91
 
92
  .chat .message div p {
93
  display: inline-block;
@@ -101,6 +83,14 @@ body {
101
 
102
  .chat .message.me div p {
103
  float: right;
 
 
 
 
 
 
 
 
104
  }
105
 
106
  .chat .message div p ul {
@@ -128,7 +118,7 @@ body {
128
  border-radius: 5px;
129
  }
130
 
131
- .input-box input,
132
  .input-box button {
133
  height: 100%;
134
  margin: 0;
@@ -143,25 +133,39 @@ body {
143
  .input-box .input-text {
144
  width: 100%;
145
  border-radius: 5px 0 0 5px;
 
 
 
 
146
  }
147
 
148
- .input-box .input-context {
149
- border-radius: 0 5px 5px 0;
150
  width: 30px;
151
- border-left: solid 1px #777;
152
- background-image: url(/static/chatbot_client/img/collapse-up.svg);
153
- background-color: #555;
 
 
154
  }
155
-
156
- .input-box .input-context.open {
157
  border-radius: 0 5px 5px 0;
158
  width: 30px;
159
- border-left: solid 1px #777;
160
- background-image: url(/static/chatbot_client/img/expand-down.svg);
161
- background-color: #555;
 
 
 
162
  }
 
 
 
163
 
164
-
 
 
 
 
165
  /* payload */
166
 
167
  .payload-column {
 
14
 
15
  .wrapper {
16
  padding: 20px 20px 80px 20px;
 
 
17
  border-bottom: 5px solid #222f3d;
18
  background: #34495e;
19
+ margin: 0;
20
+ min-width: 320px;
21
+ width: 100%;
 
22
  }
23
 
24
  .chat {
25
+ --textarea: 0px;
26
  border-radius: 5px;
27
  display: block;
28
  width: 100%;
29
+ height: calc( 100% - var(--textarea) );
30
  overflow-y: scroll;
31
  overflow-x: hidden;
32
  background: rgb(161, 161, 161);
 
35
 
36
  .chat .message {
37
  display: flex;
38
+ padding: 10px 0 0 10px;
39
+ filter: opacity(0.9);
40
  }
41
 
42
  .chat .message:last-child {
 
70
  padding: 0 8px 0 0;
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  .chat .message div p {
75
  display: inline-block;
 
83
 
84
  .chat .message.me div p {
85
  float: right;
86
+ background: #b4c2ff;
87
+ }
88
+
89
+ .chat .message.warning {
90
+ background: #f0e370;
91
+ }
92
+ .chat .message.error {
93
+ background: #f09470;
94
  }
95
 
96
  .chat .message div p ul {
 
118
  border-radius: 5px;
119
  }
120
 
121
+ .input-box textarea,
122
  .input-box button {
123
  height: 100%;
124
  margin: 0;
 
133
  .input-box .input-text {
134
  width: 100%;
135
  border-radius: 5px 0 0 5px;
136
+ resize: none;
137
+ border-top: solid 7px #fff;
138
+ border-bottom: solid 7px #fff;
139
+
140
  }
141
 
142
+ .input-box .input-send {
 
143
  width: 30px;
144
+ background-image: url(/static/img/send.png);
145
+ background-size: 20px;
146
+ background-color: #ddd;
147
+ background-repeat: no-repeat;
148
+ background-position: center;
149
  }
150
+ .input-box .input-delete {
 
151
  border-radius: 0 5px 5px 0;
152
  width: 30px;
153
+ border-left: solid 1px #555;
154
+ background-image: url(/static/img/delete.png);
155
+ background-size: 20px;
156
+ background-color: #ddd;
157
+ background-repeat: no-repeat;
158
+ background-position: center;
159
  }
160
+ .input-box .input-send:disabled, .input-box .input-delete:disabled{
161
+ background-color: #8b8b8b;
162
+ border-color: #8b8b8b;
163
 
164
+ }
165
+ .input-box .input-text:disabled{
166
+ background-color: #8b8b8b;
167
+ border-color: #8b8b8b;
168
+ }
169
  /* payload */
170
 
171
  .payload-column {
static/img/Chat Button.png DELETED
Binary file (2.2 kB)
 
static/img/Code Button.png DELETED
Binary file (1.56 kB)
 
static/img/collapse-up.svg DELETED
static/img/delete.png ADDED
static/img/expand-down.svg DELETED
static/img/map-bank.png DELETED
Binary file (111 kB)
 
static/img/map-cuisine.png DELETED
Binary file (109 kB)
 
static/img/map-gas.png DELETED
Binary file (110 kB)
 
static/img/map-restaurant.png DELETED
Binary file (109 kB)
 
static/img/map-restrooms.png DELETED
Binary file (111 kB)
 
static/img/marker_image.png DELETED
Binary file (250 Bytes)
 
static/img/send.png ADDED
static/js/main.js CHANGED
@@ -1,44 +1,104 @@
1
  let messages=[];
2
  $(document).ready(function() {
3
- // Función para enviar el mensaje al servidor al presionar enter en el input
4
- $("#input-text").keypress(function(event) {
5
- if (event.which == 13) {
 
 
 
 
 
 
6
  event.preventDefault();
7
- var message = $("#input-text").val();
8
- $("#input-text").prop("disabled", true);
9
- $("#input-text").val("");
10
- sendMessage(message);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
 
 
 
 
12
  });
13
 
14
- // Función para enviar el mensaje al servidor mediante POST y mostrar la respuesta
15
- function sendMessage(message) {
16
- // Agregar el mensaje enviado al elemento con id "payload-request"
17
- var request_clone = $("#payload-request").clone();
18
- request_clone.find("div p").text(message);
19
- request_clone.removeAttr("id")
20
- $("#chat").append(request_clone);
21
- messages.push({role:"user", content:message})
22
- // Realizar la petición POST al endpoint /chat
23
- $.ajax({
24
- url: "/chat",
25
- type: "POST",
26
- data: JSON.stringify({messages: messages}),
27
- success: function(data) {
28
-
29
- // Clonar el elemento con id "payload-response" y agregarlo al elemento con id "chat"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  var response_clone = $("#payload-response").clone();
31
- response_clone.find("div p").html(data.slice(-1)[0].content);
32
  response_clone.removeAttr("id")
 
33
  $("#chat").append(response_clone);
34
-
35
- // Hacer scroll al fondo del elemento con id "chat"
36
  $("#chat").scrollTop($("#chat")[0].scrollHeight);
37
-
38
- $("#input-text").prop("disabled", false);
39
- messages = data
40
- },
41
-
42
- });
43
- }
44
- });
 
 
 
 
 
 
 
1
  let messages=[];
2
  $(document).ready(function() {
3
+ if (localStorage.getItem("miObjeto") !== null) {
4
+ // Acceder a "miObjeto" y hacer algo con él
5
+ messages = JSON.parse(localStorage.getItem("messages"));
6
+ cargarChat();
7
+ }
8
+ $("#input-text").keyup(recaularTextbox);
9
+ $("#input-text").keydown(recaularTextbox);
10
+ $("#input-text").keypress(function(event){
11
+ if (!event.shiftKey && event.keyCode === 13) {
12
  event.preventDefault();
13
+ sendMessage();
14
+ }
15
+ })
16
+ $("#input-send").click(function(event) {
17
+ event.preventDefault();
18
+ sendMessage();
19
+ });
20
+ });
21
+ function recaularTextbox(event){
22
+ let rows = $('#input-text').val().split('\n').length;
23
+ rows = rows < 1?1:rows;
24
+ let height = rows*15+15;
25
+ $(".input-box").css("height", height+"px");
26
+ height -= 30;
27
+ $(".chat").css("--textarea", height+"px");
28
+ }
29
+ function cargarChat() {
30
+ messages.forEach(function(value, index, arr){
31
+ let clone = null;
32
+ if(value.role==user){
33
+ clone = $("#payload-request").clone();
34
+ }else{
35
+ clone = $("#payload-response").clone();
36
  }
37
+ clone.find("div p").text(value.content);
38
+ clone.removeAttr("id")
39
+ $("#chat").append(clone);
40
+ $("#chat").scrollTop($("#chat")[0].scrollHeight);
41
  });
42
 
43
+ }
44
+ // Función para enviar el mensaje al servidor mediante POST y mostrar la respuesta
45
+ function sendMessage() {
46
+ var message = $("#input-text").val();
47
+ if(message==""){
48
+ return false;
49
+ }
50
+ $("#input-text").val("");
51
+ $("button").prop("disabled", true);
52
+ $("#input-text").prop("disabled", true);
53
+ // Agregar el mensaje enviado al elemento con id "payload-request"
54
+ var request_clone = $("#payload-request").clone();
55
+ request_clone.find("div p").html(message.replace(/\n/g, "<br>"));
56
+ request_clone.removeAttr("id")
57
+ $("#chat").append(request_clone);
58
+ messages.push({role:"user", content:message})
59
+ // Realizar la petición POST al endpoint /chat
60
+ let xhr = $.ajax({
61
+ url: "/chat",
62
+ type: "POST",
63
+ data: JSON.stringify({
64
+ messages: messages,
65
+ token: token
66
+ }),
67
+ success: function(data) {
68
+ // Clonar el elemento con id "payload-response" y agregarlo al elemento con id "chat"
69
+ token = data.token
70
+ var response_clone = $("#payload-response").clone();
71
+ response_clone.find("div p").html(data.messages.slice(-1)[0].content);
72
+ response_clone.removeAttr("id")
73
+ $("#chat").append(response_clone);
74
+
75
+ // Hacer scroll al fondo del elemento con id "chat"
76
+ $("#chat").scrollTop($("#chat")[0].scrollHeight);
77
+
78
+ $("button").prop("disabled", false);
79
+ $("#input-text").prop("disabled", false);
80
+ messages = data.messages
81
+ localStorage.setItem("messages", JSON.stringify(messages));
82
+ },
83
+ error: function(xhr, textStatus, errorThrown) {
84
+ if (xhr.status == 404) {
85
  var response_clone = $("#payload-response").clone();
86
+ response_clone.find("div p").html("Se venció el token o algo así, recaga la página 🤦‍♂️");
87
  response_clone.removeAttr("id")
88
+ response_clone.addClass("warning")
89
  $("#chat").append(response_clone);
 
 
90
  $("#chat").scrollTop($("#chat")[0].scrollHeight);
91
+ } else {
92
+ var response_clone = $("#payload-response").clone();
93
+ response_clone.find("div p").html("No se que pasó 🙄 busca a Miguel y peguntale (probablemente tampoco sepa, pero es mejor que nada)");
94
+ response_clone.removeAttr("id")
95
+ response_clone.addClass("error")
96
+ $("#chat").append(response_clone);
97
+ $("#chat").scrollTop($("#chat")[0].scrollHeight);
98
+ }
99
+ }
100
+
101
+
102
+ });
103
+
104
+ }
static/main.html CHANGED
@@ -6,25 +6,27 @@
6
  <link rel="stylesheet" href="static/css/app.css">
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/main.js"></script>
12
- </head>
13
- <body>
14
-
15
- <div class="wrapper">
16
  <div class="chat" id="chat">
17
-
18
  </div>
19
-
20
  <div class='input-box'>
21
- <input class='input-text' id='input-text' placeholder="Type something" type="text" autofocus="">
22
- <button class='input-context' id='input-context' ></button>
 
23
  </div>
24
-
25
  <div id="payload-request" class="payload message me"><div><p></p></div></div>
26
  <div id="payload-response" class="payload message"><div><p></p></div></div>
27
  </div>
28
 
 
 
29
  </body>
30
  </html>
 
6
  <link rel="stylesheet" href="static/css/app.css">
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>let token = "{% token %}";</script>
 
10
  <script src="static/js/main.js"></script>
11
+ </head>
12
+ <body>
13
+
14
+ <div class="wrapper">
15
  <div class="chat" id="chat">
16
+
17
  </div>
18
+
19
  <div class='input-box'>
20
+ <textarea class='input-text' id='input-text' placeholder="Type something" type="text" autofocus=""></textarea>
21
+ <button class='input-send' id='input-send' ></button>
22
+ <button class='input-delete' id='input-delete' ></button>
23
  </div>
24
+
25
  <div id="payload-request" class="payload message me"><div><p></p></div></div>
26
  <div id="payload-response" class="payload message"><div><p></p></div></div>
27
  </div>
28
 
29
+ <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>
30
+ <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>
31
  </body>
32
  </html>
supported.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ supp_langs = [
2
+ "markup", "html", "xml", "svg", "mathml", "ssml", "atom", "rss", "css",
3
+ "clike", "javascript", "js", "abap", "abnf", "actionscript", "ada", "agda",
4
+ "al", "antlr4", "g4", "apacheconf", "apex", "apl", "applescript", "aql",
5
+ "arduino", "ino", "arff", "armasm", "arm-asm", "arturo", "art", "asciidoc",
6
+ "adoc", "aspnet", "asm6502", "asmatmel", "autohotkey", "autoit", "avisynth",
7
+ "avs", "avro-idl", "avdl", "awk", "gawk", "bash", "sh", "shell", "basic",
8
+ "batch", "bbcode", "shortcode", "bbj", "bicep", "birb", "bison", "bnf",
9
+ "rbnf", "bqn", "brainfuck", "brightscript", "bro", "bsl", "oscript", "c",
10
+ "csharp", "cs", "dotnet", "cpp", "cfscript", "cfc", "chaiscript", "cil",
11
+ "cilkc", "cilk-c", "cilkcpp", "cilk-cpp", "cilk", "clojure", "cmake", "cobol",
12
+ "coffeescript", "coffee", "concurnas", "conc", "csp", "cooklang", "coq",
13
+ "crystal", "css-extras", "csv", "cue", "cypher", "d", "dart", "dataweave",
14
+ "dax", "dhall", "diff", "django", "jinja2", "dns-zone-file", "dns-zone",
15
+ "docker", "dockerfile", "dot", "gv", "ebnf", "editorconfig", "eiffel", "ejs",
16
+ "eta", "elixir", "elm", "etlua", "erb", "erlang", "excel-formula", "xlsx", "xls",
17
+ "fsharp", "factor", "false", "firestore-security-rules", "flow", "fortran", "ftl",
18
+ "gml", "gamemakerlanguage", "gap", "gcode", "gdscript", "gedcom", "gettext", "po",
19
+ "gherkin", "git", "glsl", "gn", "gni", "linker-script", "ld", "go", "go-module",
20
+ "go-mod", "gradle", "graphql", "groovy", "haml", "handlebars", "hbs", "mustache",
21
+ "haskell", "hs", "haxe", "hcl", "hlsl", "hoon", "http", "hpkp", "hsts", "ichigojam",
22
+ "icon", "icu-message-format", "idris", "idr", ".ignore", "gitignore", "hgignore",
23
+ "npmignore", "inform7", "ini", "io", "j", "java", "javadoc", "javadoclike",
24
+ "javastacktrace", "jexl", "jolie", "jq", "jsdoc", "js-extras", "json", "webmanifest",
25
+ "json5", "jsonp", "jsstacktrace", "js-templates", "julia", "keepalived", "keyman",
26
+ "kotlin", "kt", "kts", "kumir", "kum", "kusto", "latex", "tex", "context", "latte",
27
+ "less", "lilypond", "ly", "liquid", "lisp", "emacs", "elisp", "emacs-lisp",
28
+ "livescript", "llvm", "log", "lolcode", "lua", "magma", "makefile", "markdown", "md",
29
+ "markup-templating", "mata", "matlab", "maxscript", "mel", "mermaid", "metafont",
30
+ "mizar", "mongodb", "monkey", "moonscript", "moon", "n1ql", "n4js", "n4jsd",
31
+ "nand2tetris-hdl", "naniscript", "nani", "nasm", "neon", "nevod", "nginx", "nim",
32
+ "nix", "nsis", "objectivec", "objc", "ocaml", "odin", "opencl", "openqasm", "qasm",
33
+ "oz", "parigp", "parser", "pascal", "objectpascal", "pascaligo", "psl", "pcaxis",
34
+ "px", "peoplecode", "pcode", "perl", "php", "phpdoc", "php-extras", "plant-uml",
35
+ "plantuml", "plsql", "powerquery", "pq", "mscript", "powershell", "processing",
36
+ "prolog", "promql", ".properties", "protobuf", "pug", "puppet", "pure", "purebasic",
37
+ "pbfasm", "purescript", "purs", "python", "py", "qsharp", "qs", "q", "qml", "qore",
38
+ "r", "racket", "rkt", "cshtml", "razor", "jsx", "tsx", "reason", "regex", "rego",
39
+ "renpy", "rpy", "rescript", "res", "rest", "rip", "roboconf", "robotframework",
40
+ "robot", "ruby", "rb", "rust", "sas", "sass", "scss", "scala", "scheme",
41
+ "shell-session", "sh-session", "shellsession", "smali", "smalltalk", "smarty", "sml",
42
+ "smlnj", "solidity", "sol", "solution-file", "sln", "soy", "sparql", "rq",
43
+ "splunk-spl", "sqf", "sql", "squirrel", "stan", "stata", "iecst", "stylus",
44
+ "supercollider", "sclang", "swift", "systemd", "t4-templating", "t4-cs", "t4",
45
+ "t4-vb", "tap", "tcl", "tt2", "textile", "toml", "tremor", "trickle", "troy",
46
+ "turtle", "trig", "twig", "typescript", "ts", "typoscript", "tsconfig",
47
+ "unrealscript", "uscript", "uc", "uorazor", "uri", "url", "v", "vala", "vbnet",
48
+ "velocity", "verilog", "vhdl", "vim", "visual-basic", "vb", "vba", "warpscript",
49
+ "wasm", "web-idl", "webidl", "wgsl", "wiki", "wolfram", "mathematica", "nb", "wl",
50
+ "wren", "xeora", "xeoracube", "xml-doc", "xojo", "xquery", "yaml", "yml", "yang",
51
+ "zig"]