Commit graph

447 commits

Author SHA1 Message Date
3bd518ff20 adjust progress timing: keep Hermes as default, speed up for Groq only 2025-07-12 11:26:05 -04:00
34e5e25bfb replace URL constructor with regex validation for remote URLs
- URL constructor was too strict and failing on valid domains
- new regex pattern validates common URL formats more permissively
- ensures scheme prepending works in both main logic and fetchRemotePageHTML
- fixes issues with domains like www.inrupt.com
2025-07-12 11:13:40 -04:00
c4c216316f auto-add https:// scheme to remote URLs when missing 2025-07-12 11:06:53 -04:00
e6e7a77fa3 use selected model name in translation progress messages
- replace hardcoded "Hermes AI" with actual selected model
- progress now shows "Translating with <model-name>..."
- makes progress messages accurate for all model selections
2025-07-12 11:03:43 -04:00
79377af49a switch tab order: remote URL tab now comes before custom text tab 2025-07-12 11:02:27 -04:00
e87e27b2a2 show both English and native language names in translation dropdown 2025-07-12 11:01:00 -04:00
7851c5747c fix remote URL input height - make it single line instead of textarea height 2025-07-12 08:35:18 -04:00
4c75f7cd6e fix chat and ui max_tokens errors with Groq models
- cap all max_tokens to model's max completion tokens limit
- fixes sendMessageWithCustomHistory in chat.js
- fixes intro generation in ui.js
- fixes TTS processing token calculation
- prevents "max_tokens must be less than or equal to 8192" errors
2025-07-12 07:51:31 -04:00
337f9970a8 improve translation prompt to prevent explanatory text prefixes 2025-07-12 07:40:38 -04:00
41ba59db1b use API-provided max completion tokens instead of hardcoding
Fetch and store maxCompletionTokens from models endpoint to respect
each model's specific output limits. This fixes 400 errors from
Groq models that have different completion limits than context windows.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 07:36:31 -04:00
a864366c80 add hardcoded context windows for Groq models 2025-07-12 07:28:13 -04:00
fd71442331 remove chunking complexity, use simple fit-or-error approach 2025-07-12 07:19:00 -04:00
50a0487bcd fix chunking to work directly with body children and handle edge cases 2025-07-12 07:14:51 -04:00
d4aa30e454 implement sibling-level chunking to prevent DOM duplication 2025-07-12 07:10:14 -04:00
e2c211b9c6 add chunk content debugging to identify duplication source 2025-07-11 22:10:46 -04:00
60743c5bfb add better error logging for fragment translation debugging 2025-07-11 22:04:44 -04:00
b7563d0f2b create separate translation functions for full pages vs fragments 2025-07-11 22:00:07 -04:00
e975e97ea3 fix chunk reassembly stacking and increase batch size for speed 2025-07-11 21:54:54 -04:00
a8a4359e96 auto-detect and cache endpoints without tokenization support
When upstream tokenization fails (404, errors), cache the endpoint
and automatically use JS tokenizer for future requests. This fixes
chunking for APIs like Groq that don't have tokenize endpoints.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-11 21:52:24 -04:00
e50b0b8118 improve token allocation for chunked translations
Changed from broken buffer calculation to 40% output reserve which gives
individual chunks much more room for translation output. Reverted
preservation mode changes to keep original behavior.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-11 21:47:06 -04:00
8dbf607c03 fix duplicate const declaration of getSelectedModel
Consolidated duplicate imports in translate-modal.js that were causing
SyntaxError: redeclaration of const getSelectedModel.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-11 21:42:46 -04:00
04f0ac766b fix token buffer calculation causing chunking to fail
Previous buffer calculation used 1.5x input tokens which exceeded model
context window for large content. Changed to fixed 1000 token reserve
and improved chunk sizing to use reasonable portions of model capacity.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-11 21:38:47 -04:00
7b34e60f63 fix getSelectedModelMaxTokens import in progress calculation 2025-07-11 21:23:51 -04:00
854d22ee79 fix progress calculation to show actual tokens including preservation and chunking 2025-07-11 21:21:58 -04:00
cfc6dec1f4 remove unnecessary preservation in progress calculation that was creating placeholder confusion 2025-07-11 21:18:59 -04:00
a7dddf24d8 fix small model cutoffs by accounting for translation output expansion in chunking logic 2025-07-11 21:02:23 -04:00
a43714f82d fix tab content visibility and add proper styling to URL input 2025-07-11 20:59:43 -04:00
9550fb8e94 re-enable relative to absolute URL conversion for remote translations 2025-07-11 20:54:56 -04:00
e0a784c073 fix remote translation double processing by calling translateHTML directly 2025-07-11 20:53:54 -04:00
004764a05b add translation ID tracking to debug repeated page issues 2025-07-11 20:50:07 -04:00
84b06202dd fix countTokens returning object instead of number causing incorrect chunking 2025-07-11 20:48:40 -04:00
af6108e988 add debug logging to see why chunking is being triggered when it shouldn't 2025-07-11 20:46:44 -04:00
f476b6e476 disable URL conversion during chunking and add debug logging for chunk content 2025-07-11 20:43:09 -04:00
8e78df00c0 fix DOM duplication by chunking only body content and reassembling properly 2025-07-11 20:39:15 -04:00
bbac26b487 fix chunking to work on original HTML before preservation, not placeholder soup 2025-07-11 20:29:05 -04:00
a2a786040e remove preservations references from translateTextRaw function 2025-07-11 20:24:50 -04:00
99bdb1c6f8 clean up preservations scope in translation functions 2025-07-11 20:22:30 -04:00
7d3e7ec111 complete translateTextRaw function to properly separate raw and preserved translation 2025-07-11 20:19:39 -04:00
36828be6ae fix double HTML preservation in chunked translations by using raw translate function 2025-07-11 20:18:46 -04:00
5ddf7d36d7 fix HTML placeholder restoration in parallel chunk translation 2025-07-11 20:16:27 -04:00
eed55b922a add parallel chunk translation for massive speed improvement on large pages 2025-07-11 20:13:38 -04:00
0b02a3d75e implement intelligent chunking for large page translations based on actual token limits 2025-07-11 20:11:31 -04:00
0f51d07eb1 add translateHTML function to unify translation logic between current page and remote page translations 2025-07-11 19:47:04 -04:00
a340ea4f75 convert all relative URLs to absolute URLs in remote translations 2025-07-11 19:42:11 -04:00
46a7a8c92e fix base URL resolution for remote translations using proper URL constructor 2025-07-11 19:31:21 -04:00
d09b204f60 fix preservations variable name in translateRemoteHTML 2025-07-11 19:28:09 -04:00
3d06f28954 fix remote translation to preserve full DOM structure like page translation 2025-07-11 19:25:23 -04:00
4d53518087 fix translate modal: 3 columns layout and always open remote translations in new window 2025-07-11 19:19:38 -04:00
a89a45e177 update CORS proxy to use cors-proxy.uncloseai.com endpoint 2025-07-11 19:05:47 -04:00
2b69a4d17d update CORS proxy URL to use query parameter format 2025-07-11 17:46:23 -04:00