added functionalities to personality

This commit is contained in:
Saifeddine ALOUI 2025-03-16 17:53:10 +01:00
parent ece4cadd3b
commit 6cf36b7a86

View File

@ -3084,6 +3084,114 @@ The updated memory must be put in a {chunk_processing_output_format} markdown ta
self.step_end(f" Summary of {doc_name} - Processing chunk : {i+1}/{len(chunks)}")
return "\n".join(summeries)
# ===========================================================
# Basic message element (already provided)
def build_message_element(self, element_text):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-red-500 text-white rounded-lg py-2 px-4 inline-block shadow-md">
{element_text}
</div>
</div>
"""
# Message with thinking animation (already updated)
def build_message_element_with_thinking_animation(self, element_text):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-red-500 text-white rounded-lg py-2 px-4 inline-block shadow-md flex items-center space-x-2">
<span>{element_text}</span>
<div class="flex space-x-1">
<div class="w-2 h-2 bg-white rounded-full animate-bounce" style="animation-delay: 0s;"></div>
<div class="w-2 h-2 bg-white rounded-full animate-bounce" style="animation-delay: 0.2s;"></div>
<div class="w-2 h-2 bg-white rounded-full animate-bounce" style="animation-delay: 0.4s;"></div>
</div>
</div>
</div>
"""
# Message with emoji (e.g., smiley for completion)
def build_message_element_with_emoji(self, element_text, emoji="😊"):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-red-500 text-white rounded-lg py-2 px-4 inline-block shadow-md flex items-center space-x-2">
<span>{element_text}</span>
<span class="text-xl">{emoji}</span>
</div>
</div>
"""
# Success message with checkmark
def build_success_message(self, element_text):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-green-500 text-white rounded-lg py-2 px-4 inline-block shadow-md flex items-center space-x-2">
<span class="text-xl"></span>
<span>{element_text}</span>
</div>
</div>
"""
# Warning message with alert icon
def build_warning_message(self, element_text):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-yellow-500 text-white rounded-lg py-2 px-4 inline-block shadow-md flex items-center space-x-2">
<span class="text-xl"></span>
<span>{element_text}</span>
</div>
</div>
"""
# Error message with cross
def build_error_message(self, element_text):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-red-600 text-white rounded-lg py-2 px-4 inline-block shadow-md flex items-center space-x-2">
<span class="text-xl"></span>
<span>{element_text}</span>
</div>
</div>
"""
# Progress message with spinning animation
def build_progress_message(self, element_text):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-blue-500 text-white rounded-lg py-2 px-4 inline-block shadow-md flex items-center space-x-2">
<span>{element_text}</span>
<div class="w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"></div>
</div>
</div>
"""
# Info message with light bulb
def build_info_message(self, element_text):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-blue-400 text-white rounded-lg py-2 px-4 inline-block shadow-md flex items-center space-x-2">
<span class="text-xl">💡</span>
<span>{element_text}</span>
</div>
</div>
"""
def build_progressbar_message(self, element_text, progress_percentage=50):
return f"""
<div class="max-w-md mx-auto my-2">
<div class="bg-blue-500 text-white rounded-lg py-2 px-4 shadow-md">
<div class="flex items-center space-x-2 mb-2">
<span>{element_text}</span>
</div>
<div class="w-full bg-blue-300 rounded-full h-2.5">
<div class="bg-white h-2.5 rounded-full transition-all duration-500 ease-in-out"
style="width: {progress_percentage}%"></div>
</div>
</div>
</div>
"""
class StateMachine:
def __init__(self, states_list):
"""