Skip to content

Commit ec4026b

Browse files
Merge pull request #18 from dialogoo/feature/retriever-llamaindex-Sql
Feature/retriever query builder and ollama provider
2 parents 9943fd5 + d333ab4 commit ec4026b

File tree

11 files changed

+745
-548
lines changed

11 files changed

+745
-548
lines changed

Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ all-services-up:
5858
cd services/frontend && uv run streamlit run main.py --server.address 0.0.0.0 --server.port 3000 & \
5959
cd services/retriever && uv run uvicorn retriever.api:app --host 0.0.0.0 --port 8000 --reload
6060

61-
# --------------------TESTS --------------------------------------------------------------------------------------------------
62-
test-parser:
63-
pytest tests/test_parser.py -v -s --log-cli-level=INFO --capture=no --tb=short
61+
# --------------------SERVICE STARTERS INSIDE DEVCONTAINER --------------------------------------------------------------------------------------------------
62+
start-frontend:
63+
cd services/frontend && uv sync && uv run streamlit run main.py --server.address 0.0.0.0 --server.port 3000
64+
65+
start-retriever:
66+
cd services/retriever && uv sync && uv run uvicorn src.api:app --host 0.0.0.0 --port 8000 --reload
67+
68+
start-pusher:
69+
cd services/pusher && uv sync && uv run python main.py
70+
71+
start-scraper:
72+
cd services/scraper && uv sync && cd event_scraper && uv run python main.py
73+
74+
start-parser:
75+
cd services/parser && uv sync && uv run python parser.py

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
<img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" />
2+
<img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/357725b4-4da2-4463-b9a5-896a29fc4b79" />
33
# Laiive
44

55
#### what is 🫦Laiive
@@ -16,11 +16,11 @@ laiive links the broken connection between events and public[^*]
1616

1717
#### why 🫦laiive makes sense?
1818

19-
laiive was born to connect small events with people close to them, laiive does not focus on big musical events as many platforms are, laiive works on the human and community scale where small music events live.
19+
laiive was born to connect small events with people close to them, laiive does not focus on big musical events as many platforms are, laiive works on the human and community scale where small music events live.
2020

2121
#### why is 🫦laiive good?
2222

23-
laiive was born as an AI cultural agenda, with the AI hype and AI competition without the AI Safety layer laiive has become a subversive way of using AI, it tries to steal attention from the main digital platforms and bring it back to real world social meetings. laiive positions itself as an ethical AI app helping to develop a balanced digital-physical culture before the intermediate layer in our digital comunication becomes too powerful.
23+
laiive was born as an AI cultural agenda, with the AI hype and AI competition without the AI Safety layer laiive has become a subversive way of using AI, it tries to steal attention from the main digital platforms and bring it back to real world social meetings. laiive positions itself as an ethical AI app helping to develop a balanced digital-physical culture before the intermediate layer in our digital comunication becomes too powerful.
2424

2525
#### why is 🫦laiive profitable?
2626

@@ -30,8 +30,7 @@ laiive is a catalyzer of a world wide business that is actually unatended. laiiv
3030

3131

3232
## Services
33-
<img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" />
34-
33+
<img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" /><img width="90" height="90" alt="laiive1" src="https://github.com/user-attachments/assets/f8dc0267-f630-4a87-b3f8-fe0277137ba5" />
3534
### UI
3635
a ZERO CLIC UI is the public view of laiive, easy to publish an event, easy to find an event.
3736

docker-compose.override.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ services:
5858
target: /app
5959
ignore:
6060
- .venv/
61-
pgadmin:
62-
# TODO migrate to DBeaver
63-
image: dpage/pgadmin4
64-
environment:
65-
PGADMIN_DEFAULT_EMAIL: [email protected] # pragma: allowlist secret
66-
PGADMIN_DEFAULT_PASSWORD: admin # pragma: allowlist secret
67-
ports:
68-
- "5050:80"
69-
depends_on:
70-
- db
7161

7262
volumes:
7363
frontend-venv:

services/frontend/main.py

Lines changed: 174 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,142 @@
33
from datetime import date
44
from config import settings
55

6+
# Enhanced dark theme CSS
7+
st.markdown(
8+
"""
9+
<style>
10+
/* Root background - black */
11+
.stApp {
12+
background-color: #2b2b2b;
13+
}
14+
15+
/* Main container background */
16+
.main .block-container {
17+
background-color: #2b2b2b;
18+
padding-top: 2rem;
19+
}
20+
21+
/* Title - Fuchsia Pink */
22+
h1 {
23+
color: #FF2AA0 !important;
24+
font-weight: bold;
25+
}
26+
27+
/* Chat container - dark grey with border */
28+
div[data-testid="stContainer"] {
29+
background-color: #2b2b2b;
30+
border-radius: 10px;
31+
padding: 20px;
32+
border: 1px solid #404040;
33+
}
34+
35+
/* Sidebar - mid grey with border */
36+
[data-testid="stSidebar"] {
37+
background-color: #2b2b2b !important;
38+
border-right: 2px solid #FF2AA0 !important;
39+
}
40+
41+
[data-testid="stSidebar"] > div:first-child {
42+
background-color: #2b2b2b;
43+
}
44+
45+
/* Sidebar labels and text - Fuchsia Pink */
46+
[data-testid="stSidebar"] label,
47+
[data-testid="stSidebar"] .stSelectbox label,
48+
[data-testid="stSidebar"] .stRadio label,
49+
[data-testid="stSidebar"] .stDateInput label,
50+
[data-testid="stSidebar"] .stRadio label p,
51+
[data-testid="stSidebar"] .stRadio label span,
52+
[data-testid="stSidebar"] .stRadio > label,
53+
[data-testid="stSidebar"] p,
54+
[data-testid="stSidebar"] span {
55+
color: #FF2AA0 !important;
56+
}
57+
58+
/* Input fields styling (main area only) */
59+
.stTextInput input {
60+
background-color: #1e1e1e !important;
61+
color: #ffffff !important;
62+
border: 1px solid #FF2AA0 !important;
63+
}
64+
65+
.stTextInput input:focus {
66+
border-color: #FF2AA0 !important;
67+
}
68+
69+
/* Button styling */
70+
button[kind="primary"] {
71+
background-color: #404040 !important;
72+
color: #ffffff !important;
73+
border: 1px solid #FF2AA0 !important;
74+
}
75+
76+
button[kind="primary"]:hover {
77+
background-color: #555555 !important;
78+
border-color: #FF2AA0 !important;
79+
}
80+
81+
/* Text color for readability (main area only) */
82+
.stMarkdown,
83+
.stMarkdown p,
84+
.stMarkdown strong {
85+
color: #e0e0e0 !important;
86+
}
87+
88+
/* Chat message styling */
89+
.stMarkdown strong {
90+
color: #FF2AA0 !important;
91+
}
92+
93+
/* User message bubble - right aligned with dark grey background */
94+
.user-message {
95+
background-color: #404040;
96+
padding: 10px 15px;
97+
border-radius: 10px;
98+
margin: 10px 0;
99+
margin-left: 40%;
100+
text-align: right;
101+
color: #ffffff;
102+
}
103+
104+
/* Bot message styling */
105+
.bot-message {
106+
margin: 10px 0;
107+
margin-left: 0%;
108+
text-align: left;
109+
}
110+
111+
/* Scrollbar styling */
112+
::-webkit-scrollbar {
113+
width: 8px;
114+
}
115+
116+
::-webkit-scrollbar-track {
117+
background: #1e1e1e;
118+
}
119+
120+
::-webkit-scrollbar-thumb {
121+
background: #555555;
122+
border-radius: 4px;
123+
}
124+
125+
::-webkit-scrollbar-thumb:hover {
126+
background: #666666;
127+
}
128+
</style>
129+
""",
130+
unsafe_allow_html=True,
131+
)
132+
6133
API_URL = f"{settings.api_url}{settings.api_path}"
7134

8135
st.title("🫦laiive")
9136

10-
# Sidebar for filters
11137
with st.sidebar:
12-
st.header("SQL Filters")
13-
14-
# Place filter
15138
places = ["All", "Bergamo", "Barcelona", "Boston", "Milano"]
16-
selected_place = st.selectbox("PLACE FILTER:", places)
139+
selected_place = st.selectbox("CITY:", places)
17140

18-
# Date filter
19-
date_option = st.radio("DATE FILTER:", ["All Dates", "Specific Date", "Date Range"])
141+
date_option = st.radio("DATE:", ["All Dates", "Specific Date", "Date Range"])
20142

21143
if date_option == "Specific Date":
22144
selected_date = st.date_input("Select Date:", value=date(2025, 8, 1))
@@ -33,15 +155,6 @@
33155
selected_date = None
34156
date_range = None
35157

36-
# Display current filters
37-
st.subheader("Current Filters")
38-
st.write(f"**Place:** {selected_place}")
39-
if date_option == "Specific Date":
40-
st.write(f"**Date:** {selected_date}")
41-
elif date_option == "Date Range" and date_range is not None:
42-
st.write(f"**Date Range:** {date_range[0]} to {date_range[1]}")
43-
else:
44-
st.write("**Date:** All Dates")
45158

46159
if "messages" not in st.session_state:
47160
st.session_state.messages = []
@@ -54,20 +167,24 @@ def get_laiive_response(
54167
date_range=None,
55168
):
56169
try:
57-
# Prepare the request payload with filters
170+
dates_list = None
171+
if date_filter:
172+
dates_list = [date_filter.isoformat()]
173+
elif date_range:
174+
from datetime import timedelta
175+
176+
current_date = date_range[0]
177+
end_date = date_range[1]
178+
dates_list = []
179+
while current_date <= end_date:
180+
dates_list.append(current_date.isoformat())
181+
current_date += timedelta(days=1)
182+
58183
payload = {
59184
"message": user_message,
60185
"filters": {
61186
"place": place_filter if place_filter != "All" else None,
62-
"date": date_filter.isoformat() if date_filter else None,
63-
"date_range": (
64-
{
65-
"start": date_range[0].isoformat(),
66-
"end": date_range[1].isoformat(),
67-
}
68-
if date_range is not None
69-
else None
70-
),
187+
"dates": dates_list,
71188
},
72189
}
73190

@@ -82,12 +199,37 @@ def get_laiive_response(
82199
return f"Connection error: {e}"
83200

84201

85-
# Main chat interface
86-
st.header("Chat search engine")
202+
# Create a scrollable container for chat messages
203+
chat_container = st.container(height=400) # Adjust height as needed
87204

88-
user_input = st.text_input("You:", key="user_input")
205+
with chat_container:
206+
# Display chat history
207+
for sender, msg in st.session_state.messages:
208+
if sender == "user":
209+
st.markdown(
210+
f'<div class="user-message"><strong>You:</strong> {msg}</div>',
211+
unsafe_allow_html=True,
212+
)
213+
else:
214+
st.markdown(
215+
f'<div class="bot-message"><strong>laiive:</strong> {msg}</div>',
216+
unsafe_allow_html=True,
217+
)
89218

90-
if st.button("Send") and user_input:
219+
# Fixed input area at the bottom
220+
with st.form(key="chat_form", clear_on_submit=True):
221+
col1, col2 = st.columns([5, 1])
222+
with col1:
223+
user_input = st.text_input(
224+
"You:",
225+
key="user_input",
226+
label_visibility="collapsed",
227+
placeholder="Type your message...",
228+
)
229+
with col2:
230+
send_button = st.form_submit_button("Send", use_container_width=True)
231+
232+
if send_button and user_input:
91233
st.session_state.messages.append(("user", user_input))
92234

93235
# Pass filters to the API
@@ -97,12 +239,5 @@ def get_laiive_response(
97239
date_filter=selected_date,
98240
date_range=date_range,
99241
)
100-
101-
st.session_state.messages.append(("bot", bot_reply))
102-
103-
# Display chat history
104-
for sender, msg in st.session_state.messages:
105-
if sender == "user":
106-
st.markdown(f"**You:** {msg}")
107-
else:
108-
st.markdown(f"**laiive:** {msg}")
242+
st.session_state.messages.append(("laiive", bot_reply))
243+
st.rerun() # Refresh to show new messages

services/frontend/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.13"
77
dependencies = [
8+
"loguru>=0.7.3",
89
"pydantic>=2.11.7",
910
"pydantic-settings>=2.10.1",
1011
"streamlit>=1.47.0",

0 commit comments

Comments
 (0)