feat(maria): depozit local, in afara oglinzii Drive
Dictionarul de erori Oracle pus in `documents/` ar fi disparut in 10 minute: `rclone sync` sterge de acolo tot ce nu exista in Drive. Aceeasi problema o avea si butonul de adaugare document din dashboard — documentul traia pana la urmatorul tur de sincronizare, ceea ce README-ul mentiona ca pe o ciudatenie, nu ca pe un bug. Acum sunt doua directoare cu un singur spatiu de nume: `documents/` (oglinda Drive) si `documents-local/` (ce nu vine din Drive). La acelasi nume castiga Drive-ul — e sursa comuna a echipei, iar copia locala poate fi o versiune veche uitata acolo. Dashboard-ul scrie in cel local si marcheaza documentele „local". Recalibrat cu dictionarul indexat (169 chunk-uri): 19/19, cele patru intrebari Oracle noi ies la 0,73-0,75. Reindexarea a durat cat cele 29 de chunk-uri noi, nu cat toate 169 — refolosirea vectorilor isi face treaba (log: "29 embeddings noi, 140 refolosite"). Verificat pe canalul viu: o escaladare cu captura chiar pleaca pe WhatsApp, imagine + rezumat + referinta, si apare in dashboard. 73 pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4uzvgm7AyJch5WH8QHRhY
This commit is contained in:
@@ -237,3 +237,57 @@ def test_textul_modificat_se_reembedeaza(monkeypatch, write):
|
||||
|
||||
assert calculate == ["varianta modificata"]
|
||||
assert rezultat["embeddings_refolosite"] == 0
|
||||
|
||||
|
||||
# --- documente locale, in afara oglinzii Drive -------------------------------
|
||||
|
||||
def _scrie_local(name: str, text: str):
|
||||
import config
|
||||
config.DOCS_LOCAL_DIR.mkdir(parents=True, exist_ok=True)
|
||||
p = config.DOCS_LOCAL_DIR / name
|
||||
p.write_text(text, encoding="utf-8")
|
||||
return p
|
||||
|
||||
|
||||
def test_documentele_locale_intra_in_index(write):
|
||||
import store
|
||||
write("din-drive.md", "vine din Drive")
|
||||
_scrie_local("al-meu.md", "adaugat local")
|
||||
|
||||
nume = {d["name"] for d in store.documents_for_index()}
|
||||
assert nume == {"din-drive.md", "al-meu.md"}
|
||||
|
||||
|
||||
def test_se_vede_care_e_local(write):
|
||||
import store
|
||||
write("din-drive.md", "x")
|
||||
_scrie_local("al-meu.md", "y")
|
||||
dupa_nume = {d["name"]: d for d in store.list_documents()}
|
||||
assert dupa_nume["al-meu.md"]["local"] is True
|
||||
assert dupa_nume["din-drive.md"]["local"] is False
|
||||
|
||||
|
||||
def test_la_acelasi_nume_castiga_versiunea_din_drive(write):
|
||||
import store
|
||||
_scrie_local("acelasi.md", "copie locala veche")
|
||||
write("acelasi.md", "versiunea din Drive")
|
||||
assert store.read_document("acelasi.md") == "versiunea din Drive"
|
||||
assert len(store.list_documents()) == 1
|
||||
|
||||
|
||||
def test_scrierea_din_dashboard_merge_in_directorul_local():
|
||||
# Pana acum ajungea in oglinda Drive si disparea la urmatorul rclone sync.
|
||||
import config
|
||||
import store
|
||||
store.write_document("nota.md", "ceva de tinut minte")
|
||||
assert (config.DOCS_LOCAL_DIR / "nota.md").exists()
|
||||
assert not (config.DOCS_DIR / "nota.md").exists()
|
||||
|
||||
|
||||
def test_stergerea_gaseste_documentul_in_ambele_directoare(write):
|
||||
import store
|
||||
_scrie_local("local.md", "x")
|
||||
write("drive.md", "y")
|
||||
assert store.delete_document("local.md") is True
|
||||
assert store.delete_document("drive.md") is True
|
||||
assert store.delete_document("inexistent.md") is False
|
||||
|
||||
Reference in New Issue
Block a user