fix: resolve bugs 01 through 08 and set Ollama TTL to 1h

This commit is contained in:
Antigravity committed 2026-10-07 19:19:49 +03:00
1 parent a01bf64445
commit 9bbc9473de
14 files changed
+366 -108

No files matched your search

+6 -2
View File
@@ -38,11 +38,15 @@ async def api_lookup(
raise HTTPException(status_code=400, detail="Query term cannot be empty")
data = await lookup_term(query_str)
# Ensure term is always present in response
target_term = data.get("term") or data.get("english_term") or query_str
data["term"] = target_term
# Check if this term already exists in user's dictionary
with get_db() as conn:
existing = conn.execute(
"SELECT id, term, translation, context_sentence, tags, collection, srs_state, srs_reps FROM vocabulary_cards WHERE user_id = ? AND lower(trim(term)) = lower(trim(?))",
(user["id"], query_str),
"SELECT id, term, translation, context_sentence, tags, collection, srs_state, srs_reps FROM vocabulary_cards WHERE user_id = ? AND (lower(trim(term)) = lower(trim(?)) OR lower(trim(term)) = lower(trim(?)))",
(user["id"], target_term, query_str),
).fetchone()
if existing:
data["in_library"] = True