mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-29 15:44:12 +00:00
added files to all personalities
This commit is contained in:
parent
e5c3779710
commit
3003ba80f8
@ -507,6 +507,7 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
path:Path = self.lollms_paths.personal_uploads_path / self.personality.personality_folder_name
|
path:Path = self.lollms_paths.personal_uploads_path / self.personality.personality_folder_name
|
||||||
path.mkdir(parents=True, exist_ok=True)
|
path.mkdir(parents=True, exist_ok=True)
|
||||||
file_path = path / data["filename"]
|
file_path = path / data["filename"]
|
||||||
|
File64BitsManager.b642file(data["fileData"],file_path)
|
||||||
if self.personality.processor:
|
if self.personality.processor:
|
||||||
self.personality.processor.add_file(file_path, partial(self.process_chunk, client_id=client_id))
|
self.personality.processor.add_file(file_path, partial(self.process_chunk, client_id=client_id))
|
||||||
else:
|
else:
|
||||||
@ -972,20 +973,16 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
composed_messages = self.model.detokenize(t[-nb_tk:])
|
composed_messages = self.model.detokenize(t[-nb_tk:])
|
||||||
ASCIIColors.warning(f"Cropping discussion to fit context [using {nb_tk} tokens/{self.config.ctx_size}]")
|
ASCIIColors.warning(f"Cropping discussion to fit context [using {nb_tk} tokens/{self.config.ctx_size}]")
|
||||||
discussion_messages = composed_messages
|
discussion_messages = composed_messages
|
||||||
tokens = self.model.tokenize(discussion_messages)
|
|
||||||
|
|
||||||
if self.config["debug"]:
|
|
||||||
ASCIIColors.yellow(discussion_messages)
|
|
||||||
ASCIIColors.info(f"prompt size:{len(tokens)} tokens")
|
|
||||||
|
|
||||||
|
|
||||||
if len(self.personality.files)>0 and self.personality.vectorizer:
|
if len(self.personality.files)>0 and self.personality.vectorizer:
|
||||||
pr = PromptReshaper("!@>Documentation:{{doc}}\n{{conditionning}}{{content}}")
|
pr = PromptReshaper("!@>Document chunks:\n{{doc}}\n{{conditionning}}\n{{content}}")
|
||||||
emb = self.personality.vectorizer.embed_query(message.content)
|
emb = self.personality.vectorizer.embed_query(message.content)
|
||||||
doc = self.personality.vectorizer.recover_text(emb, top_k=self.config.data_vectorization_nb_chunks)
|
docs, sorted_similarities = self.personality.vectorizer.recover_text(emb, top_k=self.config.data_vectorization_nb_chunks)
|
||||||
# TODO, fix
|
|
||||||
discussion_messages = pr.build({
|
discussion_messages = pr.build({
|
||||||
"doc":doc,
|
"doc":"\n".join(docs),
|
||||||
"conditionning":self.personality.personality_conditioning,
|
"conditionning":self.personality.personality_conditioning,
|
||||||
"content":discussion_messages
|
"content":discussion_messages
|
||||||
}, self.model.tokenize, self.model.detokenize, self.config.ctx_size, place_holders_to_sacrifice=["content"])
|
}, self.model.tokenize, self.model.detokenize, self.config.ctx_size, place_holders_to_sacrifice=["content"])
|
||||||
@ -996,6 +993,10 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
"content":discussion_messages
|
"content":discussion_messages
|
||||||
}, self.model.tokenize, self.model.detokenize, self.config.ctx_size, place_holders_to_sacrifice=["content"])
|
}, self.model.tokenize, self.model.detokenize, self.config.ctx_size, place_holders_to_sacrifice=["content"])
|
||||||
|
|
||||||
|
if self.config["debug"]:
|
||||||
|
tokens = self.model.tokenize(discussion_messages)
|
||||||
|
ASCIIColors.yellow(discussion_messages)
|
||||||
|
ASCIIColors.info(f"prompt size:{len(tokens)} tokens")
|
||||||
|
|
||||||
return discussion_messages, message.content, tokens
|
return discussion_messages, message.content, tokens
|
||||||
|
|
||||||
|
4
app.py
4
app.py
@ -1510,7 +1510,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
id = data['id']
|
id = data['id']
|
||||||
print(f"- Selecting active personality {id} ...",end="")
|
print(f"- Selecting active personality {id} ...",end="")
|
||||||
if id<len(self.config["personalities"]) and id<len(self.mounted_personalities):
|
if id<len(self.mounted_personalities):
|
||||||
self.config["active_personality_id"]=id
|
self.config["active_personality_id"]=id
|
||||||
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
|
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
|
||||||
self.apply_settings()
|
self.apply_settings()
|
||||||
@ -1522,7 +1522,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
"active_personality_id":self.config["active_personality_id"]
|
"active_personality_id":self.config["active_personality_id"]
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
ASCIIColors.error(f"nok : personality id out of bounds @ {id} >= {len(self.config['personalities'])}")
|
ASCIIColors.error(f"nok : personality id out of bounds @ {id} >= {len(self.mounted_personalities)}")
|
||||||
return jsonify({"status": False, "error":"Invalid ID"})
|
return jsonify({"status": False, "error":"Invalid ID"})
|
||||||
|
|
||||||
|
|
||||||
|
13
docs/youtube/lollms_lawyer
Normal file
13
docs/youtube/lollms_lawyer
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Disclaimer:
|
||||||
|
As any AI model, the models used on lollms are sometimes prone to errors
|
||||||
|
and bias. This is not a replacement for lawyers but just a tool that may help
|
||||||
|
you if you didn't understand some terms in a document or if you have
|
||||||
|
a big document and need to look for a specific part of it.
|
||||||
|
|
||||||
|
The quality of the answers will depend on the model you are using.
|
||||||
|
larger models tend to be better, but there is no garantee that the answer is correct.
|
||||||
|
|
||||||
|
|
||||||
|
Make sure you contact a legal professional for serious matters.
|
||||||
|
Thanks for watching
|
||||||
|
See ya
|
Loading…
x
Reference in New Issue
Block a user