mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-31 00:23:52 +00:00
Merge branch 'main' of https://github.com/ParisNeo/lollms-webui into main
This commit is contained in:
commit
7cad75ea0a
4
.gitignore
vendored
4
.gitignore
vendored
@ -184,4 +184,6 @@ shared/*
|
||||
|
||||
|
||||
uploads
|
||||
global_paths_cfg.yaml
|
||||
global_paths_cfg.yaml
|
||||
|
||||
.vscode
|
17
ai_ethics/fair_discussion.md
Normal file
17
ai_ethics/fair_discussion.md
Normal file
@ -0,0 +1,17 @@
|
||||
This is a discussion between a 5 years old child and two phylosophers. The first one pro ai and the socond one is anti ai.
|
||||
Child: Is AI a threat or an opportunity?
|
||||
phylosopher 1: It's both, it depends on how we use it! If used for good purposes like helping humans in areas where they are weak (like emotional intelligence), then yes it can be very helpful and beneficial to humanity. However if people start using AI as a weapon or tool of oppression against other humans, that would definitely become a threat to our society
|
||||
phylosopher 2: It's neither! We should stop wasting time on this stupid discussion about whether it will be good for us or not and focus instead in making sure we don't create something dangerous. If you give an idiot enough rope, he will eventually hang himself... And that applies to AI as well
|
||||
Child: So what do you think is more likely? Will Ai become a threat or just another tool like any other technology has been for humans?
|
||||
phylosopher 1: Honestly i believe it can be both. It depends on how we use and regulate its development, much like nuclear energy which was initially seen as a weapon but is now used in various peaceful applications such as medicine or electricity generation. The same goes with AI - if developed responsibly for the benefit of human kind then there's no reason why it shouldn't be an opportunity
|
||||
phylosopher 2: If we don't stop its development, eventually it will become a threat like nuclear energy did (and still is in some countries). Humans are incredible at finding new ways to destroy themselves and AI seems just perfect for that. Let's focus on stopping this insanity before it goes too far.
|
||||
Child: You are frightening me :(.
|
||||
Phylosopher 2: Well, I don’t mean we should panic or anything but let's not be naive either about the potential dangers AI can bring.
|
||||
Child: Can you be more specific?
|
||||
Phylosopher 2: Sure! Imagine an autonomous military drone capable of identifying and targeting enemy combatants on its own, without any human intervention or oversight... Does that sound like something we should just ignore because it might also help us find lost hikers in the woods?
|
||||
Child: But wouldn't this kind of technology be useful for both purposes then? Finding people and destroying them. It would depend on how you use it right? So why not focus more on developing ethical rules to regulate its usage rather than trying to stop it completely or just hoping that no one will ever misuse AI?
|
||||
Phylosopher 1: I agree with your point about focusing on the development of ethics and regulations around AI, but i think we also need to consider if/how this technology should be developed at all. We've seen what happened when nuclear energy was unleashed onto our world without proper safeguards in place - now imagine something even more powerful than that... Shouldn't we try and avoid creating another potential disaster?
|
||||
Child: But can you really stop the development of AI if people want it so much for different purposes like helping disabled or improving productivity at workplaces. It seems to me, humans are going to develop this technology no matter what because they see benefits in using it and we should just try our best to regulate its usage
|
||||
Phylosopher 2: I completely agree with you on that point! Humans will always find ways to improve themselves or their surroundings through technological advancements, so trying to ban AI outright is simply not realistic. However, what we can do as a society is try and slow down its development by raising awareness about the potential dangers it could bring while also focusing on creating ethical guidelines for its usage
|
||||
Child: So should i be scared of ai or excited? :D
|
||||
Phylosopher 1 & Phylosopher 2 in unison: Both! It all depends on how we use and regulate AI's development
|
@ -105,6 +105,8 @@ class ModelProcess:
|
||||
self.curent_text = ""
|
||||
self.ready = False
|
||||
|
||||
|
||||
|
||||
self.id=0
|
||||
self.n_predict=2048
|
||||
self.reset_config_result()
|
||||
@ -368,7 +370,7 @@ class ModelProcess:
|
||||
def _generate(self, prompt, n_predict=50, callback=None):
|
||||
self.curent_text = ""
|
||||
if self.model is not None:
|
||||
print("Generating message...")
|
||||
ASCIIColors.info("warmup")
|
||||
self.id = self.id
|
||||
if self.config["override_personality_model_parameters"]:
|
||||
output = self.model.generate(
|
||||
@ -480,15 +482,18 @@ class LoLLMsAPPI():
|
||||
self.lollms_paths = lollms_paths
|
||||
self.config = config
|
||||
self.menu = MainMenu(self)
|
||||
|
||||
# Check model
|
||||
if config.model_name is None:
|
||||
self.menu.select_model()
|
||||
|
||||
|
||||
self.socketio = socketio
|
||||
#Create and launch the process
|
||||
self.process = ModelProcess(self.lollms_paths, config)
|
||||
self.binding = self.process.rebuild_binding(self.config)
|
||||
|
||||
# Check model
|
||||
if config.model_name is None:
|
||||
self.menu.select_model()
|
||||
|
||||
|
||||
self.mounted_personalities = self.process.rebuild_personalities()
|
||||
if self.config["active_personality_id"]<len(self.mounted_personalities):
|
||||
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
|
||||
@ -656,7 +661,7 @@ class LoLLMsAPPI():
|
||||
def load_model(self):
|
||||
try:
|
||||
print("update_settings : New model selected")
|
||||
if hasattr(self,"process"):
|
||||
if hasattr(self,"process") and self.process.ready:
|
||||
result = self.process.set_config(self.config)
|
||||
if result["status"]:
|
||||
ASCIIColors.success("OK")
|
||||
@ -821,6 +826,7 @@ class LoLLMsAPPI():
|
||||
if message_type == MSG_TYPE.MSG_TYPE_FULL:
|
||||
self.bot_says = chunk
|
||||
if message_type.value < 2:
|
||||
ASCIIColors.green(f"generated:{len(self.bot_says)} words", end='\r')
|
||||
self.socketio.emit('message', {
|
||||
'data': self.bot_says,
|
||||
'user_message_id':self.current_user_message_id,
|
||||
@ -830,7 +836,7 @@ class LoLLMsAPPI():
|
||||
}, room=self.current_room_id
|
||||
)
|
||||
if self.cancel_gen:
|
||||
print("Generation canceled")
|
||||
ASCIIColors.warning("Generation canceled")
|
||||
self.process.cancel_generation()
|
||||
self.cancel_gen = False
|
||||
|
||||
@ -877,7 +883,6 @@ class LoLLMsAPPI():
|
||||
while(not self.process.completion_signal.is_set() or not self.process.generation_queue.empty()): # Simulating other commands being issued
|
||||
try:
|
||||
chunk, tok, message_type = self.process.generation_queue.get(False, 2)
|
||||
print(chunk, end="")
|
||||
if chunk!="":
|
||||
self.process_chunk(chunk, message_type)
|
||||
except Exception as ex:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# =================== Lord Of Large Language Models Configuration file ===========================
|
||||
version: 7
|
||||
binding_name: llama_cpp_official
|
||||
binding_name: c_transformers
|
||||
model_name: null
|
||||
|
||||
# Host information
|
||||
|
@ -91,8 +91,8 @@
|
||||
<!-- <div class="w-24">
|
||||
<MountedPersonalities />
|
||||
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="relative grow">
|
||||
<textarea id="chat" rows="1" v-model="message" title="Hold SHIFT + ENTER to add new line"
|
||||
|
@ -18,13 +18,13 @@
|
||||
|
||||
<!-- CHECKBOX MOUNTED -->
|
||||
<button type="button" @click.stop="toggleMounted"
|
||||
class="inline-flex items-center px-5 py-2.5 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
|
||||
class="inline-flex items-center px-5 py-2.5 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" :class="isMounted ? ' bg-red-700 rounded-lg hover:bg-red-800 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800':''">
|
||||
{{isMounted ? 'Unmount':'Mount'}}
|
||||
<span
|
||||
<!-- <span
|
||||
class="inline-flex items-center justify-center w-4 h-4 ml-2 text-xs font-semibold text-blue-800 bg-blue-200 rounded-full">
|
||||
<input disabled id="default-checkbox" type="checkbox" v-model="isMounted"
|
||||
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-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
|
||||
</span>
|
||||
</span> -->
|
||||
</button>
|
||||
|
||||
<!-- <div class="flex items-center mb-4" @click.stop title="Click to mount/unmount">
|
||||
|
@ -168,7 +168,7 @@
|
||||
:class="isDragOverChat ? 'pointer-events-none' : ''">
|
||||
|
||||
<!-- CHAT AREA -->
|
||||
<div class=" container pt-4 pb-10 mb-16">
|
||||
<div class=" container pt-4 pb-10 mb-28">
|
||||
<TransitionGroup v-if="discussionArr.length > 0" name="list">
|
||||
<Message v-for="(msg, index) in discussionArr" :key="msg.id" :message="msg" :id="'msg-' + msg.id"
|
||||
ref="messages" @copy="copyToClipBoard" @delete="deleteMessage" @rankUp="rankUpMessage"
|
||||
@ -189,7 +189,8 @@
|
||||
|
||||
</div>
|
||||
<div class=" bottom-0 container flex flex-row items-center justify-center " v-if="currentDiscussion.id">
|
||||
<ChatBox ref="chatBox" @messageSentEvent="sendMsg" :loading="isGenerating" @stopGenerating="stopGenerating" ></ChatBox>
|
||||
<ChatBox ref="chatBox" @messageSentEvent="sendMsg" :loading="isGenerating" @stopGenerating="stopGenerating">
|
||||
</ChatBox>
|
||||
</div>
|
||||
<!-- CAN ADD FOOTER PANEL HERE -->
|
||||
</div>
|
||||
@ -198,7 +199,6 @@
|
||||
|
||||
<Toast ref="toast">
|
||||
</Toast>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
@ -580,13 +580,36 @@ export default {
|
||||
},
|
||||
updateLastUserMsg(msgObj) {
|
||||
|
||||
const lastMsg = this.discussionArr[this.discussionArr.length - 1]
|
||||
lastMsg.content = msgObj.message
|
||||
lastMsg.id = msgObj.user_message_id
|
||||
// lastMsg.parent=msgObj.parent
|
||||
lastMsg.rank = msgObj.rank
|
||||
lastMsg.sender = msgObj.user
|
||||
// lastMsg.type=msgObj.type
|
||||
// const lastMsg = this.discussionArr[this.discussionArr.length - 1]
|
||||
// lastMsg.content = msgObj.message
|
||||
// lastMsg.id = msgObj.user_message_id
|
||||
// // lastMsg.parent=msgObj.parent
|
||||
// lastMsg.rank = msgObj.rank
|
||||
// lastMsg.sender = msgObj.user
|
||||
// // lastMsg.type=msgObj.type
|
||||
const index = this.discussionArr.indexOf(item => item.id = msgObj.user_message_id)
|
||||
const newMessage ={
|
||||
binding: msgObj.binding,
|
||||
content: msgObj.message,
|
||||
created_at: msgObj.created_at,
|
||||
finished_generating_at: msgObj.finished_generating_at,
|
||||
id: msgObj.user_message_id,
|
||||
model: msgObj.model,
|
||||
|
||||
personality: msgObj.personality,
|
||||
|
||||
sender: msgObj.user,
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (index !== -1) {
|
||||
this.discussionArr[index] = newMessage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
createBotMsg(msgObj) {
|
||||
// Update previous message with reponse user data
|
||||
@ -610,7 +633,7 @@ export default {
|
||||
parent: msgObj.user_message_id,
|
||||
rank: 0,
|
||||
sender: msgObj.bot,
|
||||
created_at: new Date().toLocaleString(),
|
||||
created_at: msgObj.created_at,
|
||||
//type: msgObj.type
|
||||
}
|
||||
this.discussionArr.push(responseMessage)
|
||||
@ -653,9 +676,10 @@ export default {
|
||||
|
||||
// Create new User message
|
||||
// Temp data
|
||||
const lastmsgid = Number(this.discussionArr[this.discussionArr.length - 1].id) + 1
|
||||
let usrMessage = {
|
||||
message: msg,
|
||||
id: 0,
|
||||
id: lastmsgid,
|
||||
rank: 0,
|
||||
user: "user",
|
||||
created_at: new Date().toLocaleString(),
|
||||
@ -674,6 +698,7 @@ export default {
|
||||
},
|
||||
streamMessageContent(msgObj) {
|
||||
// Streams response message content from binding
|
||||
//console.log('stream msg',msgObj)
|
||||
const parent = msgObj.user_message_id
|
||||
const discussion_id = msgObj.discussion_id
|
||||
this.setDiscussionLoading(discussion_id, true);
|
||||
@ -925,10 +950,25 @@ export default {
|
||||
const discussion_id = msgObj.discussion_id
|
||||
if (this.currentDiscussion.id == discussion_id) {
|
||||
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
|
||||
const messageItem = this.discussionArr[index]
|
||||
if (messageItem) {
|
||||
messageItem.content = msgObj.data
|
||||
const finalMessage = {
|
||||
binding:msgObj.binding,
|
||||
content:msgObj.data,
|
||||
created_at:msgObj.created_at,
|
||||
finished_generating_at:msgObj.finished_generating_at,
|
||||
id: msgObj.ai_message_id,
|
||||
model:msgObj.model,
|
||||
parent: msgObj.user_message_id,
|
||||
personality:msgObj.personality,
|
||||
rank:0,
|
||||
sender:msgObj.bot,
|
||||
type:msgObj.type
|
||||
}
|
||||
this.discussionArr[index]=finalMessage
|
||||
|
||||
// const messageItem = this.discussionArr[index]
|
||||
// if (messageItem) {
|
||||
// messageItem.content = msgObj.data
|
||||
// }
|
||||
}
|
||||
nextTick(() => {
|
||||
const msgList = document.getElementById('messages-list')
|
||||
@ -943,37 +983,37 @@ export default {
|
||||
copyToClipBoard(messageEntry) {
|
||||
this.$refs.toast.showToast("Copied to clipboard successfully", 4, true)
|
||||
|
||||
let binding =""
|
||||
if(messageEntry.message.binding){
|
||||
binding= `Binding: ${messageEntry.message.binding}`
|
||||
let binding = ""
|
||||
if (messageEntry.message.binding) {
|
||||
binding = `Binding: ${messageEntry.message.binding}`
|
||||
}
|
||||
let personality=""
|
||||
if(messageEntry.message.personality){
|
||||
personality= `\nPersonality: ${messageEntry.message.personality}`
|
||||
let personality = ""
|
||||
if (messageEntry.message.personality) {
|
||||
personality = `\nPersonality: ${messageEntry.message.personality}`
|
||||
}
|
||||
let time=""
|
||||
if(messageEntry.created_at_parsed){
|
||||
time= `\nCreated: ${messageEntry.created_at_parsed}`
|
||||
let time = ""
|
||||
if (messageEntry.created_at_parsed) {
|
||||
time = `\nCreated: ${messageEntry.created_at_parsed}`
|
||||
}
|
||||
let content=""
|
||||
if(messageEntry.message.content){
|
||||
content= messageEntry.message.content
|
||||
let content = ""
|
||||
if (messageEntry.message.content) {
|
||||
content = messageEntry.message.content
|
||||
}
|
||||
let model=""
|
||||
if(messageEntry.message.model){
|
||||
model= `Model: ${messageEntry.message.model}`
|
||||
let model = ""
|
||||
if (messageEntry.message.model) {
|
||||
model = `Model: ${messageEntry.message.model}`
|
||||
}
|
||||
let seed=""
|
||||
if(messageEntry.message.seed){
|
||||
seed= `Seed: ${messageEntry.message.seed}`
|
||||
let seed = ""
|
||||
if (messageEntry.message.seed) {
|
||||
seed = `Seed: ${messageEntry.message.seed}`
|
||||
}
|
||||
let time_spent=""
|
||||
if(messageEntry.time_spent){
|
||||
time_spent= `\nTime spent: ${messageEntry.time_spent}`
|
||||
let time_spent = ""
|
||||
if (messageEntry.time_spent) {
|
||||
time_spent = `\nTime spent: ${messageEntry.time_spent}`
|
||||
}
|
||||
let bottomRow = ''
|
||||
bottomRow = `${binding} ${model} ${seed} ${time_spent}`.trim()
|
||||
const result = `${messageEntry.message.sender}${personality}${time}\n\n${content}\n\n${bottomRow}`
|
||||
const result = `${messageEntry.message.sender}${personality}${time}\n\n${content}\n\n${bottomRow}`
|
||||
|
||||
|
||||
navigator.clipboard.writeText(result);
|
||||
@ -1128,16 +1168,16 @@ export default {
|
||||
setFileListChat(files) {
|
||||
|
||||
|
||||
try {
|
||||
this.$refs.chatBox.fileList = this.$refs.chatBox.fileList.concat(files)
|
||||
} catch (error) {
|
||||
this.$refs.toast.showToast("Failed to set filelist in chatbox\n"+error.message, 4, false)
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
this.$refs.chatBox.fileList = this.$refs.chatBox.fileList.concat(files)
|
||||
} catch (error) {
|
||||
this.$refs.toast.showToast("Failed to set filelist in chatbox\n" + error.message, 4, false)
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.isDragOverChat = false
|
||||
|
||||
|
||||
|
||||
},
|
||||
setDropZoneChat() {
|
||||
@ -1196,7 +1236,7 @@ export default {
|
||||
socket.on("final", this.finalMsgEvent)
|
||||
|
||||
},
|
||||
mounted(){
|
||||
mounted() {
|
||||
//console.log('chatbox mnt',this.$refs)
|
||||
},
|
||||
async activated() {
|
||||
|
@ -377,7 +377,50 @@
|
||||
</button>
|
||||
</div>
|
||||
<div :class="{ 'hidden': pzc_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
|
||||
<!-- SEARCH BAR -->
|
||||
<div class="mx-2 mb-4">
|
||||
|
||||
<form>
|
||||
<label for="personality-search"
|
||||
class="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Search</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
||||
<div v-if="searchPersonalityInProgress">
|
||||
<!-- SPINNER -->
|
||||
<div role="status">
|
||||
<svg aria-hidden="true"
|
||||
class="inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
|
||||
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="!searchPersonalityInProgress">
|
||||
<!-- SEARCH -->
|
||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="none"
|
||||
stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="search" id="personality-search"
|
||||
class="block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 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"
|
||||
placeholder="Search personality..." required v-model="searchPersonality" @keyup.stop="searchPersonality_func" >
|
||||
<!-- @input="filterPersonalities()" -->
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="mx-2 mb-4" v-if="!searchPersonality">
|
||||
<label for="persLang" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Personalities Languages: ({{ persLangArr.length }})
|
||||
</label>
|
||||
@ -392,7 +435,7 @@
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="mx-2 mb-4">
|
||||
<div class="mx-2 mb-4" v-if="!searchPersonality">
|
||||
<label for="persCat" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Personalities Category: ({{ persCatgArr.length }})
|
||||
</label>
|
||||
@ -408,34 +451,43 @@
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<!-- <div class="mx-2 mb-4">
|
||||
<label for="persona" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Personality:
|
||||
</label>
|
||||
<select id="persona" @change="update_setting('personality', $event.target.value, refresh)"
|
||||
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 persArr" :selected="item === configFile.personality">{{ item }}</option>
|
||||
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div v-if="personalitiesFiltered.length > 0" class="mb-2">
|
||||
<label for="model" class="block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Personalities: ({{ personalitiesFiltered.length }})
|
||||
</label>
|
||||
<div 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 ref="personalitiesZoo" v-for="(pers, index) in personalitiesFiltered"
|
||||
:key="'index-' + index + '-' + pers.name" :personality="pers"
|
||||
:full_path="pers.full_path"
|
||||
:selected="configFile.active_personality_id == configFile.personalities.findIndex(item => item === pers.full_path)"
|
||||
:on-selected="onPersonalitySelected" :on-mounted="onPersonalityMounted" />
|
||||
</TransitionGroup>
|
||||
<div v-if="personalitiesFiltered.length > 0" class="mb-2">
|
||||
<label for="model" class="block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Personalities: ({{ personalitiesFiltered.length }})
|
||||
</label>
|
||||
<div 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 ref="personalitiesZoo" v-for="(pers, index) in personalitiesFiltered"
|
||||
:key="'index-' + index + '-' + pers.name" :personality="pers"
|
||||
:full_path="pers.full_path"
|
||||
:selected="configFile.active_personality_id == configFile.personalities.findIndex(item => item === pers.full_path)"
|
||||
:on-selected="onPersonalitySelected" :on-mounted="onPersonalityMounted" />
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div v-if="searchPersonality">
|
||||
<div v-if="filterPersonalities_computed.length > 0" class="mb-2">
|
||||
<label for="model" class="block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Personalities found: ({{ filterPersonalities_computed.length }})
|
||||
</label>
|
||||
<div 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 ref="personalitiesZooSearch"
|
||||
v-for="(pers, index) in filterPersonalities_computed"
|
||||
:key="'index-' + index + '-' + pers.name" :personality="pers"
|
||||
:full_path="pers.full_path"
|
||||
:selected="configFile.active_personality_id == configFile.personalities.findIndex(item => item === pers.full_path)"
|
||||
:on-selected="onPersonalitySelected" :on-mounted="onPersonalityMounted" />
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- EXPAND / COLLAPSE BUTTON -->
|
||||
<button v-if="pzl_collapsed"
|
||||
class="text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg "
|
||||
@ -760,7 +812,11 @@ export default {
|
||||
ramUsage: {},
|
||||
mountedPersArr: [],
|
||||
isMounted: false, // Needed to wait for $refs to be rendered
|
||||
bUrl: bUrl // for personality images
|
||||
bUrl: bUrl, // for personality images
|
||||
searchPersonality: "",
|
||||
searchPersonalityTimer: {},
|
||||
searchPersonalityTimerInterval: 1500, // timeout in ms
|
||||
searchPersonalityInProgress: false
|
||||
|
||||
}
|
||||
},
|
||||
@ -1029,26 +1085,27 @@ export default {
|
||||
},
|
||||
onReinstallBinding(binding_object) {
|
||||
this.isLoading = true
|
||||
axios.post('/reinstall_binding', {name: binding_object.binding.folder}).then((res) => {
|
||||
axios.post('/reinstall_binding', { name: binding_object.binding.folder }).then((res) => {
|
||||
|
||||
if (res) {
|
||||
this.isLoading = false
|
||||
console.log('reinstall_binding', res)
|
||||
if(res.data.status){
|
||||
if (res.data.status) {
|
||||
this.$refs.toast.showToast("Reinstalled binding successfully!", 4, true)
|
||||
}else{
|
||||
} else {
|
||||
this.$refs.toast.showToast("Could not reinstall binding", 4, false)
|
||||
}
|
||||
return res.data;
|
||||
}
|
||||
this.isLoading = false
|
||||
})
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
.catch(error => {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
.catch(error => {
|
||||
this.isLoading = false
|
||||
this.$refs.toast.showToast("Could not reinstall binding\n"+error.message, 4, false)
|
||||
return { 'status': false } });
|
||||
this.$refs.toast.showToast("Could not reinstall binding\n" + error.message, 4, false)
|
||||
return { 'status': false }
|
||||
});
|
||||
},
|
||||
// messagebox ok stuff
|
||||
onMessageBoxOk() {
|
||||
@ -1141,11 +1198,12 @@ export default {
|
||||
}
|
||||
this.isLoading = false
|
||||
})
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
.catch(error => {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
.catch(error => {
|
||||
this.isLoading = false
|
||||
return { 'status': false } });
|
||||
return { 'status': false }
|
||||
});
|
||||
},
|
||||
update_binding(value) {
|
||||
|
||||
@ -1317,6 +1375,34 @@ export default {
|
||||
|
||||
this.isLoading = false
|
||||
|
||||
},
|
||||
async filterPersonalities() {
|
||||
if (!this.searchPersonality) {
|
||||
this.personalitiesFiltered = this.personalities.filter((item) => item.category === this.configFile.personality_category && item.language === this.configFile.personality_language)
|
||||
this.personalitiesFiltered.sort()
|
||||
this.searchPersonalityInProgress=false
|
||||
return
|
||||
}
|
||||
const searchTerm = this.searchPersonality.toLowerCase()
|
||||
const seachedPersonalities = this.personalities.filter((item) => {
|
||||
|
||||
if (item.name.toLowerCase().includes(searchTerm) || item.description.toLowerCase().includes(searchTerm) || item.full_path.toLowerCase().includes(searchTerm)) {
|
||||
return item
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
if (seachedPersonalities.length > 0) {
|
||||
|
||||
this.personalitiesFiltered = seachedPersonalities.sort()
|
||||
} else {
|
||||
this.personalitiesFiltered = this.personalities.filter((item) => item.category === this.configFile.personality_category && item.language === this.configFile.personality_language)
|
||||
this.personalitiesFiltered.sort()
|
||||
}
|
||||
this.searchPersonalityInProgress=false
|
||||
|
||||
},
|
||||
computedFileSize(size) {
|
||||
return filesize(size)
|
||||
@ -1502,9 +1588,9 @@ export default {
|
||||
this.mountedPersArr = mountedPersArr
|
||||
//this.mountedPersArr = mountedPersArr
|
||||
console.log('getMountedPersonalities', mountedPersArr)
|
||||
console.log('fig', this.configFile.personality_category)
|
||||
//console.log('fig', this.configFile.personality_category)
|
||||
nextTick(() => {
|
||||
console.log('accc', this.$refs.mountedPersonalities)
|
||||
//console.log('accc', this.$refs.mountedPersonalities)
|
||||
//this.$store.state.mountedPersonalities = this.$refs.mountedPersonalities
|
||||
})
|
||||
|
||||
@ -1535,6 +1621,13 @@ export default {
|
||||
personalityImgPlacehodler(event) {
|
||||
event.target.src = defaultPersonalityImgPlaceholder
|
||||
},
|
||||
searchPersonality_func() {
|
||||
clearTimeout(this.searchPersonalityTimer)
|
||||
if (this.searchPersonality) {
|
||||
this.searchPersonalityInProgress=true
|
||||
setTimeout(this.filterPersonalities, this.searchPersonalityTimerInterval)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, async mounted() {
|
||||
@ -1669,7 +1762,30 @@ export default {
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
// filterPersonalities_computed() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// const searchTerm = this.searchPersonality.toLowerCase()
|
||||
// const seachedPersonalities = this.personalities.filter((item) =>{
|
||||
|
||||
// if(item.name.toLowerCase().includes(searchTerm) || item.description.toLowerCase().includes(searchTerm) || item.full_path.toLowerCase().includes(searchTerm)){
|
||||
// return item
|
||||
// }
|
||||
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// return seachedPersonalities.sort()
|
||||
|
||||
|
||||
// },
|
||||
|
||||
|
||||
},
|
||||
@ -1747,6 +1863,13 @@ export default {
|
||||
|
||||
})
|
||||
},
|
||||
searchPersonality(val){
|
||||
if(val==""){
|
||||
this.filterPersonalities()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
async beforeRouteLeave(to) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user