This commit is contained in:
Saifeddine ALOUI 2024-03-24 03:42:04 +01:00
parent df7a90ac09
commit 3c74d2d7e7
8 changed files with 268 additions and 194 deletions

@ -1 +1 @@
Subproject commit e6cb0ec26ad57d7aaebe4d79a525ba3e5493dc29
Subproject commit 2209934b94bfd755ef39d67d98c6517d4f00308f

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
View File

@ -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-a0053fc9.js"></script>
<link rel="stylesheet" href="/assets/index-59ed6826.css">
<script type="module" crossorigin src="/assets/index-6179c5cb.js"></script>
<link rel="stylesheet" href="/assets/index-7711d71f.css">
</head>
<body>
<div id="app"></div>

View File

@ -112,7 +112,7 @@
</div>
<!-- CHAT BOX -->
<div v-if="selecting_model" title="Selecting model" class="flex flex-row flex-grow justify-end bg-primary">
<div v-if="selecting_model||selecting_binding" title="Selecting model" class="flex flex-row flex-grow justify-end bg-primary">
<!-- SPINNER -->
<div role="status">
<img :src="loader_v0" class="w-50 h-50">
@ -121,6 +121,37 @@
</div>
<div class="flex w-fit pb-3 relative grow w-full">
<div class="relative grow flex h-12.5 cursor-pointer select-none items-center gap-2 rounded-lg border bg-bg-light-tone dark:bg-bg-dark-tone p-1 shadow-sm hover:shadow-none dark:border-gray-800" tabindex="0">
<div v-if="loading" title="Waiting for reply">
<img :src="loader_v0">
<!-- SPINNER -->
<div role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<div class="w-fit group relative" v-if="!loading" >
<!-- :onShowPersList="onShowPersListFun" -->
<div class= "group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300">
<div class="w-full"
v-for="(item, index) in installedBindings" :key="index + '-' + item.name"
ref="installedBindings">
<div v-if="item.name!=binding_name" class="group items-center flex flex-row">
<button @click.prevent="setBinding(item)" class="w-8 h-8">
<img :src="item.icon?item.icon:modelImgPlaceholder"
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary "
:title="item.name">
</button>
</div>
</div>
</div>
<div class="group items-center flex flex-row">
<button @click.prevent="showModelConfig()" class="w-8 h-8">
<img :src="currentBindingIcon"
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary "
:title="currentBinding?currentBinding.name:'unknown'">
</button>
</div>
</div>
<div v-if="loading" title="Waiting for reply">
<img :src="loader_v0">
<!-- SPINNER -->
@ -145,7 +176,7 @@
</div>
<div class="group items-center flex flex-row">
<button @click.prevent="showModelConfig()" class="w-8 h-8">
<img :src="currentModel.icon?currentModel.icon:modelImgPlaceholder"
<img :src="currentModelIcon"
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary "
:title="currentModel?currentModel.name:'unknown'">
</button>
@ -361,6 +392,7 @@ export default {
modelImgPlaceholder:modelImgPlaceholder,
bUrl:bUrl,
message: "",
selecting_binding:false,
selecting_model:false,
selectedModel:'',
isLesteningToVoice:false,
@ -374,22 +406,27 @@ export default {
}
},
computed: {
currentBindingIcon(){
return this.currentBinding.icon || this.modelImgPlaceholder;
},
currentBinding(){
return this.$store.state.currentBinding || {};
},
currentModel() {
if(this.$store.state.currentModel!=undefined){
console.log("Model found")
return this.$store.state.currentModel;
}
else{
console.log("No model found")
let obj = {}
obj.name="unknown"
return obj;
}
return this.$store.state.currentModel || {};
},
currentModelIcon() {
return this.currentModel.icon || this.modelImgPlaceholder;
},
installedBindings() {
return this.$store.state.installedBindings;
},
installedModels() {
return this.$store.state.installedModels;
},
binding_name(){
return this.$store.state.config.binding_name
},
model_name(){
return this.$store.state.config.model_name
},
@ -634,11 +671,33 @@ export default {
selectElement.dispatchEvent(event_);
},
setBinding(selectedBinding){
console.log("Setting binding to "+selectedBinding.name);
this.selecting_binding=true
this.selectedModel = selectedBinding
axios.post("/update_setting", {
client_id: this.$store.state.client_id,
setting_name: "binding_name",
setting_value: selectedBinding.name
}).then(async (response) => {
console.log("UPDATED");
console.log(response);
await this.$store.dispatch('refreshConfig');
await this.$store.dispatch('refreshBindings');
await this.$store.dispatch('refreshModels');
this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,true)
this.selecting_binding=false
}).catch(err=>{
this.$store.state.toast.showToast(`Error ${err}`,4,true)
this.selecting_binding=false
});
},
setModel(selectedModel){
console.log("Setting model to "+selectedModel.name);
this.selecting_model=true
this.selectedModel = selectedModel
axios.post("/update_setting", {
axios.post("/update_setting", {
client_id: this.$store.state.client_id,
setting_name: "model_name",
setting_value: selectedModel.name
}).then(async (response) => {

View File

@ -67,7 +67,9 @@ export const store = createStore({
vramUsage:null,
modelsZoo:[],
installedModels:[],
installedBindings:[],
currentModel:null,
currentBinding:null,
extensionsZoo:[],
databases:[],
}
@ -122,6 +124,9 @@ export const store = createStore({
setModelsZoo(state, modelsZoo) {
state.modelsZoo = modelsZoo;
},
setCurrentBinding(state, currentBinding){
state.currentBinding = currentBinding
},
setCurrentModel(state, currentModel) {
state.currentModel = currentModel;
},
@ -189,6 +194,9 @@ export const store = createStore({
getModelsZoo(state) {
return state.modelsZoo;
},
getCyrrentBinding(state){
return state.currentBinding
},
getCurrentModel(state) {
return state.currentModel;
},
@ -343,6 +351,14 @@ export const store = createStore({
},
async refreshBindings({ commit }) {
let bindingsZoo = await api_get_req("list_bindings")
console.log("Loaded bindings zoo :",bindingsZoo)
this.state.installedBindings = bindingsZoo.filter(item=> item.installed)
const index = bindingsZoo.findIndex(item=>item.name == this.state.config.binding_name)
if (index!=-1){
commit('setCurrentBinding',bindingsZoo[index])
}
console.log("Loaded bindings zoo ", this.state.installedBindings)
commit('setbindingsZoo',bindingsZoo)
},
async refreshModelsZoo({ commit }) {

View File

@ -102,7 +102,6 @@
<div class="flex gap-2 items-center ">
<div>
<div v-if="vramUsage&&vramUsage.gpus && vramUsage.gpus.length == 1">
<div class="flex gap-2 items-center " v-for="item in vramUsage.gpus">
<!-- GPU IMAGE -->

@ -1 +1 @@
Subproject commit f9105a966fff78a1967c26879fb1bd4f17efb29e
Subproject commit 194994291ca9d5da251327c64fd089741fedcf64