upgraded tool with new functionalities

This commit is contained in:
saloui 2023-07-05 17:51:42 +02:00
parent 4604d4c08a
commit 80c837bbf9
6 changed files with 47 additions and 57 deletions

View File

@ -611,15 +611,7 @@ class LoLLMsAPPI(LollmsApplication):
link_text = self.personality.link_text
if not is_continue:
if self.personality.processor is not None:
preprocessed_prompt = self.personality.processor.process_model_input(message["content"])
else:
preprocessed_prompt = message["content"]
if preprocessed_prompt is not None:
self.full_message_list.append(self.personality.user_message_prefix+preprocessed_prompt+self.personality.link_text+self.personality.ai_message_prefix)
else:
self.full_message_list.append(self.personality.user_message_prefix+message["content"]+self.personality.link_text+self.personality.ai_message_prefix)
self.full_message_list.append(self.personality.user_message_prefix+message["content"]+self.personality.link_text+self.personality.ai_message_prefix)
else:
self.full_message_list.append(self.personality.ai_message_prefix+message["content"])
@ -748,23 +740,20 @@ class LoLLMsAPPI(LollmsApplication):
def generate(self, full_prompt, prompt, n_predict=50, callback=None):
if self.personality.processor is not None:
if self.personality.processor_cfg is not None:
if "custom_workflow" in self.personality.processor_cfg:
if self.personality.processor_cfg["custom_workflow"]:
ASCIIColors.success("Running workflow")
try:
output = self.personality.processor.run_workflow( prompt, full_prompt, self.process_chunk)
self.process_chunk(output, MSG_TYPE.MSG_TYPE_FULL)
except Exception as ex:
# Catch the exception and get the traceback as a list of strings
traceback_lines = traceback.format_exception(type(ex), ex, ex.__traceback__)
# Join the traceback lines into a single string
traceback_text = ''.join(traceback_lines)
ASCIIColors.error(f"Workflow run failed.\nError:{ex}")
ASCIIColors.error(traceback_text)
self.process_chunk(f"Workflow run failed\nError:{ex}", MSG_TYPE.MSG_TYPE_EXCEPTION)
print("Finished executing the workflow")
return
ASCIIColors.success("Running workflow")
try:
output = self.personality.processor.run_workflow( prompt, full_prompt, self.process_chunk)
self.process_chunk(output, MSG_TYPE.MSG_TYPE_FULL)
except Exception as ex:
# Catch the exception and get the traceback as a list of strings
traceback_lines = traceback.format_exception(type(ex), ex, ex.__traceback__)
# Join the traceback lines into a single string
traceback_text = ''.join(traceback_lines)
ASCIIColors.error(f"Workflow run failed.\nError:{ex}")
ASCIIColors.error(traceback_text)
self.process_chunk(f"Workflow run failed\nError:{ex}", MSG_TYPE.MSG_TYPE_EXCEPTION)
print("Finished executing the workflow")
return
self._generate(full_prompt, n_predict, callback)
print("Finished executing the generation")

1
app.py
View File

@ -127,7 +127,6 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.add_endpoint("/reinstall_binding", "reinstall_binding", self.reinstall_binding, methods=["POST"])
self.add_endpoint("/switch_personal_path", "switch_personal_path", self.switch_personal_path, methods=["POST"])
self.add_endpoint("/add_reference_to_local_model", "add_reference_to_local_model", self.add_reference_to_local_model, methods=["POST"])

File diff suppressed because one or more lines are too long

2
web/dist/index.html vendored
View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-cff54d0e.js"></script>
<script type="module" crossorigin src="/assets/index-60e3fd61.js"></script>
<link rel="stylesheet" href="/assets/index-8884f14a.css">
</head>
<body>

View File

@ -126,7 +126,6 @@ export default {
this.onShowPersList()
},
toggleMountUnmount() {
console.log('moununmoun pers list')
this.onMountUnmount(this)
},
async constructor() {

View File

@ -13,10 +13,6 @@
<h3 class="font-bold font-large text-lg line-clamp-3">
{{ personality.name }}
</h3>
</div>
<div class="flex items-center flex-row-reverse gap-2 my-1">
<!-- CONTROLS -->
@ -26,7 +22,12 @@
<span class="sr-only">Settings</span>
</button>
<button v-if="personality.installed" title="Click to Reinstall personality" type="button" @click.stop="toggleReinstall"
class="inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900">
Reinstall personality
<span class="sr-only">Reinstall personality</span>
</button>
<button v-if="!isMounted" title="Mount personality" type="button"
@click.stop="toggleMounted"
class="inline-flex items-center gap-2 px-3 py-2 text-xs 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">
@ -89,10 +90,9 @@ export default {
onSelected: Function,
selected: Boolean,
onMounted: Function,
onReinstall: Function,
full_path: String,
onSettings: Function
},
data() {
return {
@ -131,6 +131,9 @@ selected_computed(){
toggleSettings() {
this.onSettings(this)
},
toggleReinstall() {
this.onReinstall(this)
},
},
watch: {