Skip to content

Add 测速 and 设为默认 for FreeOS local models - #48

Merged
XYAIStudio merged 1 commit into
mainfrom
cursor/local-model-speed-default-de1f
Sep 17, 2026
Merged

XYAIStudio merged 1 commit into
mainfrom
cursor/local-model-speed-default-de1f

Conversation

@XYAIStudio

@XYAIStudio XYAIStudio commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Models page local list (Ollama / registered GGUF) now supports two desktop-friendly actions:

  1. 测速 (speed test) — pings the local runtime with a tiny fixed prompt and shows total latency, time-to-first-token, and tokens/sec.
  2. 设为默认 (set as default) — marks a registered local model as the chat default so new conversations and the model picker prefer it.

How default is stored

  • Per-user preferred_model in user preferences (provider/model, e.g. Ollama (Local)/tiny). The chat composer already initializes new threads from this value.
  • Global active_model in settings KV (same provider/model ref). AUTO expert routing and the Models pool fall back to this when the user has no preferred model.
  • Clear default (取消默认) clears the preferred model and, when it matches, the global active model.
  • Set-default is allowed when the tag is registered or already enabled on the local provider, even if Ollama is currently down.

How speed test is measured

  • POST /api/local-models/speed-test with { name }.
  • First tries native Ollama POST {root}/api/generate (streamed) with Reply with the single word ok. and num_predict=16.
  • Falls back to OpenAI-compatible {base}/v1/chat/completions if generate returns 404/405.
  • latency_ms: wall time of the request.
  • ttft_ms: time until the first non-empty token.
  • tokens_per_sec: Ollama eval_count / eval_duration when present, otherwise tokens / elapsed.
  • Timeout 45s on both server and UI; the UI can cancel without blocking the page. Last result is kept in sessionStorage on the model row.
  • If Ollama is down, 测速 is disabled with an explanation; 设为默认 stays available for registered models.

Target branch

  • Base is main (requested)

Type of change

  • New feature

Test plan

  • uv run pytest tests/unit/agents/test_local_speed.py tests/unit/agents/test_local_default.py tests/integration/test_local_models_default.py
  • npx vitest run for LocalHardwarePanel + localSpeedResults (7 passed)
  • uv run ruff check + mypy --strict src/octop
  • cd dashboard && npx tsc --noEmit
  • make test — 3497 passed, 15 skipped
  • GitHub CI — 5 checks green on 971e5d75
  • Live Ollama UI click-through (not available in this environment)

Checklist

  • Updated CHANGELOG.md
  • Updated docs/api.md
Open in Web Open in Cursor 

Let FreeOS users time a registered Ollama/local model and mark it as
the chat default from the Models page local list.

Co-authored-by: XYAI Labs <haoboy8@gmail.com>
@XYAIStudio
XYAIStudio marked this pull request as ready for review September 17, 2026 14:45
@XYAIStudio
XYAIStudio merged commit 28356d9 into main Sep 17, 2026
5 checks passed
@XYAIStudio
XYAIStudio deleted the cursor/local-model-speed-default-de1f branch September 17, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants