File size: 1,788 Bytes
26ef710
 
c64ef0e
26ef710
c64ef0e
 
 
 
 
 
 
 
 
 
 
26ef710
 
c64ef0e
 
 
 
 
 
 
26ef710
 
c64ef0e
 
26ef710
c64ef0e
 
26ef710
 
 
 
 
c64ef0e
 
 
 
 
26ef710
 
 
 
 
c64ef0e
26ef710
 
 
 
 
 
c64ef0e
26ef710
 
 
 
 
 
c64ef0e
26ef710
 
 
 
 
 
 
 
 
 
c64ef0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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>
#   """)