Spaces:
Runtime error
Runtime error
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> | |
# """) | |