leandroaraujodev commited on
Commit
2d1ddb2
·
1 Parent(s): 860dbdf

test Adaptação Chatbot - Sicoob UI

Browse files
Files changed (37) hide show
  1. .streamlit/config.toml +4 -1
  2. app.py +126 -42
  3. chatbot_server.py +2 -9
  4. files/config.yaml +38 -0
  5. files/credenciais.json +13 -0
  6. logos/ChangelogUser.md +31 -0
  7. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Black.woff2 +0 -0
  8. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-BlackItalic.woff2 +0 -0
  9. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Bold.woff2 +0 -0
  10. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-BoldItalic.woff2 +0 -0
  11. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Extrabold.woff2 +0 -0
  12. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-ExtraboldItalic.woff2 +0 -0
  13. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Extralight.woff2 +0 -0
  14. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-ExtralightItalic.woff2 +0 -0
  15. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Italic.woff2 +0 -0
  16. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Light.woff2 +0 -0
  17. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-LightItalic.woff2 +0 -0
  18. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Medium.woff2 +0 -0
  19. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-MediumItalic.woff2 +0 -0
  20. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Regular.woff2 +0 -0
  21. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Semibold.woff2 +0 -0
  22. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-SemiboldItalic.woff2 +0 -0
  23. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Thin.woff2 +0 -0
  24. logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-ThinItalic.woff2 +0 -0
  25. logos/logo-sicoob.jpg +0 -0
  26. logos/sicoob-ico.ico +0 -0
  27. logos/sicoob-logo-horizontal-dark.png +0 -0
  28. logos/sicoob-logo-horizontal-light.png +0 -0
  29. logos/sicoob-logo-vertical-lg.png +0 -0
  30. logos/sicoob-logo-vertical-md.png +0 -0
  31. logos/sicoob-logo-vertical-sm.png +0 -0
  32. logos/styles/base.css +56 -0
  33. logos/styles/dark.css +131 -0
  34. logos/styles/light.css +178 -0
  35. pngegg.png +0 -0
  36. requirements.txt +2 -1
  37. sicoob-logo.png +0 -0
.streamlit/config.toml CHANGED
@@ -1,3 +1,6 @@
1
  [theme]
 
 
 
 
2
 
3
- base = 'light'
 
1
  [theme]
2
+ font = "sans serif"
3
+
4
+ [client]
5
+ toolbarMode = "developer"
6
 
 
app.py CHANGED
@@ -2,20 +2,83 @@ import streamlit as st
2
  import requests
3
  from PIL import Image
4
  import base64
5
-
6
- import streamlit as st
7
  import streamlit_authenticator as stauth
8
-
 
9
  import yaml
10
  from yaml.loader import SafeLoader
11
-
 
 
 
12
 
13
  class ChatbotApp:
14
  def __init__(self):
15
- # URL do backend (Flask)
 
 
16
  self.backend_url = "http://localhost:5001/chat"
17
- self.title = "Chatbot Carômetro"
 
18
  self.description = "Este assistente virtual pode te ajudar com informações sobre carômetros da Sicoob."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  def stream_chat(self, user_input):
21
  """
@@ -36,36 +99,41 @@ class ChatbotApp:
36
  except Exception as e:
37
  yield f"Erro ao conectar ao servidor: {e}"
38
 
 
 
 
 
39
  def render_sidebar(self):
40
- """
41
- Exibe opções na barra lateral e renderiza a logo do Sicoob.
42
- """
43
- st.sidebar.title("Configuração de LLM")
44
- sidebar_option = st.sidebar.radio("Selecione o LLM", ["gpt-3.5-turbo"])
45
- if sidebar_option != "gpt-3.5-turbo":
46
- raise Exception("Opção de LLM inválida!")
47
-
48
- # Exibe a logo do Sicoob na barra lateral
49
- with open("sicoob-logo.png", "rb") as f:
50
- data = base64.b64encode(f.read()).decode("utf-8")
51
- st.sidebar.markdown(
52
- f"""
53
- <div style="display:table;margin-top:-80%;margin-left:0%;">
54
- <img src="data:image/png;base64,{data}" width="250" height="70">
55
- </div>
56
- """,
57
- unsafe_allow_html=True,
58
- )
59
-
 
60
  def render(self):
 
61
  """
62
  Renderiza a interface do chatbot.
63
- """
64
- # Configura título, ícone e layout da página
65
- im = Image.open("pngegg.png")
66
- st.set_page_config(page_title="Chatbot Carômetro", page_icon=im, layout="wide")
67
 
68
- with open('./config.yaml') as file:
 
 
69
  config = yaml.load(file, Loader=SafeLoader)
70
 
71
  # Pre-hashing all plain text passwords once
@@ -82,7 +150,10 @@ class ChatbotApp:
82
  # authenticator.login()
83
  #except Exception as e:
84
  # st.error(e)
85
-
 
 
 
86
  with open('./config.yaml', 'w', encoding='utf-8') as file:
87
  yaml.dump(config, file, default_flow_style=False)
88
 
@@ -90,8 +161,7 @@ class ChatbotApp:
90
  authentication_status = authenticator.login()
91
 
92
  if st.session_state["authentication_status"]:
93
- authenticator.logout('Logout', 'main')
94
-
95
  # Renderiza a barra lateral
96
  self.render_sidebar()
97
 
@@ -99,6 +169,9 @@ class ChatbotApp:
99
  st.title(self.title)
100
  st.write(self.description)
101
 
 
 
 
102
  # Inicializa o histórico na sessão
103
  if "chat_history" not in st.session_state:
104
  st.session_state.chat_history = []
@@ -107,7 +180,7 @@ class ChatbotApp:
107
  for message in st.session_state.chat_history:
108
  role, text = message.split(":", 1)
109
  with st.chat_message(role.strip().lower()):
110
- st.write(text.strip())
111
 
112
  # Captura o input do usuário
113
  user_input = st.chat_input("Digite sua pergunta")
@@ -124,16 +197,27 @@ class ChatbotApp:
124
 
125
  # Executa o streaming de tokens enquanto o backend responde
126
  for token in self.stream_chat(user_input):
127
- assistant_message += token
128
- message_placeholder.markdown(assistant_message + "▌")
129
-
130
- # Atualiza o placeholder com a mensagem final
131
- message_placeholder.markdown(assistant_message)
132
- st.session_state.chat_history.append(f"assistant: {assistant_message}")
 
 
 
 
 
 
 
 
 
 
 
133
  elif st.session_state["authentication_status"] == False:
134
  st.error('Username/password is incorrect')
135
  elif st.session_state["authentication_status"] == None:
136
- st.warning('Please enter your username and password')
137
 
138
  if __name__ == "__main__":
139
  chatbot_app = ChatbotApp()
 
2
  import requests
3
  from PIL import Image
4
  import base64
5
+ import re
 
6
  import streamlit_authenticator as stauth
7
+ from streamlit_feedback import streamlit_feedback
8
+ import os
9
  import yaml
10
  from yaml.loader import SafeLoader
11
+ from pathlib import Path
12
+ from drive_search import search_file_in_drive
13
+ from datetime import datetime
14
+ import json
15
 
16
  class ChatbotApp:
17
  def __init__(self):
18
+ # Configura título, ícone e layout da página
19
+ st.set_page_config(page_title="Sicoob Chatbot 🤖", page_icon="logos/sicoob-ico.ico", layout="wide")
20
+
21
  self.backend_url = "http://localhost:5001/chat"
22
+ self.title = "Sicoob Chatbot"
23
+ self.feedback_dir = os.path.join(os.getcwd(), "./feedback")
24
  self.description = "Este assistente virtual pode te ajudar com informações sobre carômetros da Sicoob."
25
+
26
+ self.style_dir = Path("./logos/styles")
27
+ self.load_styles()
28
+ st.session_state.first = False
29
+
30
+ if "theme" not in st.session_state:
31
+ st.session_state.theme = "light"
32
+
33
+ self.configyml = os.path.join(os.getcwd(), "./files/config.yaml")
34
+
35
+ def load_styles(self):
36
+ try:
37
+ self.base_style = (self.style_dir / "base.css").read_text()
38
+ self.light_style = (self.style_dir / "light.css").read_text()
39
+ self.dark_style = (self.style_dir / "dark.css").read_text()
40
+ except FileNotFoundError as e:
41
+ st.error(f"Error loading styles: {e}")
42
+ self.base_style = ""
43
+ self.light_style = ""
44
+ self.dark_style = ""
45
+
46
+ @st.dialog("📄 Atualizações Sicoob Chatbot", width="small")
47
+ def changelog_user(self):
48
+ with open("./logos/ChangelogUser.md", encoding="utf-8") as f:
49
+ st.markdown(f"{f.read()}", unsafe_allow_html=True)
50
+
51
+ def get_current_style(self):
52
+ theme_style = self.dark_style if st.session_state.theme == "dark" else self.light_style
53
+ return f"<style>{self.base_style}{theme_style}</style>"
54
+
55
+
56
+ def save_feedback(feedback_type, user_input, assistant_response):
57
+ feedback_dir = os.path.join(os.getcwd(), "feedback")
58
+
59
+ if not os.path.exists(feedback_dir):
60
+ os.makedirs(feedback_dir)
61
+
62
+ filename = os.path.join(feedback_dir, f"feedback_{feedback_type}.json")
63
+
64
+ try:
65
+ data = []
66
+ if os.path.exists(filename):
67
+ with open(filename, 'r', encoding='utf-8') as f:
68
+ data = json.load(f)
69
+
70
+ data.append({
71
+ "user_input": user_input,
72
+ "assistant_response": assistant_response,
73
+ "timestamp": datetime.now().isoformat()
74
+ })
75
+
76
+ with open(filename, 'w', encoding='utf-8') as f:
77
+ json.dump(data, f, ensure_ascii=False, indent=2)
78
+
79
+ st.toast(f"Feedback {feedback_type} salvo com sucesso!", icon="✅")
80
+ except Exception as e:
81
+ st.toast(f"Erro ao salvar feedback: {str(e)}", icon="❌")
82
 
83
  def stream_chat(self, user_input):
84
  """
 
99
  except Exception as e:
100
  yield f"Erro ao conectar ao servidor: {e}"
101
 
102
+ def clear_chat_history(self):
103
+ st.session_state.chat_history = []
104
+ st.toast("Histórico limpo com sucesso!", icon="✅")
105
+
106
  def render_sidebar(self):
107
+ """Siderbar"""
108
+ with st.sidebar:
109
+ if st.button("Light/Dark Mode"):
110
+ st.session_state.theme = "dark" if st.session_state.theme == "light" else "light"
111
+ st.rerun()
112
+ if st.session_state.theme == "light":
113
+ st.logo("./logos/sicoob-logo-horizontal-light.png", icon_image="./logos/sicoob-logo-vertical-sm.png")
114
+ else:
115
+ st.logo("./logos/sicoob-logo-horizontal-dark.png", icon_image="./logos/sicoob-logo-vertical-sm.png")
116
+
117
+ if st.button("Limpar Histórico", icon=":material/delete:"):
118
+ self.clear_chat_history()
119
+
120
+ if st.button("Atualizações", icon=":material/info:"):
121
+ self.changelog_user()
122
+ st.divider()
123
+ # st.title("Configuração de LLM")
124
+ # sidebar_option = st.radio("Selecione o LLM", ["gpt-3.5-turbo"])
125
+ # if sidebar_option != "gpt-3.5-turbo":
126
+ # raise Exception("Opção de LLM inválida!")
127
+
128
  def render(self):
129
+
130
  """
131
  Renderiza a interface do chatbot.
132
+ """
 
 
 
133
 
134
+ st.markdown(self.get_current_style(), unsafe_allow_html=True)
135
+
136
+ with open(self.configyml) as file:
137
  config = yaml.load(file, Loader=SafeLoader)
138
 
139
  # Pre-hashing all plain text passwords once
 
150
  # authenticator.login()
151
  #except Exception as e:
152
  # st.error(e)
153
+ def add_link_to_text(text):
154
+ return re.sub(r'\|\|(.*?)\|\|', lambda match: f' <br>Fonte: <a href="{search_file_in_drive(match.group(1))}" target="_blank">{match.group(1)}</a>', text)
155
+
156
+
157
  with open('./config.yaml', 'w', encoding='utf-8') as file:
158
  yaml.dump(config, file, default_flow_style=False)
159
 
 
161
  authentication_status = authenticator.login()
162
 
163
  if st.session_state["authentication_status"]:
164
+
 
165
  # Renderiza a barra lateral
166
  self.render_sidebar()
167
 
 
169
  st.title(self.title)
170
  st.write(self.description)
171
 
172
+ with st.sidebar:
173
+ authenticator.logout('Sair', 'main')
174
+
175
  # Inicializa o histórico na sessão
176
  if "chat_history" not in st.session_state:
177
  st.session_state.chat_history = []
 
180
  for message in st.session_state.chat_history:
181
  role, text = message.split(":", 1)
182
  with st.chat_message(role.strip().lower()):
183
+ st.markdown(text.strip(), unsafe_allow_html=True)
184
 
185
  # Captura o input do usuário
186
  user_input = st.chat_input("Digite sua pergunta")
 
197
 
198
  # Executa o streaming de tokens enquanto o backend responde
199
  for token in self.stream_chat(user_input):
200
+ assistant_message += token
201
+ assistant_message_with_link = add_link_to_text(assistant_message)
202
+ message_placeholder.markdown(assistant_message_with_link + "▌", unsafe_allow_html=True)
203
+
204
+ message_placeholder.markdown(assistant_message_with_link, unsafe_allow_html=True)
205
+
206
+ #Adicionando histórico Streamlit
207
+ st.session_state.chat_history.append(f"assistant: {assistant_message_with_link}")
208
+
209
+ #Feedback
210
+ with st.container(border=True):
211
+ if st.button("Gostei", icon=":material/thumb_up:"):
212
+ save_feedback("positive", "Exemplo de pergunta do usuário", "Exemplo de resposta do assistente")
213
+
214
+ if st.button("Não Gostei", icon=":material/thumb_down:"):
215
+ save_feedback("negative", "Exemplo de pergunta do usuário", "Exemplo de resposta do assistente")
216
+
217
  elif st.session_state["authentication_status"] == False:
218
  st.error('Username/password is incorrect')
219
  elif st.session_state["authentication_status"] == None:
220
+ st.warning('Por favor entre com seu "username" e senha.')
221
 
222
  if __name__ == "__main__":
223
  chatbot_app = ChatbotApp()
chatbot_server.py CHANGED
@@ -58,17 +58,10 @@ import chromadb
58
  db = chromadb.PersistentClient(path="chroma_db")
59
  chroma_collection = db.get_or_create_collection("dense_vectors")
60
  vector_store = ChromaVectorStore(chroma_collection=chroma_collection)
61
-
62
  storage_context = StorageContext.from_defaults(
63
  docstore=docstore, vector_store=vector_store
64
  )
65
-
66
- if db.list_collections():
67
- index = VectorStoreIndex.from_vector_store(vector_store=vector_store, storage_context=storage_context, show_progress = True)
68
- bm25_retriever_docstore = docstore
69
- else:
70
- index = VectorStoreIndex(nodes = nodes, storage_context=storage_context, show_progress = True)
71
- bm25_retriever_docstore = index.docstore
72
 
73
  storage_context.docstore.persist("./docstore.json")
74
 
@@ -77,7 +70,7 @@ import nest_asyncio
77
  nest_asyncio.apply()
78
  from llama_index.retrievers.bm25 import BM25Retriever
79
  bm25_retriever = BM25Retriever.from_defaults(
80
- docstore=bm25_retriever_docstore,
81
  similarity_top_k=2,
82
  language = "portuguese",
83
  verbose=True,
 
58
  db = chromadb.PersistentClient(path="chroma_db")
59
  chroma_collection = db.get_or_create_collection("dense_vectors")
60
  vector_store = ChromaVectorStore(chroma_collection=chroma_collection)
 
61
  storage_context = StorageContext.from_defaults(
62
  docstore=docstore, vector_store=vector_store
63
  )
64
+ index = VectorStoreIndex(nodes = nodes, storage_context=storage_context, show_progress = True)
 
 
 
 
 
 
65
 
66
  storage_context.docstore.persist("./docstore.json")
67
 
 
70
  nest_asyncio.apply()
71
  from llama_index.retrievers.bm25 import BM25Retriever
72
  bm25_retriever = BM25Retriever.from_defaults(
73
+ docstore=index.docstore,
74
  similarity_top_k=2,
75
  language = "portuguese",
76
  verbose=True,
files/config.yaml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cookie:
2
+ expiry_days: 30
3
+ key: some_signature_key
4
+ name: some_cookie_name
5
+ credentials:
6
+ usernames:
7
+ akcit_root:
8
9
+ failed_login_attempts: 0
10
+ first_name: akcit
11
+ last_name: root
12
+ logged_in: false
13
+ password: $2b$12$wd1lg1DTs4qEDRmohdptDegeSJhGstxqgCaTitfRQ0IGN.rnr51aG
14
+ roles:
15
+ - admin
16
+ - editor
17
+ - viewer
18
+ sicoob_central:
19
20
+ failed_login_attempts: 0
21
+ first_name: sicoob
22
+ last_name: central
23
+ logged_in: false
24
+ password: $2b$12$Y5tHfGABzVP9dm510HuHHuUbeZvNqUibUgj4TYH40rglhZGLPZ8rK
25
+ roles:
26
+ - viewer
27
+ sicoob_unidade:
28
29
+ failed_login_attempts: 0
30
+ first_name: sicoob
31
+ last_name: unidade
32
+ logged_in: false
33
+ password: $2b$12$h8U7XrVfACkHJaqGqcwR0OzDO.YorKF21lHpG/9MVa4K/98AbXtG.
34
+ roles:
35
+ - viewer
36
+ pre-authorized:
37
+ emails:
38
files/credenciais.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "type": "service_account",
3
+ "project_id": "light-processor-374314",
4
+ "private_key_id": "a207b3d84c4dfdf97eef75f442a78b79a9af7e4a",
5
+ "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCcU0q1HO5hdzVK\nGcVGnOaZ/Eedjqr+g70yrOylrE1Ke794vXAOFynbq2OifjwjuTJQD0ZSP2KGQC7x\np1jHolEgP7GHsusnCZeb6lPyQCvkk8M6EzxdiSY5cOm4xJAzEENZ0aFB5qMdtR/t\ndjO4YwK8eHGUXAWeL7OezC7xzLpbkFnOJYo44CQVgbIWoROQY/7MNqcw67/z/HS9\nETKyB9+lgv+w1f+1HG9XBvHKjoI79fa4njmJBGu66DN0afp9lYrdqbX24j3fieaB\nyhJOq6w0U16t/nvfLhzxixAVafMQSvuENh6DjXfQ5wCy+U2osALH5zEOqkOmNWo1\neWMPQiwVAgMBAAECggEAENdmWonB4s05eAC7wKZBr8A+pOpMYLwno3B+1EByWT5o\nu+TI0DPNpiVaSBTKfNzEX1yt6kl631TF2fH5/hPuIofKJADyFZQSedEudxBTyj3j\nD/wnijou3IxeGbJPiLjNUL1lXpiu5RHw3R/ZZZmBH3XoYp/hWQ/xjX+Y5SL1xsxk\nuslv+xGmFjAWCzCSFMIosyRl8evElFyuWeEU9IGM8h9JKs/aLTkdkN+X7o77L9pi\ndhQj5RemmKtzm7MStwVFGT2zdkMk3LCnXYi+VbuIi+wHJuZbxn+xP7nhnsu4vLcQ\nNzZKouk/7dK2px2zkaclnu8kNTQy3ONAfFrYZb3BQQKBgQDUICD7aIaA/cBlI5Ph\nifrtsyRKdWMhU2Sobe7qtX2s+azgcX7o57wxIo/dnG/2IG1rFBFbUO6Qv8UcfS9B\n9KNIdfV1+YnudOYn7TaFAhQfudWF9HrTsWZaIHpHS5yyzcpHoXvehKcU6MXy4vMj\nirY4dbx8daeiaBbkJHMtOKJZdQKBgQC8qJdWwjkSW0eJoqnNYP4SHtCo056S6Ufp\n8qkBBrpnnq85jJGzXJ71fWR3pgvGXLRjYSk2t3Csy3S7lwe6G9iszdBloHdTEQb7\nEfPpmE23m+s3YQIL0jY2UdTRrudtmk8RYpwEKZ22fz9d1x4pIBIlU2Pcc26j4uhu\nZ3zbC4mUIQKBgQDEb+RbLRaxyUsr3eCKUg6vpN+MnFxqdiGW4AcKD3wMfUIcrr3J\nzR+3mLwFi2MbWDg7mt/f4niqTwyoLz1eJMA40BO5ZpbW3iZs/v0n+x7LqnoTjK1Z\n8MRJ3h2efGTmKDCUWPSuwcVAVbdKD+T9Gu1YJ5+e2g2dFitsplyKmhGuKQKBgQCx\nPSpBBeMcTckdk0Y3fwHzACREF9wIZUV8ks8X+bwyETDJvjg7664jMBStG8BAMWP/\nYY6YqyoeDF60xiUqQXMEla9Nar3vujV2tt0R/lY1QzRuKKMFfA4WZjasb8dYfvn9\neUjd2EMk6tMbVDgvpsOlcXyF5aRyL4DyCCOSnno4QQKBgQC92jVM7MkDSzlMT6zt\nJ2HQAvKR/uzxz0GQJrqx8YPUsmGUDJDcMXbjVNCSw2UfJkdlZIfZQrbpQJACewqA\nWLfWbsGvoyZk5AnkVVQqcIrRVdk85cL5EG32VSQIyAlH+m5f4DwcEHdVUFysS6BB\nYglZoVNfDeElMat1FZR9dhXo9w==\n-----END PRIVATE KEY-----\n",
6
+ "client_email": "[email protected]",
7
+ "client_id": "115319015910729374958",
8
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
9
+ "token_uri": "https://oauth2.googleapis.com/token",
10
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11
+ "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/mydriveapi%40light-processor-374314.iam.gserviceaccount.com",
12
+ "universe_domain": "googleapis.com"
13
+ }
logos/ChangelogUser.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog - Versão 0.4.0
2
+
3
+ ## Novos Recursos
4
+
5
+ - **Suporte a múltiplos manuais**: O chatbot agora pode acessar e fornecer informações de diversos manuais.
6
+ - Manuais disponíveis nesta versão:
7
+ - Manual de Normatização
8
+ - Manual de Riscos Sociais, Ambientais e Climáticos
9
+ - Manual de Supervisão Auxiliar
10
+ - Manual de Controles Internos e Conformidade
11
+ - Manual de Crédito
12
+ - Manual de Boas Práticas Legais e Tributárias nas Campanhas e Promoções
13
+ - Manual de Gerenciamento do Risco de Mercado e do IRRBB
14
+ - Manual de Seguro Vida Prestamista
15
+ - Manual do Produto Pix
16
+ - Manual de Câmbio - Operações de Crédito
17
+ - ...
18
+
19
+ ## Melhorias
20
+
21
+ - **Qualidade de resposta aprimorada**: Refinamento nos modelos de resposta para oferecer informações mais precisas e relevantes.
22
+ - **Otimização de consultas**: Melhorias no tempo de resposta ao buscar informações em documentos.
23
+
24
+ ## Alterações e Remoções
25
+
26
+ - **Remoção temporária de respostas sobre o organograma**: Devido a ajustes internos, informações sobre a estrutura organizacional foram temporariamente desativadas. Previsto para retorno na versão 0.5.0.
27
+
28
+ ## Próximos Passos
29
+
30
+ - **Expansão do suporte a mais manuais e documentos internos.**
31
+ - **Reintegração das informações sobre o organograma na versão 0.5.0.**
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Black.woff2 ADDED
Binary file (31.2 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-BlackItalic.woff2 ADDED
Binary file (31.4 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Bold.woff2 ADDED
Binary file (31.8 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-BoldItalic.woff2 ADDED
Binary file (32.3 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Extrabold.woff2 ADDED
Binary file (31.9 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-ExtraboldItalic.woff2 ADDED
Binary file (32.5 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Extralight.woff2 ADDED
Binary file (31.5 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-ExtralightItalic.woff2 ADDED
Binary file (31.7 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Italic.woff2 ADDED
Binary file (31.6 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Light.woff2 ADDED
Binary file (31.6 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-LightItalic.woff2 ADDED
Binary file (31.9 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Medium.woff2 ADDED
Binary file (31.4 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-MediumItalic.woff2 ADDED
Binary file (31.9 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Regular.woff2 ADDED
Binary file (31.2 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Semibold.woff2 ADDED
Binary file (31.8 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-SemiboldItalic.woff2 ADDED
Binary file (32.2 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Thin.woff2 ADDED
Binary file (29.6 kB). View file
 
logos/fonts/Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-ThinItalic.woff2 ADDED
Binary file (30.2 kB). View file
 
logos/logo-sicoob.jpg DELETED
Binary file (3.45 kB)
 
logos/sicoob-ico.ico ADDED
logos/sicoob-logo-horizontal-dark.png ADDED
logos/sicoob-logo-horizontal-light.png ADDED
logos/sicoob-logo-vertical-lg.png ADDED
logos/sicoob-logo-vertical-md.png ADDED
logos/sicoob-logo-vertical-sm.png ADDED
logos/styles/base.css ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: "sicoob-sans-regular";
3
+ src: url("../Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Regular.woff2");
4
+ font-weight: 400;
5
+ font-style: normal;
6
+ }
7
+ @font-face {
8
+ font-family: "sicoob-sans-medium";
9
+ src: url("../Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Medium.woff2");
10
+ font-weight: 500;
11
+ font-style: normal;
12
+ }
13
+ @font-face {
14
+ font-family: "sicoob-sans-bold";
15
+ src: url("../Sicoob_Sans/Sicoob Sans/Webfonts/WOFF2/SicoobSansRC3-Bold.woff2");
16
+ font-weight: 700;
17
+ font-style: normal;
18
+ }
19
+
20
+ body * {
21
+ font-family: "sicoob-sans-medium", "Source Sans Pro", sans-serif !important;
22
+ font-weight: 500;
23
+ transition: all 0.1s ease-in-out;
24
+ }
25
+
26
+ .st-emotion-cache-kgpedg img {
27
+ height: 100% !important;
28
+ }
29
+
30
+ .stMarkdown h1 {
31
+ font-family: "sicoob-sans-bold", "Source Sans Pro", sans-serif !important;
32
+ font-weight: 700;
33
+ }
34
+
35
+ a {
36
+ font-family: "sicoob-sans-bold", "Source Sans Pro", sans-serif !important;
37
+ font-weight: 700;
38
+ }
39
+
40
+ .stDecoration {
41
+ display: none;
42
+ }
43
+
44
+ [data-testid="stIconMaterial"] {
45
+ font-family: "Material Symbols Rounded" !important;
46
+ font-weight: 400;
47
+ font-style: normal;
48
+ }
49
+
50
+ .MuiStack-root {
51
+ background-color: transparent;
52
+ }
53
+
54
+ .stButton button {
55
+ margin-right: 5px;
56
+ }
logos/styles/dark.css ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .stMain, .stAppHeader, .st-emotion-cache-hzygls {
2
+ background-color: #003641;
3
+ }
4
+
5
+ .stAppHeader, .st-emotion-cache-hzygls, .stBottomBlockContainer {
6
+ background-color: #002025;
7
+ }
8
+
9
+ .stSidebar {
10
+ background-color: #002530;
11
+ border-color: #7DB61C;
12
+ color: #FAFAFA
13
+ }
14
+
15
+ [data-testid="stChatInputSubmitButton"] > svg {
16
+ fill: #7DB61C;
17
+ }
18
+
19
+ [data-testid="stChatInputSubmitButton"]:hover {
20
+ background-color: #49479D;
21
+ border-radius: 10px;
22
+ }
23
+
24
+ .stButton > button {
25
+ background-color: #7DB61C;
26
+ color: #FAFAFA;
27
+ }
28
+ .stButton > button:hover {
29
+ background-color: #7DB61C;
30
+ border-color: #49479D;
31
+ color: #FAFAFA;
32
+ }
33
+
34
+ .stButton > button:active , .stButton > button:focus, .stButton > button:focus-visible, .stButton > button:focus:not(:active) {
35
+ background-color: #49479D;
36
+ border-color: #7DB61C;
37
+ color: #FAFAFA;
38
+ }
39
+
40
+ .stChatInput {
41
+ border: none;
42
+ background-color: transparent;
43
+ }
44
+
45
+ [data-testid="stChatInput"] > div > div {
46
+ border: none;
47
+ }
48
+
49
+ [data-testid="stChatInput"] > div > div > div > textarea {
50
+ background-color: #002530;
51
+ border-radius: 10px;
52
+ border: 1px solid #7DB61C;
53
+ }
54
+
55
+ [data-testid="stChatInput"] > div > div > div > textarea:focus {
56
+ border-bottom-color: #49479D !important;
57
+ border-top-color: #49479D !important;
58
+ border-right-color: #49479D !important;
59
+ border-left-color: #49479D !important;
60
+ }
61
+
62
+ a {
63
+ color: #C9D200 !important;
64
+ }
65
+
66
+ a:hover {
67
+ color: #7DB61C !important;
68
+ }
69
+
70
+ [data-testid="stChatMessageAvatarUser"] {
71
+ fill: #7DB61C !important;
72
+ background-color: #7DB61C !important;
73
+ width: 35px;
74
+ height: 35px;
75
+ border-radius: 50%;
76
+ padding: 5px;
77
+ }
78
+
79
+ [data-testid="stChatMessageAvatarUser"] > svg {
80
+ color: #49479D
81
+ }
82
+
83
+ [data-testid="stChatMessageAvatarAssistant"] {
84
+ fill: #C9D200 !important;
85
+ background-color: #C9D200 !important;
86
+ width: 35px;
87
+ height: 35px;
88
+ border-radius: 50%;
89
+ padding: 5px;
90
+ }
91
+
92
+ [data-testid="stChatMessageAvatarAssistant"] > svg {
93
+ color: #49479D
94
+ }
95
+
96
+ .st-key-Logout > div > button {
97
+ background-color: transparent !important;
98
+ border: none;
99
+ color: #7DB61C;
100
+ }
101
+
102
+ hr {
103
+ background-color: #FAFAFA;
104
+ }
105
+
106
+ [data-testid="stDialog"] > div > div > div > div {
107
+ max-height: 550px !important;
108
+ overflow: scroll;
109
+ color: #002025 !important;
110
+ }
111
+
112
+ [data-testid="stDialog"] > div > div > div {
113
+ background-color: #00AE9D;
114
+ border-top-left-radius: 0px;
115
+ border-top-right-radius: 0px;
116
+ border-bottom-left-radius: 10px;
117
+ border-bottom-right-radius: 10px;
118
+ }
119
+
120
+
121
+ [data-testid="stDialog"] > div > div > div > .stMarkdown {
122
+ color: #002530 !important;
123
+ }
124
+
125
+ [data-testid="stDialog"] > div > div > div:first-child {
126
+ background-color: #002530;
127
+ border-top-left-radius: 10px;
128
+ border-top-right-radius: 10px;
129
+ border-bottom-left-radius: 0;
130
+ border-bottom-right-radius: 0;
131
+ }
logos/styles/light.css ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .stMain, .stAppHeader, .st-emotion-cache-hzygls {
2
+ background-color: #FAFAFA;
3
+ }
4
+
5
+ .stAppHeader, .st-emotion-cache-hzygls, .stBottomBlockContainer {
6
+ background-color: #00AE9D ;
7
+ }
8
+
9
+ .stSidebar {
10
+ background-color: #ebebeb;
11
+ border-color: #7DB61C;
12
+ color: #FAFAFA
13
+ }
14
+
15
+ .stHeading {
16
+ color: #003641;
17
+ }
18
+
19
+ [data-testid="stChatInputSubmitButton"] > svg {
20
+ fill: #C9D200;
21
+ }
22
+
23
+ [data-testid="stChatInputSubmitButton"]:hover {
24
+ background-color: #49479D;
25
+ border-radius: 10px;
26
+ }
27
+
28
+ .stButton > button {
29
+ background-color: #003641;
30
+ color: #FAFAFA;
31
+ }
32
+
33
+ .stButton > button:hover {
34
+ background-color: #003641;
35
+ border-color: #7DB61C;
36
+ color: #C9D200;
37
+ }
38
+
39
+ .stButton > button:active , .stButton > button:focus, .stButton > button:focus-visible, .stButton > button:focus:not(:active) {
40
+ background-color: #7DB61C;
41
+ border-color: #003641;
42
+ color: #FAFAFA;
43
+ }
44
+
45
+ .stChatInput {
46
+ border: none;
47
+ background-color: transparent;
48
+ }
49
+
50
+ [data-testid="stChatInput"] > div > div {
51
+ border: none;
52
+ }
53
+
54
+ [data-testid="stChatInput"] > div > div > div > textarea {
55
+ background-color: #003641;
56
+ border-radius: 10px;
57
+ border: 1px solid #C9D200;
58
+ color: #FAFAFA;
59
+ }
60
+
61
+ [data-testid="stChatInput"] > div > div > div > textarea:focus {
62
+ border-bottom-color: #49479D !important;
63
+ border-top-color: #49479D !important;
64
+ border-right-color: #49479D !important;
65
+ border-left-color: #49479D !important;
66
+ }
67
+
68
+ a {
69
+ color: #49479D !important;
70
+ }
71
+
72
+ a:hover {
73
+ color: #7DB61C !important;
74
+ }
75
+
76
+ .stMarkdown h1 {
77
+ color: #003641
78
+ }
79
+
80
+ body, .stMarkdown, .stText, .stTitle, .stHeader, .stSubheader {
81
+ color: #003641
82
+ }
83
+
84
+ [data-testid="stChatMessageAvatarUser"] {
85
+ fill: #7DB61C !important;
86
+ background-color: #7DB61C !important;
87
+ width: 35px;
88
+ height: 35px;
89
+ border-radius: 50%;
90
+ padding: 5px;
91
+ }
92
+
93
+ [data-testid="stChatMessageAvatarUser"] > svg {
94
+ color: #49479D
95
+ }
96
+
97
+ [data-testid="stChatMessageAvatarAssistant"] {
98
+ fill: #C9D200 !important;
99
+ background-color: #C9D200 !important;
100
+ width: 35px;
101
+ height: 35px;
102
+ border-radius: 50%;
103
+ padding: 5px;
104
+ }
105
+
106
+ [data-testid="stChatMessageAvatarAssistant"] > svg {
107
+ color: #49479D
108
+ }
109
+
110
+ .stMarkdown hr {
111
+ background-color: #002530;
112
+ }
113
+
114
+ .stSidebarHeader > div > button {
115
+ fill: #002530;
116
+ }
117
+
118
+ .stSidebarHeader > div > button > svg {
119
+ fill: #C9D200;
120
+ }
121
+
122
+ .stChatMessage:has([data-testid="stChatMessageAvatarUser"]) {
123
+ background-color: #00AE9D;
124
+ color: #FAFAFA;
125
+ border-radius: 10px;
126
+ }
127
+
128
+ .stChatMessage:has([data-testid="stChatMessageAvatarUser"]) {
129
+ background-color: #008679;
130
+ color: #FAFAFA;
131
+ border-radius: 10px;
132
+ }
133
+
134
+ .stChatMessage:has([data-testid="stChatMessageAvatarUser"]) {
135
+ background-color: #ebebeb;
136
+ color: #FAFAFA;
137
+ border-radius: 10px;
138
+ }
139
+
140
+ .st-key-Logout > div > button {
141
+ background-color: transparent !important;
142
+ border: none;
143
+ color: #002530;
144
+ }
145
+
146
+ .st-key-Logout > div > button:hover {
147
+ color: #7DB61C;
148
+ }
149
+
150
+ [data-testid="stDialog"] > div > div > div > div {
151
+ max-height: 550px !important;
152
+ overflow: scroll;
153
+ }
154
+
155
+ [data-testid="stDialog"] > div > div > div {
156
+ background-color: #00AE9D;
157
+ border-top-left-radius: 0px;
158
+ border-top-right-radius: 0px;
159
+ border-bottom-left-radius: 10px;
160
+ border-bottom-right-radius: 10px;
161
+ }
162
+
163
+ [data-testid="stDialog"] > div > div > div:first-child {
164
+ background-color: #002530;
165
+ border-top-left-radius: 10px;
166
+ border-top-right-radius: 10px;
167
+ border-bottom-left-radius: 0;
168
+ border-bottom-right-radius: 0;
169
+ }
170
+
171
+
172
+ [data-testid="stAlertContainer"] p {
173
+ color: #002530;
174
+ }
175
+
176
+ .stTextInput > label {
177
+ color: #002530;
178
+ }
pngegg.png DELETED
Binary file (42.8 kB)
 
requirements.txt CHANGED
@@ -5,4 +5,5 @@ llama-index-readers-google==0.6.0
5
  openpyxl==3.1.5
6
  flask==3.1.0
7
  streamlit==1.41.1
8
- streamlit_authenticator
 
 
5
  openpyxl==3.1.5
6
  flask==3.1.0
7
  streamlit==1.41.1
8
+ streamlit-authenticator==0.4.1
9
+ python-levenshtein==0.26.1
sicoob-logo.png DELETED
Binary file (95 kB)