This commit is contained in:
Saifeddine ALOUI 2024-12-20 23:43:40 +01:00
parent 54e09e85da
commit 97f8620480
8 changed files with 100 additions and 68 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8
web/dist/assets/index-jjsz8X-a.css vendored Normal file

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View File

@ -6,8 +6,8 @@
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script> <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI</title> <title>LoLLMS WebUI</title>
<script type="module" crossorigin src="/assets/index-Bt6VF9H5.js"></script> <script type="module" crossorigin src="/assets/index-P0ETQvbt.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-COFFlPfA.css"> <link rel="stylesheet" crossorigin href="/assets/index-jjsz8X-a.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

11
web/package-lock.json generated
View File

@ -31,7 +31,6 @@
"marked": "^14.1.4", "marked": "^14.1.4",
"mathjax": "^3.2.2", "mathjax": "^3.2.2",
"mermaid": "^11.2.1", "mermaid": "^11.2.1",
"monaco-editor": "^0.51.0",
"monaco-editor-vue3": "^0.1.10", "monaco-editor-vue3": "^0.1.10",
"papaparse": "^5.4.1", "papaparse": "^5.4.1",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
@ -51,12 +50,14 @@
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^8.34.0", "eslint": "^8.34.0",
"eslint-plugin-vue": "^9.9.0", "eslint-plugin-vue": "^9.9.0",
"monaco-editor": "^0.52.2",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"postcss-cli": "^11.0.0", "postcss-cli": "^11.0.0",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"tailwind-scrollbar": "^3.0.1", "tailwind-scrollbar": "^3.0.1",
"tailwindcss": "^3.4.14", "tailwindcss": "^3.4.14",
"vite": "^5.1.8" "vite": "^5.1.8",
"vite-plugin-monaco-editor": "^1.1.0"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@ -3968,9 +3969,9 @@
} }
}, },
"node_modules/monaco-editor": { "node_modules/monaco-editor": {
"version": "0.51.0", "version": "0.52.2",
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.51.0.tgz", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.2.tgz",
"integrity": "sha512-xaGwVV1fq343cM7aOYB6lVE4Ugf0UyimdD/x5PWcWBMKENwectaEu77FAN7c5sFiyumqeJdX1RPTh1ocioyDjw==", "integrity": "sha512-GEQWEZmfkOGLdd3XK8ryrfWz3AIP8YymVXiPHEdewrUq7mh0qrKrfHLNCXcbB6sTnMLnOZ3ztSiKcciFUkIJwQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/monaco-editor-vue3": { "node_modules/monaco-editor-vue3": {

View File

@ -34,7 +34,6 @@
"marked": "^14.1.4", "marked": "^14.1.4",
"mathjax": "^3.2.2", "mathjax": "^3.2.2",
"mermaid": "^11.2.1", "mermaid": "^11.2.1",
"monaco-editor": "^0.51.0",
"monaco-editor-vue3": "^0.1.10", "monaco-editor-vue3": "^0.1.10",
"papaparse": "^5.4.1", "papaparse": "^5.4.1",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
@ -54,11 +53,13 @@
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^8.34.0", "eslint": "^8.34.0",
"eslint-plugin-vue": "^9.9.0", "eslint-plugin-vue": "^9.9.0",
"monaco-editor": "^0.52.2",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"postcss-cli": "^11.0.0", "postcss-cli": "^11.0.0",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"tailwind-scrollbar": "^3.0.1", "tailwind-scrollbar": "^3.0.1",
"tailwindcss": "^3.4.14", "tailwindcss": "^3.4.14",
"vite": "^5.1.8" "vite": "^5.1.8",
"vite-plugin-monaco-editor": "^1.1.0"
} }
} }

View File

@ -20,14 +20,24 @@
> >
<i data-feather="copy"></i> <i data-feather="copy"></i>
</button> </button>
<button v-if="['function', 'python', 'sh', 'shell', 'bash', 'cmd', 'powershell', 'latex', 'mermaid', 'graphviz', 'dot', 'javascript', 'html', 'html5', 'svg', 'lilypond'].includes(language)" ref="btn_code_exec" @click="executeCode" title="execute" <button
class="px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200" v-if="['function', 'python', 'sh', 'shell', 'bash', 'cmd', 'powershell', 'latex', 'mermaid', 'graphviz', 'dot', 'javascript', 'html', 'html5', 'svg', 'lilypond'].includes(language)"
:class="isExecuting?'bg-green-500':''"> ref="btn_code_exec"
@click="executeCode"
title="execute"
class="execute-button px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"
:class="isExecuting ? 'bg-green-500' : ''"
>
<i data-feather="play-circle"></i> <i data-feather="play-circle"></i>
</button> </button>
<button v-if="['airplay', 'mermaid', 'graphviz', 'dot', 'javascript', 'html', 'html5', 'svg', 'css'].includes(language.trim())" ref="btn_code_exec_in_new_tab" @click="executeCode_in_new_tab" title="execute" <button
class="px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200" v-if="['airplay', 'mermaid', 'graphviz', 'dot', 'javascript', 'html', 'html5', 'svg', 'css'].includes(language.trim())"
:class="isExecuting?'bg-green-500':''"> ref="btn_code_exec_in_new_tab"
@click="executeCode_in_new_tab"
title="execute"
class="execute-button px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"
:class="isExecuting ? 'bg-green-500' : ''"
>
<i data-feather="airplay"></i> <i data-feather="airplay"></i>
</button> </button>
<button @click="openFolder" title="open code project folder" <button @click="openFolder" title="open code project folder"
@ -157,6 +167,10 @@ export default {
}, },
executeCode() { executeCode() {
this.isExecuting=true; this.isExecuting=true;
nextTick(() => {
feather.replace()
})
const json = JSON.stringify({ const json = JSON.stringify({
'client_id': this.client_id, 'client_id': this.client_id,
'code': this.code, 'code': this.code,
@ -187,6 +201,9 @@ export default {
}, },
executeCode_in_new_tab(){ executeCode_in_new_tab(){
this.isExecuting=true; this.isExecuting=true;
nextTick(() => {
feather.replace()
})
const json = JSON.stringify({ const json = JSON.stringify({
'client_id': this.client_id, 'client_id': this.client_id,
'code': this.code, 'code': this.code,
@ -200,12 +217,14 @@ export default {
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: json body: json
}).then(response=>{ }).then(response=>{
console.log("done")
this.isExecuting=false; this.isExecuting=false;
// Parse the JSON data from the response body // Parse the JSON data from the response body
return response.json(); return response.json();
}) })
.then(jsonData => { .then(jsonData => {
// Now you can work with the JSON data // Now you can work with the JSON data
console.log("done2")
console.log(jsonData); console.log(jsonData);
this.executionOutput = jsonData.output; this.executionOutput = jsonData.output;
}) })
@ -307,5 +326,18 @@ export default {
outline: none; /* Remove the default focus outline */ outline: none; /* Remove the default focus outline */
} }
.spinner {
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.execute-button {
display: flex;
align-items: center;
gap: 0.5rem;
}
</style> </style>

View File

@ -2,9 +2,7 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite' import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import monacoEditorPlugin from 'vite-plugin-monaco-editor' import path from 'path'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default async ({ mode }) => { export default async ({ mode }) => {
// Load app-level env vars to node-level env vars. // Load app-level env vars to node-level env vars.