diff --git a/assets/icons/tg.svg b/assets/icons/tg.svg
new file mode 100644
index 0000000..326c99f
--- /dev/null
+++ b/assets/icons/tg.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/chat.py b/chat.py
index cdcba41..89cf45b 100644
--- a/chat.py
+++ b/chat.py
@@ -1,8 +1,9 @@
from streamlit_option_menu import option_menu
from pathlib import Path
+from src.styles.menu_styles import HEADER_STYLES, FOOTER_STYLES
from src.utils.lang import en, ru
-from src.utils.donates import show_donates
+from src.utils.footer import show_donates, show_info
from src.utils.conversation import get_user_input, show_chat_buttons, show_conversation
import streamlit as st
@@ -10,8 +11,10 @@ import streamlit as st
# --- PATH SETTINGS ---
current_dir = Path(__file__).parent if "__file__" in locals() else Path.cwd()
css_file = current_dir / "src/styles/.css"
-assets_dir = current_dir / "src/assets"
+assets_dir = current_dir / "assets"
icons_dir = assets_dir / "icons"
+tg_svg = icons_dir / "telegram.svg"
+tg_svg = icons_dir / "tg.svg"
# --- GENERAL SETTINGS ---
PAGE_TITLE = "AI Talks"
@@ -31,35 +34,11 @@ with open(css_file) as f:
selected_lang = option_menu(
menu_title=None,
options=["En", "Ru", ],
- icons=["flag_en", "flag_ru"],
+ icons=["globe2", "globe"],
menu_icon="cast",
- default_index=0,
+ default_index=1,
orientation="horizontal",
- styles={
- "container": {
- "padding": "0px",
- "display": "grid",
- "margin": "0!important",
- "background-color": "#2C3333"
- },
- "icon": {"color": "#CBE4DE", "font-size": "14px"},
- "nav-link": {
- "font-size": "14px",
- "text-align": "center",
- "margin": "auto",
- "background-color": "#2C3333",
- "height": "30px",
- "width": "7rem",
- "color": "#CBE4DE",
- "border-radius": "5px"
- },
- "nav-link-selected": {
- "background-color": "#2E4F4F",
- "font-weight": "300",
- "color": "#f5f5f5",
- "border": "1px solid #0E8388"
- }
- }
+ styles=HEADER_STYLES
)
# Storing The Context
@@ -100,4 +79,21 @@ if __name__ == "__main__":
main()
st.markdown("---")
st.image("assets/ai.jpg")
- show_donates()
+ st.markdown("---")
+ selected_footer = option_menu(
+ menu_title=None,
+ options=["Info", "Donates", ],
+ icons=["info-circle", "piggy-bank"],
+ menu_icon="cast",
+ default_index=0,
+ orientation="horizontal",
+ styles=FOOTER_STYLES
+ )
+ st.markdown("---")
+ match selected_footer:
+ case "Info":
+ show_info(tg_svg)
+ case "Donates":
+ show_donates()
+ case _:
+ show_info(tg_svg)
diff --git a/src/styles/__init__.py b/src/styles/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/styles/menu_styles.py b/src/styles/menu_styles.py
new file mode 100644
index 0000000..d640d92
--- /dev/null
+++ b/src/styles/menu_styles.py
@@ -0,0 +1,31 @@
+from typing import Dict
+
+HEADER_STYLES: Dict[str, Dict] = {
+ "container": {
+ "padding": "0px",
+ "display": "grid",
+ "margin": "0!important",
+ "background-color": "#2C3333"
+ },
+ "icon": {"color": "#CBE4DE", "font-size": "14px"},
+ "nav-link": {
+ "font-size": "14px",
+ "text-align": "center",
+ "margin": "auto",
+ "background-color": "#2C3333",
+ "height": "30px",
+ "width": "7rem",
+ "color": "#CBE4DE",
+ "border-radius": "5px"
+ },
+ "nav-link-selected": {
+ "background-color": "#2E4F4F",
+ "font-weight": "300",
+ "color": "#f5f5f5",
+ "border": "1px solid #0E8388"
+ }
+}
+
+FOOTER_STYLES: Dict[str, Dict] = {
+
+}
diff --git a/src/utils/conversation.py b/src/utils/conversation.py
index 4133cdc..28f4281 100644
--- a/src/utils/conversation.py
+++ b/src/utils/conversation.py
@@ -21,9 +21,9 @@ def get_user_input() -> str:
def show_chat_buttons() -> None:
b0, b1, b2 = st.columns(3)
with b0, b1, b2:
- b0.button(st.session_state.locale.chat_btn0)
- b1.button(st.session_state.locale.chat_btn1, on_click=st.cache_data.clear)
- b2.button(st.session_state.locale.chat_btn2, on_click=clear_chat)
+ b0.button(st.session_state.locale.chat_run_btn)
+ b1.button(st.session_state.locale.chat_rerun_btn, on_click=st.cache_data.clear)
+ b2.button(st.session_state.locale.chat_clear_btn, on_click=clear_chat)
def show_chat(ai_content: str, user_text: str) -> None:
diff --git a/src/utils/donates.py b/src/utils/footer.py
similarity index 61%
rename from src/utils/donates.py
rename to src/utils/footer.py
index d3262ad..832a0bb 100644
--- a/src/utils/donates.py
+++ b/src/utils/footer.py
@@ -1,8 +1,19 @@
+from pathlib import Path
+
import streamlit as st
+from src.utils.helpers import render_svg
+
+
+def show_info(icon: Path) -> None:
+ st.markdown(f"""
+ ### :page_with_curl: {st.session_state.locale.footer_title}
+ - {render_svg(icon)} [{st.session_state.locale.footer_chat}](https://t.me/talks_ai)
+ - {render_svg(icon)} [{st.session_state.locale.footer_channel}](https://t.me/talks_aii)
+ """, unsafe_allow_html=True)
+
def show_donates() -> None:
- st.markdown("---")
st.markdown(f"""
### :moneybag: {st.session_state.locale.donates}
**{st.session_state.locale.donates1}:**
diff --git a/src/utils/helpers.py b/src/utils/helpers.py
new file mode 100644
index 0000000..84fa590
--- /dev/null
+++ b/src/utils/helpers.py
@@ -0,0 +1,9 @@
+import base64
+from pathlib import Path
+
+
+def render_svg(svg: Path) -> str:
+ """Renders the given svg string."""
+ with open(svg) as file:
+ b64 = base64.b64encode(file.read().encode("utf-8")).decode("utf-8")
+ return f""
diff --git a/src/utils/lang.py b/src/utils/lang.py
index 69eb1c6..62777bb 100644
--- a/src/utils/lang.py
+++ b/src/utils/lang.py
@@ -14,12 +14,15 @@ class Locale:
donates1: str
donates2: str
chat_placeholder: str
- chat_btn0: str
- chat_btn1: str
- chat_btn2: str
+ chat_run_btn: str
+ chat_rerun_btn: str
+ chat_clear_btn: str
select_placeholder1: str
select_placeholder2: str
stt_placeholder: str
+ footer_title: str
+ footer_chat: str
+ footer_channel: str
# Child data class for English
@@ -33,12 +36,15 @@ class EnLocale(Locale):
donates1: str = "Russia"
donates2: str = "World"
chat_placeholder: str = "Start Your Conversation With AI:"
- chat_btn0: str = "Run"
- chat_btn1: str = "Rerun"
- chat_btn2: str = "Clear Conversation"
+ chat_run_btn: str = "Run"
+ chat_rerun_btn: str = "Rerun"
+ chat_clear_btn: str = "Clear Conversation"
select_placeholder1: str = "Select AI Model"
select_placeholder2: str = "Select AI Role"
stt_placeholder: str = "To Hear The Voice Of AI, Press Play"
+ footer_title: str = "Support & Feedback"
+ footer_chat: str = "AI Talks Chat"
+ footer_channel: str = "AI Talks Channel"
# Child data class for Russian
@@ -52,12 +58,15 @@ class RuLocale(Locale):
donates1: str = "Россия"
donates2: str = "Остальной Мир"
chat_placeholder: str = "Начните Вашу Беседу с ИИ:"
- chat_btn0: str = "Запустить"
- chat_btn1: str = "Перезапустить"
- chat_btn2: str = "Очистить Беседу"
+ chat_run_btn: str = "Запустить"
+ chat_rerun_btn: str = "Перезапустить"
+ chat_clear_btn: str = "Очистить Беседу"
select_placeholder1: str = "Выберите Модель ИИ"
select_placeholder2: str = "Выберите Роль ИИ"
stt_placeholder: str = "Чтобы Услышать ИИ Нажми Кнопку Проигрывателя"
+ footer_title: str = "Поддержка и Обратная Связь"
+ footer_chat: str = "Чат Разговорчики с ИИ"
+ footer_channel: str = "Канал Разговорчики с ИИ"
AI_ROLE_OPTIONS_EN = [