Dev step
Browse files- main.py +0 -2
- static/css/menu.css +105 -1
- static/js/chatHandler.js +1 -1
- templates/main.html +38 -2
main.py
CHANGED
|
@@ -10,7 +10,6 @@ from fastapi.templating import Jinja2Templates
|
|
| 10 |
|
| 11 |
|
| 12 |
app = FastAPI(docs_url=None, redoc_url=None)
|
| 13 |
-
httpsecurity = HTTPBasic()
|
| 14 |
|
| 15 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 16 |
templates = Jinja2Templates(directory="templates")
|
|
@@ -20,7 +19,6 @@ users = json.loads(str(os.getenv("USER_KEYS")).replace("\n", ""))
|
|
| 20 |
fecha_unix = str(int(time.time()))
|
| 21 |
log_module.log_write("master", "iniciado", "-")
|
| 22 |
|
| 23 |
-
|
| 24 |
########################## MAIN ##########################
|
| 25 |
@app.get("/", response_class=HTMLResponse)
|
| 26 |
async def main_page(request: Request):
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
app = FastAPI(docs_url=None, redoc_url=None)
|
|
|
|
| 13 |
|
| 14 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 15 |
templates = Jinja2Templates(directory="templates")
|
|
|
|
| 19 |
fecha_unix = str(int(time.time()))
|
| 20 |
log_module.log_write("master", "iniciado", "-")
|
| 21 |
|
|
|
|
| 22 |
########################## MAIN ##########################
|
| 23 |
@app.get("/", response_class=HTMLResponse)
|
| 24 |
async def main_page(request: Request):
|
static/css/menu.css
CHANGED
|
@@ -1,3 +1,107 @@
|
|
| 1 |
.menu{
|
| 2 |
background-color: #FFF;
|
| 3 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
.menu{
|
| 2 |
background-color: #FFF;
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
dialog#menu{
|
| 6 |
+
width: 380px;
|
| 7 |
+
height: 500px;
|
| 8 |
+
border: solid 1px #000;
|
| 9 |
+
box-shadow: 5px 5px 5px #000A;
|
| 10 |
+
overflow-x: hidden;
|
| 11 |
+
overflow-y: auto;
|
| 12 |
+
padding: 20px;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
dialog#menu .title{
|
| 16 |
+
font-size: 32px;
|
| 17 |
+
margin-top: -15px;
|
| 18 |
+
margin-left: -5px;
|
| 19 |
+
margin-bottom: 20px;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
dialog#menu .item{
|
| 23 |
+
width: 100%;
|
| 24 |
+
display: grid;
|
| 25 |
+
align-items: center;
|
| 26 |
+
grid-template-columns: 165px auto;
|
| 27 |
+
margin-bottom: 10px;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
dialog#menu hr{
|
| 31 |
+
margin: 15px -5px;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
dialog#menu .item .switch {
|
| 35 |
+
--secondary-container: #3a4b39;
|
| 36 |
+
--primary: #84da89;
|
| 37 |
+
font-size: 17px;
|
| 38 |
+
position: relative;
|
| 39 |
+
display: inline-block;
|
| 40 |
+
width: 3.7em;
|
| 41 |
+
height: 1.8em;
|
| 42 |
+
zoom: 0.6;
|
| 43 |
+
margin: auto;
|
| 44 |
+
}
|
| 45 |
+
dialog#menu .item .switch input {
|
| 46 |
+
display: none;
|
| 47 |
+
opacity: 0;
|
| 48 |
+
width: 0;
|
| 49 |
+
height: 0;
|
| 50 |
+
}
|
| 51 |
+
dialog#menu .item .slider {
|
| 52 |
+
position: absolute;
|
| 53 |
+
cursor: pointer;
|
| 54 |
+
top: 0;
|
| 55 |
+
left: 0;
|
| 56 |
+
right: 0;
|
| 57 |
+
bottom: 0;
|
| 58 |
+
background-color: #313033;
|
| 59 |
+
transition: 0.2s;
|
| 60 |
+
border-radius: 30px;
|
| 61 |
+
}
|
| 62 |
+
dialog#menu .item .slider:before {
|
| 63 |
+
position: absolute;
|
| 64 |
+
content: "";
|
| 65 |
+
height: 1.4em;
|
| 66 |
+
width: 1.4em;
|
| 67 |
+
border-radius: 20px;
|
| 68 |
+
left: 0.2em;
|
| 69 |
+
bottom: 0.2em;
|
| 70 |
+
background-color: #aeaaae;
|
| 71 |
+
transition: 0.4s;
|
| 72 |
+
}
|
| 73 |
+
dialog#menu .item input:checked + .slider::before {
|
| 74 |
+
background-color: var(--primary);
|
| 75 |
+
}
|
| 76 |
+
dialog#menu .item input:checked + .slider {
|
| 77 |
+
background-color: var(--secondary-container);
|
| 78 |
+
}
|
| 79 |
+
dialog#menu .item input:focus + .slider {
|
| 80 |
+
box-shadow: 0 0 1px var(--secondary-container);
|
| 81 |
+
}
|
| 82 |
+
dialog#menu .item input:checked + .slider:before {
|
| 83 |
+
transform: translateX(1.9em);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
dialog#menu .item label{
|
| 87 |
+
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
dialog#menu .item input{
|
| 91 |
+
outline: none;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
dialog#menu .item input[type=text]{
|
| 95 |
+
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
dialog#menu .item .range{
|
| 99 |
+
width: 100%;
|
| 100 |
+
display: grid;
|
| 101 |
+
align-items: center;
|
| 102 |
+
grid-template-columns: auto 40px;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
dialog#menu .item .range span{
|
| 106 |
+
text-align: right;
|
| 107 |
+
}
|
static/js/chatHandler.js
CHANGED
|
@@ -56,7 +56,7 @@ class ChatGPT{
|
|
| 56 |
// Se crea el nuevo manejador de ventana
|
| 57 |
let uuid = this.generateRandID()
|
| 58 |
this.windowHandlers[index||uuid] = new WindowHandler(
|
| 59 |
-
conversacion||this.definicion,
|
| 60 |
index||uuid,
|
| 61 |
this
|
| 62 |
);
|
|
|
|
| 56 |
// Se crea el nuevo manejador de ventana
|
| 57 |
let uuid = this.generateRandID()
|
| 58 |
this.windowHandlers[index||uuid] = new WindowHandler(
|
| 59 |
+
conversacion||JSON.parse(JSON.stringify(this.definicion)),
|
| 60 |
index||uuid,
|
| 61 |
this
|
| 62 |
);
|
templates/main.html
CHANGED
|
@@ -9,7 +9,6 @@
|
|
| 9 |
<link rel="stylesheet" href="static/css/tabs.css?v={{ version }}">
|
| 10 |
<link rel="stylesheet" href="static/css/menu.css?v={{ version }}">
|
| 11 |
|
| 12 |
-
|
| 13 |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
| 14 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css" rel="stylesheet" />
|
| 15 |
<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>
|
|
@@ -76,17 +75,54 @@
|
|
| 76 |
|
| 77 |
|
| 78 |
<dialog class="menu" id="menu">
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
</dialog>
|
| 81 |
|
| 82 |
<script>
|
|
|
|
| 83 |
var cHand;
|
| 84 |
$(document).ready(function() {
|
|
|
|
| 85 |
cHand = new ChatGPT("{{ token }}");
|
| 86 |
});
|
| 87 |
let versionLocal = localStorage.getItem("version")
|
| 88 |
let versionRemota = "{{ version }}"
|
| 89 |
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
|
| 92 |
</script>
|
|
|
|
| 9 |
<link rel="stylesheet" href="static/css/tabs.css?v={{ version }}">
|
| 10 |
<link rel="stylesheet" href="static/css/menu.css?v={{ version }}">
|
| 11 |
|
|
|
|
| 12 |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
| 13 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css" rel="stylesheet" />
|
| 14 |
<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>
|
|
|
|
| 75 |
|
| 76 |
|
| 77 |
<dialog class="menu" id="menu">
|
| 78 |
+
<div class="title">
|
| 79 |
+
Configuración
|
| 80 |
+
</div>
|
| 81 |
+
<div class="item">
|
| 82 |
+
<label for="temperature">Temperatura:</label>
|
| 83 |
+
<input id="temperature" type="range" min=0 max=1 value=0.5 step=0.01>
|
| 84 |
+
</div>
|
| 85 |
+
<div class="item">
|
| 86 |
+
<label for="frequency_penalty">Frequency penalty:</label>
|
| 87 |
+
<div class="range">
|
| 88 |
+
<input id="frequency_penalty" type="range" min=-1 max=1 value=0 step=0.01>
|
| 89 |
+
<span>12</span>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
<div class="item">
|
| 93 |
+
<label for="presence_penalty">Presence penalty:</label>
|
| 94 |
+
<div class="range">
|
| 95 |
+
<input id="presence_penalty" type="range" min=-1 max=1 value=0 step=0.01>
|
| 96 |
+
<span>12</span>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
<hr>
|
| 100 |
+
<div class="item">
|
| 101 |
+
<label for="use_tool">Usar herramientas:</label>
|
| 102 |
+
<label class="switch">
|
| 103 |
+
<input type="checkbox">
|
| 104 |
+
<span class="slider"></span>
|
| 105 |
+
</label>
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
</dialog>
|
| 112 |
|
| 113 |
<script>
|
| 114 |
+
|
| 115 |
var cHand;
|
| 116 |
$(document).ready(function() {
|
| 117 |
+
$("#menu")[0].showModal();
|
| 118 |
cHand = new ChatGPT("{{ token }}");
|
| 119 |
});
|
| 120 |
let versionLocal = localStorage.getItem("version")
|
| 121 |
let versionRemota = "{{ version }}"
|
| 122 |
|
| 123 |
+
$(".range input").on("input", function(){
|
| 124 |
+
$(this).parent().find("span").text((Math.round(this.value * 100) / 100).toFixed(2));
|
| 125 |
+
})
|
| 126 |
|
| 127 |
|
| 128 |
</script>
|