Commit cf5827b
committed
Search: Replace AI JSON generation with enum classification
- New architecture: LLM classifies into predefined enums (type, time, size, scope, exclude, folders) + extracts filename keywords. Rust handles all computation — regex construction, date math, size thresholds, pattern merging. Key-value line output, not JSON.
- `ai_response_parser.rs`: line-by-line parser with enum validation, fallback keyword extraction (3 longest words)
- `ai_query_builder.rs`: 22-type lookup table, 14 time enums (incl. `last_3_months`, `last_6_months`), size/scope/keyword mappers, `merge_keyword_and_type()` combining keywords + type into single regex, redundant keyword detection
- Delete: `AiSearchQuery`, `PreflightContext`, `SEARCH_PROMPT_TEMPLATE`, `REFINEMENT_RULES`, two-pass refinement, JSON parser, backslash escape fixer, regex validator, preflight table formatter
- Single-pass flow: one LLM call → parse → build → search (was: translate → search → build preflight → refine → search)
- Frontend: remove preflight row, generation counter, pass-2 orchestration. `executeAiSearch` is now translate → search
- MCP executor: single translate → search, delete preflight/refinement orchestration
- Remove `.key` from presentations type (was matching TLS certs, not Keynote files)
- Prompt rules: time-only-when-explicit, singular keywords, type-over-keywords, stronger exclude handling
- 57 new Rust tests for parser, builder, and merge logic
- R7 eval: 2B local model improved from 23% Great to 43% Great, Bad down from 43% to 20%. Cloud model at 67% Great. Zero parse errors on both (was 13% on 2B with old pipeline)1 parent 1d588f8 commit cf5827b
15 files changed
Lines changed: 2816 additions & 1637 deletions
File tree
- apps/desktop
- src-tauri/src
- commands
- mcp
- src/lib
- search
- tauri-commands
- docs
- notes
- specs
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
0 commit comments