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(
|
||||
"user",
|
||||
message,
|
||||
message_type=DiscussionsDB.MSG_TYPE_NORMAL_USER,
|
||||
message_type=MSG_TYPE.MSG_TYPE_FULL.value,
|
||||
parent=self.message_id
|
||||
)
|
||||
|
||||
@ -566,9 +566,10 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
self.current_discussion = self.db.load_last_discussion()
|
||||
|
||||
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(
|
||||
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,
|
||||
-1,
|
||||
binding= self.config["binding_name"],
|
||||
@ -601,7 +602,7 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
self.full_message_list = []
|
||||
for message in messages:
|
||||
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:
|
||||
self.full_message_list.append(self.personality.ai_message_prefix+message["content"])
|
||||
else:
|
||||
@ -626,7 +627,7 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
self.full_message_list = []
|
||||
for message in messages:
|
||||
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:
|
||||
self.full_message_list.append(self.personality.ai_message_prefix+message["content"])
|
||||
else:
|
||||
@ -809,7 +810,7 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
self.current_ai_message_id = self.current_discussion.add_message(
|
||||
self.personality.name,
|
||||
"",
|
||||
message_type = DiscussionsDB.MSG_TYPE_NORMAL_AI,
|
||||
message_type = MSG_TYPE.MSG_TYPE_FULL.value,
|
||||
parent = self.current_user_message_id,
|
||||
binding = self.config["binding_name"],
|
||||
model = self.config["model_name"],
|
||||
|
@ -12,12 +12,6 @@ __license__ = "Apache 2.0"
|
||||
|
||||
# =================================== Database ==================================================================
|
||||
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"):
|
||||
self.db_path = Path(db_path)
|
||||
|
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">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-3107af8d.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-8af7331e.css">
|
||||
<script type="module" crossorigin src="/assets/index-72356ec7.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-ad2fc7e5.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -499,6 +499,7 @@ export default {
|
||||
this.mountedPersArr = mountedPersArr
|
||||
//this.mountedPersArr = mountedPersArr
|
||||
console.log('discussionPersonalities', this.discussionPersonalities)
|
||||
if (this.discussionPersonalities!=undefined){
|
||||
if (this.discussionPersonalities.length > 0) {
|
||||
for (let i = 0; i < this.discussionPersonalities.length; i++) {
|
||||
const per = this.discussionPersonalities[i]
|
||||
@ -524,6 +525,8 @@ export default {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.isLoading = false
|
||||
console.log('getMountedPersonalities', this.mountedPersArr)
|
||||
|
@ -240,23 +240,25 @@ export default {
|
||||
// Messaging
|
||||
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_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
|
||||
MSG_TYPE_EXCEPTION: 2, // An exception occured
|
||||
MSG_TYPE_WARNING: 3, // A warning occured
|
||||
MSG_TYPE_INFO: 4, // An information to be shown to user
|
||||
MSG_TYPE_EXCEPTION : 4, // An exception occured
|
||||
MSG_TYPE_WARNING : 5, // A warning occured
|
||||
MSG_TYPE_INFO : 6, // An information to be shown to user
|
||||
|
||||
// Steps
|
||||
MSG_TYPE_STEP: 5, // 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_PROGRESS: 7, // 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 : 7, // An instant step (a step that doesn't need time to be executed)
|
||||
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 : 9, // The progress value (the text contains a percentage and can be parsed by the reception)
|
||||
MSG_TYPE_STEP_END : 10,// A step has been done (the text contains an explanation of the step done by he personality)
|
||||
|
||||
//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_REF: 10, // References (in form of [text](path))
|
||||
MSG_TYPE_CODE: 11, // 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_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 : 12,// References (in form of [text](path))
|
||||
MSG_TYPE_CODE : 13,// A javascript code to execute
|
||||
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
|
||||
@ -760,7 +762,9 @@ export default {
|
||||
this.isGenerating = true;
|
||||
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
|
||||
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
|
||||
}
|
||||
else if (msgObj.message_type == this.msgTypes.MSG_TYPE_STEP_START){
|
||||
|
Loading…
Reference in New Issue
Block a user