Upload folder using huggingface_hub
Browse files- static/css/ragrqs.min.css +1 -1
- static/help0.html +3 -2
- static/javascript/rag_data_mgr.js +6 -2
- static/javascript/rag_env.js +14 -0
- static/javascript/rag_http.js +1 -15
- static/javascript/rag_mgr.js +3 -4
- static/javascript/rag_prompts.js +36 -29
- static/javascript/rag_rqs.js +32 -12
- static/javascript/rag_ui.js +1 -0
- static/js/ragrqs.min.js +47 -40
- static/less/ragrqs.less +39 -2
- static/less/ualog3.less +12 -13
- static/ragrqs_.html +4 -7
static/css/ragrqs.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
a,body,button,div,html,input,label,li,p,span,table,td,ul{padding:0;margin:0;font-family:arial,verdana,Helvetica,sans-serif}.bb0{background:#daee59!important}.bb1{background:#5487fc!important}html{background:#1a1a1a}body{background:#1a1a1a;box-sizing:border-box;min-height:100vh;height:100vh;position:relative;padding:0;margin:0;overflow:hidden;font-family:arial,verdana,Helvetica,sans-serif;font-weight:400}.spinner{z-index:1000;position:absolute;top:70vh;left:50vw;transform:translate(-50%,-50%);cursor:pointer;display:none;align-items:center}.spinner .pulse-icon{width:20px;height:20px;background-color:#ff8c00;border-radius:50%;animation:1.5s ease-in-out infinite pulse}.spinner .stop-message{margin-left:15px;background-color:inherit;color:#8f8a8a;padding:8px 15px;border-radius:10px;font-size:22px;font-weight:700;opacity:1;transition:opacity .3s}.spinner:hover .stop-message{color:#fff;background:#595959;opacity:1}@keyframes pulse{0%{transform:scale(.6);box-shadow:0 0 0 0 rgba(255,140,0,.7)}70%{transform:scale(1.4);box-shadow:0 0 0 20px rgba(255,140,0,0)}100%{transform:scale(.6);box-shadow:0 0 0 0 rgba(255,140,0,0)}}.show-spinner{display:flex}.upload{background-color:#1e1e1e;padding:0 2em 2em;margin:0;border-radius:4px;box-shadow:0 2px 4px rgba(0,0,0,.5);text-align:center}.upload h4{color:#fff;margin-bottom:1em}.upload form{display:flex;flex-direction:column;align-items:center}.upload form .file{background-color:#121212;border:1px solid #515151;color:#fff;padding:.5em;margin-bottom:1em;border-radius:4px;width:100%;box-sizing:border-box}.upload form .file::file-selector-button{background-color:#0a5f4e;color:#fff;border:none;padding:.5em 1em;border-radius:4px;cursor:pointer}.upload form .file::file-selector-button:hover{background-color:#053128}.upload form button{background-color:#0a5f4e;color:#fff;border:none;padding:.5em 1em;border-radius:4px;cursor:pointer;width:100%;box-sizing:border-box}.upload form button:hover{background-color:#053128}.upload .result{width:100%;background:#000;color:#fff;font-size:15px;font-weight:400;text-align:left}div.container{background:#1a1a1a;box-sizing:border-box;position:relative;top:5vh;left:0;height:95vh;margin:0;padding:0;transition:margin-left .5s;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;flex-wrap:nowrap;overflow-y:auto;overflow-x:auto}div.container div.item{box-sizing:border-box;min-height:50px;margin:0;padding:0}div.container div.item1{flex:5;padding:.5vh .5vw 10vh}div.container div.item1 .output-wrapper{background-color:#1a1a1a;border-radius:20px;position:relative;bottom:0;right:0;left:0;width:100%;height:100%;display:flex;flex-direction:row;align-items:flex-start}div.container div.item1 .output-wrapper .text-out{flex:1;box-sizing:border-box;background:#000;color:#fff;border:none;padding:2px;min-width:50vw;height:100%;border-radius:10px;overflow-y:auto;outline:0;box-shadow:0 0 0 2px #4d4d4d}div.container div.item1 .output-wrapper .text-out:hover{box-shadow:0 0 0 2px #17d2ad}div.container div.item1 .output-wrapper .text-out .pre-text{white-space:pre-wrap;word-wrap:break-word;font-family:arial,verdana,Helvetica,sans-serif;font-size:20px;line-height:1.6;padding:2px;margin:0;height:100%;box-sizing:border-box;overflow-y:scroll;scroll-behavior:smooth}div.container div.item1 .output-wrapper .text-out .pre-text.copied{background-color:#0d0d0d;color:#61eed2}div.container div.item1 .output-wrapper .text-out .div-text{white-space:pre-wrap;word-wrap:break-word;font-family:arial,verdana,Helvetica,sans-serif;font-size:20px;line-height:1.6;padding:2px;margin:0;height:100%;box-sizing:border-box;overflow-y:scroll}div.container div.item1 .output-wrapper .text-out.copied{background-color:#0d0d0d;color:#61eed2}div.container div.item1 .output-actions{display:flex;flex-direction:column;align-items:flex-end;margin-left:.5vw;margin-right:.5vw}div.container div.item1 .output-actions .clear-output,div.container div.item1 .output-actions .copy-output,div.container div.item1 .output-actions .wnd-output{box-sizing:border-box;background-color:#333;color:#fff;border:none;padding:10px;cursor:pointer;border-radius:50%;width:40px;height:40px;display:flex;align-items:center;margin-bottom:5px}div.container div.item1 .output-actions .clear-output:hover,div.container div.item1 .output-actions .copy-output:hover,div.container div.item1 .output-actions .wnd-output:hover{background-color:#595959}div.container div.item1 .output-actions .copy-output{transition:background-color .3s,transform .3s}div.container div.item1 .output-actions .copy-output.copied{background:#33e9c5;transform:scale(1.2)}div.container div.item1 .output-actions .copy-output .copy-icon{fill:#ffffff;width:24px;height:24px}div.container div.item1 .output-actions .copy-output .copy-icon:hover{fill:#33e9c5}div.container div.item1 .output-actions .clear-output,div.container div.item1 .output-actions .wnd-output{transition:background-color .3s,transform .3s}div.container div.item1 .output-actions .clear-output .icon,div.container div.item1 .output-actions .wnd-output .icon{fill:#ffffff;width:24px;height:24px}div.container div.item1 .output-actions .clear-output .icon:hover,div.container div.item1 .output-actions .wnd-output .icon:hover{fill:#33e9c5}:hover{outline:0;caret-color:transparent}textarea:focus{caret-color:auto}div.item2{flex:2;padding:0 .5vw}div.item2 .input-wrapper{background-color:#1a1a1a;border-radius:20px;position:relative;bottom:2vh;right:0;left:0;width:100%;height:100%;display:flex;flex-direction:row;align-items:flex-start}div.item2 .input-wrapper:focus-within .clear-button{display:block}div.item2 .input-wrapper .text-input{flex:1;font-size:20px;font-family:arial,verdana,Helvetica,sans-serif;resize:none;box-sizing:border-box;background:#000;color:#fff;border:none;padding:2px 40px 2px 2px;height:100%;margin-left:5px;border-radius:10px;overflow-y:auto;outline:0;box-shadow:0 0 0 2px #4d4d4d}div.item2 .input-wrapper .text-input:hover{box-shadow:0 0 0 2px #17d2ad}div.item2 .input-wrapper .text-input:focus{box-shadow:0 0 0 2px #ff4500}div.item2 .input-wrapper .clear-button{position:absolute;right:60px;top:19vh;padding:5px;border-radius:50%;background:#333;border:none;font-size:20px;cursor:pointer;color:#ccc;display:none}div.item2 .input-wrapper .clear-button:hover{font-weight:700;background:#595959;color:#fff}div.item2 .input-wrapper .input-actions{display:flex;flex-direction:column;margin-left:.5vw;margin-right:.5vw}div.item2 .input-wrapper .input-actions .clear-input,div.item2 .input-wrapper .input-actions .send-input,div.item2 .input-wrapper .input-actions .send2-input{box-sizing:border-box;background-color:#333;color:#fff;border:none;padding:10px;cursor:pointer;border-radius:50%;width:40px;height:40px;margin-bottom:5px;transition:background-color .3s}div.item2 .input-wrapper .input-actions .send-input{background:#992900}div.item2 .input-wrapper .input-actions .send-input:hover{background:#ff4500}div.item2 .input-wrapper .input-actions .send2-input{background:#0d7661}div.item2 .input-wrapper .input-actions .send2-input:hover{background:#14bb9a}div.item2 .input-wrapper .input-actions .clear-input{background:#333;color:#e6e6e6}div.item2 .input-wrapper .input-actions .clear-input:hover{background:#595959;color:#33e9c5}.menu-open .container{margin-left:16vw}.menu-open .menu-box{left:0!important}div.menu-h{background-color:#1a1a1a;position:fixed;top:0;left:0;width:100vw;height:4.5vh;padding:0;margin:0;outline:0;box-shadow:0 0 0 2px #4d4d4d;z-index:100}div.menu-h .release{background:inherit;color:#ff6a33;font-weight:700;margin-left:50vw;margin-top:.5vh}div.menu-h .menu-btn{appearance:none}div.menu-h .menu-btn:checked+.menu-icon{border:1px solid #333}div.menu-h .menu-btn:checked+.menu-icon .nav-icon{transform:rotate(45deg)}div.menu-h .menu-btn:checked+.menu-icon .nav-icon::before{top:0}div.menu-h .menu-btn:checked+.menu-icon .nav-icon::after{top:0;transform:rotate(90deg)}div.menu-h .menu-icon{box-sizing:border-box;background-color:inherit;display:block;position:absolute;margin-left:2vw;top:0;left:0;width:4vw;height:4.5vh;cursor:pointer;padding:2px;z-index:1}div.menu-h .menu-icon:hover .nav-icon,div.menu-h .menu-icon:hover .nav-icon::after,div.menu-h .menu-icon:hover .nav-icon::before{background-color:#33e9c5}div.menu-h .menu-icon .nav-icon{background-color:#aea7a7;display:block;position:absolute;top:14px;left:0;width:25px;height:2px;transition-duration:.25s}div.menu-h .menu-icon .nav-icon::after,div.menu-h .menu-icon .nav-icon::before{content:"";position:absolute;left:0;background-color:inherit;width:inherit;height:inherit}div.menu-h .menu-icon .nav-icon::before{top:-8px}div.menu-h .menu-icon .nav-icon::after{top:8px}div.menu-h .head-wrapper{position:absolute;top:0;left:5vw;height:4vh;padding:0;margin:0;display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:flex-start}div.menu-h .head-wrapper .help,div.menu-h .head-wrapper .log,div.menu-h .head-wrapper .upload,div.menu-h .head-wrapper .upload-dir{margin-top:2px;margin-left:30px;margin-right:0;padding:5px 5px 0;border:none;cursor:pointer;border-radius:20%;font-size:20px;color:#fff;background:#333;max-height:4vh}div.menu-h .head-wrapper .help:hover,div.menu-h .head-wrapper .log:hover,div.menu-h .head-wrapper .upload-dir:hover,div.menu-h .head-wrapper .upload:hover{background:#595959}div.menu-h .upload,div.menu-h .upload-dir{transition:background-color .3s,transform .3s}div.menu-h .upload .icon,div.menu-h .upload-dir .icon{fill:#ffffff;width:24px;height:24px}div.menu-h .upload .icon:hover,div.menu-h .upload-dir .icon:hover{fill:#33e9c5}div.menu-h .log{font-size:14px!important;font-weight:400!important;background:#992900!important}div.menu-h .log:hover{background:#cc3700!important}div.menu-h .log.active{background:#0d7661!important}div.menu-h .log.active:hover{background:#12a487!important}div.menu-h div.menu-box{position:fixed;top:5vh;left:-2000px;height:95vh;width:16vw;transition:left .3s ease-out;padding:1vh 0 0 .5vw;z-index:101;background:#0d0d0d;box-sizing:border-box;outline:0;box-shadow:0 0 0 2px #4d4d4d;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch;overflow-y:auto;overflow-x:auto}div.menu-h div.menu-box ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;border-top:1px solid #333}div.menu-h div.menu-box ul li{border-left:1px solid #333;border-right:1px solid #333;border-bottom:1px solid #333}div.menu-h div.menu-box ul li a{color:#fff;font-size:14px;font-family:arial,verdana,Helvetica,sans-serif;font-weight:400;display:block;margin:0;padding:2px 2px 2px 0;text-align:left;text-decoration:none}div.menu-h div.menu-box ul li:hover{text-decoration:underline;background-color:#333;color:#33e9c5}div.menu-h div.menu-box ul a.delete{text-align:center;font-weight:700;font-style:italic;color:#000;background:#b3a80b}div.menu-h div.menu-box ul a.help{text-align:center;font-weight:700;font-style:italic;color:#000;background:#cc3700}div.menu-h div.menu-box ul li.show{background:#000;color:#fff;width:100%;text-align:center;box-sizing:border-box}div.menu-h div.menu-box ul li.show:hover{text-decoration:none}.window-text{position:relative;top:0;left:0;background:#1a1a1a;color:#fff;border:none;padding:0 2px 2px;width:78vw;height:80vh;border-radius:10px;box-sizing:border-box;outline:0;box-shadow:0 0 0 2px #b3a80b;overflow-y:auto}.window-text pre.pre-text{color:#f8f292;white-space:pre-wrap;word-wrap:break-word;font-family:Georigia,"Ties New Roman",serif;font-size:18px;line-height:1.6;padding:2px;margin:0;text-align:left}.window-text div.text{font-size:18px;font-weight:400;padding-left:10px;padding-right:10px;margin:0}.window-text div.text pre{white-space:pre-wrap;word-wrap:break-word;font-family:arial,verdana,Helvetica,sans-serif;font-size:18px;line-height:1.3;padding:0 5px;margin:0;text-align:left}.window-text div.text .center{text-align:center;font-size:18px;font-weight:700;text-decoration:underline;font-style:italic;color:#e3d50e}.window-text div.text .label{margin:5px 0 5px 10px;font-size:18px;font-weight:700;font-style:italic;color:#e3d50e}.window-text div.text div{font-family:arial,verdana,Helvetica,sans-serif;font-size:18px;font-weight:700;padding-top:0;padding-bottom:0}.window-text div.text div a{background:#000;color:#fff;font-weight:400}.window-text div.text div a:hover{background:#333;color:#fff}.window-text div.text p{font-size:18px;font-weight:400;font-family:arial,verdana,Helvetica,sans-serif;text-align:justify;padding-bottom:9px;padding-right:0;padding-left:10px}.btn-wrapper{width:100%;height:2vw;position:sticky;top:0;padding:0;background:#262626}.btn-wrapper .btn-copy{position:absolute;top:1px;right:5vw;box-sizing:border-box;background:inherit;color:#fff;border:none;cursor:pointer;width:30px;margin:0;padding:0;transition:background-color .3s}.btn-wrapper .btn-copy:hover{background-color:#595959}.btn-wrapper .btn-copy .copy-icon{fill:#e6e6e6;width:20px;height:20px}.btn-wrapper .btn-copy .copy-icon:hover{fill:#33e9c5;background:#404040}.btn-wrapper .btn-close{position:absolute;top:0;right:2vw;margin:0;background-color:transparent;border:none;color:#e6e6e6;font-size:22px;font-weight:700;cursor:pointer;outline:0}.btn-wrapper .btn-close:hover{color:#33e9c5;background:#404040}.msg{box-sizing:border-box;position:fixed;width:300px;height:100px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#222;color:#ffeb3b;border:2px solid #ffeb3b;border-radius:15px;display:flex;align-items:center;justify-content:center;font-family:Arial,sans-serif;font-size:24px;font-weight:700;text-align:center;z-index:1000;box-shadow:0 4px 8px rgba(0,0,0,.2)}.alert,.confirm{background-color:#303030!important;color:#fff;padding:20px;border-radius:4px;box-shadow:0 2px 4px #00000033!important}.alert .button,.confirm .button{background-color:#37474f!important;color:#fff;border:none;padding:10px 20px;border-radius:4px;cursor:pointer;margin-top:20px}.alert .button:hover,.confirm .button:hover{background-color:#222c31}#ualog_{box-sizing:border-box;width:auto;height:auto;text-align:center;padding:2px;margin:2px 0 0;background:#333;color:#fff;font-size:16px;font-weight:400;border-radius:9px;border:1px solid #999}#ualog_ button{padding:5px;margin:0 5px;font-size:18px;font-weight:700;border:2px solid #999;border-radius:10px}#ualog_ button:hover{cursor:pointer;color:#000}#ualog_ button.close{background:#000;color:#ff4500}#ualog_ button.close:hover{text-decoration:underline;border-color:#ff4500}#ualog_ button.clear{background:#000;color:#ff0}#ualog_ button.clear:hover{text-decoration:underline;border-color:#ff0}#ualog_ pre{box-sizing:border-box;width:auto;min-width:400px;max-width:400px;max-height:500px;text-align:left;font-size:16px;font-family:monospace;padding:2px;margin:2px;color:#fff;background:#111;overflow:auto;scrollbar-color:#23eb04 #454444;scrollbar-width:auto;word-wrap:break-word}
|
|
|
1 |
+
a,body,button,div,html,input,label,li,p,span,table,td,ul{padding:0;margin:0;font-family:arial,verdana,Helvetica,sans-serif}.bb0{background:#daee59!important}.bb1{background:#5487fc!important}html{background:#1a1a1a}body{background:#1a1a1a;box-sizing:border-box;min-height:100vh;height:100vh;position:relative;padding:0;margin:0;overflow:hidden;font-family:arial,verdana,Helvetica,sans-serif;font-weight:400}.spinner{z-index:1000;position:absolute;top:70vh;left:50vw;transform:translate(-50%,-50%);cursor:pointer;display:none;align-items:center}.spinner .pulse-icon{width:20px;height:20px;background-color:#ff8c00;border-radius:50%;animation:1.5s ease-in-out infinite pulse}.spinner .stop-message{margin-left:15px;background-color:inherit;color:#8f8a8a;padding:8px 15px;border-radius:10px;font-size:22px;font-weight:700;opacity:1;transition:opacity .3s}.spinner:hover .stop-message{color:#fff;background:#595959;opacity:1}@keyframes pulse{0%{transform:scale(.6);box-shadow:0 0 0 0 rgba(255,140,0,.7)}70%{transform:scale(1.4);box-shadow:0 0 0 20px rgba(255,140,0,0)}100%{transform:scale(.6);box-shadow:0 0 0 0 rgba(255,140,0,0)}}.show-spinner{display:flex}.upload{background-color:#1e1e1e;padding:0 2em 2em;margin:0;border-radius:4px;box-shadow:0 2px 4px rgba(0,0,0,.5);text-align:center}.upload h4{color:#fff;margin-bottom:1em}.upload form{display:flex;flex-direction:column;align-items:center}.upload form .file{background-color:#121212;border:1px solid #515151;color:#fff;padding:.5em;margin-bottom:1em;border-radius:4px;width:100%;box-sizing:border-box}.upload form .file::file-selector-button{background-color:#0a5f4e;color:#fff;border:none;padding:.5em 1em;border-radius:4px;cursor:pointer}.upload form .file::file-selector-button:hover{background-color:#053128}.upload form button{background-color:#0a5f4e;color:#fff;border:none;padding:.5em 1em;border-radius:4px;cursor:pointer;width:100%;box-sizing:border-box}.upload form button:hover{background-color:#053128}.upload .result{width:100%;background:#000;color:#fff;font-size:15px;font-weight:400;text-align:left}div.container{background:#1a1a1a;box-sizing:border-box;position:relative;top:5vh;left:0;height:95vh;margin:0;padding:0;transition:margin-left .5s;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;flex-wrap:nowrap;overflow-y:auto;overflow-x:auto}div.container div.item{box-sizing:border-box;min-height:50px;margin:0;padding:0}div.container div.item1{flex:5;padding:.5vh .5vw 10vh}div.container div.item1 .output-wrapper{background-color:#1a1a1a;border-radius:20px;position:relative;bottom:0;right:0;left:0;width:100%;height:100%;display:flex;flex-direction:row;align-items:flex-start}div.container div.item1 .output-wrapper .text-out{flex:1;box-sizing:border-box;background:#000;color:#fff;border:none;padding:2px;min-width:50vw;height:100%;border-radius:10px;overflow-y:auto;outline:0;box-shadow:0 0 0 2px #4d4d4d}div.container div.item1 .output-wrapper .text-out:hover{box-shadow:0 0 0 2px #17d2ad}div.container div.item1 .output-wrapper .text-out .pre-text{white-space:pre-wrap;word-wrap:break-word;font-family:arial,verdana,Helvetica,sans-serif;font-size:20px;line-height:1.6;padding:2px;margin:0;height:100%;box-sizing:border-box;overflow-y:scroll;scroll-behavior:smooth}div.container div.item1 .output-wrapper .text-out .pre-text.copied{background-color:#0d0d0d;color:#61eed2}div.container div.item1 .output-wrapper .text-out .div-text{white-space:pre-wrap;word-wrap:break-word;font-family:arial,verdana,Helvetica,sans-serif;font-size:20px;line-height:1.6;padding:2px;margin:0;height:100%;box-sizing:border-box;overflow-y:scroll}div.container div.item1 .output-wrapper .text-out.copied{background-color:#0d0d0d;color:#61eed2}div.container div.item1 .output-actions{display:flex;flex-direction:column;align-items:flex-end;margin-left:.5vw;margin-right:.5vw}div.container div.item1 .output-actions .clear-output,div.container div.item1 .output-actions .copy-output,div.container div.item1 .output-actions .wnd-output{box-sizing:border-box;background-color:#333;color:#fff;border:none;padding:10px;cursor:pointer;border-radius:50%;width:40px;height:40px;display:flex;align-items:center;margin-bottom:5px}div.container div.item1 .output-actions .clear-output:hover,div.container div.item1 .output-actions .copy-output:hover,div.container div.item1 .output-actions .wnd-output:hover{background-color:#595959}div.container div.item1 .output-actions .copy-output{transition:background-color .3s,transform .3s}div.container div.item1 .output-actions .copy-output.copied{background:#33e9c5;transform:scale(1.2)}div.container div.item1 .output-actions .copy-output .copy-icon{fill:#ffffff;width:24px;height:24px}div.container div.item1 .output-actions .copy-output .copy-icon:hover{fill:#33e9c5}div.container div.item1 .output-actions .clear-output,div.container div.item1 .output-actions .wnd-output{transition:background-color .3s,transform .3s}div.container div.item1 .output-actions .clear-output .icon,div.container div.item1 .output-actions .wnd-output .icon{fill:#ffffff;width:24px;height:24px}div.container div.item1 .output-actions .clear-output .icon:hover,div.container div.item1 .output-actions .wnd-output .icon:hover{fill:#33e9c5}:hover{outline:0;caret-color:transparent}textarea:focus{caret-color:auto}div.item2{flex:2;padding:0 .5vw}div.item2 .input-wrapper{background-color:#1a1a1a;border-radius:20px;position:relative;bottom:2vh;right:0;left:0;width:100%;height:100%;display:flex;flex-direction:row;align-items:flex-start}div.item2 .input-wrapper:focus-within .clear-button{display:block}div.item2 .input-wrapper .text-input{flex:1;font-size:20px;font-family:arial,verdana,Helvetica,sans-serif;resize:none;box-sizing:border-box;background:#000;color:#fff;border:none;padding:2px 40px 2px 2px;height:100%;margin-left:5px;border-radius:10px;overflow-y:auto;outline:0;box-shadow:0 0 0 2px #4d4d4d}div.item2 .input-wrapper .text-input:hover{box-shadow:0 0 0 2px #17d2ad}div.item2 .input-wrapper .text-input:focus{box-shadow:0 0 0 2px #ff4500}div.item2 .input-wrapper .clear-button{position:absolute;right:60px;top:19vh;padding:5px;border-radius:50%;background:#333;border:none;font-size:20px;cursor:pointer;color:#ccc;display:none}div.item2 .input-wrapper .clear-button:hover{font-weight:700;background:#595959;color:#fff}div.item2 .input-wrapper .input-actions{display:flex;flex-direction:column;margin-left:.5vw;margin-right:.5vw}div.item2 .input-wrapper .input-actions .clear-input,div.item2 .input-wrapper .input-actions .send-input,div.item2 .input-wrapper .input-actions .send2-input{box-sizing:border-box;background-color:#333;color:#fff;border:none;padding:10px;cursor:pointer;border-radius:50%;width:40px;height:40px;margin-bottom:5px;transition:background-color .3s}div.item2 .input-wrapper .input-actions .send-input{background:#992900}div.item2 .input-wrapper .input-actions .send-input:hover{background:#ff4500}div.item2 .input-wrapper .input-actions .send2-input{background:#0d7661}div.item2 .input-wrapper .input-actions .send2-input:hover{background:#14bb9a}div.item2 .input-wrapper .input-actions .clear-input{background:#333;color:#e6e6e6}div.item2 .input-wrapper .input-actions .clear-input:hover{background:#595959;color:#33e9c5}.menu-open .container{margin-left:16vw}.menu-open .menu-box{left:0!important}div.menu-h{background-color:#1a1a1a;position:fixed;top:0;left:0;width:100vw;height:4.5vh;padding:0;margin:0;outline:0;box-shadow:0 0 0 2px #4d4d4d;z-index:100}div.menu-h .release{background:inherit;color:#ff6a33;font-weight:700;margin-left:50vw;margin-top:.5vh}div.menu-h .menu-btn{appearance:none}div.menu-h .menu-btn:checked+.menu-icon{border:1px solid #333}div.menu-h .menu-btn:checked+.menu-icon .nav-icon{transform:rotate(45deg)}div.menu-h .menu-btn:checked+.menu-icon .nav-icon::before{top:0}div.menu-h .menu-btn:checked+.menu-icon .nav-icon::after{top:0;transform:rotate(90deg)}div.menu-h .menu-icon{box-sizing:border-box;background-color:inherit;display:block;position:absolute;margin-left:2vw;top:0;left:0;width:4vw;height:4.5vh;cursor:pointer;padding:2px;z-index:1}div.menu-h .menu-icon:hover .nav-icon,div.menu-h .menu-icon:hover .nav-icon::after,div.menu-h .menu-icon:hover .nav-icon::before{background-color:#33e9c5}div.menu-h .menu-icon .nav-icon{background-color:#aea7a7;display:block;position:absolute;top:14px;left:0;width:25px;height:2px;transition-duration:.25s}div.menu-h .menu-icon .nav-icon::after,div.menu-h .menu-icon .nav-icon::before{content:"";position:absolute;left:0;background-color:inherit;width:inherit;height:inherit}div.menu-h .menu-icon .nav-icon::before{top:-8px}div.menu-h .menu-icon .nav-icon::after{top:8px}div.menu-h .head-wrapper{position:absolute;top:0;left:5vw;height:4vh;padding:0;margin:0;display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:flex-start}div.menu-h .head-wrapper .help,div.menu-h .head-wrapper .log,div.menu-h .head-wrapper .upload,div.menu-h .head-wrapper .upload-dir{margin-top:2px;margin-left:30px;margin-right:0;padding:5px 5px 0;border:none;cursor:pointer;border-radius:20%;font-size:20px;color:#fff;background:#333;max-height:4vh}div.menu-h .head-wrapper .help:hover,div.menu-h .head-wrapper .log:hover,div.menu-h .head-wrapper .upload-dir:hover,div.menu-h .head-wrapper .upload:hover{background:#595959}div.menu-h .upload,div.menu-h .upload-dir{transition:background-color .3s,transform .3s}div.menu-h .upload .icon,div.menu-h .upload-dir .icon{fill:#ffffff;width:24px;height:24px}div.menu-h .upload .icon:hover,div.menu-h .upload-dir .icon:hover{fill:#33e9c5}div.menu-h .log{font-size:14px!important;font-weight:400!important;background:#992900!important}div.menu-h .log:hover{background:#cc3700!important}div.menu-h .log.active{background:#0d7661!important}div.menu-h .log.active:hover{background:#12a487!important}div.menu-h div.menu-box{position:fixed;top:5vh;left:-2000px;height:95vh;width:16vw;transition:left .3s ease-out;padding:1vh 0 0 .5vw;z-index:101;background:#0d0d0d;box-sizing:border-box;outline:0;box-shadow:0 0 0 2px #4d4d4d;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch;overflow-y:auto;overflow-x:auto}div.menu-h div.menu-box ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;border-top:1px solid #333}div.menu-h div.menu-box ul li{border-left:1px solid #333;border-right:1px solid #333;border-bottom:1px solid #333}div.menu-h div.menu-box ul li a{color:#fff;font-size:14px;font-family:arial,verdana,Helvetica,sans-serif;font-weight:400;display:block;margin:0;padding:2px 2px 2px 0;text-align:left;text-decoration:none}div.menu-h div.menu-box ul li:hover{text-decoration:underline;background-color:#333;color:#33e9c5}div.menu-h div.menu-box ul a.delete{text-align:center;font-weight:700;font-style:italic;color:#000;background:#b3a80b}div.menu-h div.menu-box ul a.help{text-align:center;font-weight:700;font-style:italic;color:#000;background:#cc3700}div.menu-h div.menu-box ul li.show{background:#000;color:#fff;width:100%;text-align:center;box-sizing:border-box}div.menu-h div.menu-box ul li.show:hover{text-decoration:none}.window-text{position:relative;top:0;left:0;background:#1a1a1a;color:#fff;border:none;padding:0 2px 2px;width:78vw;height:80vh;border-radius:10px;box-sizing:border-box;outline:0;box-shadow:0 0 0 2px #b3a80b;overflow-y:auto;overflow-x:auto}.window-text pre.pre-text{color:#f8f292;white-space:pre-wrap;word-wrap:break-word;font-family:Georigia,"Ties New Roman",serif;font-size:18px;line-height:1.6;padding:2px;margin:0;text-align:left}.window-text div.div-text{color:#f8f292;word-wrap:break-word;font-family:Georigia,"Ties New Roman",serif;font-size:18px;padding:0 2px;margin:0}.window-text div.div-text ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;border-top:1px solid #333}.window-text div.div-text ul li{border-left:1px solid #333;border-right:1px solid #333;border-bottom:1px solid #333}.window-text div.div-text ul li a{color:#fff;font-size:14px;font-family:arial,verdana,Helvetica,sans-serif;font-weight:400;display:block;margin:0;padding:5px 2px 2px 0;text-align:left;text-decoration:none}.window-text div.div-text ul li:hover{text-decoration:underline;background-color:#333;color:#33e9c5}.window-text div.text{font-size:18px;font-weight:400;padding-left:10px;padding-right:10px;margin:0}.window-text div.text pre{white-space:pre-wrap;word-wrap:break-word;font-family:arial,verdana,Helvetica,sans-serif;font-size:18px;line-height:1.3;padding:0 5px;margin:0;text-align:left}.window-text div.text .center{text-align:center;font-size:18px;font-weight:700;text-decoration:underline;font-style:italic;color:#e3d50e}.window-text div.text .label{margin:5px 0 5px 10px;font-size:18px;font-weight:700;font-style:italic;color:#e3d50e}.window-text div.text div{font-family:arial,verdana,Helvetica,sans-serif;font-size:18px;font-weight:700;padding-top:0;padding-bottom:0}.window-text div.text div a{background:#000;color:#fff;font-weight:400}.window-text div.text div a:hover{background:#333;color:#fff}.window-text div.text p{font-size:18px;font-weight:400;font-family:arial,verdana,Helvetica,sans-serif;text-align:justify;padding-bottom:9px;padding-right:0;padding-left:10px}.btn-wrapper{width:100%;height:2vw;position:sticky;top:0;padding:0;background:#262626}.btn-wrapper .btn-copy{position:absolute;top:1px;right:5vw;box-sizing:border-box;background:inherit;color:#fff;border:none;cursor:pointer;width:30px;margin:0;padding:0;transition:background-color .3s}.btn-wrapper .btn-copy:hover{background-color:#595959}.btn-wrapper .btn-copy .copy-icon{fill:#e6e6e6;width:20px;height:20px}.btn-wrapper .btn-copy .copy-icon:hover{fill:#33e9c5;background:#404040}.btn-wrapper .btn-close{position:absolute;top:0;right:2vw;margin:0;background-color:transparent;border:none;color:#e6e6e6;font-size:22px;font-weight:700;cursor:pointer;outline:0}.btn-wrapper .btn-close:hover{color:#33e9c5;background:#404040}.msg{box-sizing:border-box;position:fixed;width:300px;height:100px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#222;color:#ffeb3b;border:2px solid #ffeb3b;border-radius:15px;display:flex;align-items:center;justify-content:center;font-family:Arial,sans-serif;font-size:24px;font-weight:700;text-align:center;z-index:1000;box-shadow:0 4px 8px rgba(0,0,0,.2)}.alert,.confirm{background-color:#303030!important;color:#fff;padding:20px;border-radius:4px;box-shadow:0 2px 4px #00000033!important}.alert .button,.confirm .button{background-color:#37474f!important;color:#fff;border:none;padding:10px 20px;border-radius:4px;cursor:pointer;margin-top:20px}.alert .button:hover,.confirm .button:hover{background-color:#222c31}#ualog_{box-sizing:border-box;width:auto;height:auto;text-align:center;padding:2px;margin:2px 0 0;background:#333;color:#fff;font-size:16px;font-weight:400;border-radius:9px;border:1px solid #999}#ualog_ button{padding:5px;margin:0 5px;font-size:18px;font-weight:700;border:2px solid #888;border-radius:10px;color:#000}#ualog_ button:hover{cursor:pointer;text-decoration:underline}#ualog_ button.close{background:#cc3700}#ualog_ button.close:hover{background:#ff8f66;border-color:#992900}#ualog_ button.clear{background:#b3a80b}#ualog_ button.clear:hover{background:#f5ec62;border-color:#837b08}#ualog_ pre{box-sizing:border-box;width:auto;min-width:400px;max-width:400px;max-height:500px;text-align:left;font-size:16px;font-family:monospace;padding:2px;margin:2px;color:#fff;background:#111;overflow:auto;scrollbar-color:#23eb04 #454444;scrollbar-width:auto;word-wrap:break-word}
|
static/help0.html
CHANGED
@@ -128,9 +128,10 @@
|
|
128 |
</p>
|
129 |
</div>
|
130 |
<div>
|
131 |
-
|
132 |
<p>
|
133 |
-
Visualizza la lista dei documenti achviati ed utilizzabili per l'elaborazione
|
|
|
134 |
</p>
|
135 |
</div>
|
136 |
|
|
|
128 |
</p>
|
129 |
</div>
|
130 |
<div>
|
131 |
+
Elenco Documenti:
|
132 |
<p>
|
133 |
+
Visualizza la lista dei documenti achviati ed utilizzabili per l'elaborazione.<br>
|
134 |
+
Con il clic del mouse sul nome di un documento si visualizza.
|
135 |
</p>
|
136 |
</div>
|
137 |
|
static/javascript/rag_data_mgr.js
CHANGED
@@ -5,8 +5,7 @@ const ID_RESPONSES = "id_responses";
|
|
5 |
const ID_DOC_NAMES = "id_doc_names";
|
6 |
const ID_DOCS = "id_docs;";
|
7 |
const ID_RAG = "id_rag";
|
8 |
-
const ID_THREAD="id_thread";
|
9 |
-
|
10 |
|
11 |
const UaDb = {
|
12 |
create(id, data) {
|
@@ -78,10 +77,15 @@ const DataMgr = {
|
|
78 |
return parts[parts.length - 1];
|
79 |
},
|
80 |
async loadDoc(link) {
|
|
|
81 |
try {
|
82 |
const text = await requestGet(link);
|
83 |
const doc = cleanDoc(text);
|
84 |
const name = this.linkToName(link);
|
|
|
|
|
|
|
|
|
85 |
this.doc_names.push(name);
|
86 |
this.docs.push(doc);
|
87 |
this.saveDbDocs();
|
|
|
5 |
const ID_DOC_NAMES = "id_doc_names";
|
6 |
const ID_DOCS = "id_docs;";
|
7 |
const ID_RAG = "id_rag";
|
8 |
+
const ID_THREAD = "id_thread";
|
|
|
9 |
|
10 |
const UaDb = {
|
11 |
create(id, data) {
|
|
|
77 |
return parts[parts.length - 1];
|
78 |
},
|
79 |
async loadDoc(link) {
|
80 |
+
this.readDbDocNames();
|
81 |
try {
|
82 |
const text = await requestGet(link);
|
83 |
const doc = cleanDoc(text);
|
84 |
const name = this.linkToName(link);
|
85 |
+
if (this.doc_names.includes(name)) {
|
86 |
+
alert(`Il docuento ${name} è già caricato`);
|
87 |
+
return;
|
88 |
+
}
|
89 |
this.doc_names.push(name);
|
90 |
this.docs.push(doc);
|
91 |
this.saveDbDocs();
|
static/javascript/rag_env.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** @format */
|
2 |
+
|
3 |
+
function umgm() {
|
4 |
+
const arr = ["bWtkW0l+XX0=", "SXx2d1FxbVc=", "V1tRXlxneUY=", "flV6a1NdbUg=", "VllpUkc="];
|
5 |
+
return arr
|
6 |
+
.map((part) => {
|
7 |
+
const ch = atob(part);
|
8 |
+
return ch
|
9 |
+
.split("")
|
10 |
+
.map((char) => String.fromCharCode((char.charCodeAt(0) - 5 + 256) % 256))
|
11 |
+
.join("");
|
12 |
+
})
|
13 |
+
.join("");
|
14 |
+
}
|
static/javascript/rag_http.js
CHANGED
@@ -1,25 +1,11 @@
|
|
1 |
/** @format */
|
2 |
"use strict";
|
3 |
|
4 |
-
|
5 |
const model_name = "mistralai/Mistral-7B-Instruct-v0.3";
|
6 |
// const model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1";
|
7 |
// const model_name = "mistralai/Mixtral-8x22B-Instruct-v0.1"
|
8 |
|
9 |
-
const umgm = (arr) => {
|
10 |
-
return arr
|
11 |
-
.map((part) => {
|
12 |
-
const ch = atob(part);
|
13 |
-
return ch
|
14 |
-
.split("")
|
15 |
-
.map((char) => String.fromCharCode((char.charCodeAt(0) - 5 + 256) % 256))
|
16 |
-
.join("");
|
17 |
-
})
|
18 |
-
.join("");
|
19 |
-
};
|
20 |
-
|
21 |
-
const tm = umgm(arr);
|
22 |
-
|
23 |
async function requestGet(url) {
|
24 |
try {
|
25 |
const response = await fetch(url, {
|
|
|
1 |
/** @format */
|
2 |
"use strict";
|
3 |
|
4 |
+
|
5 |
const model_name = "mistralai/Mistral-7B-Instruct-v0.3";
|
6 |
// const model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1";
|
7 |
// const model_name = "mistralai/Mixtral-8x22B-Instruct-v0.1"
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
async function requestGet(url) {
|
10 |
try {
|
11 |
const response = await fetch(url, {
|
static/javascript/rag_mgr.js
CHANGED
@@ -239,8 +239,7 @@ const Rag = {
|
|
239 |
this.saveRespToDb();
|
240 |
ThreadMgr.init();
|
241 |
this.saveToDb();
|
242 |
-
|
243 |
-
UaLog.log(`Risposta (${pl},${text.length})`);
|
244 |
} catch (err) {
|
245 |
console.error(err);
|
246 |
text = `${err}`;
|
@@ -287,7 +286,7 @@ const Rag = {
|
|
287 |
text = cleanResponse(text);
|
288 |
ThreadMgr.add(query, text);
|
289 |
text = ThreadMgr.getThread();
|
290 |
-
UaLog.log(`Inizio Conversazione (${prompt.length}
|
291 |
} catch (err) {
|
292 |
console.error(err);
|
293 |
text = `${err}`;
|
@@ -323,7 +322,7 @@ const Rag = {
|
|
323 |
text = cleanResponse(text);
|
324 |
ThreadMgr.add(query, text);
|
325 |
text = ThreadMgr.getThread();
|
326 |
-
UaLog.log(`Conversazione (${prompt.length}
|
327 |
} catch (err) {
|
328 |
console.error(err);
|
329 |
text = `${err}`;
|
|
|
239 |
this.saveRespToDb();
|
240 |
ThreadMgr.init();
|
241 |
this.saveToDb();
|
242 |
+
UaLog.log(`Risposta (${text.length})`);
|
|
|
243 |
} catch (err) {
|
244 |
console.error(err);
|
245 |
text = `${err}`;
|
|
|
286 |
text = cleanResponse(text);
|
287 |
ThreadMgr.add(query, text);
|
288 |
text = ThreadMgr.getThread();
|
289 |
+
UaLog.log(`Inizio Conversazione (${prompt.length})`);
|
290 |
} catch (err) {
|
291 |
console.error(err);
|
292 |
text = `${err}`;
|
|
|
322 |
text = cleanResponse(text);
|
323 |
ThreadMgr.add(query, text);
|
324 |
text = ThreadMgr.getThread();
|
325 |
+
UaLog.log(`Conversazione (${prompt.length})`);
|
326 |
} catch (err) {
|
327 |
console.error(err);
|
328 |
text = `${err}`;
|
static/javascript/rag_prompts.js
CHANGED
@@ -5,10 +5,12 @@
|
|
5 |
function promptDoc(documento, domanda, docName) {
|
6 |
return `
|
7 |
SYSTEM:
|
8 |
-
Sei un assistente AI specializzato nell'analisi di documenti.
|
|
|
9 |
|
10 |
TASK:
|
11 |
-
|
|
|
12 |
|
13 |
INSTRUCTIONS:
|
14 |
1. Analizza attentamente il documento fornito e identifica le informazioni pertinenti alla domanda.
|
@@ -20,12 +22,12 @@ INSTRUCTIONS:
|
|
20 |
7. Assicurati che la risposta sia interamente in italiano,se nel testo è usata un'altra lingua traduci in italiano.
|
21 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
22 |
|
23 |
-
|
24 |
-
<<<
|
25 |
${documento}
|
26 |
-
<<<
|
27 |
|
28 |
-
|
29 |
${domanda}
|
30 |
|
31 |
OUTPUT_FORMAT:
|
@@ -35,13 +37,15 @@ RESPONSE:
|
|
35 |
`;
|
36 |
}
|
37 |
|
38 |
-
function promptBuildContext(
|
39 |
return `
|
40 |
-
|
41 |
-
Sei un assistente AI specializzato nell'analisi di documenti.
|
|
|
42 |
|
43 |
TASK:
|
44 |
-
Analizza e riorganizza logicamente il documento fornito.
|
|
|
45 |
|
46 |
INSTRUCTIONS:
|
47 |
1. Valuta la tipologia e lo scopo del documento (es. articolo scientifico, racconto,saggio, documento tecnico) e adatta l'analisi di conseguenza.
|
@@ -60,10 +64,10 @@ INSTRUCTIONS:
|
|
60 |
14. Assicurati che la risposta sia interamente in italiano.
|
61 |
15. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
62 |
|
63 |
-
|
64 |
-
<<<
|
65 |
-
${
|
66 |
-
<<<
|
67 |
|
68 |
OUTPUT_FORMAT:
|
69 |
Rispondi con un testo continuo suddiviso in paragrafi. Inizia direttamente con il contenuto. Evita di usare etichette, elenchi o marcatori speciali.
|
@@ -75,10 +79,11 @@ RESPONSE:
|
|
75 |
function promptWithContext(contesto, domanda) {
|
76 |
return `
|
77 |
SYSTEM:
|
78 |
-
Sei un assistente AI specializzato nell'analisi e nell'elaborazione di informazioni contestuali.
|
|
|
79 |
|
80 |
TASK:
|
81 |
-
|
82 |
|
83 |
INSTRUCTIONS:
|
84 |
1. Analizza attentamente il documento e identifica le informazioni pertinenti alla domanda.
|
@@ -90,12 +95,12 @@ INSTRUCTIONS:
|
|
90 |
7. Assicurati che la risposta sia interamente in italiano.
|
91 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
92 |
|
93 |
-
|
94 |
-
<<<
|
95 |
${contesto}
|
96 |
-
<<<
|
97 |
|
98 |
-
|
99 |
${domanda}
|
100 |
|
101 |
OUTPUT_FORMAT:
|
@@ -108,10 +113,11 @@ RESPONSE:
|
|
108 |
function promptThread(contesto, conversazione, richiesta) {
|
109 |
return `
|
110 |
SYSTEM:
|
111 |
-
Sei un assistente AI versatile progettato per gestire conversazioni dinamiche e adattarti a varie richieste.
|
|
|
112 |
|
113 |
TASK:
|
114 |
-
Elaborare la risposta alla
|
115 |
|
116 |
INSTRUCTIONS:
|
117 |
1. Analizza attentamente il contesto, la conversazione precedente e la richiesta attuale.
|
@@ -126,16 +132,17 @@ INSTRUCTIONS:
|
|
126 |
10. Se è necessario integrare con conoscenze generali, specifica chiaramente quando lo stai facendo.
|
127 |
11. Assicurati che la risposta sia interamente in italiano.
|
128 |
|
129 |
-
|
130 |
-
<<<
|
131 |
${contesto}
|
132 |
-
<<<
|
133 |
|
134 |
-
|
|
|
135 |
${conversazione}
|
136 |
-
<<<
|
137 |
|
138 |
-
|
139 |
${richiesta}
|
140 |
|
141 |
OUTPUT_FORMAT:
|
@@ -243,7 +250,7 @@ function getPayloadBuildContext(prompt) {
|
|
243 |
return_full_text: false,
|
244 |
details: false,
|
245 |
max_time: 120.0,
|
246 |
-
seed: 42
|
247 |
},
|
248 |
options: {
|
249 |
use_cache: false,
|
|
|
5 |
function promptDoc(documento, domanda, docName) {
|
6 |
return `
|
7 |
SYSTEM:
|
8 |
+
- Sei un assistente AI specializzato nell'analisi di documenti.
|
9 |
+
- Rispondi sempre ed esclusivamente in italiano.
|
10 |
|
11 |
TASK:
|
12 |
+
- Analizza il documento fornito ed estrai le informazioni rilevanti per rispondere alla domanda fornita.
|
13 |
+
- Attieniti rigorosamente alle istruzioni.
|
14 |
|
15 |
INSTRUCTIONS:
|
16 |
1. Analizza attentamente il documento fornito e identifica le informazioni pertinenti alla domanda.
|
|
|
22 |
7. Assicurati che la risposta sia interamente in italiano,se nel testo è usata un'altra lingua traduci in italiano.
|
23 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
24 |
|
25 |
+
DOCUMENTO:
|
26 |
+
<<<INIZIO DOCUMENTO ${docName}>>>
|
27 |
${documento}
|
28 |
+
<<<FINE DOCUMENTO>>>
|
29 |
|
30 |
+
DOMANDA:
|
31 |
${domanda}
|
32 |
|
33 |
OUTPUT_FORMAT:
|
|
|
37 |
`;
|
38 |
}
|
39 |
|
40 |
+
function promptBuildContext(documento) {
|
41 |
return `
|
42 |
+
SYSTEM:
|
43 |
+
- Sei un assistente AI specializzato nell'analisi di documenti.
|
44 |
+
- Rispondi sempre ed esclusivamente in italiano.
|
45 |
|
46 |
TASK:
|
47 |
+
- Analizza e riorganizza logicamente il documento fornito.
|
48 |
+
- Attieniti rigorosamente alle istruzioni.
|
49 |
|
50 |
INSTRUCTIONS:
|
51 |
1. Valuta la tipologia e lo scopo del documento (es. articolo scientifico, racconto,saggio, documento tecnico) e adatta l'analisi di conseguenza.
|
|
|
64 |
14. Assicurati che la risposta sia interamente in italiano.
|
65 |
15. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
66 |
|
67 |
+
DOCUMENTO:
|
68 |
+
<<<INIZIO_DOCUMENTO>>>
|
69 |
+
${documento}
|
70 |
+
<<<FINE_DOCUMENTO>>>
|
71 |
|
72 |
OUTPUT_FORMAT:
|
73 |
Rispondi con un testo continuo suddiviso in paragrafi. Inizia direttamente con il contenuto. Evita di usare etichette, elenchi o marcatori speciali.
|
|
|
79 |
function promptWithContext(contesto, domanda) {
|
80 |
return `
|
81 |
SYSTEM:
|
82 |
+
- Sei un assistente AI specializzato nell'analisi e nell'elaborazione di informazioni contestuali.
|
83 |
+
- Rispondi sempre ed esclusivamente in italiano.
|
84 |
|
85 |
TASK:
|
86 |
+
Elabora la risposta alla domanda sulla base del contesto fornito.
|
87 |
|
88 |
INSTRUCTIONS:
|
89 |
1. Analizza attentamente il documento e identifica le informazioni pertinenti alla domanda.
|
|
|
95 |
7. Assicurati che la risposta sia interamente in italiano.
|
96 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
97 |
|
98 |
+
CONTESTO:
|
99 |
+
<<<INIZIO_CONTESTO>>>
|
100 |
${contesto}
|
101 |
+
<<<FINE_CONTESTO>>>
|
102 |
|
103 |
+
DOMANDA:
|
104 |
${domanda}
|
105 |
|
106 |
OUTPUT_FORMAT:
|
|
|
113 |
function promptThread(contesto, conversazione, richiesta) {
|
114 |
return `
|
115 |
SYSTEM:
|
116 |
+
- Sei un assistente AI versatile progettato per gestire conversazioni dinamiche e adattarti a varie richieste.
|
117 |
+
- Rispondi sempre in italiano.
|
118 |
|
119 |
TASK:
|
120 |
+
Elaborare la risposta alla richista sulla base del contesto fornito e della conversazione.
|
121 |
|
122 |
INSTRUCTIONS:
|
123 |
1. Analizza attentamente il contesto, la conversazione precedente e la richiesta attuale.
|
|
|
132 |
10. Se è necessario integrare con conoscenze generali, specifica chiaramente quando lo stai facendo.
|
133 |
11. Assicurati che la risposta sia interamente in italiano.
|
134 |
|
135 |
+
CONTESTO:
|
136 |
+
<<<INIZIO_CONTESTO>>>
|
137 |
${contesto}
|
138 |
+
<<<FINE_CONTESTO>>>
|
139 |
|
140 |
+
CONVERSAZIONE:
|
141 |
+
<<<INIZIO_CONVERSAZIONE>>>
|
142 |
${conversazione}
|
143 |
+
<<<FINE_CONVERSAZIONE>>>
|
144 |
|
145 |
+
RICHIESTA:
|
146 |
${richiesta}
|
147 |
|
148 |
OUTPUT_FORMAT:
|
|
|
250 |
return_full_text: false,
|
251 |
details: false,
|
252 |
max_time: 120.0,
|
253 |
+
seed: 42,
|
254 |
},
|
255 |
options: {
|
256 |
use_cache: false,
|
static/javascript/rag_rqs.js
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
*/
|
20 |
|
21 |
"use strict";
|
22 |
-
const VERS = "0.1.
|
23 |
|
24 |
var xlog = console.log;
|
25 |
var xerror = console.error;
|
@@ -66,13 +66,15 @@ const hideSpinner = () => {
|
|
66 |
spinner.removeEventListener("click", cancelRequest);
|
67 |
};
|
68 |
|
|
|
69 |
// INIZIO
|
70 |
function openApp() {
|
|
|
71 |
wnds.init();
|
72 |
Menu.init();
|
73 |
TextInput.init();
|
74 |
TextOutput.init();
|
75 |
-
Rag.init();
|
76 |
document.querySelector(".menu-btn").checked = false;
|
77 |
release();
|
78 |
}
|
@@ -142,11 +144,35 @@ function elencoDati(e) {
|
|
142 |
}
|
143 |
|
144 |
//elenco documenti in memoria
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
DataMgr.readDbDocNames();
|
147 |
const arr = DataMgr.doc_names;
|
148 |
-
const
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
152 |
//calcolo query
|
@@ -176,6 +202,7 @@ function calcQuery() {
|
|
176 |
wnds.wpre.show(s);
|
177 |
}
|
178 |
|
|
|
179 |
//cancella dati
|
180 |
function deleteDati(e) {
|
181 |
const ok = confirm("Confermi cancellazione dati?");
|
@@ -234,10 +261,3 @@ function showPrompts(e) {
|
|
234 |
wnds.wpre.show(text);
|
235 |
}
|
236 |
|
237 |
-
//testi
|
238 |
-
function showTesti(e) {
|
239 |
-
DataMgr.readDbDocs();
|
240 |
-
const arr = DataMgr.docs;
|
241 |
-
const s = arr.join("\n");
|
242 |
-
wnds.wpre.show(s);
|
243 |
-
}
|
|
|
19 |
*/
|
20 |
|
21 |
"use strict";
|
22 |
+
const VERS = "0.1.45 (14-08-2024)";
|
23 |
|
24 |
var xlog = console.log;
|
25 |
var xerror = console.error;
|
|
|
66 |
spinner.removeEventListener("click", cancelRequest);
|
67 |
};
|
68 |
|
69 |
+
var tm;
|
70 |
// INIZIO
|
71 |
function openApp() {
|
72 |
+
tm = umgm();
|
73 |
wnds.init();
|
74 |
Menu.init();
|
75 |
TextInput.init();
|
76 |
TextOutput.init();
|
77 |
+
Rag.init();
|
78 |
document.querySelector(".menu-btn").checked = false;
|
79 |
release();
|
80 |
}
|
|
|
144 |
}
|
145 |
|
146 |
//elenco documenti in memoria
|
147 |
+
// function elencoDocs(e) {
|
148 |
+
// DataMgr.readDbDocNames();
|
149 |
+
// const arr = DataMgr.doc_names;
|
150 |
+
// const s = arr.join("\n");
|
151 |
+
// wnds.wpre.show(s);
|
152 |
+
// }
|
153 |
+
|
154 |
+
//visualizza docuemnto
|
155 |
+
const showT = (n) => {
|
156 |
+
const arr = DataMgr.docs;
|
157 |
+
const s = arr[n];
|
158 |
+
wnds.wpre.show(s);
|
159 |
+
};
|
160 |
+
|
161 |
+
// elenco e visualizzazione documenti
|
162 |
+
function elencoDocs() {
|
163 |
+
DataMgr.readDbDocs();
|
164 |
DataMgr.readDbDocNames();
|
165 |
const arr = DataMgr.doc_names;
|
166 |
+
const fh = (x,i) => `
|
167 |
+
<li><a href="#" onCLick="showT(${i});">${i + 1}.${x}</a></li>
|
168 |
+
`;
|
169 |
+
const jfh = UaJtfh();
|
170 |
+
let i = 0;
|
171 |
+
jfh.append("<ul>");
|
172 |
+
for (const x of arr) jfh.append(fh(x, i++));
|
173 |
+
jfh.append("</ul>");
|
174 |
+
const t = jfh.html();
|
175 |
+
wnds.wdiv.show(`<br><br>${t}`);
|
176 |
}
|
177 |
|
178 |
//calcolo query
|
|
|
202 |
wnds.wpre.show(s);
|
203 |
}
|
204 |
|
205 |
+
|
206 |
//cancella dati
|
207 |
function deleteDati(e) {
|
208 |
const ok = confirm("Confermi cancellazione dati?");
|
|
|
261 |
wnds.wpre.show(text);
|
262 |
}
|
263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/javascript/rag_ui.js
CHANGED
@@ -111,6 +111,7 @@ const WndDiv = (id) => {
|
|
111 |
};
|
112 |
};
|
113 |
|
|
|
114 |
const wnds = {
|
115 |
wdiv: null,
|
116 |
wpre: null,
|
|
|
111 |
};
|
112 |
};
|
113 |
|
114 |
+
//TODO
|
115 |
const wnds = {
|
116 |
wdiv: null,
|
117 |
wpre: null,
|
static/js/ragrqs.min.js
CHANGED
@@ -2,10 +2,9 @@ const removeChars=a=>a.replace(/[\u00AD\u200B\u200C\u200D\u2060\uFEFF]/g,""),rep
|
|
2 |
cleanDoc=a=>{try{return a=removeTag(a),a=removeChars(a),a=replaceChars(a),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/[\t\r]/g," "),a=a.replace(/\u201c/g,'"').replace(/\u201d/g,'"'),a=a.replace(new RegExp(`[^${ALLOWED_CHARS.source}]`,"g")," "),a=a.replace(/ +([.,;:!?])/g,"$1"),a=a.replace(/ +/g," "),a.trim()}catch(b){return console.error(b),"Errore di codifica nella risposta"}},cleanResponse=a=>{try{return a=removeChars(a),a=replaceChars(a),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/[\t\r\n]/g," "),
|
3 |
a=a.replace(new RegExp(`[^${ALLOWED_CHARS.source}]`,"g")," "),a=a.replace(/ +([.,;:!?])/g,"$1"),a=a.replace(/ +/g," "),a.trim()}catch(b){return console.error(b),"Errore di codifica nella risposta"}},cleanOutput=a=>{txt=removeTag(txt);a=a.trim();a=a.replace(/\n{3,}/g,"\n\n");a=a.replace(/^\s+/gm,"");a=a.replace(/^(\s*[-*\u2022])(\s*)/gm,"\n$1 ");a=a.replace(/^(\s*\d+\.)(\s*)/gm,"\n$1 ");a=a.replace(/(```[\s\S]*?```)/g,"\n\n$1\n\n");a=a.replace(/\.(?!\n|$)/g,".\n");return a=a.replace(/\s+$/gm,"")};
|
4 |
function subResponseDOcTag(a){return a.replace(/<<<(.*?)>>>/,(b,c)=>`Documento: ${c}`)};const ID_RESPONSES="id_responses",ID_DOC_NAMES="id_doc_names",ID_DOCS="id_docs;",ID_RAG="id_rag",ID_THREAD="id_thread",UaDb={create(a,b){localStorage.getItem(a)?xerror(`ID ${a} already exists.`):localStorage.setItem(a,b)},read(a){const b=localStorage.getItem(a);return null===b?(xlog(`UaDb.read ${a} not found.`),""):b},update(a,b){localStorage.getItem(a)?localStorage.setItem(a,b):xlog(`UaDb.update ${a} not found.`)},delete(a){localStorage.getItem(a)?localStorage.removeItem(a):xerror(`ID ${a} not found.`)},
|
5 |
-
save(a,b){localStorage.setItem(a,b)},getAllIds(){const a=[];for(let b=0;b<localStorage.length;b++)a.push(localStorage.key(b));return a},saveArray(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readArray(a){a=UaDb.read(a);return 0==a.trim().length?[]:JSON.parse(a)},saveJson(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readJson(a){return(a=UaDb.read(a))?JSON.parse(a):{}}},DataMgr={docs:[],doc_names:[],linkToName(a){a=a.split("/");return a[a.length-1]},async loadDoc(a){try{const b=await requestGet(a),
|
6 |
-
d=this.linkToName(a);this.doc_names.
|
7 |
-
UaDb.delete(b);Rag.ragQuery="";Rag.ragContext="";Rag.ragResponse="";Rag.responses=[];Rag.prompts=[];ThreadMgr.rows=[]}};
|
8 |
-
async function requestGet(a){try{var b=await fetch(a,{method:"GET",headers:{"Content-Type":"text/plain;charset=UTF-8"}});if(!b.ok)throw Error(`HTTP error! status: ${b.status}`);const c=await b.arrayBuffer();return(new TextDecoder("utf-8")).decode(c)}catch(c){throw console.error(c),b="AbortError"===c.name?"Request was aborted":c.message.includes("HTTP error! status")?c.message:"An error occurred",alert(`requestGet()\nurl: ${a}\n${b}`),c;}}
|
9 |
const ERROR_TOKENS="ERROR_TOKENS",TIMEOUT_ERROR="TIMEOUT_ERROR",HfRequest={controller:null,isCancelled:!1,baseUrl:"https://api-inference.huggingface.co/models",async post(a,b=5E4){this.isCancelled=!1;this.controller=new AbortController;try{const c=setTimeout(()=>{this.controller.abort()},b),d=await fetch(`${this.baseUrl}/${model_name}`,{method:"POST",headers:{Authorization:`Bearer ${tm}`,"Content-Type":"application/json"},body:JSON.stringify(a),signal:this.controller.signal});clearTimeout(c);if(this.isCancelled)return null;
|
10 |
const e=await d.json();if(!d.ok){const g=this.checkError(d.status,e),m=this.createErrorInfo(d.status,d.statusText,e.error,g);throw Error(m);}const f=this.isInvalidResponse(e);if("string"===typeof f){const g=this.createErrorInfo(d.status,d.statusText,e.error,f);throw Error(g);}return e[0].generated_text.trim()}catch(c){if(this.isCancelled)return null;if("AbortError"===c.name)throw a=this.createErrorInfo(0,"Timeout","La richiesta \u00e8 scaduta",TIMEOUT_ERROR),Error(a);throw c;}},cancelRequest(){this.controller&&
|
11 |
(this.isCancelled=!0,this.controller.abort())},checkError(a,b){return 500<=a?"SERVER_ERROR":400<=a&&500>a?"object"===typeof b&&"validation"===b.error_type?b.error.includes("tokens")?ERROR_TOKENS:"ERROR_VALIDATION":"CLIENT_ERROR":"UNKNOWN_ERROR"},isInvalidResponse(a){return a&&Array.isArray(a)&&0!==a.length?a[0].generated_text?null:"MISSING_GENERATED_TEXT":"INVALID_DATA"},createErrorInfo(a,b,c,d){return JSON.stringify({status:a,statusText:b,errorType:d,message:c||"Errore sconosciuto"})}};
|
@@ -37,15 +36,17 @@ this.responses)},readRespsFromDb(){this.responses=UaDb.readArray(ID_RESPONSES)},
|
|
37 |
q);ragLog(`${b},${d+1}`,l.length,r.length,this.responses);h=promptDoc(l,a,f);const n=getPayloadDoc(h);try{if(k=await HfRequest.post(n,TIMEOUT),!k)return""}catch(t){if(errorInfo(t).errorType===ERROR_TOKENS){UaLog.log(`Error tokens Doc ${l.length}`);console.error(`Error tokens. Doc ${h.length}`);m+=PROMPT_DECR;continue}else throw console.error(t),t;}d++;e=r;k=cleanResponse(k);p.push(k);this.responses.push(`DOCUMENTO : ${f}\n${k}`)}d=0;if(1==p)k=p[0],d=k.length;else for(k=p.join("\n"),d=k.length;;){h=
|
38 |
promptBuildContext(k);const q=getPayloadBuildContext(h);try{if(k=await HfRequest.post(q,TIMEOUT),!k)return""}catch(n){if(errorInfo(n).errorType===ERROR_TOKENS){UaLog.log(`Error tokens build Context ${l.length}`);console.error(`Error tokens buildContext. ${h.length}`);k=truncInput(k,PROMPT_DECR);continue}else throw console.error(n),n;}break}UaLog.log(`context ${d} => ${k.length}`);k=cleanResponse(k);k=`DOCUMENTO: ${f}\n ${k}`;this.contextAnswers.push(k)}}catch(e){throw console.error(e),e;}this.ragContext=
|
39 |
this.contextAnswers.join("\n");this.saveToDb();b="";c=this.ragContext;try{for(;;){let e=promptWithContext(c,a);const f=getPayloadWithContext(e);try{if(b=await HfRequest.post(f,TIMEOUT),!b)return""}catch(g){if(errorInfo(g).errorType===ERROR_TOKENS){UaLog.log(`Error tokens with COntext ${lft.length}`);console.error(`Error tokens context. Doc ${e.length}`);c=truncInput(c,PROMPT_DECR);continue}else throw console.error(g),g;}break}this.ragResponse=b=cleanResponse(b);this.saveRespToDb();ThreadMgr.init();
|
40 |
-
this.saveToDb();UaLog.log(`Risposta (${
|
41 |
-
console.error(`Error tokens Thread Init. ${prompt.length}`);d=truncInput(d,PROMPT_DECR);continue}else throw console.error(f),f;}break}b=cleanResponse(b);ThreadMgr.add(a,b);b=ThreadMgr.getThread();UaLog.log(`Inizio Conversazione (${prompt.length}
|
42 |
-
ERROR_TOKENS){UaLog.log(`Error tokens Thread ${c.length}`);console.error(`Error tokens Thread. ${c.length}`);e=truncInput(e,PROMPT_DECR);continue}else throw console.error(g),g;}break}b=cleanResponse(b);ThreadMgr.add(a,b);b=ThreadMgr.getThread();UaLog.log(`Conversazione (${c.length}
|
43 |
-
|
44 |
SYSTEM:
|
45 |
-
Sei un assistente AI specializzato nell'analisi di documenti.
|
|
|
46 |
|
47 |
TASK:
|
48 |
-
|
|
|
49 |
|
50 |
INSTRUCTIONS:
|
51 |
1. Analizza attentamente il documento fornito e identifica le informazioni pertinenti alla domanda.
|
@@ -57,12 +58,12 @@ INSTRUCTIONS:
|
|
57 |
7. Assicurati che la risposta sia interamente in italiano,se nel testo \u00e8 usata un'altra lingua traduci in italiano.
|
58 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
59 |
|
60 |
-
|
61 |
-
<<<
|
62 |
${a}
|
63 |
-
<<<
|
64 |
|
65 |
-
|
66 |
${b}
|
67 |
|
68 |
OUTPUT_FORMAT:
|
@@ -70,11 +71,13 @@ Rispondi con un testo continuo suddiviso in paragrafi. Inizia direttamente con i
|
|
70 |
|
71 |
RESPONSE:
|
72 |
`}function promptBuildContext(a){return`
|
73 |
-
|
74 |
-
Sei un assistente AI specializzato nell'analisi di documenti.
|
|
|
75 |
|
76 |
TASK:
|
77 |
-
Analizza e riorganizza logicamente il documento fornito.
|
|
|
78 |
|
79 |
INSTRUCTIONS:
|
80 |
1. Valuta la tipologia e lo scopo del documento (es. articolo scientifico, racconto,saggio, documento tecnico) e adatta l'analisi di conseguenza.
|
@@ -93,10 +96,10 @@ INSTRUCTIONS:
|
|
93 |
14. Assicurati che la risposta sia interamente in italiano.
|
94 |
15. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
95 |
|
96 |
-
|
97 |
-
<<<
|
98 |
${a}
|
99 |
-
<<<
|
100 |
|
101 |
OUTPUT_FORMAT:
|
102 |
Rispondi con un testo continuo suddiviso in paragrafi. Inizia direttamente con il contenuto. Evita di usare etichette, elenchi o marcatori speciali.
|
@@ -104,10 +107,11 @@ Rispondi con un testo continuo suddiviso in paragrafi. Inizia direttamente con i
|
|
104 |
RESPONSE:
|
105 |
`}function promptWithContext(a,b){return`
|
106 |
SYSTEM:
|
107 |
-
Sei un assistente AI specializzato nell'analisi e nell'elaborazione di informazioni contestuali.
|
|
|
108 |
|
109 |
TASK:
|
110 |
-
|
111 |
|
112 |
INSTRUCTIONS:
|
113 |
1. Analizza attentamente il documento e identifica le informazioni pertinenti alla domanda.
|
@@ -119,12 +123,12 @@ INSTRUCTIONS:
|
|
119 |
7. Assicurati che la risposta sia interamente in italiano.
|
120 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
121 |
|
122 |
-
|
123 |
-
<<<
|
124 |
${a}
|
125 |
-
<<<
|
126 |
|
127 |
-
|
128 |
${b}
|
129 |
|
130 |
OUTPUT_FORMAT:
|
@@ -133,10 +137,11 @@ Rispondi con un testo continuo suddiviso in paragrafi. Inizia direttamente con i
|
|
133 |
RESPONSE:
|
134 |
`}function promptThread(a,b,c){return`
|
135 |
SYSTEM:
|
136 |
-
Sei un assistente AI versatile progettato per gestire conversazioni dinamiche e adattarti a varie richieste.
|
|
|
137 |
|
138 |
TASK:
|
139 |
-
Elaborare la risposta alla
|
140 |
|
141 |
INSTRUCTIONS:
|
142 |
1. Analizza attentamente il contesto, la conversazione precedente e la richiesta attuale.
|
@@ -151,16 +156,17 @@ INSTRUCTIONS:
|
|
151 |
10. Se \u00e8 necessario integrare con conoscenze generali, specifica chiaramente quando lo stai facendo.
|
152 |
11. Assicurati che la risposta sia interamente in italiano.
|
153 |
|
154 |
-
|
155 |
-
<<<
|
156 |
${a}
|
157 |
-
<<<
|
158 |
|
159 |
-
|
|
|
160 |
${b}
|
161 |
-
<<<
|
162 |
|
163 |
-
|
164 |
${c}
|
165 |
|
166 |
OUTPUT_FORMAT:
|
@@ -170,13 +176,14 @@ RESPONSE:
|
|
170 |
`}function getPayloadDoc(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:1024,num_return_sequences:1,temperature:.5,top_k:50,top_p:.7,do_sample:!1,no_repeat_ngram_size:4,num_beams:4,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:90,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
|
171 |
function getPayloadBuildContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:4096,num_return_sequences:1,temperature:.4,top_k:20,top_p:.8,do_sample:!1,no_repeat_ngram_size:4,num_beams:6,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
|
172 |
function getPayloadWithContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:2048,num_return_sequences:1,temperature:.6,top_k:50,top_p:.7,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
|
173 |
-
function getPayloadThread(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:2048,num_return_sequences:1,temperature:.6,top_k:50,top_p:.7,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}};const VERS="0.1.
|
174 |
-
function openApp(){wnds.init();Menu.init();TextInput.init();TextOutput.init();Rag.init();document.querySelector(".menu-btn").checked=!1;release()}function release(){document.querySelector(".release").innerHTML=VERS}const op0=async function(a){a=await requestGet("./help1.html");wnds.wdiv.show(a)};function showQuery(a){wnds.wpre.show(`\n${Rag.ragQuery}`)}function showRagResponse(a){wnds.wpre.show(`\n${Rag.ragResponse}`)}function showThread(a){a=ThreadMgr.getThread();wnds.wpre.show(a)}
|
175 |
-
function elencoRisposte(a){a=[...Rag.responses];0==a.length&&(a=UaDb.readArray(ID_RESPONSES));0!=a.length&&(a=a.map((b,c)=>{b=subResponseDOcTag(b);return`\n[${c+1}]\n ${b.trim()}`}).join("\n"),wnds.wpre.show(a))}function showContesto(a){wnds.wpre.show(`${Rag.ragContext}`)}function elencoDati(a){var b=UaDb.getAllIds();a=[];for(var c of b)b=UaDb.read(c).length,a.push(`${c} (${b})`);c=a.join("\n ");wnds.wpre.show(c)}
|
176 |
-
|
177 |
-
|
|
|
178 |
function deleteDati(a){confirm("Confermi cancellazione dati?")&&(DataMgr.deleteJsonDati(),wnds.wdiv.close(),wnds.wpre.close(),TextOutput.clear())}function deleteSttorage(a){confirm("Confermi cancellazione documenti & dati?")&&(DataMgr.deleteJsonDati(),localStorage.clear(),wnds.wdiv.close(),wnds.wpre.close(),TextOutput.clear(),DataMgr.docs=[],DataMgr.doc_names=[])}async function help1(a){a=await requestGet("./data/help_test.html");wnds.wdiv.show(a)}
|
179 |
-
function loadTestoEsempio(a){DataMgr.loadDoc(`data/${a}`);wnds.wdiv.close()}async function help2(a){a=await requestGet("./help2.html");wnds.wdiv.show(a)}function showPrompts(a){0!=Rag.prompts.length&&(a=Rag.prompts.map((b,c)=>`[${c+1}]${b}\n`).join("\n"),wnds.wpre.show(a))}
|
180 |
<div class="window-text">
|
181 |
<div class="btn-wrapper">
|
182 |
<button class="btn-copy" title="Copia">
|
|
|
2 |
cleanDoc=a=>{try{return a=removeTag(a),a=removeChars(a),a=replaceChars(a),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/[\t\r]/g," "),a=a.replace(/\u201c/g,'"').replace(/\u201d/g,'"'),a=a.replace(new RegExp(`[^${ALLOWED_CHARS.source}]`,"g")," "),a=a.replace(/ +([.,;:!?])/g,"$1"),a=a.replace(/ +/g," "),a.trim()}catch(b){return console.error(b),"Errore di codifica nella risposta"}},cleanResponse=a=>{try{return a=removeChars(a),a=replaceChars(a),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/[\t\r\n]/g," "),
|
3 |
a=a.replace(new RegExp(`[^${ALLOWED_CHARS.source}]`,"g")," "),a=a.replace(/ +([.,;:!?])/g,"$1"),a=a.replace(/ +/g," "),a.trim()}catch(b){return console.error(b),"Errore di codifica nella risposta"}},cleanOutput=a=>{txt=removeTag(txt);a=a.trim();a=a.replace(/\n{3,}/g,"\n\n");a=a.replace(/^\s+/gm,"");a=a.replace(/^(\s*[-*\u2022])(\s*)/gm,"\n$1 ");a=a.replace(/^(\s*\d+\.)(\s*)/gm,"\n$1 ");a=a.replace(/(```[\s\S]*?```)/g,"\n\n$1\n\n");a=a.replace(/\.(?!\n|$)/g,".\n");return a=a.replace(/\s+$/gm,"")};
|
4 |
function subResponseDOcTag(a){return a.replace(/<<<(.*?)>>>/,(b,c)=>`Documento: ${c}`)};const ID_RESPONSES="id_responses",ID_DOC_NAMES="id_doc_names",ID_DOCS="id_docs;",ID_RAG="id_rag",ID_THREAD="id_thread",UaDb={create(a,b){localStorage.getItem(a)?xerror(`ID ${a} already exists.`):localStorage.setItem(a,b)},read(a){const b=localStorage.getItem(a);return null===b?(xlog(`UaDb.read ${a} not found.`),""):b},update(a,b){localStorage.getItem(a)?localStorage.setItem(a,b):xlog(`UaDb.update ${a} not found.`)},delete(a){localStorage.getItem(a)?localStorage.removeItem(a):xerror(`ID ${a} not found.`)},
|
5 |
+
save(a,b){localStorage.setItem(a,b)},getAllIds(){const a=[];for(let b=0;b<localStorage.length;b++)a.push(localStorage.key(b));return a},saveArray(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readArray(a){a=UaDb.read(a);return 0==a.trim().length?[]:JSON.parse(a)},saveJson(a,b){b=JSON.stringify(b);UaDb.save(a,b)},readJson(a){return(a=UaDb.read(a))?JSON.parse(a):{}}},DataMgr={docs:[],doc_names:[],linkToName(a){a=a.split("/");return a[a.length-1]},async loadDoc(a){this.readDbDocNames();try{const b=await requestGet(a),
|
6 |
+
c=cleanDoc(b),d=this.linkToName(a);if(this.doc_names.includes(d))alert(`Il docuento ${d} \u00e8 gi\u00e0 caricato`);else return this.doc_names.push(d),this.docs.push(c),this.saveDbDocs(),c}catch(b){alert("loadDoc()\n"+b+"\n"+a)}},addDoc(a,b){b=cleanDoc(b);this.docs.push(b);this.doc_names.push(a);this.saveDbDocs()},saveDbDocs(){UaDb.saveArray(ID_DOC_NAMES,this.doc_names);UaDb.saveArray(ID_DOCS,this.docs)},readDbDocs(){this.docs=UaDb.readArray(ID_DOCS)},readDbDocNames(){this.doc_names=UaDb.readArray(ID_DOC_NAMES)},
|
7 |
+
deleteJsonDati(){const a=UaDb.getAllIds();for(const b of a)[ID_DOCS,ID_DOC_NAMES].includes(b)||UaDb.delete(b);Rag.ragQuery="";Rag.ragContext="";Rag.ragResponse="";Rag.responses=[];Rag.prompts=[];ThreadMgr.rows=[]}};function umgm(){return["bWtkW0l+XX0=","SXx2d1FxbVc=","V1tRXlxneUY=","flV6a1NdbUg=","VllpUkc="].map(a=>atob(a).split("").map(b=>String.fromCharCode((b.charCodeAt(0)-5+256)%256)).join("")).join("")};const model_name="mistralai/Mistral-7B-Instruct-v0.3";async function requestGet(a){try{var b=await fetch(a,{method:"GET",headers:{"Content-Type":"text/plain;charset=UTF-8"}});if(!b.ok)throw Error(`HTTP error! status: ${b.status}`);const c=await b.arrayBuffer();return(new TextDecoder("utf-8")).decode(c)}catch(c){throw console.error(c),b="AbortError"===c.name?"Request was aborted":c.message.includes("HTTP error! status")?c.message:"An error occurred",alert(`requestGet()\nurl: ${a}\n${b}`),c;}}
|
|
|
8 |
const ERROR_TOKENS="ERROR_TOKENS",TIMEOUT_ERROR="TIMEOUT_ERROR",HfRequest={controller:null,isCancelled:!1,baseUrl:"https://api-inference.huggingface.co/models",async post(a,b=5E4){this.isCancelled=!1;this.controller=new AbortController;try{const c=setTimeout(()=>{this.controller.abort()},b),d=await fetch(`${this.baseUrl}/${model_name}`,{method:"POST",headers:{Authorization:`Bearer ${tm}`,"Content-Type":"application/json"},body:JSON.stringify(a),signal:this.controller.signal});clearTimeout(c);if(this.isCancelled)return null;
|
9 |
const e=await d.json();if(!d.ok){const g=this.checkError(d.status,e),m=this.createErrorInfo(d.status,d.statusText,e.error,g);throw Error(m);}const f=this.isInvalidResponse(e);if("string"===typeof f){const g=this.createErrorInfo(d.status,d.statusText,e.error,f);throw Error(g);}return e[0].generated_text.trim()}catch(c){if(this.isCancelled)return null;if("AbortError"===c.name)throw a=this.createErrorInfo(0,"Timeout","La richiesta \u00e8 scaduta",TIMEOUT_ERROR),Error(a);throw c;}},cancelRequest(){this.controller&&
|
10 |
(this.isCancelled=!0,this.controller.abort())},checkError(a,b){return 500<=a?"SERVER_ERROR":400<=a&&500>a?"object"===typeof b&&"validation"===b.error_type?b.error.includes("tokens")?ERROR_TOKENS:"ERROR_VALIDATION":"CLIENT_ERROR":"UNKNOWN_ERROR"},isInvalidResponse(a){return a&&Array.isArray(a)&&0!==a.length?a[0].generated_text?null:"MISSING_GENERATED_TEXT":"INVALID_DATA"},createErrorInfo(a,b,c,d){return JSON.stringify({status:a,statusText:b,errorType:d,message:c||"Errore sconosciuto"})}};
|
|
|
36 |
q);ragLog(`${b},${d+1}`,l.length,r.length,this.responses);h=promptDoc(l,a,f);const n=getPayloadDoc(h);try{if(k=await HfRequest.post(n,TIMEOUT),!k)return""}catch(t){if(errorInfo(t).errorType===ERROR_TOKENS){UaLog.log(`Error tokens Doc ${l.length}`);console.error(`Error tokens. Doc ${h.length}`);m+=PROMPT_DECR;continue}else throw console.error(t),t;}d++;e=r;k=cleanResponse(k);p.push(k);this.responses.push(`DOCUMENTO : ${f}\n${k}`)}d=0;if(1==p)k=p[0],d=k.length;else for(k=p.join("\n"),d=k.length;;){h=
|
37 |
promptBuildContext(k);const q=getPayloadBuildContext(h);try{if(k=await HfRequest.post(q,TIMEOUT),!k)return""}catch(n){if(errorInfo(n).errorType===ERROR_TOKENS){UaLog.log(`Error tokens build Context ${l.length}`);console.error(`Error tokens buildContext. ${h.length}`);k=truncInput(k,PROMPT_DECR);continue}else throw console.error(n),n;}break}UaLog.log(`context ${d} => ${k.length}`);k=cleanResponse(k);k=`DOCUMENTO: ${f}\n ${k}`;this.contextAnswers.push(k)}}catch(e){throw console.error(e),e;}this.ragContext=
|
38 |
this.contextAnswers.join("\n");this.saveToDb();b="";c=this.ragContext;try{for(;;){let e=promptWithContext(c,a);const f=getPayloadWithContext(e);try{if(b=await HfRequest.post(f,TIMEOUT),!b)return""}catch(g){if(errorInfo(g).errorType===ERROR_TOKENS){UaLog.log(`Error tokens with COntext ${lft.length}`);console.error(`Error tokens context. Doc ${e.length}`);c=truncInput(c,PROMPT_DECR);continue}else throw console.error(g),g;}break}this.ragResponse=b=cleanResponse(b);this.saveRespToDb();ThreadMgr.init();
|
39 |
+
this.saveToDb();UaLog.log(`Risposta (${b.length})`)}catch(e){throw console.error(e),b=`${e}`,e;}finally{return b}},async requestContext(a){let b="";if(!this.ragContext&&!await confirm("Contesto vuoto. Vuoi continuare?"))return"";if(ThreadMgr.isFirst()){ThreadMgr.init();try{var c=this.ragContext;let d=ThreadMgr.getThread();for(;;){prompt=promptThread(c,d,a);const e=getPayloadThread(prompt);try{if(b=await HfRequest.post(e,TIMEOUT),!b)return""}catch(f){if(errorInfo(f).errorType===ERROR_TOKENS){UaLog.log(`Error tokens Thread Init ${prompt.length}`);
|
40 |
+
console.error(`Error tokens Thread Init. ${prompt.length}`);d=truncInput(d,PROMPT_DECR);continue}else throw console.error(f),f;}break}b=cleanResponse(b);ThreadMgr.add(a,b);b=ThreadMgr.getThread();UaLog.log(`Inizio Conversazione (${prompt.length})`)}catch(d){throw console.error(d),b=`${d}`,d;}finally{return b}}else try{let d=this.ragContext,e=ThreadMgr.getThread();for(c="";;){c=promptThread(d,e,a);const f=getPayloadThread(c);try{if(b=await HfRequest.post(f,TIMEOUT),!b)return""}catch(g){if(errorInfo(g).errorType===
|
41 |
+
ERROR_TOKENS){UaLog.log(`Error tokens Thread ${c.length}`);console.error(`Error tokens Thread. ${c.length}`);e=truncInput(e,PROMPT_DECR);continue}else throw console.error(g),g;}break}b=cleanResponse(b);ThreadMgr.add(a,b);b=ThreadMgr.getThread();UaLog.log(`Conversazione (${c.length})`)}catch(d){throw console.error(d),b=`${d}`,d;}finally{return b}}},LLM="Assistant:",USER="User:",ThreadMgr={rows:[],init(){this.rows=[];Rag.ragResponse?this.add(Rag.ragQuery,Rag.ragResponse):this.add("","")},add(a,b){this.rows.push([a,
|
42 |
+
b]);UaDb.saveArray(ID_THREAD,ThreadMgr.rows)},getThread(){const a=[];for(const b of this.rows)a.push(`\n${USER}\n${b[0]}\n${LLM}\n${b[1]}\n`);return a.join("").trim()},isFirst(){return 2>this.rows.length}};function promptDoc(a,b,c){return`
|
43 |
SYSTEM:
|
44 |
+
- Sei un assistente AI specializzato nell'analisi di documenti.
|
45 |
+
- Rispondi sempre ed esclusivamente in italiano.
|
46 |
|
47 |
TASK:
|
48 |
+
- Analizza il documento fornito ed estrai le informazioni rilevanti per rispondere alla domanda fornita.
|
49 |
+
- Attieniti rigorosamente alle istruzioni.
|
50 |
|
51 |
INSTRUCTIONS:
|
52 |
1. Analizza attentamente il documento fornito e identifica le informazioni pertinenti alla domanda.
|
|
|
58 |
7. Assicurati che la risposta sia interamente in italiano,se nel testo \u00e8 usata un'altra lingua traduci in italiano.
|
59 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
60 |
|
61 |
+
DOCUMENTO:
|
62 |
+
<<<INIZIO DOCUMENTO ${c}>>>
|
63 |
${a}
|
64 |
+
<<<FINE DOCUMENTO>>>
|
65 |
|
66 |
+
DOMANDA:
|
67 |
${b}
|
68 |
|
69 |
OUTPUT_FORMAT:
|
|
|
71 |
|
72 |
RESPONSE:
|
73 |
`}function promptBuildContext(a){return`
|
74 |
+
SYSTEM:
|
75 |
+
- Sei un assistente AI specializzato nell'analisi di documenti.
|
76 |
+
- Rispondi sempre ed esclusivamente in italiano.
|
77 |
|
78 |
TASK:
|
79 |
+
- Analizza e riorganizza logicamente il documento fornito.
|
80 |
+
- Attieniti rigorosamente alle istruzioni.
|
81 |
|
82 |
INSTRUCTIONS:
|
83 |
1. Valuta la tipologia e lo scopo del documento (es. articolo scientifico, racconto,saggio, documento tecnico) e adatta l'analisi di conseguenza.
|
|
|
96 |
14. Assicurati che la risposta sia interamente in italiano.
|
97 |
15. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
98 |
|
99 |
+
DOCUMENTO:
|
100 |
+
<<<INIZIO_DOCUMENTO>>>
|
101 |
${a}
|
102 |
+
<<<FINE_DOCUMENTO>>>
|
103 |
|
104 |
OUTPUT_FORMAT:
|
105 |
Rispondi con un testo continuo suddiviso in paragrafi. Inizia direttamente con il contenuto. Evita di usare etichette, elenchi o marcatori speciali.
|
|
|
107 |
RESPONSE:
|
108 |
`}function promptWithContext(a,b){return`
|
109 |
SYSTEM:
|
110 |
+
- Sei un assistente AI specializzato nell'analisi e nell'elaborazione di informazioni contestuali.
|
111 |
+
- Rispondi sempre ed esclusivamente in italiano.
|
112 |
|
113 |
TASK:
|
114 |
+
Elabora la risposta alla domanda sulla base del contesto fornito.
|
115 |
|
116 |
INSTRUCTIONS:
|
117 |
1. Analizza attentamente il documento e identifica le informazioni pertinenti alla domanda.
|
|
|
123 |
7. Assicurati che la risposta sia interamente in italiano.
|
124 |
8. Mantieni un tono oggettivo e uno stile fluido e coerente.
|
125 |
|
126 |
+
CONTESTO:
|
127 |
+
<<<INIZIO_CONTESTO>>>
|
128 |
${a}
|
129 |
+
<<<FINE_CONTESTO>>>
|
130 |
|
131 |
+
DOMANDA:
|
132 |
${b}
|
133 |
|
134 |
OUTPUT_FORMAT:
|
|
|
137 |
RESPONSE:
|
138 |
`}function promptThread(a,b,c){return`
|
139 |
SYSTEM:
|
140 |
+
- Sei un assistente AI versatile progettato per gestire conversazioni dinamiche e adattarti a varie richieste.
|
141 |
+
- Rispondi sempre in italiano.
|
142 |
|
143 |
TASK:
|
144 |
+
Elaborare la risposta alla richista sulla base del contesto fornito e della conversazione.
|
145 |
|
146 |
INSTRUCTIONS:
|
147 |
1. Analizza attentamente il contesto, la conversazione precedente e la richiesta attuale.
|
|
|
156 |
10. Se \u00e8 necessario integrare con conoscenze generali, specifica chiaramente quando lo stai facendo.
|
157 |
11. Assicurati che la risposta sia interamente in italiano.
|
158 |
|
159 |
+
CONTESTO:
|
160 |
+
<<<INIZIO_CONTESTO>>>
|
161 |
${a}
|
162 |
+
<<<FINE_CONTESTO>>>
|
163 |
|
164 |
+
CONVERSAZIONE:
|
165 |
+
<<<INIZIO_CONVERSAZIONE>>>
|
166 |
${b}
|
167 |
+
<<<FINE_CONVERSAZIONE>>>
|
168 |
|
169 |
+
RICHIESTA:
|
170 |
${c}
|
171 |
|
172 |
OUTPUT_FORMAT:
|
|
|
176 |
`}function getPayloadDoc(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:1024,num_return_sequences:1,temperature:.5,top_k:50,top_p:.7,do_sample:!1,no_repeat_ngram_size:4,num_beams:4,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:90,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
|
177 |
function getPayloadBuildContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:4096,num_return_sequences:1,temperature:.4,top_k:20,top_p:.8,do_sample:!1,no_repeat_ngram_size:4,num_beams:6,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
|
178 |
function getPayloadWithContext(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:2048,num_return_sequences:1,temperature:.6,top_k:50,top_p:.7,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}}
|
179 |
+
function getPayloadThread(a){return{inputs:a,parameters:{task:"text2text-generation",max_new_tokens:2048,num_return_sequences:1,temperature:.6,top_k:50,top_p:.7,do_sample:!1,no_repeat_ngram_size:4,num_beams:5,repetition_penalty:1.4,return_full_text:!1,details:!1,max_time:120,seed:42},options:{use_cache:!1,wait_for_model:!0}}};const VERS="0.1.45 (14-08-2024)";var xlog=console.log,xerror=console.error;const cancelRequest=()=>{confirm("Confermi Cancellazione Richeista ?")&&(HfRequest.cancelRequest(),hideSpinner())},showSpinner=()=>{const a=document.getElementById("spinner");a.classList.add("show-spinner");a.addEventListener("click",cancelRequest)},hideSpinner=()=>{const a=document.getElementById("spinner");a.classList.remove("show-spinner");a.removeEventListener("click",cancelRequest)};var tm;
|
180 |
+
function openApp(){tm=umgm();wnds.init();Menu.init();TextInput.init();TextOutput.init();Rag.init();document.querySelector(".menu-btn").checked=!1;release()}function release(){document.querySelector(".release").innerHTML=VERS}const op0=async function(a){a=await requestGet("./help1.html");wnds.wdiv.show(a)};function showQuery(a){wnds.wpre.show(`\n${Rag.ragQuery}`)}function showRagResponse(a){wnds.wpre.show(`\n${Rag.ragResponse}`)}function showThread(a){a=ThreadMgr.getThread();wnds.wpre.show(a)}
|
181 |
+
function elencoRisposte(a){a=[...Rag.responses];0==a.length&&(a=UaDb.readArray(ID_RESPONSES));0!=a.length&&(a=a.map((b,c)=>{b=subResponseDOcTag(b);return`\n[${c+1}]\n ${b.trim()}`}).join("\n"),wnds.wpre.show(a))}function showContesto(a){wnds.wpre.show(`${Rag.ragContext}`)}function elencoDati(a){var b=UaDb.getAllIds();a=[];for(var c of b)b=UaDb.read(c).length,a.push(`${c} (${b})`);c=a.join("\n ");wnds.wpre.show(c)}const showT=a=>{wnds.wpre.show(DataMgr.docs[a])};
|
182 |
+
function elencoDocs(){DataMgr.readDbDocs();DataMgr.readDbDocNames();var a=DataMgr.doc_names,b=UaJtfh();let c=0;b.append("<ul>");for(const g of a){a=b;var d=a.append,e=g,f=c++;d.call(a,`
|
183 |
+
<li><a href="#" onCLick="showT(${f});">${f+1}.${e}</a></li>
|
184 |
+
`)}b.append("</ul>");b=b.html();wnds.wdiv.show(`<br><br>${b}`)}function calcQuery(){DataMgr.readDbDocs();DataMgr.readDbDocNames();var a=[];let b=0,c=0;a.push("Documento Num.Parti");a.push("==================");for(const d of DataMgr.docs){const e=DataMgr.doc_names[c];c+=1;const f=Math.ceil(d.length/MAX_PROMPT_LENGTH);b+=f;a.push(`${e} [${f}]`)}a.push("==================");a.push(`Totale num. Parti: ${b}`);a=a.join("\n");wnds.wpre.show(a)}
|
185 |
function deleteDati(a){confirm("Confermi cancellazione dati?")&&(DataMgr.deleteJsonDati(),wnds.wdiv.close(),wnds.wpre.close(),TextOutput.clear())}function deleteSttorage(a){confirm("Confermi cancellazione documenti & dati?")&&(DataMgr.deleteJsonDati(),localStorage.clear(),wnds.wdiv.close(),wnds.wpre.close(),TextOutput.clear(),DataMgr.docs=[],DataMgr.doc_names=[])}async function help1(a){a=await requestGet("./data/help_test.html");wnds.wdiv.show(a)}
|
186 |
+
function loadTestoEsempio(a){DataMgr.loadDoc(`data/${a}`);wnds.wdiv.close()}async function help2(a){a=await requestGet("./help2.html");wnds.wdiv.show(a)}function showPrompts(a){0!=Rag.prompts.length&&(a=Rag.prompts.map((b,c)=>`[${c+1}]${b}\n`).join("\n"),wnds.wpre.show(a))};const WndPre=a=>({w:UaWindowAdm.create(a),out:null,show(b){wnds.closeAll();b=`
|
187 |
<div class="window-text">
|
188 |
<div class="btn-wrapper">
|
189 |
<button class="btn-copy" title="Copia">
|
static/less/ragrqs.less
CHANGED
@@ -799,6 +799,7 @@ div.menu-h {
|
|
799 |
outline: none;
|
800 |
box-shadow: 0 0 0 2px @wnd-border-shadow;
|
801 |
overflow-y: auto;
|
|
|
802 |
|
803 |
pre.pre-text {
|
804 |
color: @wnd-pre-color;
|
@@ -807,11 +808,48 @@ div.menu-h {
|
|
807 |
font-family: @fserif;
|
808 |
font-size: @fsize-help;
|
809 |
line-height: 1.6;
|
810 |
-
padding: 2px;
|
811 |
margin: 0;
|
812 |
text-align: left;
|
813 |
}
|
814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
// help
|
816 |
div.text {
|
817 |
font-size: @fsize-help;
|
@@ -860,7 +898,6 @@ div.menu-h {
|
|
860 |
}
|
861 |
}
|
862 |
}
|
863 |
-
|
864 |
p {
|
865 |
font-size: @fsize-help;
|
866 |
font-weight: normal;
|
|
|
799 |
outline: none;
|
800 |
box-shadow: 0 0 0 2px @wnd-border-shadow;
|
801 |
overflow-y: auto;
|
802 |
+
overflow-x: auto;
|
803 |
|
804 |
pre.pre-text {
|
805 |
color: @wnd-pre-color;
|
|
|
808 |
font-family: @fserif;
|
809 |
font-size: @fsize-help;
|
810 |
line-height: 1.6;
|
811 |
+
padding: 2px 2px 2px 2px;
|
812 |
margin: 0;
|
813 |
text-align: left;
|
814 |
}
|
815 |
|
816 |
+
div.div-text {
|
817 |
+
color: @wnd-pre-color;
|
818 |
+
word-wrap: break-word;
|
819 |
+
font-family: @fserif;
|
820 |
+
font-size: @fsize-help;
|
821 |
+
padding: 0 2px 0 2px;
|
822 |
+
margin: 0;
|
823 |
+
ul {
|
824 |
+
list-style: none;
|
825 |
+
margin: 0;
|
826 |
+
padding: 0;
|
827 |
+
display: flex;
|
828 |
+
flex-direction: column;
|
829 |
+
border-top: 1px solid @menu-border;
|
830 |
+
li {
|
831 |
+
border-left: 1px solid @menu-border;
|
832 |
+
border-right: 1px solid @menu-border;
|
833 |
+
border-bottom: 1px solid @menu-border;
|
834 |
+
a {
|
835 |
+
color: @menu-fg;
|
836 |
+
font-size: @fsize-menu;
|
837 |
+
font-family: @fsans;
|
838 |
+
font-weight: normal;
|
839 |
+
display: block;
|
840 |
+
margin: 0;
|
841 |
+
padding: 5px 2px 2px 0;
|
842 |
+
text-align: left;
|
843 |
+
text-decoration: none;
|
844 |
+
}
|
845 |
+
&:hover {
|
846 |
+
text-decoration: underline;
|
847 |
+
background-color: lighten(@menu-bg, 20%);
|
848 |
+
color: @menu-icon-hover;
|
849 |
+
}
|
850 |
+
}
|
851 |
+
}
|
852 |
+
}
|
853 |
// help
|
854 |
div.text {
|
855 |
font-size: @fsize-help;
|
|
|
898 |
}
|
899 |
}
|
900 |
}
|
|
|
901 |
p {
|
902 |
font-size: @fsize-help;
|
903 |
font-weight: normal;
|
static/less/ualog3.less
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
/** @format */
|
|
|
|
|
2 |
|
3 |
#ualog_ {
|
4 |
box-sizing: border-box;
|
5 |
width: auto;
|
6 |
-
// min-width: 300px;
|
7 |
height: auto;
|
8 |
text-align: center;
|
9 |
padding: 2px;
|
@@ -20,30 +22,27 @@
|
|
20 |
margin: 0 5px;
|
21 |
font-size: 18px;
|
22 |
font-weight: bold;
|
23 |
-
border: 2px solid #
|
24 |
border-radius: 10px;
|
|
|
25 |
|
26 |
&:hover {
|
27 |
cursor: pointer;
|
28 |
-
|
29 |
}
|
30 |
}
|
31 |
button.close {
|
32 |
-
background:
|
33 |
-
color: #ff4500;
|
34 |
&:hover {
|
35 |
-
|
36 |
-
|
37 |
-
border-color: #ff4500;
|
38 |
}
|
39 |
}
|
40 |
button.clear {
|
41 |
-
background:
|
42 |
-
color: yellow;
|
43 |
&:hover {
|
44 |
-
|
45 |
-
|
46 |
-
border-color: yellow;
|
47 |
}
|
48 |
}
|
49 |
|
|
|
1 |
/** @format */
|
2 |
+
@color1: #ff4500;
|
3 |
+
@color3: #e3d50e;
|
4 |
|
5 |
#ualog_ {
|
6 |
box-sizing: border-box;
|
7 |
width: auto;
|
8 |
+
// min-width: 300px;
|
9 |
height: auto;
|
10 |
text-align: center;
|
11 |
padding: 2px;
|
|
|
22 |
margin: 0 5px;
|
23 |
font-size: 18px;
|
24 |
font-weight: bold;
|
25 |
+
border: 2px solid #888888;
|
26 |
border-radius: 10px;
|
27 |
+
color: #000000;
|
28 |
|
29 |
&:hover {
|
30 |
cursor: pointer;
|
31 |
+
text-decoration: underline;
|
32 |
}
|
33 |
}
|
34 |
button.close {
|
35 |
+
background: lighten(@color1, -10%);
|
|
|
36 |
&:hover {
|
37 |
+
background: lighten(@color1, 20%);
|
38 |
+
border-color: darken(@color1, 20%);
|
|
|
39 |
}
|
40 |
}
|
41 |
button.clear {
|
42 |
+
background: lighten(@color3, -10%);
|
|
|
43 |
&:hover {
|
44 |
+
background: lighten(@color3, 20%);
|
45 |
+
border-color: darken(@color3, 20%);
|
|
|
46 |
}
|
47 |
}
|
48 |
|
static/ragrqs_.html
CHANGED
@@ -12,8 +12,8 @@
|
|
12 |
<script src="js/ragrqs.min.js"></script>
|
13 |
-->
|
14 |
<link rel="stylesheet" href="less/normalize.css" />
|
15 |
-
<link rel="stylesheet/less"
|
16 |
-
<link rel="stylesheet/less"
|
17 |
<script src="less/less.js"></script>
|
18 |
|
19 |
<script src="javascript/uadrag.js"></script>
|
@@ -28,20 +28,18 @@
|
|
28 |
<script src="javascript/rag_rqs.js"></script>
|
29 |
<script src="javascript/rag_upload.js"></script>
|
30 |
<script src="javascript/rag_ui.js"></script>
|
|
|
31 |
|
32 |
<body>
|
33 |
<div id="spinner" class="spinner">
|
34 |
<div class="pulse-icon"></div>
|
35 |
<div class="stop-message">Stop</div>
|
36 |
</div>
|
37 |
-
|
38 |
<div class="menu-h">
|
39 |
-
|
40 |
<input id="id-menu-btn" name="id-menu-btn" class="menu-btn" type="checkbox" />
|
41 |
<label for="id-menu-btn" class="menu-icon">
|
42 |
<span class="nav-icon"></span>
|
43 |
</label>
|
44 |
-
|
45 |
<div class="head-wrapper">
|
46 |
|
47 |
<button class="help" onclick="Menu.help();" title="Istruzioni">?</button>
|
@@ -79,9 +77,8 @@
|
|
79 |
<li>-</li>
|
80 |
<li><a href="#" onCLick="help1(this);">Esempi di documenti</a></li>
|
81 |
<li><a href="#" onCLick="help2(this);">Esempi di domande</a></li>
|
82 |
-
|
83 |
<li><a href="#" onCLick="showPrompts(this);">prompts</a></li>
|
84 |
-
<li><a href="#" onCLick="showTesti(this);">Testo Documenti</a></li>
|
85 |
|
86 |
</ul>
|
87 |
</div>
|
|
|
12 |
<script src="js/ragrqs.min.js"></script>
|
13 |
-->
|
14 |
<link rel="stylesheet" href="less/normalize.css" />
|
15 |
+
<link rel="stylesheet/less" href="less/ragrqs.less" />
|
16 |
+
<link rel="stylesheet/less" href="less/ualog3.less" />
|
17 |
<script src="less/less.js"></script>
|
18 |
|
19 |
<script src="javascript/uadrag.js"></script>
|
|
|
28 |
<script src="javascript/rag_rqs.js"></script>
|
29 |
<script src="javascript/rag_upload.js"></script>
|
30 |
<script src="javascript/rag_ui.js"></script>
|
31 |
+
<script src="javascript/rag_env.js"></script>
|
32 |
|
33 |
<body>
|
34 |
<div id="spinner" class="spinner">
|
35 |
<div class="pulse-icon"></div>
|
36 |
<div class="stop-message">Stop</div>
|
37 |
</div>
|
|
|
38 |
<div class="menu-h">
|
|
|
39 |
<input id="id-menu-btn" name="id-menu-btn" class="menu-btn" type="checkbox" />
|
40 |
<label for="id-menu-btn" class="menu-icon">
|
41 |
<span class="nav-icon"></span>
|
42 |
</label>
|
|
|
43 |
<div class="head-wrapper">
|
44 |
|
45 |
<button class="help" onclick="Menu.help();" title="Istruzioni">?</button>
|
|
|
77 |
<li>-</li>
|
78 |
<li><a href="#" onCLick="help1(this);">Esempi di documenti</a></li>
|
79 |
<li><a href="#" onCLick="help2(this);">Esempi di domande</a></li>
|
80 |
+
<!-- -->
|
81 |
<li><a href="#" onCLick="showPrompts(this);">prompts</a></li>
|
|
|
82 |
|
83 |
</ul>
|
84 |
</div>
|