mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-20 04:47:55 +00:00
updated code
This commit is contained in:
parent
c79ba08227
commit
460c0143b6
@ -654,7 +654,7 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
|
|
||||||
tk = model.tokenize(prompt)
|
tk = model.tokenize(prompt)
|
||||||
n_tokens = len(tk)
|
n_tokens = len(tk)
|
||||||
fd = model.detokenize(tk[-min(self.config.ctx_size-n_predicts,n_tokens):])
|
fd = model.detokenize(tk[-min(self.config.ctx_size-n_predicts,n_tokens, len(tk)):])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ASCIIColors.print("warming up", ASCIIColors.color_bright_cyan)
|
ASCIIColors.print("warming up", ASCIIColors.color_bright_cyan)
|
||||||
|
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">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>LoLLMS WebUI - Welcome</title>
|
<title>LoLLMS WebUI - Welcome</title>
|
||||||
<script type="module" crossorigin src="/assets/index-9c673d5e.js"></script>
|
<script type="module" crossorigin src="/assets/index-04bf888d.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/index-489786d6.css">
|
<link rel="stylesheet" href="/assets/index-5d272872.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
@ -122,11 +122,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- CHAT BOX -->
|
<!-- CHAT BOX -->
|
||||||
<div class="flex flex-row flex-grow items-center gap-2 overflow-visible">
|
<div class="flex flex-row flex-grow items-center gap-2 overflow-visible">
|
||||||
<select v-model="selectedModel" @change="setModel" class="bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-0">
|
<InteractiveMenu
|
||||||
<option v-for="model in models" :key="model" :value="model">
|
:title="selectedModel"
|
||||||
{{ model }}
|
:sendCommand="setModel"
|
||||||
</option>
|
:icon="models_menu_icon"
|
||||||
</select>
|
:commands="commandify(models)"
|
||||||
|
:selected_entry="selectedModel"></InteractiveMenu>
|
||||||
<div v-if="selecting_model" title="Selecting model" class="flex flex-row flex-grow justify-end">
|
<div v-if="selecting_model" title="Selecting model" class="flex flex-row flex-grow justify-end">
|
||||||
<!-- SPINNER -->
|
<!-- SPINNER -->
|
||||||
<div role="status">
|
<div role="status">
|
||||||
@ -249,6 +250,7 @@ import filesize from '../plugins/filesize'
|
|||||||
import MountedPersonalities from '@/components/MountedPersonalities.vue'
|
import MountedPersonalities from '@/components/MountedPersonalities.vue'
|
||||||
import MountedPersonalitiesList from '@/components/MountedPersonalitiesList.vue'
|
import MountedPersonalitiesList from '@/components/MountedPersonalitiesList.vue'
|
||||||
import PersonalitiesCommands from '@/components/PersonalitiesCommands.vue';
|
import PersonalitiesCommands from '@/components/PersonalitiesCommands.vue';
|
||||||
|
import InteractiveMenu from '@/components/InteractiveMenu.vue';
|
||||||
import { useStore } from 'vuex'; // Import the useStore function
|
import { useStore } from 'vuex'; // Import the useStore function
|
||||||
import { inject } from 'vue';
|
import { inject } from 'vue';
|
||||||
import socket from '@/services/websocket.js'
|
import socket from '@/services/websocket.js'
|
||||||
@ -268,7 +270,8 @@ export default {
|
|||||||
Toast,
|
Toast,
|
||||||
MountedPersonalities,
|
MountedPersonalities,
|
||||||
MountedPersonalitiesList,
|
MountedPersonalitiesList,
|
||||||
PersonalitiesCommands
|
PersonalitiesCommands,
|
||||||
|
InteractiveMenu
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
@ -288,6 +291,7 @@ export default {
|
|||||||
showFileList: true,
|
showFileList: true,
|
||||||
showPersonalities: false,
|
showPersonalities: false,
|
||||||
personalities_ready: false,
|
personalities_ready: false,
|
||||||
|
models_menu_icon:'#M'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -314,15 +318,39 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setModel(){
|
showModels(event){
|
||||||
|
// Prevent the default button behavior
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Programmatically trigger the click event on the select element
|
||||||
|
const selectElement = this.$refs.modelsSelectionList;
|
||||||
|
console.log(selectElement)
|
||||||
|
|
||||||
|
const event_ = new MouseEvent("click");
|
||||||
|
|
||||||
|
selectElement.dispatchEvent(event_);
|
||||||
|
},
|
||||||
|
commandify(list_of_strings){
|
||||||
|
let list_of_dicts=[]
|
||||||
|
for (var i = 0; i < list_of_strings.length; i++) {
|
||||||
|
let dict={}
|
||||||
|
dict["name"]=list_of_strings[i]
|
||||||
|
dict["value"]=list_of_strings[i]
|
||||||
|
list_of_dicts.push(dict)
|
||||||
|
}
|
||||||
|
return list_of_dicts
|
||||||
|
|
||||||
|
},
|
||||||
|
setModel(selectedModel){
|
||||||
this.selecting_model=true
|
this.selecting_model=true
|
||||||
|
this.selectedModel = selectedModel
|
||||||
axios.post("/update_setting", {
|
axios.post("/update_setting", {
|
||||||
setting_name: "model_name",
|
setting_name: "model_name",
|
||||||
setting_value: this.selectedModel
|
setting_value: selectedModel
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,true)
|
this.$refs.toast.showToast(`Model changed to ${selectedModel}`,4,true)
|
||||||
this.selecting_model=false
|
this.selecting_model=false
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
this.$refs.toast.showToast(`Error ${err}`,4,true)
|
this.$refs.toast.showToast(`Error ${err}`,4,true)
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="menu-container">
|
<div class="menu-container">
|
||||||
<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">
|
<button @click.prevent="toggleMenu" :title="title" class="menu-button m-0 p-0 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">
|
||||||
<img v-if="icon && !icon.includes('feather')" :src="command.icon" :alt="command.name" class="w-5 h-5">
|
<img v-if="icon && !icon.includes('#') && !icon.includes('feather')" :src="icon" class="w-5 h-5 p-0 m-0 shadow-lg bold">
|
||||||
<i v-if="icon && icon.includes('feather')" :data-feather="command.icon.split(':')[1]" class="w-5 h-5"></i>
|
<i v-else-if="icon && icon.includes('feather')" :data-feather="icon.split(':')[1]" class="w-5 h-5"></i>
|
||||||
<i data-feather="command" ></i>
|
<p v-else-if="icon && icon.includes('#')" class="w-5 h-5">{{ icon.split('#')[1] }}</p>
|
||||||
|
<i v-else data-feather="command" ></i>
|
||||||
</button>
|
</button>
|
||||||
<transition name="slide">
|
<transition name="slide">
|
||||||
<div v-if="isMenuOpen" class="menu-list flex-grow" :style="menuPosition" ref="menu">
|
<div v-if="isMenuOpen" class="menu-list flex-grow" :style="menuPosition" ref="menu">
|
||||||
<ul class="flex-grow menu-ul">
|
<ul class="flex-grow menu-ul">
|
||||||
<li v-for="(command, index) in commands" :key="index" @click="executeCommand(command)" class="menu-command menu-li flex-grow hover:bg-blue-400 ">
|
<li v-for="(command, index) in commands" :key="index" @click="executeCommand(command)" class="menu-command menu-li flex-grow hover:bg-blue-400 ">
|
||||||
<img v-if="command.icon && !command.icon.includes('feather') && !command.is_file" :src="command.icon" :alt="command.name" class="menu-icon">
|
<i v-if="selected_entry==command.name" data-feather="check"></i>
|
||||||
|
<img v-else-if="command.icon && !command.icon.includes('feather') && !command.is_file" :src="command.icon" :alt="command.name" class="menu-icon">
|
||||||
<i v-if="command.icon && command.icon.includes('feather') && !command.is_file" :data-feather="command.icon.split(':')[1]" class="mr-2"></i>
|
<i v-if="command.icon && command.icon.includes('feather') && !command.is_file" :data-feather="command.icon.split(':')[1]" class="mr-2"></i>
|
||||||
<span v-else class="menu-icon"></span>
|
<span v-else class="menu-icon"></span>
|
||||||
<span>{{ command.name }}</span>
|
<span>{{ command.name }}</span>
|
||||||
@ -25,10 +27,15 @@ import { nextTick } from 'vue'
|
|||||||
import feather from 'feather-icons'
|
import feather from 'feather-icons'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
title: {
|
||||||
|
type:String,
|
||||||
|
required:false,
|
||||||
|
value:"menu"
|
||||||
|
},
|
||||||
icon: {
|
icon: {
|
||||||
type:String,
|
type:String,
|
||||||
required:false,
|
required:false,
|
||||||
value:"feather:command"
|
value:"feather:menu"
|
||||||
},
|
},
|
||||||
commands: {
|
commands: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@ -41,6 +48,10 @@ export default {
|
|||||||
execute_cmd: {
|
execute_cmd: {
|
||||||
type: Function, // The execute_cmd property should be a function
|
type: Function, // The execute_cmd property should be a function
|
||||||
required: false
|
required: false
|
||||||
|
},
|
||||||
|
selected_entry: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -1677,12 +1677,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<Toast ref="toast" />
|
||||||
|
|
||||||
<YesNoDialog ref="yesNoDialog" class="z-20" />
|
<YesNoDialog ref="yesNoDialog" class="z-20" />
|
||||||
<AddModelDialog ref="addmodeldialog" />
|
<AddModelDialog ref="addmodeldialog" />
|
||||||
<MessageBox ref="messageBox" />
|
<MessageBox ref="messageBox" />
|
||||||
<Toast ref="toast" />
|
|
||||||
<UniversalForm ref="universalForm" class="z-20" />
|
<UniversalForm ref="universalForm" class="z-20" />
|
||||||
<ChoiceDialog class="z-20"
|
<ChoiceDialog class="z-20"
|
||||||
:show="variantSelectionDialogVisible"
|
:show="variantSelectionDialogVisible"
|
||||||
@ -2438,7 +2436,12 @@ export default {
|
|||||||
const index = this.models.findIndex((model) => model.path === model_object.path);
|
const index = this.models.findIndex((model) => model.path === model_object.path);
|
||||||
this.models[index].isInstalled = false;
|
this.models[index].isInstalled = false;
|
||||||
if (model_object.model.isCustomModel) {
|
if (model_object.model.isCustomModel) {
|
||||||
this.models = this.models.filter((model) => model.title !== model_object.title)
|
try{
|
||||||
|
this.models = this.models.filter((model) => model.title !== model_object.title)
|
||||||
|
}
|
||||||
|
catch{
|
||||||
|
this.models = model
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\nwas uninstalled!", 4, true)
|
this.$refs.toast.showToast("Model:\n" + model_object.title + "\nwas uninstalled!", 4, true)
|
||||||
this.$store.dispatch('refreshDiskUsage');
|
this.$store.dispatch('refreshDiskUsage');
|
||||||
|
Loading…
Reference in New Issue
Block a user