mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 04:17:52 +00:00
cleaned up a bit, removed log events
This commit is contained in:
parent
2f0f44aff6
commit
1db8d2eff2
@ -168,24 +168,7 @@
|
||||
|
||||
|
||||
<style scoped>
|
||||
.expand-enter-active,
|
||||
.expand-leave-active {
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
|
||||
.expand-enter{
|
||||
transition: all 0.5s ease;
|
||||
opacity: 1;
|
||||
transform: translatey(30px);
|
||||
}
|
||||
.expand-leave-to {
|
||||
|
||||
transform: translatey(-30px);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* THESE ARE FOR TransitionGroup components */
|
||||
.list-move, /* apply transition to moving elements */
|
||||
.list-enter-active,
|
||||
.list-leave-active {
|
||||
@ -241,7 +224,7 @@ export default {
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.log(error.message,'api_get_req')
|
||||
return
|
||||
}
|
||||
|
||||
@ -257,7 +240,7 @@ export default {
|
||||
return res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not list discussions", error)
|
||||
console.log("Error: Could not list discussions", error.message)
|
||||
return []
|
||||
}
|
||||
},
|
||||
@ -278,7 +261,7 @@ export default {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.log(error.message,'load_discussion')
|
||||
this.loading = false
|
||||
this.setDiscussionLoading(id, this.loading)
|
||||
}
|
||||
@ -291,7 +274,7 @@ export default {
|
||||
return res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not create new discussion", error)
|
||||
console.log("Error: Could not create new discussion", error.message)
|
||||
return {}
|
||||
}
|
||||
},
|
||||
@ -307,7 +290,7 @@ export default {
|
||||
this.setDiscussionLoading(id, this.loading)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not delete discussion", error)
|
||||
console.log("Error: Could not delete discussion", error.message)
|
||||
this.loading = false
|
||||
this.setDiscussionLoading(id, this.loading)
|
||||
}
|
||||
@ -331,7 +314,7 @@ export default {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not edit title", error)
|
||||
console.log("Error: Could not edit title", error.message)
|
||||
this.loading = false
|
||||
this.setDiscussionLoading(id, this.loading)
|
||||
}
|
||||
@ -344,7 +327,7 @@ export default {
|
||||
return res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could delete message", error)
|
||||
console.log("Error: Could delete message", error.message)
|
||||
return {}
|
||||
}
|
||||
},
|
||||
@ -356,7 +339,7 @@ export default {
|
||||
return res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not stop generating", error)
|
||||
console.log("Error: Could not stop generating", error.message)
|
||||
return {}
|
||||
}
|
||||
},
|
||||
@ -368,7 +351,7 @@ export default {
|
||||
return res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not rank up message", error)
|
||||
console.log("Error: Could not rank up message", error.message)
|
||||
return {}
|
||||
}
|
||||
},
|
||||
@ -380,7 +363,7 @@ export default {
|
||||
return res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not rank down message", error)
|
||||
console.log("Error: Could not rank down message", error.message)
|
||||
return {}
|
||||
}
|
||||
},
|
||||
@ -392,7 +375,7 @@ export default {
|
||||
return res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error: Could not update message", error)
|
||||
console.log("Error: Could not update message", error.message)
|
||||
return {}
|
||||
}
|
||||
},
|
||||
@ -409,7 +392,7 @@ export default {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log("Error: Could not export multiple discussions", error)
|
||||
console.log("Error: Could not export multiple discussions", error.message)
|
||||
return {}
|
||||
}
|
||||
},
|
||||
@ -567,7 +550,7 @@ export default {
|
||||
sendMsg(msg) {
|
||||
// Sends message to binding
|
||||
if(!msg){
|
||||
this.$refs.toast.showToast("Message contains no centent!", 4, false)
|
||||
this.$refs.toast.showToast("Message contains no content!", 4, false)
|
||||
return
|
||||
}
|
||||
this.isGenerating = true;
|
||||
@ -599,11 +582,8 @@ export default {
|
||||
},
|
||||
streamMessageContent(msgObj) {
|
||||
// Streams response message content from binding
|
||||
//console.log("stream", JSON.stringify(content))
|
||||
const parent = msgObj.user_message_id
|
||||
const discussion_id = msgObj.discussion_id
|
||||
// next statement - incorrect comparison: was '=' and should be '=='
|
||||
|
||||
this.setDiscussionLoading(discussion_id, true);
|
||||
if (this.currentDiscussion.id == discussion_id) {
|
||||
|
||||
@ -612,14 +592,10 @@ export default {
|
||||
const messageItem = this.discussionArr[index]
|
||||
if (messageItem) {
|
||||
messageItem.content = msgObj.data
|
||||
//console.log("user-msg-id",parent, "ai-msg-id",msgObj.ai_message_id, index, discussion_id, msgObj.data)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//const lastMsg = this.discussionArr[this.discussionArr.length - 1]
|
||||
//lastMsg.content = content.data
|
||||
},
|
||||
async changeTitleUsingUserMSG(id, msg) {
|
||||
// If discussion is untitled or title is null then it sets the title to first user message.
|
||||
@ -649,7 +625,6 @@ export default {
|
||||
const selectedDisElement = document.getElementById('dis-' + res.id)
|
||||
this.scrollToElement(selectedDisElement)
|
||||
})
|
||||
//console.log("disc",JSON.stringify(discussionItem))
|
||||
},
|
||||
loadLastUsedDiscussion() {
|
||||
// Checks local storage for last selected discussion
|
||||
@ -665,9 +640,6 @@ export default {
|
||||
async deleteDiscussion(id) {
|
||||
// Deletes discussion from binding and frontend
|
||||
|
||||
//const index = this.list.findIndex((x) => x.id == id)
|
||||
//const discussionItem = this.list[index]
|
||||
//discussionItem.loading = true
|
||||
await this.delete_discussion(id)
|
||||
if (this.currentDiscussion.id == id) {
|
||||
this.currentDiscussion = {}
|
||||
@ -677,7 +649,6 @@ export default {
|
||||
this.list.splice(this.list.findIndex(item => item.id == id), 1)
|
||||
|
||||
this.createDiscussionList(this.list)
|
||||
//await this.list_discussions()
|
||||
},
|
||||
async deleteDiscussionMulti() {
|
||||
// Delete selected discussions
|
||||
@ -697,6 +668,8 @@ export default {
|
||||
}
|
||||
this.tempList = this.list
|
||||
this.isCheckbox = false
|
||||
this.$refs.toast.showToast("Removed ("+deleteList.length+") items", 4, true)
|
||||
|
||||
console.log("Multi delete done")
|
||||
},
|
||||
async deleteMessage(msgId) {
|
||||
@ -706,7 +679,7 @@ export default {
|
||||
this.discussionArr.splice(this.discussionArr.findIndex(item => item.id == msgId), 1)
|
||||
|
||||
}).catch(() => {
|
||||
|
||||
this.$refs.toast.showToast("Could not remove message", 4, false)
|
||||
console.log("Error: Could not delete message")
|
||||
})
|
||||
|
||||
@ -788,7 +761,7 @@ export default {
|
||||
const message = this.discussionArr[this.discussionArr.findIndex(item => item.id == msgId)]
|
||||
message.rank = res.new_rank
|
||||
}).catch(() => {
|
||||
|
||||
this.$refs.toast.showToast("Could not rank up message", 4, false)
|
||||
console.log("Error: Could not rank up message")
|
||||
})
|
||||
|
||||
@ -799,6 +772,7 @@ export default {
|
||||
const message = this.discussionArr[this.discussionArr.findIndex(item => item.id == msgId)]
|
||||
message.rank = res.new_rank
|
||||
}).catch(() => {
|
||||
this.$refs.toast.showToast("Could not rank down message", 4, false)
|
||||
|
||||
console.log("Error: Could not rank down message")
|
||||
})
|
||||
@ -811,6 +785,7 @@ export default {
|
||||
message.content = msg
|
||||
|
||||
}).catch(() => {
|
||||
this.$refs.toast.showToast("Could not update message", 4, false)
|
||||
|
||||
console.log("Error: Could not update message")
|
||||
})
|
||||
@ -861,8 +836,9 @@ export default {
|
||||
this.chime.play()
|
||||
},
|
||||
copyToClipBoard(content) {
|
||||
this.$refs.toast.showToast("Copied to clipboard successfully", 4, true)
|
||||
navigator.clipboard.writeText(content);
|
||||
|
||||
this.$refs.toast.showToast("Copied to clipboard successfully")
|
||||
nextTick(() => {
|
||||
feather.replace()
|
||||
|
||||
@ -965,9 +941,7 @@ export default {
|
||||
}
|
||||
return newItem
|
||||
})
|
||||
// const index = personalities.findIndex((x) => x.name === sender)
|
||||
// const pers = personalities[index]
|
||||
// return pers.avatar
|
||||
|
||||
|
||||
},
|
||||
getAvatar(sender) {
|
||||
|
@ -81,13 +81,14 @@
|
||||
<div :class="{ 'hidden': mzc_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
|
||||
<div class="mx-2 mb-4">
|
||||
<label for="binding" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Binding: ({{ bindingsArr.length }})
|
||||
Bindings: ({{ bindingsArr.length }})
|
||||
</label>
|
||||
<select id="binding" @change="update_binding($event.target.value)"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
|
||||
<option v-for="item in bindingsArr" :selected="item.folder === configFile.binding" :value="item.folder">
|
||||
{{ item.name }} by ({{item.author}})
|
||||
<option v-for="item in bindingsArr" :selected="item.folder === configFile.binding"
|
||||
:value="item.folder">
|
||||
{{ item.name }} by ({{ item.author }})
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -97,12 +98,12 @@
|
||||
</label>
|
||||
<div ref="modelZoo" class="overflow-y-auto no-scrollbar p-2 pb-0 "
|
||||
:class="mzl_collapsed ? '' : 'max-h-96'">
|
||||
<TransitionGroup name="list" >
|
||||
<model-entry v-for="(model, index) in models" :key="index" :title="model.title"
|
||||
:icon="model.icon" :path="model.path" :owner="model.owner" :owner_link="model.owner_link"
|
||||
:license="model.license" :description="model.description" :is-installed="model.isInstalled"
|
||||
:on-install="onInstall" :on-uninstall="onUninstall" :on-selected="onSelected"
|
||||
:selected="model.title === configFile.model" :model="model" />
|
||||
<TransitionGroup name="list">
|
||||
<model-entry v-for="(model, index) in models" :key="'index-' + index + '-' + model.title"
|
||||
:title="model.title" :icon="model.icon" :path="model.path" :owner="model.owner"
|
||||
:owner_link="model.owner_link" :license="model.license" :description="model.description"
|
||||
:is-installed="model.isInstalled" :on-install="onInstall" :on-uninstall="onUninstall"
|
||||
:on-selected="onSelected" :selected="model.title === configFile.model" :model="model" />
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
</div>
|
||||
@ -183,8 +184,8 @@
|
||||
<div ref="personalitiesZoo"
|
||||
class="overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4"
|
||||
:class="pzl_collapsed ? '' : 'max-h-96'">
|
||||
<TransitionGroup name="bounce" >
|
||||
<personality-entry v-for="(pers, index) in personalitiesFiltered" :key="index"
|
||||
<TransitionGroup name="bounce">
|
||||
<personality-entry v-for="(pers, index) in personalitiesFiltered" :key="'index-' + index + '-' + pers.name"
|
||||
:personality="pers"
|
||||
:selected="pers.name === configFile.personality && pers.category === configFile.personality_category && pers.language === configFile.personality_language"
|
||||
:on-selected="onPersonalitySelected" />
|
||||
@ -224,7 +225,8 @@
|
||||
|
||||
<input id="override-model-parameters" type="checkbox"
|
||||
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 dark:focus:ring-offset-gray-700 focus:ring-2 dark:bg-gray-600 dark:border-gray-500"
|
||||
@click.stop v-model="configFile.override_personality_model_parameters" @change="update_setting('override_personality_model_parameters', configFile.override_personality_model_parameters)">
|
||||
@click.stop v-model="configFile.override_personality_model_parameters"
|
||||
@change="update_setting('override_personality_model_parameters', configFile.override_personality_model_parameters)">
|
||||
<label for="override-model-parameters" class="block text-sm font-medium ">
|
||||
Override personality model parameters
|
||||
</label>
|
||||
@ -380,11 +382,11 @@
|
||||
<YesNoDialog ref="yesNoDialog" />
|
||||
<MessageBox ref="messageBox" />
|
||||
<Toast ref="toast" />
|
||||
|
||||
|
||||
</template>
|
||||
<style scoped>
|
||||
.list-move, /* apply transition to moving elements */
|
||||
/* THESE ARE FOR TransitionGroup components */
|
||||
.list-move,
|
||||
/* apply transition to moving elements */
|
||||
.list-enter-active,
|
||||
.list-leave-active {
|
||||
transition: all 0.5s ease;
|
||||
@ -393,29 +395,35 @@
|
||||
.list-enter-from {
|
||||
transform: translatey(-30px);
|
||||
}
|
||||
|
||||
.list-leave-to {
|
||||
opacity: 0;
|
||||
transform: translatey(30px);
|
||||
}
|
||||
|
||||
/* ensure leaving items are taken out of layout flow so that moving
|
||||
animations can be calculated correctly. */
|
||||
.list-leave-active {
|
||||
.list-leave-active {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.bounce-enter-active {
|
||||
animation: bounce-in 0.5s;
|
||||
}
|
||||
|
||||
.bounce-leave-active {
|
||||
animation: bounce-in 0.5s reverse;
|
||||
}
|
||||
|
||||
@keyframes bounce-in {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: scale(1.25);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
@ -424,7 +432,7 @@
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import feather from 'feather-icons'
|
||||
import { nextTick,TransitionGroup } from 'vue'
|
||||
import { nextTick, TransitionGroup } from 'vue'
|
||||
import MessageBox from "@/components/MessageBox.vue";
|
||||
import YesNoDialog from "@/components/YesNoDialog.vue";
|
||||
import Toast from '../components/Toast.vue'
|
||||
@ -489,30 +497,30 @@ export default {
|
||||
this.mc_collapsed = val
|
||||
},
|
||||
fetchModels() {
|
||||
console.log("Fetching models")
|
||||
|
||||
axios.get('/get_available_models')
|
||||
.then(response => {
|
||||
//console.log(`Models list recovered successfuly: ${JSON.stringify(response.data)}`)
|
||||
console.log(" models", response.data.length)
|
||||
|
||||
this.models = response.data;
|
||||
this.fetchCustomModels()
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
console.log(error.message,'fetchModels');
|
||||
});
|
||||
},
|
||||
fetchCustomModels() {
|
||||
console.log("Fetching Custom models")
|
||||
|
||||
axios.get('/list_models')
|
||||
.then(response => {
|
||||
// Returns array of model filenames which are = to title of models zoo entry
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
const customModel = response.data[i]
|
||||
const index = this.models.findIndex(x => x.title == customModel)
|
||||
console.log("model-ccc", customModel, index)
|
||||
|
||||
if (index == -1) {
|
||||
let newModelEntry = {}
|
||||
newModelEntry.title = customModel
|
||||
newModelEntry.path = customModel
|
||||
newModelEntry.isCustomModel = true
|
||||
newModelEntry.isInstalled = true
|
||||
this.models.push(newModelEntry)
|
||||
@ -522,31 +530,25 @@ export default {
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
console.log(error.message,'fetchCustomModels');
|
||||
});
|
||||
},
|
||||
onPersonalitySelected(pers) {
|
||||
console.log("Selected personality")
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
if (this.isLoading) {
|
||||
this.$refs.toast.showToast("Loading... please wait", 4, false)
|
||||
}
|
||||
if (pers.personality) {
|
||||
// if (model_object.isInstalled) {
|
||||
|
||||
this.settingsChanged = true
|
||||
const res = this.update_setting('personality', pers.personality.name, () => {
|
||||
this.$refs.toast.showToast("Selected personality:\n" + pers.personality.name , 4, true)
|
||||
this.$refs.toast.showToast("Selected personality:\n" + pers.personality.name, 4, true)
|
||||
this.configFile.personality = pers.personality.name
|
||||
this.configFile.personality_category = pers.personality.category
|
||||
this.configFile.personality_language = pers.personality.language
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nextTick(() => {
|
||||
feather.replace()
|
||||
|
||||
@ -555,7 +557,7 @@ export default {
|
||||
|
||||
},
|
||||
onSelected(model_object) {
|
||||
console.log("Selected model")
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
if (this.isLoading) {
|
||||
this.$refs.toast.showToast("Loading... please wait", 4, false)
|
||||
@ -563,12 +565,10 @@ export default {
|
||||
if (model_object) {
|
||||
if (model_object.isInstalled) {
|
||||
|
||||
|
||||
|
||||
if (this.configFile.model != model_object.title) {
|
||||
this.update_model(model_object.title)
|
||||
this.configFile.model = model_object.title
|
||||
this.$refs.toast.showToast("Selected model:\n" + model_object.title , 4, true)
|
||||
this.$refs.toast.showToast("Selected model:\n" + model_object.title, 4, true)
|
||||
this.settingsChanged = true
|
||||
this.isModelSelected = true
|
||||
}
|
||||
@ -587,6 +587,11 @@ export default {
|
||||
// Model installation
|
||||
|
||||
onInstall(model_object) {
|
||||
if (model_object.linkNotValid) {
|
||||
model_object.installing = false
|
||||
this.$refs.toast.showToast("Link is not valid, file does not exist", 4, false)
|
||||
return
|
||||
}
|
||||
let path = model_object.path;
|
||||
this.showProgress = true;
|
||||
this.progress = 0;
|
||||
@ -598,9 +603,12 @@ export default {
|
||||
if (response.status === 'progress') {
|
||||
console.log(`Progress = ${response.progress}`);
|
||||
model_object.progress = response.progress
|
||||
if(model_object.progress==100){
|
||||
model_object.installing = true
|
||||
if (model_object.progress == 100) {
|
||||
const index = this.models.findIndex((model) => model.path === path);
|
||||
this.models[index].isInstalled = true;
|
||||
this.showProgress = false;
|
||||
model_object.installing = false
|
||||
}
|
||||
} else if (response.status === 'succeeded') {
|
||||
console.log("Received succeeded")
|
||||
@ -610,18 +618,23 @@ export default {
|
||||
const index = this.models.findIndex((model) => model.path === path);
|
||||
this.models[index].isInstalled = true;
|
||||
this.showProgress = false;
|
||||
|
||||
model_object.installing = false
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\ninstalled!", 4, true)
|
||||
} else if (response.status === 'failed') {
|
||||
socket.off('install_progress', progressListener);
|
||||
console.log("Install failed")
|
||||
// Installation failed or encountered an error
|
||||
model_object.installing = false;
|
||||
v
|
||||
this.showProgress = false;
|
||||
console.error('Installation failed:', response.error);
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\nfailed to install!", 4, false)
|
||||
}
|
||||
};
|
||||
|
||||
socket.on('install_progress', progressListener);
|
||||
|
||||
|
||||
socket.emit('install_model', { path: path });
|
||||
console.log("Started installation, please wait");
|
||||
},
|
||||
@ -631,23 +644,29 @@ export default {
|
||||
if (response.status === 'progress') {
|
||||
this.progress = response.progress;
|
||||
} else if (response.status === 'succeeded') {
|
||||
console.log(model_object)
|
||||
// Installation completed
|
||||
model_object.uninstalling = false;
|
||||
socket.off('install_progress', progressListener);
|
||||
this.showProgress = false;
|
||||
const index = this.models.findIndex((model) => model.path === model_object.path);
|
||||
this.models[index].isInstalled = false;
|
||||
if (model_object.model.isCustomModel) {
|
||||
this.models = this.models.filter((model) => model.title !== model_object.title)
|
||||
}
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\nwas uninstalled!", 4, true)
|
||||
} else if (response.status === 'failed') {
|
||||
// Installation failed or encountered an error
|
||||
model_object.uninstalling = false;
|
||||
this.showProgress = false;
|
||||
socket.off('install_progress', progressListener);
|
||||
// eslint-disable-next-line no-undef
|
||||
console.error('Installation failed:', message.error);
|
||||
console.error('Uninstallation failed:', message.error);
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\nfailed to uninstall!", 4, false)
|
||||
}
|
||||
};
|
||||
|
||||
socket.on('install_progress', progressListener);
|
||||
|
||||
socket.emit('uninstall_model', { path: model_object.path });
|
||||
},
|
||||
// messagebox ok stuff
|
||||
@ -657,7 +676,7 @@ export default {
|
||||
// Refresh stuff
|
||||
refresh() {
|
||||
|
||||
console.log("Refreshing")
|
||||
|
||||
// No need to refresh all lists because they never change during using application.
|
||||
// On settings change only config file chnages.
|
||||
//
|
||||
@ -669,9 +688,9 @@ export default {
|
||||
//this.api_get_req("list_languages").then(response => { this.langArr = response })
|
||||
this.api_get_req("get_config").then(response => {
|
||||
this.configFile = response
|
||||
console.log("selecting model")
|
||||
|
||||
this.models.forEach(model => {
|
||||
console.log(`${model} -> ${response["model"]}`)
|
||||
|
||||
if (model.title == response["model"]) {
|
||||
model.selected = true;
|
||||
|
||||
@ -693,13 +712,13 @@ export default {
|
||||
setting_name: setting_name_val,
|
||||
setting_value: setting_value_val
|
||||
}
|
||||
console.log("change", setting_name_val, setting_value_val, obj)
|
||||
|
||||
axios.post('/update_setting', obj).then((res) => {
|
||||
console.log("Update setting done")
|
||||
|
||||
if (res) {
|
||||
console.log("res is ok")
|
||||
|
||||
if (next !== undefined) {
|
||||
console.log("Calling next")
|
||||
|
||||
next(res)
|
||||
}
|
||||
return res.data;
|
||||
@ -710,13 +729,11 @@ export default {
|
||||
},
|
||||
update_binding(value) {
|
||||
|
||||
console.log("Upgrading binding")
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
this.isLoading = true
|
||||
this.update_setting('binding', value, (res) => {
|
||||
this.refresh();
|
||||
console.log("Binding changed");
|
||||
console.log(res);
|
||||
|
||||
this.$refs.toast.showToast("Binding changed.", 4, true)
|
||||
this.settingsChanged = true
|
||||
this.isLoading = false
|
||||
@ -731,19 +748,17 @@ export default {
|
||||
},
|
||||
update_model(value) {
|
||||
if (!value) this.isModelSelected = false
|
||||
|
||||
console.log("Upgrading model")
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
this.isLoading = true
|
||||
this.update_setting('model', value, (res) => {
|
||||
console.log("Model changed");
|
||||
this.fetchModels();
|
||||
|
||||
//this.fetchModels();
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
applyConfiguration() {
|
||||
if (!this.configFile.model) {
|
||||
console.log("applying configuration failed")
|
||||
|
||||
this.$refs.toast.showToast("Configuration changed failed.\nPlease select model first", 4, false)
|
||||
nextTick(() => {
|
||||
feather.replace()
|
||||
@ -753,14 +768,14 @@ export default {
|
||||
this.isLoading = true;
|
||||
axios.post('/apply_settings').then((res) => {
|
||||
this.isLoading = false;
|
||||
console.log(res.data)
|
||||
|
||||
if (res.data.status === "succeeded") {
|
||||
console.log("applying configuration succeeded")
|
||||
|
||||
this.$refs.toast.showToast("Configuration changed successfully.", 4, true)
|
||||
this.settingsChanged = false
|
||||
this.save_configuration()
|
||||
} else {
|
||||
console.log("applying configuration failed")
|
||||
|
||||
this.$refs.toast.showToast("Configuration change failed.", 4, false)
|
||||
|
||||
}
|
||||
@ -784,7 +799,7 @@ export default {
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
console.log(error.message,'save_configuration')
|
||||
this.$refs.messageBox.showMessage("Couldn't save settings!")
|
||||
return { 'status': false }
|
||||
});
|
||||
@ -805,7 +820,7 @@ export default {
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
console.log(error.message,'reset_configuration')
|
||||
this.$refs.messageBox.showMessage("Couldn't reset settings!")
|
||||
return { 'status': false }
|
||||
});
|
||||
@ -827,7 +842,7 @@ export default {
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.log(error.message,'api_get_req - settings')
|
||||
return
|
||||
}
|
||||
|
||||
@ -951,12 +966,6 @@ export default {
|
||||
|
||||
})
|
||||
},
|
||||
isModelSelected(val) {
|
||||
|
||||
console.log('iss selected:', val)
|
||||
},
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user