mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 04:17:52 +00:00
fixed personalities ui
This commit is contained in:
parent
a14e2f75e4
commit
3148d5118e
@ -373,7 +373,7 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
message_id = self.current_discussion.add_message(
|
message_id = self.current_discussion.add_message(
|
||||||
"user",
|
"user",
|
||||||
message,
|
message,
|
||||||
message_type=DiscussionsDB.MSG_TYPE_NORMAL_USER,
|
message_type=MSG_TYPE.MSG_TYPE_FULL.value,
|
||||||
parent=self.message_id
|
parent=self.message_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -566,9 +566,10 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
self.current_discussion = self.db.load_last_discussion()
|
self.current_discussion = self.db.load_last_discussion()
|
||||||
|
|
||||||
if self.personality.welcome_message!="":
|
if self.personality.welcome_message!="":
|
||||||
|
message_type = MSG_TYPE.MSG_TYPE_FULL.value if self.personality.include_welcome_message_in_disucssion else MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_AI.value
|
||||||
message_id = self.current_discussion.add_message(
|
message_id = self.current_discussion.add_message(
|
||||||
self.personality.name, self.personality.welcome_message,
|
self.personality.name, self.personality.welcome_message,
|
||||||
DiscussionsDB.MSG_TYPE_NORMAL_AI if self.personality.include_welcome_message_in_disucssion else DiscussionsDB.MSG_TYPE_USER_ONLY,
|
message_type,
|
||||||
0,
|
0,
|
||||||
-1,
|
-1,
|
||||||
binding= self.config["binding_name"],
|
binding= self.config["binding_name"],
|
||||||
@ -601,7 +602,7 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
self.full_message_list = []
|
self.full_message_list = []
|
||||||
for message in messages:
|
for message in messages:
|
||||||
if message["id"]< message_id or message_id==-1:
|
if message["id"]< message_id or message_id==-1:
|
||||||
if message["type"]==self.db.MSG_TYPE_NORMAL_USER or message["type"]==self.db.MSG_TYPE_NORMAL_AI:
|
if message["type"]==MSG_TYPE.MSG_TYPE_FULL:
|
||||||
if message["sender"]==self.personality.name:
|
if message["sender"]==self.personality.name:
|
||||||
self.full_message_list.append(self.personality.ai_message_prefix+message["content"])
|
self.full_message_list.append(self.personality.ai_message_prefix+message["content"])
|
||||||
else:
|
else:
|
||||||
@ -626,7 +627,7 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
self.full_message_list = []
|
self.full_message_list = []
|
||||||
for message in messages:
|
for message in messages:
|
||||||
if message["id"]<= message_id or message_id==-1:
|
if message["id"]<= message_id or message_id==-1:
|
||||||
if message["type"]!=self.db.MSG_TYPE_CONDITIONNING:
|
if message["type"]!=MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_USER:
|
||||||
if message["sender"]==self.personality.name:
|
if message["sender"]==self.personality.name:
|
||||||
self.full_message_list.append(self.personality.ai_message_prefix+message["content"])
|
self.full_message_list.append(self.personality.ai_message_prefix+message["content"])
|
||||||
else:
|
else:
|
||||||
@ -809,7 +810,7 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
self.current_ai_message_id = self.current_discussion.add_message(
|
self.current_ai_message_id = self.current_discussion.add_message(
|
||||||
self.personality.name,
|
self.personality.name,
|
||||||
"",
|
"",
|
||||||
message_type = DiscussionsDB.MSG_TYPE_NORMAL_AI,
|
message_type = MSG_TYPE.MSG_TYPE_FULL.value,
|
||||||
parent = self.current_user_message_id,
|
parent = self.current_user_message_id,
|
||||||
binding = self.config["binding_name"],
|
binding = self.config["binding_name"],
|
||||||
model = self.config["model_name"],
|
model = self.config["model_name"],
|
||||||
|
@ -12,13 +12,7 @@ __license__ = "Apache 2.0"
|
|||||||
|
|
||||||
# =================================== Database ==================================================================
|
# =================================== Database ==================================================================
|
||||||
class DiscussionsDB:
|
class DiscussionsDB:
|
||||||
MSG_TYPE_NORMAL_USER = 0 # A normal message from user
|
|
||||||
MSG_TYPE_NORMAL_AI = 1 # A normal message from ai
|
|
||||||
|
|
||||||
MSG_TYPE_CONDITIONNING = 2 # This is the AI conditionning (to be protected from window sliding)
|
|
||||||
MSG_TYPE_HIDDEN = 3 # Don't show this to user
|
|
||||||
MSG_TYPE_USER_ONLY = 4 # Don't give this to the AI
|
|
||||||
|
|
||||||
def __init__(self, db_path="database.db"):
|
def __init__(self, db_path="database.db"):
|
||||||
self.db_path = Path(db_path)
|
self.db_path = Path(db_path)
|
||||||
self.db_path .parent.mkdir(exist_ok=True, parents= True)
|
self.db_path .parent.mkdir(exist_ok=True, parents= True)
|
||||||
|
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-3107af8d.js"></script>
|
<script type="module" crossorigin src="/assets/index-72356ec7.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/index-8af7331e.css">
|
<link rel="stylesheet" href="/assets/index-ad2fc7e5.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
@ -499,31 +499,34 @@ export default {
|
|||||||
this.mountedPersArr = mountedPersArr
|
this.mountedPersArr = mountedPersArr
|
||||||
//this.mountedPersArr = mountedPersArr
|
//this.mountedPersArr = mountedPersArr
|
||||||
console.log('discussionPersonalities', this.discussionPersonalities)
|
console.log('discussionPersonalities', this.discussionPersonalities)
|
||||||
if (this.discussionPersonalities.length > 0) {
|
if (this.discussionPersonalities!=undefined){
|
||||||
for (let i = 0; i < this.discussionPersonalities.length; i++) {
|
if (this.discussionPersonalities.length > 0) {
|
||||||
const per = this.discussionPersonalities[i]
|
for (let i = 0; i < this.discussionPersonalities.length; i++) {
|
||||||
console.log('discussionPersonalities - per', per)
|
const per = this.discussionPersonalities[i]
|
||||||
const perIndex = this.mountedPersArr.findIndex((item) => item.full_path == per)
|
console.log('discussionPersonalities - per', per)
|
||||||
console.log('discussionPersonalities -includes', perIndex)
|
const perIndex = this.mountedPersArr.findIndex((item) => item.full_path == per)
|
||||||
console.log('discussionPersonalities -mounted list', this.mountedPersArr)
|
console.log('discussionPersonalities -includes', perIndex)
|
||||||
|
console.log('discussionPersonalities -mounted list', this.mountedPersArr)
|
||||||
|
|
||||||
if (perIndex == -1) {
|
if (perIndex == -1) {
|
||||||
|
|
||||||
const index2 = this.personalities.findIndex(item2 => item2.full_path == per)
|
const index2 = this.personalities.findIndex(item2 => item2.full_path == per)
|
||||||
// const index22 = this.personalities.filter(item2 => item2.full_path.localeCompare(per) ==1 )
|
// const index22 = this.personalities.filter(item2 => item2.full_path.localeCompare(per) ==1 )
|
||||||
|
|
||||||
|
const pers = this.personalities[index2]
|
||||||
|
console.log('adding discucc121', pers, per)
|
||||||
|
if (pers) {
|
||||||
|
this.mountedPersArr.push(pers)
|
||||||
|
console.log('adding discucc', pers)
|
||||||
|
}
|
||||||
|
|
||||||
const pers = this.personalities[index2]
|
|
||||||
console.log('adding discucc121', pers, per)
|
|
||||||
if (pers) {
|
|
||||||
this.mountedPersArr.push(pers)
|
|
||||||
console.log('adding discucc', pers)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
console.log('getMountedPersonalities', this.mountedPersArr)
|
console.log('getMountedPersonalities', this.mountedPersArr)
|
||||||
|
@ -238,25 +238,27 @@ export default {
|
|||||||
// To be synced with the backend database types
|
// To be synced with the backend database types
|
||||||
msgTypes: {
|
msgTypes: {
|
||||||
// Messaging
|
// Messaging
|
||||||
MSG_TYPE_CHUNK: 0, // A chunk of a message (used for classical chat)
|
MSG_TYPE_CHUNK : 0, // A chunk of a message (used for classical chat)
|
||||||
MSG_TYPE_FULL: 1, // A full message (for some personality the answer is sent in bulk)
|
MSG_TYPE_FULL : 1, // A full message (for some personality the answer is sent in bulk)
|
||||||
|
MSG_TYPE_FULL_INVISIBLE_TO_AI : 2, // A full message (for some personality the answer is sent in bulk)
|
||||||
|
MSG_TYPE_FULL_INVISIBLE_TO_USER : 3, // A full message (for some personality the answer is sent in bulk)
|
||||||
|
|
||||||
// Informations
|
// Informations
|
||||||
MSG_TYPE_EXCEPTION: 2, // An exception occured
|
MSG_TYPE_EXCEPTION : 4, // An exception occured
|
||||||
MSG_TYPE_WARNING: 3, // A warning occured
|
MSG_TYPE_WARNING : 5, // A warning occured
|
||||||
MSG_TYPE_INFO: 4, // An information to be shown to user
|
MSG_TYPE_INFO : 6, // An information to be shown to user
|
||||||
|
|
||||||
// Steps
|
// Steps
|
||||||
MSG_TYPE_STEP: 5, // An instant step (a step that doesn't need time to be executed)
|
MSG_TYPE_STEP : 7, // An instant step (a step that doesn't need time to be executed)
|
||||||
MSG_TYPE_STEP_START: 6, // A step has started (the text contains an explanation of the step done by he personality)
|
MSG_TYPE_STEP_START : 8, // A step has started (the text contains an explanation of the step done by he personality)
|
||||||
MSG_TYPE_STEP_PROGRESS: 7, // The progress value (the text contains a percentage and can be parsed by the reception)
|
MSG_TYPE_STEP_PROGRESS : 9, // The progress value (the text contains a percentage and can be parsed by the reception)
|
||||||
MSG_TYPE_STEP_END: 8, // A step has been done (the text contains an explanation of the step done by he personality)
|
MSG_TYPE_STEP_END : 10,// A step has been done (the text contains an explanation of the step done by he personality)
|
||||||
|
|
||||||
//Extra
|
//Extra
|
||||||
MSG_TYPE_JSON_INFOS: 9, // A JSON output that is useful for summarizing the process of generation used by personalities like chain of thoughts and tree of thooughts
|
MSG_TYPE_JSON_INFOS : 11,// A JSON output that is useful for summarizing the process of generation used by personalities like chain of thoughts and tree of thooughts
|
||||||
MSG_TYPE_REF: 10, // References (in form of [text](path))
|
MSG_TYPE_REF : 12,// References (in form of [text](path))
|
||||||
MSG_TYPE_CODE: 11, // A javascript code to execute
|
MSG_TYPE_CODE : 13,// A javascript code to execute
|
||||||
MSG_TYPE_UI: 12 // A vue.js component to show (we need to build some and parse the text to show it)
|
MSG_TYPE_UI : 14 // A vue.js component to show (we need to build some and parse the text to show it)
|
||||||
|
|
||||||
},
|
},
|
||||||
list: [], // Discussion list
|
list: [], // Discussion list
|
||||||
@ -760,7 +762,9 @@ export default {
|
|||||||
this.isGenerating = true;
|
this.isGenerating = true;
|
||||||
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
|
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
|
||||||
const messageItem = this.discussionArr[index]
|
const messageItem = this.discussionArr[index]
|
||||||
if (messageItem && msgObj.message_type<2) {
|
console.log("Message type")
|
||||||
|
console.log(msgObj.message_type)
|
||||||
|
if (messageItem && msgObj.message_type<this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_USER) {
|
||||||
messageItem.content = msgObj.data
|
messageItem.content = msgObj.data
|
||||||
}
|
}
|
||||||
else if (msgObj.message_type == this.msgTypes.MSG_TYPE_STEP_START){
|
else if (msgObj.message_type == this.msgTypes.MSG_TYPE_STEP_START){
|
||||||
|
Loading…
Reference in New Issue
Block a user