705 Commits

Author SHA1 Message Date
Faisal Amir
5b59c7a18a
Merge pull request #6560 from menloresearch/fix/layout-downlod-management
fix: download management ui and double refresh model
2025-09-24 09:48:42 +07:00
Akarshan Biswas
38ad8deae2
feat: normalize LaTeX fragments in markdown rendering (#6488)
* feat: normalize LaTeX fragments in markdown rendering

Added a preprocessing step that converts LaTeX delimiters `\[…\]` to `$$…$$` and `\(...\)` to `$…$` before rendering. The function skips code blocks, inline code, and HTML tags to avoid unintended transformations. This improves authoring experience by supporting common LaTeX syntax without requiring explicit `$` delimiters.

* fix: correct inline LaTeX normalization replacement

The replacement function for inline math (`\(...\)`) incorrectly accepted a fourth
parameter (`post`) and appended it to the result, which could introduce stray
characters or `undefined` into the rendered output. Updated the function to
use only the captured prefix and inner content and removed the extraneous
`${post}` interpolation, ensuring clean LaTeX conversion.

* feat: optimize markdown rendering with LaTeX caching and memoized code blocks

- Added cache to normalizeLatex to avoid reprocessing repeated content
- Introduced CodeComponent with stable IDs and memoization to reduce re-renders
- Replaced per-render code block ID mapping with hash-based IDs
- Memoized copy handler and normalized markdown content
- Simplified plugin/component setup with stable references
- Added custom comparison for RenderMarkdown memoization to prevent unnecessary updates

* refactor: memoize content only

---------

Co-authored-by: Louis <louis@jan.ai>
2025-09-24 07:19:32 +05:30
Dinh Long Nguyen
b322c7649b
Merge pull request #6563 from menloresearch/feat/web-minor-ui-tweak-login
feat: tweak login UI
2025-09-23 21:09:58 +07:00
Faisal Amir
3a5580c725 chore: update test case 2025-09-23 20:25:05 +07:00
Faisal Amir
d3fff154d4 fix: download management ui and double refresh model 2025-09-23 20:17:51 +07:00
Roushan Kumar Singh
3f51c35229
feat: support .zip archives for manual backend install (#6534)
* feat(llamacpp): support .zip archives for manual backend install

* Update Lock Files
2025-09-23 18:02:06 +05:30
Nghia Doan
6f827872fb
fix: Catch local API server various errors (#6548)
* fix: Catch local API server various errors

* chore: Add tests to cover error catches
2025-09-23 17:40:16 +07:00
Faisal Amir
3bbce97329
Merge pull request #6559 from menloresearch/fix/layout-ability-model
fix: layout ability model
2025-09-23 16:13:33 +07:00
Louis
8a51cc1656
feat: add azure as first class provider (#6555)
* feat: add azure as first class provider

* fix: deployment url
2025-09-23 16:09:06 +07:00
Faisal Amir
3133d40081 fix: layout ability model 2025-09-23 15:27:41 +07:00
Dinh Long Nguyen
df61546942
feat: web remote conversation (#6554)
* feat: implement conversation endpoint

* use conversation aware endpoint

* fetch message correctly

* preserve first message

* fix logout

* fix broadcast issue locally + auth not refreshing profile on other tabs+ clean up and sync messages

* add is dev tag
2025-09-23 15:09:45 +07:00
Louis
292941e1d0
fix: prevent relocation to root directories (#6547)
* fix: prevent relocation to root directories

* Update web-app/src/locales/zh-TW/settings.json

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-09-23 10:16:11 +07:00
Alexey Haidamaka
5adc0d9d46
add full-width model names (#6350) 2025-09-23 10:14:21 +07:00
Louis
568ee857d5
fix: custom fetch for all providers (#6538)
* fix: custom fetch for all providers

* fix: run in development should use built-in fetch
2025-09-23 09:55:36 +07:00
Akarshan Biswas
885da29f28
feat: add getTokensCount method to compute token usage (#6467)
* feat: add getTokensCount method to compute token usage

Implemented a new async `getTokensCount` function in the LLaMA.cpp extension.
The method validates the model session, checks process health, applies the request template, and tokenizes the resulting prompt to return the token count. Includes detailed error handling for crashed models and API failures, enabling callers to assess token usage before sending completions.

* Fix: typos

* chore: update ui token usage

* chore: remove unused code

* feat: add image token handling for multimodal LlamaCPP models

Implemented support for counting image tokens when using vision-enabled models:
- Extended `SessionInfo` with optional `mmprojPath` to store the multimodal project file.
- Propagated `mmproj_path` from the Tauri plugin into the session info.
- Added import of `chatCompletionRequestMessage` and enhanced token calculation logic in the LlamaCPP extension:
- Detects image content in messages.
- Reads GGUF metadata from `mmprojPath` to compute accurate image token counts.
- Provides a fallback estimation if metadata reading fails.
- Returns the sum of text and image tokens.
- Introduced helper methods `calculateImageTokens` and `estimateImageTokensFallback`.
- Minor clean‑ups such as comment capitalization and debug logging.

* chore: update FE send params message include content type image_url

* fix mmproj path from session info and num tokens calculation

* fix: Correct image token estimation calculation in llamacpp extension

This commit addresses an inaccurate token count for images in the llama.cpp extension.

The previous logic incorrectly calculated the token count based on image patch size and dimensions. This has been replaced with a more precise method that uses the clip.vision.projection_dim value from the model metadata.

Additionally, unnecessary debug logging was removed, and a new log was added to show the mmproj metadata for improved visibility.

* fix per image calc

* fix: crash due to force unwrap

---------

Co-authored-by: Faisal Amir <urmauur@gmail.com>
Co-authored-by: Louis <louis@jan.ai>
2025-09-23 07:52:19 +05:30
Akarshan Biswas
bf7f176741
feat: Prompt progress when streaming (#6503)
* feat: Prompt progress when streaming

- BE changes:
    - Add a `return_progress` flag to `chatCompletionRequest` and a corresponding `prompt_progress` payload in `chatCompletionChunk`. Introduce `chatCompletionPromptProgress` interface to capture cache, processed, time, and total token counts.
    - Update the Llamacpp extension to always request progress data when streaming, enabling UI components to display real‑time generation progress and leverage llama.cpp’s built‑in progress reporting.

* Make return_progress optional

* chore: update ui prompt progress before streaming content

* chore: remove log

* chore: remove progress when percentage >= 100

* chore: set timeout prompt progress

* chore: move prompt progress outside streaming content

* fix: tests

---------

Co-authored-by: Faisal Amir <urmauur@gmail.com>
Co-authored-by: Louis <louis@jan.ai>
2025-09-22 20:37:27 +05:30
Faisal Amir
e1294cdc30
Merge pull request #6529 from menloresearch/enhancement/toaster-delete-mcp
enhancement: toaster delete mcp server
2025-09-22 21:12:02 +07:00
Louis
0d2c99a413
fix: prevent consecutive messages with same role (#6544)
* fix: prevent consecutive messages with same role

* fix: tests

* fix: first message should not be assistant

* fix: tests
2025-09-22 19:27:45 +07:00
Louis
b0b84b7eda
Merge pull request #6475 from menloresearch/feat/bump-tokenjs
feat: fix remote provider vision capability
2025-09-22 14:37:26 +07:00
Faisal Amir
ec425163d3 enhancement: toaster delete mcp server 2025-09-19 23:25:01 +07:00
Roushan Singh
ae2532d40d fix(number-input): preserve '0.0x' format when typing (#6520) 2025-09-19 11:36:06 +05:30
Louis
6bd64409e8
fix: thread rerender issue (#6515)
* fix: thread rerender issue

* chore: clean up console log

* chore: uncomment irrelevant fix

* fix: linter

* chore: remove duplicated block

* fix: tests

* fix: reduce unnessary rerender due to current thread retrieval

* fix: reduce app layout rerender due to router state update

* fix: avoid the entire app layout re render on route change

* clean: unused import

* fix: should not rerender thread message components when typing

* fix re render issue

* direct tokenspeed access

* chore: sync latest

* fix: tests

* fix: linter

* fix: build

---------

Co-authored-by: Dinh Long Nguyen <dinhlongviolin1@gmail.com>
2025-09-19 11:50:46 +07:00
Louis
0f349f4b8c
fix: build 2025-09-19 11:13:39 +07:00
Louis
1ec9c29df6
fix: linter 2025-09-19 11:08:37 +07:00
Louis
3d8cfbf99a
fix: tests 2025-09-19 10:56:25 +07:00
Akarshan Biswas
d1a8bdc4e3
feat: Add Jan API server Swagger UI (#6502)
* feat: Add Jan API server Swagger UI

- Serve OpenAPI spec (`static/openapi.json`) directly from the proxy server.
- Implement Swagger UI assets (`swagger-ui.css`, `swagger-ui-bundle.js`, `favicon.ico`) and a simple HTML wrapper under `/docs`.
- Extend the proxy whitelist to include Swagger UI routes.
- Add routing logic for `/openapi.json`, `/docs`, and Swagger UI static files.
- Update whitelisted paths and integrate CORS handling for the new endpoints.

* feat: serve Swagger UI at root path

The Swagger UI endpoint previously lived under `/docs`. The route handling and
exclusion list have been updated so the UI is now served directly at `/`.
This simplifies access, aligns with the expected root URL in the Tauri
frontend, and removes the now‑unused `/docs` path handling.

* feat: add model loading state and translations for local API server

Implemented a loading indicator for model startup, updated the start/stop button to reflect model loading and server starting states, and disabled interactions while pending. Added new translation keys (`loadingModel`, `startingServer`) across all supported locales (en, de, id, pl, vn, zh-CN, zh-TW) and integrated them into the UI. Included a small delay after model start to ensure backend state consistency. This improves user feedback and prevents race conditions during server initialization.
2025-09-19 09:11:55 +05:30
Louis
c9d165e65c
Merge branch 'dev' into fix/thread-rerender-issue 2025-09-19 10:34:08 +07:00
Louis
ebb6837437 chore: sync latest 2025-09-19 10:30:03 +07:00
Dinh Long Nguyen
4cfc88ae95 direct tokenspeed access 2025-09-18 23:28:05 +07:00
Dinh Long Nguyen
c5c39f22e6 Merge branch 'fix/thread-rerender-issue' of https://github.com/menloresearch/jan into fix/thread-rerender-issue 2025-09-18 23:21:28 +07:00
Dinh Long Nguyen
a39c38e1fd fix re render issue 2025-09-18 23:11:50 +07:00
Louis
508879e3ae fix: should not rerender thread message components when typing 2025-09-18 22:44:03 +07:00
Dinh Long Nguyen
359dd8f41e
Merge pull request #6514 from menloresearch/feat/web-gtag
feat: Add GA Measurement and change keyboard bindings on web
2025-09-18 20:45:41 +07:00
Dinh Long Nguyen
645548e931
Merge pull request #6516 from menloresearch/release/v0.6.10 2025-09-18 19:15:54 +07:00
Louis
f237936b0c
clean: unused import 2025-09-18 18:49:12 +07:00
Louis
5f6a68d844
fix: avoid the entire app layout re render on route change 2025-09-18 18:44:21 +07:00
Louis
be83395f69 fix: reduce app layout rerender due to router state update 2025-09-18 18:26:03 +07:00
Louis
6342956cd6 fix: reduce unnessary rerender due to current thread retrieval 2025-09-18 17:55:07 +07:00
Louis
86a92ead85
Merge pull request #6469 from menloresearch/fix/deeplink-not-work-on-windows
fix: deeplink issue on Windows
2025-09-18 17:47:00 +07:00
Louis
2a2bc40dfe
fix: tests 2025-09-18 17:21:59 +07:00
Louis
707fdac2ce chore: remove duplicated block 2025-09-18 16:45:37 +07:00
Louis
e64607eb43 fix: linter 2025-09-18 16:44:16 +07:00
Louis
da69f3acec chore: uncomment irrelevant fix 2025-09-18 16:35:56 +07:00
Louis
f271e8fe9c chore: clean up console log 2025-09-18 16:31:19 +07:00
Louis
241a90492e fix: thread rerender issue 2025-09-18 16:24:42 +07:00
Dinh Long Nguyen
0f85fce6ef
feat: add auth + google auth provider for web (#6505)
* handle google auth

* fix lint

* fix auto login button type

* update i18 language + userprofilemenu position

* minor api rename for consistency
2025-09-18 11:11:14 +07:00
Faisal Amir
6f2a01990f chore: prevent click outside for edit dialog 2025-09-17 09:35:36 +07:00
Faisal Amir
7fc3afd0ef
Merge pull request #6478 from menloresearch/fix/mcp-json-validation
fix: mcp json  validation structure and serverName
2025-09-17 09:01:01 +07:00
Faisal Amir
a3c2c1aa3b fix: validat type mcp json 2025-09-16 22:35:51 +07:00
Faisal Amir
703b44558c chore: update locale mcp json 2025-09-16 17:24:32 +07:00