zotero-qa / models.py
lifan0127's picture
Minor clean-up
c64ef0e
raw
history blame
1.79 kB
from enum import Enum
class Icons(Enum):
def __str__(self):
return str(self.value)
DOC = "πŸ“„"
ERR = "❌"
INDEX = "πŸ—„οΈ"
INFO = "ℹ️"
OK = "πŸ‘Œ"
SUCCESS = "βœ…"
WAIT = "βŒ›"
WARN = "⚠️"
class Message():
def __init__(self, icon, content):
self.icon = icon
self.content = content
def __str__(self):
return f"{self.icon} {self.content}"
class Messages():
def __init__(self, messages=[]):
self.messages = messages
def __str__(self):
return f"""
<div class="messages" style="padding: 1rem; background-color: #fffbe7; font-size: 0.8rem;">
{("").join([f"<div>{x}</div>" for x in self.messages])}
</div>
"""
def append(self, new_message):
self.messages.append(new_message)
def set(self, messages):
self.messages = messages
# class Message():
# def standing_by(self):
# return "<div>πŸ‘Œ Standing by...</div>"
# def not_ready(self):
# return """
# <div style="padding: 1rem; background-color: #fffbe7; font-size: 0.8rem;">
# You have to select a Zotero collection to proceed.
# </div>
# """
# def openai_api_key(self):
# return """
# <div style="padding: 1rem; background-color: #fcd7da; font-size: 0.8rem;">
# OpenAI API key is either missing or incorrect.
# </div>
# """
# def use_queries(queries):
# query_str = ", ".join([f"<span style="font-weight: bold;">{q}</span>" for q in queries])
# return f"<div>Search your Zotero collection for {query_str}"
# def update_status(messages):
# return gr.HTML.update(f"""
# <div class="messages" style="padding: 1rem; background-color: #fffbe7; font-size: 0.8rem;">
# {("").join(messages)}
# </div>
# """)