mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 20:37:51 +00:00
enahnced
This commit is contained in:
parent
454d8cee1d
commit
b11d56a457
1
app.py
1
app.py
@ -1398,6 +1398,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
file.save( file_path )
|
||||
if self.personality.processor:
|
||||
self.personality.processor.add_file(file_path)
|
||||
|
||||
return jsonify({"status": True})
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(ex)
|
||||
|
8
web/dist/assets/index-7e264016.css
vendored
Normal file
8
web/dist/assets/index-7e264016.css
vendored
Normal file
File diff suppressed because one or more lines are too long
8
web/dist/assets/index-8620bb03.css
vendored
8
web/dist/assets/index-8620bb03.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-b03ce880.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-8620bb03.css">
|
||||
<script type="module" crossorigin src="/assets/index-98082134.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-7e264016.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -1,16 +1,19 @@
|
||||
<template>
|
||||
<div class="menu-container">
|
||||
<button @click="toggleMenu" class="menu-button">Menu</button>
|
||||
<transition name="slide">
|
||||
<div v-if="isMenuOpen" class="menu-list" :style="menuPosition">
|
||||
<ul>
|
||||
<li v-for="(command, index) in commands" :key="index" @click="executeCommand(command)">
|
||||
<img v-if="command.icon && !command.is_file" :src="command.icon" :alt="command.name" class="menu-icon">
|
||||
<span v-else>{{ command.name }}</span>
|
||||
<button @click.prevent="toggleMenu" class="menu-button bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 rounded-full flex items-center justify-center w-6 h-6 border-none cursor-pointer hover:bg-blue-400 w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-gray-300 border-secondary cursor-pointer" ref="menuButton">
|
||||
<i data-feather="command" class="w-5 h-5"></i>
|
||||
</button>
|
||||
<transition name="slide">
|
||||
<div v-if="isMenuOpen" class="menu-list" :style="menuPosition" ref="menu">
|
||||
<ul>
|
||||
<li v-for="(command, index) in commands" :key="index" @click="executeCommand(command)" class="menu-command hover:bg-blue-400 ">
|
||||
<img v-if="command.icon && !command.is_file" :src="command.icon" :alt="command.name" class="menu-icon">
|
||||
<span v-else class="menu-icon"></span>
|
||||
<span>{{ command.name }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</transition>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -20,6 +23,10 @@
|
||||
commands: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
execute_cmd: {
|
||||
type: Function, // The execute_cmd property should be a function
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -33,6 +40,7 @@
|
||||
},
|
||||
methods: {
|
||||
toggleMenu() {
|
||||
this.positionMenu();
|
||||
this.isMenuOpen = !this.isMenuOpen;
|
||||
},
|
||||
executeCommand(command) {
|
||||
@ -40,11 +48,27 @@
|
||||
this[command.value]();
|
||||
}
|
||||
this.isMenuOpen = false;
|
||||
if (this.execute_cmd) {
|
||||
this.execute_cmd(command); // Call the execute_cmd property with the current command
|
||||
}
|
||||
},
|
||||
positionMenu() {
|
||||
if (this.$refs.menuButton!=undefined){
|
||||
const buttonRect = this.$refs.menuButton.getBoundingClientRect();
|
||||
//const menuRect = this.$refs.menu.getBoundingClientRect();
|
||||
|
||||
const windowHeight = window.innerHeight;
|
||||
const isMenuAboveButton = buttonRect.bottom > windowHeight / 2;
|
||||
|
||||
this.menuPosition.top = isMenuAboveButton ? 'auto' : 'calc(100% + 10px)';
|
||||
this.menuPosition.bottom = isMenuAboveButton ? '100%' : 'auto';
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// Listen to window resize to reposition the menu if needed
|
||||
window.addEventListener('resize', this.positionMenu);
|
||||
this.positionMenu(); // Initial positioning
|
||||
},
|
||||
beforeDestroy() {
|
||||
// Cleanup the event listener
|
||||
@ -52,19 +76,6 @@
|
||||
},
|
||||
watch: {
|
||||
isMenuOpen: 'positionMenu'
|
||||
},
|
||||
methods: {
|
||||
positionMenu() {
|
||||
const menu = this.$el.querySelector('.menu-list');
|
||||
if (!menu) return;
|
||||
|
||||
const rect = menu.getBoundingClientRect();
|
||||
const windowHeight = window.innerHeight;
|
||||
const isMenuAboveButton = rect.bottom > windowHeight;
|
||||
|
||||
this.menuPosition.top = isMenuAboveButton ? 'auto' : 'calc(100% + 10px)';
|
||||
this.menuPosition.bottom = isMenuAboveButton ? '100%' : 'auto';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,49 +1,23 @@
|
||||
<template>
|
||||
<div class="menu relative">
|
||||
<div class="commands-menu-items-wrapper">
|
||||
<button
|
||||
id="commands-menu"
|
||||
@click.prevent="toggleMenu"
|
||||
class="menu-button bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 rounded-full flex items-center justify-center w-6 h-6 border-none cursor-pointer hover:bg-blue-400 w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-gray-300 border-secondary cursor-pointer"
|
||||
>
|
||||
<i data-feather="command" class="w-5 h-5"></i>
|
||||
</button>
|
||||
<div v-if="loading" title="Loading.." class="flex flex-row flex-grow justify-end">
|
||||
<!-- SPINNER -->
|
||||
<div role="status">
|
||||
<svg aria-hidden="true" class="w-6 h-6 animate-spin fill-secondary" viewBox="0 0 100 101"
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
||||
fill="currentColor" />
|
||||
<path
|
||||
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
||||
fill="currentFill" />
|
||||
</svg>
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="showMenu" id="commands-menu-items" class="absolute left-0 mt-4 bg-white border border-gray-300 z-10 w-48 overflow-y-auto custom-scrollbar" :style="{ top: '-200px', maxHeight: '200px' }">
|
||||
<button
|
||||
v-for="command in commands"
|
||||
:key="command.value"
|
||||
@click.prevent="execute_cmd(command)"
|
||||
class="menu-button py-2 px-4 w-full text-left cursor-pointer bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 hover:bg-blue-400"
|
||||
:class="{ 'bg-blue-400 text-white': hoveredCommand === command.value }"
|
||||
:title="command.help"
|
||||
@mouseover="hoveredCommand = command.value"
|
||||
@mouseout="hoveredCommand = null"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<img v-if="command.icon" :src="command.icon" alt="Command Icon" class="w-4 h-4 mr-2" style="width: 25px; height: 25px;">
|
||||
<div class="flex-grow">
|
||||
{{ command.name }}
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<div v-if="loading" title="Loading.." class="flex flex-row flex-grow justify-end">
|
||||
<!-- SPINNER -->
|
||||
<div role="status">
|
||||
<svg aria-hidden="true" class="w-6 h-6 animate-spin fill-secondary" viewBox="0 0 100 101"
|
||||
fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
||||
fill="currentColor" />
|
||||
<path
|
||||
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
||||
fill="currentFill" />
|
||||
</svg>
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<InteractiveMenu v-else :commands="commandsList" :execute_cmd="execute_cmd">
|
||||
|
||||
</InteractiveMenu>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
@ -88,8 +62,13 @@
|
||||
<script>
|
||||
import feather from 'feather-icons'
|
||||
import axios from "axios";
|
||||
import InteractiveMenu from "@/components/InteractiveMenu.vue"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
components:{
|
||||
InteractiveMenu
|
||||
},
|
||||
props: {
|
||||
commandsList: {
|
||||
type: Array,
|
||||
required: true,
|
||||
@ -112,15 +91,18 @@ async mounted() {
|
||||
//console.log('model path', this.model.path)
|
||||
nextTick(() => {
|
||||
feather.replace()
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
selectFile(next) {
|
||||
isHTML(str) {
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(str, 'text/html');
|
||||
return Array.from(doc.body.childNodes).some(node => node.nodeType === Node.ELEMENT_NODE);
|
||||
},
|
||||
selectFile(file_types, next) {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.accept = 'application/pdf'; // Specify the file type you want to accept
|
||||
input.accept = file_types; // Specify the file type you want to accept
|
||||
input.onchange = (e) => {
|
||||
this.selectedFile = e.target.files[0];
|
||||
console.log("File selected")
|
||||
@ -158,7 +140,7 @@ methods: {
|
||||
this.showMenu = !this.showMenu;
|
||||
if (cmd.hasOwnProperty('is_file')) {
|
||||
console.log("Need to send a file.");
|
||||
this.selectFile(()=>{
|
||||
this.selectFile(cmd.hasOwnProperty('file_types')?cmd.file_types:"*",()=>{
|
||||
if(this.selectedFile!=null){
|
||||
this.uploadFile()
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
</Card>
|
||||
<Card :disableHoverAnimation="true" :disableFocus="true">
|
||||
<button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded">Quantize LLM</button>
|
||||
<ProgressBar v-if="loading" :progress="progressValue" />
|
||||
<!-- <ProgressBar v-if="loading" :progress="progressValue" /> -->
|
||||
</Card>
|
||||
</form>
|
||||
</div>
|
||||
@ -25,13 +25,13 @@
|
||||
<script>
|
||||
import ClipBoardTextInput from "@/components/ClipBoardTextInput.vue";
|
||||
import Card from "@/components/Card.vue"
|
||||
import ProgressBar from '@/components/ProgressBar.vue';
|
||||
//import ProgressBar from '@/components/ProgressBar.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ClipBoardTextInput,
|
||||
Card,
|
||||
ProgressBar
|
||||
//ProgressBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -49,7 +49,7 @@
|
||||
</Card>
|
||||
<Card :disableHoverAnimation="true" :disableFocus="true">
|
||||
<button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded">Train LLM</button>
|
||||
<ProgressBar v-if="loading" :progress="progressValue" />
|
||||
<!-- <ProgressBar v-if="loading" :progress="progressValue" /> -->
|
||||
</Card>
|
||||
|
||||
</form>
|
||||
@ -59,13 +59,13 @@
|
||||
<script>
|
||||
import ClipBoardTextInput from "@/components/ClipBoardTextInput.vue";
|
||||
import Card from "@/components/Card.vue"
|
||||
import ProgressBar from '@/components/ProgressBar.vue';
|
||||
//import ProgressBar from '@/components/ProgressBar.vue';
|
||||
import axios from "axios";
|
||||
export default {
|
||||
components: {
|
||||
ClipBoardTextInput,
|
||||
Card,
|
||||
ProgressBar
|
||||
//ProgressBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user