bayan-api / src

Commit History

  1. fix: Remove 'Apply All' button - conflicts with spelling+grammar pipeline

    7f0ddc6
  2. fix: Word-level grammar suggestions + robust grammar model validation⁠

    b0bed28
  3. fix: Proper grammar suggestion generation — keep spelling suggestions, add grammar on top⁠

    63587df
  4. fix: Add missing SequenceMatcher import

    0f10098
  5. fix: Rewrite suggestion system — unified diff eliminates text duplication - Instead of mapping grammar offsets back through OffsetMapper (broken), now: - Run full pipeline: spelling -> grammar -> punctuation - Do ONE clean diff: original_text vs final_text - Classify each change as spelling/grammar based on what spelling changed - Guarantees non-overlapping suggestions with correct offsets

    1a2449a
  6. fix: Prevent overlapping spelling+grammar suggestions from duplicating text - Backend: Skip grammar suggestions that overlap with existing spelling ranges - Frontend: applyAllSuggestions skips overlapping ranges to prevent duplication

    02d51b7
  7. revert: Restore ORIGINAL grammar params that were working (num_beams=4, max_length=512) - Remove all hallucination checks that were blocking valid corrections - The model WAS correcting ذهب→ذهبت before, only highlight was wrong - Keep word-level diff fix (in app.py) + raw output logging

    9eee80b
  8. fix: Switch grammar to greedy decoding + stronger anti-hallucination - num_beams=1 (greedy, most stable for seq2seq correction) - repetition_penalty=2.0 (strong anti-repeat) - Log raw model output before hallucination check - Tightened bigram duplicate detection

    ea6d242
  9. fix: Prevent grammar model hallucination (rearranging/duplicating text) - Dynamic max_length (1.3x input instead of fixed 512) - repetition_penalty=1.5 to discourage repeating - Reduce beams 4→2 (less hallucination on CPU) - Add _is_hallucinated() safety checker: output length, word count, repeated phrases, sentence rearrangement

    964adc9
  10. debug: Add grammar diff logging to diagnose missing suggestions

    7520375
  11. fix: Grammar shows word-level suggestions instead of sentence chunks - Break grammar diffs into individual word changes - Skip grammar suggestions overlapping with spelling - Add alternatives to grammar suggestions - Prevents duplication on Apply All

    291a28f
  12. feat: NLP-2 Grammar model integration (Bayan_Arabic_Grammar T5) - New: src/nlp/grammar/grammar_service.py (lazy T5 loading) - Dockerfile: pre-download grammar model (2.14GB safetensors) - Wire /api/analyze Step 2 to grammar service - Update /api/grammar standalone endpoint - Add _grammar_available() health check

    4ec8363

  1. perf: Reduce debounce from 1500ms to 1000ms for faster response

    4540c4b
  2. fix: Increase analyze debounce to 1.5s to prevent text overwrite while typing - Debounce 500ms -> 1500ms - Abort in-flight requests when user starts typing again - Double-check no new input before running analysis

    9a1be04
  3. feat: Show 3 spelling alternatives + keep-as-is option - Backend: Generate alternatives via EditDistanceCorrector - Tooltip: Multiple clickable correction buttons - Sidebar cards: Alt chips for each suggestion - Dismiss button removes error highlight (keep original word)

    3f8001b
  4. fix: Handle N-to-M word replacements in analyze post-filter - Process each original word individually against corrected segment - Accept 1-to-1 small edits and 1-to-N word splits within multi-word blocks - Previously all multi-word blocks were silently rejected

    d1f18ad
  5. fix: Relax analyze post-filters to show AraSpell corrections in editor - Allow 3 char edits (was 2), 50% ratio (was 40%) - Lower word-split threshold from 12 to 5 chars

    6d70738
  6. feat: Wire /api/analyze to use AraSpell service for real-time editor spelling

    bf32528
  7. fix: Remove duplicate /api/spelling route causing AssertionError

    738185d
  8. feat: Enable ContextualCorrector (BERT MLM) for spelling - Pre-download AutoModelForMaskedLM in Dockerfile

    bcf3607
  9. feat: Add AraSpell spelling correction endpoint (POST /api/spelling) with lazy model loading - Extract AraSpell pipeline into src/nlp/spelling/ (araspell_rules.py + araspell_service.py) - Pre-download AraBERT encoder-decoder + checkpoint in Dockerfile - Lazy load on first request, contextual=False to save RAM - Update health check to report spelling status

    53f433b
  10. fix: Always load models on import (RENDER/GUNICORN_LOADED env vars not set in HF Spaces)

    ccf3eef
  11. debug: Add startup error tracking + memory info to debug endpoint

    756045d
  12. fix: Load summarization model locally with float16 (HF free tier has no outbound DNS)⁠

    d229a9c
  13. fix: DNS endpoint discovery - test multiple HF hostnames to find reachable one

    922cc55
  14. fix: Construct RequestParameters with all 6 required args (url, task, model, json, data, headers)

    625b5d7
  15. fix: Construct RequestParameters properly using inspect.signature

    d3fe06e
  16. fix: Try multiple _inner_post calling conventions + inspect signature

    06ff15b
  17. fix: Use _inner_post transport from InferenceClient v1.19.0

    82a77dd
  18. debug: Deep diagnostics to find InferenceClient internal transport

    dc7f39b
  19. fix: Back to InferenceClient with correct method signatures + diagnostics

    8b888b0
  20. fix: Use requests.post() directly instead of InferenceClient (version compat issue)

    0405b6b
  21. fix: Use client.post() for all models, fix summarization params, better error capture

    e18c6c8
  22. fix: Use huggingface_hub InferenceClient instead of raw urllib (fixes DNS inside HF Spaces)

    7cd5afa
  23. fix: Add wait_for_model, debug endpoint, and better HF API error handling

    2df4f2d
  24. feat: Switch all NLP models to HuggingFace Inference API⁠

    239c0bb

  1. Fix: Google link failure now falls back to full sign-in instead of error toast

    d487585
  2. Fix: Guest login navigates to home/landing page instead of editor

    349ddaa
  3. authDone Ready for deployment

    bb51619
  4. added light theme and ISLAMIC RAG and fixed the UI/UX issues and added the auth

    012d0ac

  1. initial UI

    0c086e7

  1. Initial commit: repository skeleton and folder READMEs

    b366dff