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>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI</title>
<script type="module" crossorigin src="/assets/index-Bt6VF9H5.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-COFFlPfA.css">
<script type="module" crossorigin src="/assets/index-P0ETQvbt.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-jjsz8X-a.css">
</head>
<body>
<div id="app"></div>

11
web/package-lock.json generated
View File

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

View File

@ -34,7 +34,6 @@
"marked": "^14.1.4",
"mathjax": "^3.2.2",
"mermaid": "^11.2.1",
"monaco-editor": "^0.51.0",
"monaco-editor-vue3": "^0.1.10",
"papaparse": "^5.4.1",
"prismjs": "^1.29.0",
@ -54,11 +53,13 @@
"autoprefixer": "^10.4.20",
"eslint": "^8.34.0",
"eslint-plugin-vue": "^9.9.0",
"monaco-editor": "^0.52.2",
"postcss": "^8.4.47",
"postcss-cli": "^11.0.0",
"prettier": "^2.8.4",
"tailwind-scrollbar": "^3.0.1",
"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>
</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"
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"
:class="isExecuting?'bg-green-500':''">
<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"
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>
</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"
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"
:class="isExecuting?'bg-green-500':''">
</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"
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>
</button>
<button @click="openFolder" title="open code project folder"
@ -157,6 +167,10 @@ export default {
},
executeCode() {
this.isExecuting=true;
nextTick(() => {
feather.replace()
})
const json = JSON.stringify({
'client_id': this.client_id,
'code': this.code,
@ -187,6 +201,9 @@ export default {
},
executeCode_in_new_tab(){
this.isExecuting=true;
nextTick(() => {
feather.replace()
})
const json = JSON.stringify({
'client_id': this.client_id,
'code': this.code,
@ -200,12 +217,14 @@ export default {
headers: { 'Content-Type': 'application/json' },
body: json
}).then(response=>{
console.log("done")
this.isExecuting=false;
// Parse the JSON data from the response body
return response.json();
})
.then(jsonData => {
// Now you can work with the JSON data
console.log("done2")
console.log(jsonData);
this.executionOutput = jsonData.output;
})
@ -307,5 +326,18 @@ export default {
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>

View File

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