25 Commits

Author SHA1 Message Date
171b40f525 fix: serialise local Cog model calls with a queue to prevent 409 conflicts 2026-03-10 10:39:06 +01:00
41d2aa7295 fix: respect JigsawStack 5000-char limit with proper batching
- buildBatches: groups texts into chunks that fit within 4800 chars
  (200 char safety margin) when joined with the separator
- translateLongText: splits individual cells/paragraphs that exceed
  the limit at paragraph/sentence boundaries, translates each chunk,
  then rejoins — instead of hitting the API with oversized input
- Process batches sequentially to avoid overloading the local model
- Separator fallback still works: if separator gets translated,
  falls back to individual calls per text within that batch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 10:26:22 +01:00
0be8b0b0f0 fix: resolve 422 from Replicate + add local Cog Docker mode
- replicate-translate: parse owner/model:hash correctly — extract only
  the hash portion for the version field, and use the model endpoint
  (POST /v1/models/{owner}/{model}/predictions) which avoids 422
  'Invalid version' errors when sending the full owner/model:hash string.

- Add local Cog mode: when replicateMode="local", calls the local Docker
  container directly (no Replicate API key needed), default endpoint
  http://localhost:5030/predictions (host port 5030 → container port 5000).

- settings-store: add replicateMode ("cloud"|"local") and localEndpoint
  fields with env var fallbacks REPLICATE_MODE and LOCAL_MODEL_ENDPOINT.

- admin panel: Radio selector for Cloud vs Local mode; shows docker run
  command snippet and local endpoint URL field when local is selected;
  hides Replicate API token field in local mode (not needed).

Local model startup:
  docker run -d -p 5030:5000 \
    r8.im/jigsawstack/text-translate@sha256:454df4c...

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 08:50:40 +01:00
e034771087 fix: handle EACCES on data/settings.json in Docker containers
- settings-store: auto-detect writable path at startup — tries
  <cwd>/data/settings.json first, falls back to /tmp/lingvai-settings.json
  if the directory is not writable. Logs a warning when fallback is used.
  Also supports SETTINGS_PATH env var for explicit override.

- Dockerfile: switch from yarn to npm, explicitly create /app/data with
  chown nextjs:nodejs so the directory is writable at runtime without
  needing a privileged volume mount.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 08:23:29 +01:00
0799101da3 feat: add admin panel, Replicate AI translation, and document translation
- Admin panel (/admin) with JWT auth: configure Replicate API token,
  JigsawStack API key, model version, enable/disable AI translation,
  change admin password. Settings persisted in data/settings.json.

- Replicate AI translation: POST /api/translate/replicate uses
  JigsawStack text-translate model via Replicate API. Main page
  switches to client-side AI translation when enabled.

- Document translation tab: supports PDF, DOCX, XLSX, XLS, CSV.
  Excel/Word formatting fully preserved (SheetJS + JSZip XML manipulation).
  PDF uses pdf-parse extraction + pdf-lib reconstruction.
  Column selector UI for tabular data (per-sheet, All/None toggles).

- Updated README with full implementation documentation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 07:43:54 +01:00
David
274e7f1a4b Refactor to external scraper and update dependencies (#113) 2022-06-15 23:37:15 +02:00
David
ff1ad202ae Fix translation query overflow (#106) 2022-05-04 21:11:44 +02:00
David
5856776785 Default languages with env & langcodes typed (#94) 2022-02-24 19:53:31 +01:00
David
0f6ad1a978 Make localStorage usable while disabling cookies (#44) 2021-09-04 18:58:26 +02:00
David
870ec2db64 Add language endpoint to developer APIs (#41)
* Added languages endpoint and its tests
2021-08-30 21:35:22 +02:00
Mohammed Anas
6f6ddfdda0 Use https for Google Translate URL (#35)
* Use https for Google Translate text-to-speech URL

* Update translate.ts
2021-08-28 16:08:34 +02:00
David
5870e4b096 Add manual translate as default (#33)
* Added translate and switch auto buttons

* Tests updated

* Added hotkey & improved buttons visually
2021-07-12 17:06:27 +02:00
David
cf0b310918 Added hotkeys + updated dependencies & webpack5 + humanetech badge (#15)
* Added language & theme switch hotkeys

* Hotkeys testing

* Language switch when equal

* Shortcut keys changed

* Dependencies updated & upgraded to webpack5

* Added HumaneTech badge

* Disabled FLoC
2021-04-30 23:11:26 +02:00
David
ea8c1bad57 Blocking behaviour while typing fixed + added spinner (#6)
* Some README tweaks

* Next's staticProps blocking beheaviour while typing fixed + Added spinner

* Testing for previous fix

* Faker deprecational update
2021-04-01 15:40:25 +02:00
David
2938f780aa APIs (#3)
* Initial RESTful API

* RESTful API tests

* Scrapping error handling refactored

* Initial GraphQL API

* GraphQL API tests
2021-03-28 23:17:47 +02:00
David
7288e9ace7 Text to Speech (#2)
* Initial TTS scrapping implemented

* Audio & copy buttons added

* TTS langs mapping fix

* Webkit audio api fix

* Added TTS-related testing

* Last tweaks
2021-03-25 16:48:46 +01:00
David
2bc931a4d3 Translation swap added 2021-03-18 23:47:12 +01:00
David
0a38a83c38 Tests refactored 2021-03-13 19:37:44 +01:00
David
c9fbfefc78 Tests for language & reducer utils 2021-03-12 19:41:20 +01:00
David
17dfdc3214 Tests for translate utils 2021-03-12 16:18:26 +01:00
David
f7897061fc Refactor using hooks rules 2021-03-11 13:29:22 +01:00
David
27ffaa425c Language switch implemented 2021-03-10 21:31:50 +01:00
David
8f33cb92f2 State refactored using reducer 2021-03-10 19:27:36 +01:00
David
61f83278bc Language selection added 2021-03-10 18:15:57 +01:00
David
d5c87d1550 Basic SSG scrapping and client-side routing 2021-03-10 01:16:52 +01:00