Skip to content

feat(ui): add Token Router management - #5378

Open
m199369309 wants to merge 9 commits into
xorbitsai:mainfrom
m199369309:feat/token-router-ui
Open

feat(ui): add Token Router management#5378
m199369309 wants to merge 9 commits into
xorbitsai:mainfrom
m199369309:feat/token-router-ui

Conversation

@m199369309

@m199369309 m199369309 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add the /token-router management page and navigation/permission integration
  • support Token Router CRUD, enable/disable, validation, runtime status and detail views
  • provide V1 and V2 routing editors, typed rules, backend candidate selection and config normalization
  • add tokenizer asset selection/validation and direct-path permission handling
  • add English, Chinese, Japanese and Korean translations and service types

Dependency

Depends on #5375
Depends on #5376

Please merge the prerequisite PRs first. This PR is intentionally stacked and targets main for review.

Validation

  • npm run lint (passed with existing repository warnings only)
  • npm run build (passed; /token-router exported successfully)

Please review now if convenient, but merge only after the dependency PRs have landed.

@XprobeBot XprobeBot added this to the v3.x milestone Aug 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a token-aware router feature for DeepSeek-V4 on Xinference, adding both frontend UI components and backend services to manage routing between short- and long-context model backends. The review feedback highlights several critical issues to address before merging: performance bottlenecks from creating httpx.AsyncClient per request and using copy.deepcopy on chat history; event loop blocking during synchronous asset validation; Python 3.8/3.10 compatibility issues with cancel_futures, asyncio.to_thread, and TimeoutError handling; a potential TypeError if template_kwargs contains a 'messages' key; and a minor typo in a string literal.

Comment thread xinference/api/restful_api.py Outdated
Comment thread xinference/core/supervisor.py Outdated
Comment thread xinference/router/tokenization.py
Comment thread xinference/router/tokenization.py
Comment thread xinference/router/admission.py Outdated
Comment thread xinference/router/control_plane.py
Comment thread xinference/api/restful_api.py Outdated
Comment thread xinference/router/tokenizer.py Outdated
Comment thread xinference/router/tokenizer.py Outdated
@m199369309
m199369309 force-pushed the feat/token-router-ui branch 3 times, most recently from a826225 to fe37a89 Compare August 18, 2026 18:08
- P1-1: stop executing asset Python in the Supervisor; validation is
  static (manifest, checksum, path safety, file hashes) and smoke tests
  are removed.
- P1-2: Router workers measure the asset fingerprint and asset.json
  revision after real loading and report them through the heartbeat;
  the Supervisor compares against measured values, with TOCTOU checks.
- P2: propagate asset capabilities into RouterConfig and enforce them
  on the request path (tools/thinking) and during rule validation.
The CI optional deps (diffusers -> huggingface-hub>=1.23) resolve click to
8.4.x, which removed CliRunner(mix_stderr=...) and captures stdout/stderr
separately by default. The two failing cmdline tests assumed click <8.2
semantics:

- test_cmdline_model_path_error: drop mix_stderr=False (unused by the test).
- test_cmdline_of_custom_model: assert on result.output (combined streams on
  both click <8.2 mix_stderr default and click >=8.4 capture='sys'), since
  list_model_registrations writes its table to stderr.
@m199369309
m199369309 force-pushed the feat/token-router-ui branch from 45bd480 to fa28725 Compare August 21, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants