Skip to content

Commit 0483d46

Browse files
authored
Merge pull request #13 from lucas-rampimdesouza_data/feature/settings-redesign-and-cache-fix
fix: cache NULL columns + Settings redesign + UI polish
2 parents 8ad5a33 + f7f73ee commit 0483d46

File tree

7 files changed

+412
-358
lines changed

7 files changed

+412
-358
lines changed

backend/app/api/genie_clone_routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ async def _process_genie_background(
228228
query_text, query_embedding, sql_query,
229229
identity, gateway_id or space_id, rs,
230230
original_query_text=original_query_text,
231+
genie_space_id=space_id,
231232
)
232233
logger.info("Background cache SAVED id=%s query=%s", cache_id, query_text[:50])
233234
except Exception as e:

backend/app/services/storage_dynamic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ async def _op():
217217
return backend.save_query_cache(
218218
query_text, query_embedding, sql_query, identity, gateway_id,
219219
original_query_text=original_query_text,
220+
genie_space_id=genie_space_id,
220221
)
221222
return await self._with_reconnect(_op, runtime_settings)
222223

@@ -231,7 +232,7 @@ async def _op():
231232
backend = await self._resolve_backend(runtime_settings)
232233
if hasattr(backend, 'pool'):
233234
return await backend.get_all_cached_queries(identity, gateway_id=gateway_id)
234-
return backend.get_all_cached_queries(identity)
235+
return backend.get_all_cached_queries(identity, genie_space_id=gateway_id)
235236
return await self._with_reconnect(_op, runtime_settings)
236237

237238
async def save_query_log(

backend/app/services/storage_local.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ def save_query_cache(
137137
query_embedding: List[float],
138138
sql_query: str,
139139
identity: str,
140-
genie_space_id: str,
140+
gateway_id: str,
141141
original_query_text: str = None,
142+
genie_space_id: str = None,
142143
) -> int:
143144
"""Save a new query to the cache"""
144145
new_id = max([item.get('id', 0) for item in self.cache], default=0) + 1
@@ -149,6 +150,7 @@ def save_query_cache(
149150
'original_query_text': original_query_text,
150151
'sql_query': sql_query,
151152
'identity': identity,
153+
'gateway_id': gateway_id,
152154
'genie_space_id': genie_space_id,
153155
'created_at': datetime.now().isoformat(),
154156
'last_used': datetime.now().isoformat(),

frontend/src/components/gateways/GatewayCacheTab.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default function GatewayCacheTab({ gateway }) {
7474
key: 'query_text',
7575
label: 'Query',
7676
render: (val) => (
77-
<span className="block truncate max-w-[260px]" title={val}>
77+
<span className="block truncate" title={val}>
7878
{val}
7979
</span>
8080
),
@@ -84,10 +84,10 @@ export default function GatewayCacheTab({ gateway }) {
8484
label: 'SQL',
8585
render: (val) => (
8686
<code
87-
className="text-[12px] px-1.5 py-0.5 rounded block truncate max-w-[200px] bg-[#F7F7F7] text-[#161616]"
87+
className="text-[12px] px-1.5 py-0.5 rounded block truncate bg-[#F7F7F7] text-[#161616]"
8888
title={val}
8989
>
90-
{val ? val.substring(0, 60) + (val.length > 60 ? '...' : '') : '-'}
90+
{val || '-'}
9191
</code>
9292
),
9393
},

frontend/src/components/playground/PlaygroundPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ export default function PlaygroundPage() {
583583
id="playground-run-btn"
584584
onClick={handleSubmit}
585585
disabled={running || !queryText.trim() || (!selectedGateway && gateways.length > 0)}
586-
className="flex items-center justify-center gap-2 h-8 px-4 bg-[#2272B4] text-white rounded text-[13px] font-medium hover:bg-[#1b5e96] disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
586+
className="flex items-center justify-center gap-2 h-8 w-[100px] bg-[#2272B4] text-white rounded text-[13px] font-medium hover:bg-[#1b5e96] disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
587587
>
588588
{running ? <Loader className="w-3.5 h-3.5 animate-spin" /> : <Play className="w-3.5 h-3.5" />}
589589
{running ? 'Running' : 'Run'}

0 commit comments

Comments
 (0)