This commit is contained in:
Saifeddine ALOUI 2023-08-30 14:04:59 +02:00
parent b7009357c8
commit 9c6db80a8d
3 changed files with 31 additions and 5 deletions

View File

@ -1223,10 +1223,10 @@ class LoLLMsAPPI(LollmsApplication):
if antiprompt:
ASCIIColors.warning(f"\nDetected hallucination with antiprompt: {antiprompt}")
self.connections[client_id]["generated_text"] = self.remove_text_from_string(self.connections[client_id]["generated_text"],antiprompt)
self.update_message(client_id, self.connections[client_id]["generated_text"], parameters, metadata,MSG_TYPE.MSG_TYPE_FULL)
self.update_message(client_id, self.connections[client_id]["generated_text"], parameters, metadata, None, MSG_TYPE.MSG_TYPE_FULL)
return False
else:
self.update_message(client_id, chunk, metadata)
self.update_message(client_id, chunk, parameters, metadata)
# if stop generation is detected then stop
if not self.cancel_gen:
return True
@ -1240,7 +1240,7 @@ class LoLLMsAPPI(LollmsApplication):
self.connections[client_id]["generated_text"] = chunk
self.nb_received_tokens += 1
ASCIIColors.green(f"Received {self.nb_received_tokens} tokens",end="\r",flush=True)
self.update_message(client_id, chunk, parameters, metadata, msg_type=message_type)
self.update_message(client_id, chunk, parameters, metadata, ui=None, msg_type=message_type)
return True
# Stream the generated text to the frontend
else:

12
app.py
View File

@ -907,6 +907,13 @@ class LoLLMsWebUI(LoLLMsAPPI):
"binding_models_percent_usage": None,
})
def find_extension(self, path:Path, filename:str, exts:list)->Path:
for ext in exts:
full_path = path/(filename+ext)
if full_path.exists():
return full_path
return None
def list_bindings(self):
bindings_dir = self.lollms_paths.bindings_zoo_path # replace with the actual path to the models folder
bindings=[]
@ -916,10 +923,11 @@ class LoLLMsWebUI(LoLLMsAPPI):
try:
bnd = load_config(card)
bnd["folder"]=f.stem
icon_path = Path(f"bindings/{f.name}/logo.png")
installed = (self.lollms_paths.personal_configuration_path/"bindings"/f.stem/f"config.yaml").exists()
bnd["installed"]=installed
if Path(self.lollms_paths.bindings_zoo_path/f"{f.name}/logo.png").exists():
icon_file = self.find_extension(self.lollms_paths.bindings_zoo_path/f"{f.name}", "logo", [".svg",".gif",".png"])
if icon_file is not None:
icon_path = Path(f"bindings/{f.name}/logo{icon_file.suffix}")
bnd["icon"]=str(icon_path)
bindings.append(bnd)

View File

@ -0,0 +1,18 @@
name: StableBulga2 Instruct
content: |
### System:
@<Put your system prompt here>@
### User:
@<Put your user prompt here>@
### Assistant:
@<generation_placeholder>@
help: |
This is the default StableBulga2 format for instructions.
There are two parameters:
- The first is the system prompt, that conditions the AI.
- The second is the prompt itself.
author: ParisNeo (adapted from the original StableBeluga2 documentation by Stability AI)