Spaces:
Sleeping
Sleeping
ensuree rows returned from sqlite are dictionary objects not tuples
Browse files- src/relationships.py +2 -1
- ui/format.py +4 -3
src/relationships.py
CHANGED
|
@@ -29,9 +29,10 @@ class Relationship:
|
|
| 29 |
class RelationshipEngine:
|
| 30 |
"""Engine for managing entity and event relationships."""
|
| 31 |
|
| 32 |
-
def __init__(self, db_path: str = ':memory:')
|
| 33 |
"""Initialize the relationship engine with database connection."""
|
| 34 |
self.conn = sqlite3.connect(db_path, check_same_thread=False)
|
|
|
|
| 35 |
self.setup_database()
|
| 36 |
|
| 37 |
def setup_database(self) -> None:
|
|
|
|
| 29 |
class RelationshipEngine:
|
| 30 |
"""Engine for managing entity and event relationships."""
|
| 31 |
|
| 32 |
+
def __init__(self, db_path: str = ':memory:'):
|
| 33 |
"""Initialize the relationship engine with database connection."""
|
| 34 |
self.conn = sqlite3.connect(db_path, check_same_thread=False)
|
| 35 |
+
self.conn.row_factory = sqlite3.Row # Critical fix
|
| 36 |
self.setup_database()
|
| 37 |
|
| 38 |
def setup_database(self) -> None:
|
ui/format.py
CHANGED
|
@@ -17,11 +17,12 @@ class ResultFormatter:
|
|
| 17 |
|
| 18 |
items = []
|
| 19 |
for rel in relationships:
|
|
|
|
| 20 |
item = f"""
|
| 21 |
<li class="mb-2">
|
| 22 |
-
<strong>{rel['
|
| 23 |
-
<span class="text-blue-600">{rel['
|
| 24 |
-
<strong>{rel['
|
| 25 |
<br/>
|
| 26 |
<small class="text-gray-600">Confidence: {int(rel['confidence'] * 100)}%</small>
|
| 27 |
</li>
|
|
|
|
| 17 |
|
| 18 |
items = []
|
| 19 |
for rel in relationships:
|
| 20 |
+
# Use correct SQL column names
|
| 21 |
item = f"""
|
| 22 |
<li class="mb-2">
|
| 23 |
+
<strong>{rel['source_text']}</strong> →
|
| 24 |
+
<span class="text-blue-600">{rel['relationship_type'].replace('_to_', ' to ')}</span> →
|
| 25 |
+
<strong>{rel['target_text']}</strong>
|
| 26 |
<br/>
|
| 27 |
<small class="text-gray-600">Confidence: {int(rel['confidence'] * 100)}%</small>
|
| 28 |
</li>
|