From 1e7a711e368893f3f47c2e848a4a3aa9ddeab402 Mon Sep 17 00:00:00 2001 From: Laura Date: Sun, 9 Nov 2025 22:12:32 +0100 Subject: [PATCH] add provider sorting --- chat.go | 16 ++++++++++++++++ static/css/chat.css | 8 ++++++-- static/css/dropdown.css | 1 + static/index.html | 11 ++++++++++- static/js/chat.js | 17 ++++++++++++++--- static/js/lib.js | 4 +++- 6 files changed, 50 insertions(+), 7 deletions(-) diff --git a/chat.go b/chat.go index a313c2e..feec519 100644 --- a/chat.go +++ b/chat.go @@ -54,6 +54,7 @@ type Metadata struct { type Request struct { Prompt string `json:"prompt"` Model string `json:"model"` + Provider string `json:"provider"` Temperature float64 `json:"temperature"` Iterations int64 `json:"iterations"` Tools Tools `json:"tools"` @@ -168,6 +169,21 @@ func (r *Request) Parse() (*openrouter.ChatCompletionRequest, error) { } } + switch r.Provider { + case "throughput": + request.Provider = &openrouter.ChatProvider{ + Sort: openrouter.ProviderSortingThroughput, + } + case "latency": + request.Provider = &openrouter.ChatProvider{ + Sort: openrouter.ProviderSortingLatency, + } + case "price": + request.Provider = &openrouter.ChatProvider{ + Sort: openrouter.ProviderSortingPrice, + } + } + if model.JSON && r.Tools.JSON { request.ResponseFormat = &openrouter.ChatCompletionResponseFormat{ Type: openrouter.ChatCompletionResponseFormatTypeJSONObject, diff --git a/static/css/chat.css b/static/css/chat.css index 871a8c9..f62f2c9 100644 --- a/static/css/chat.css +++ b/static/css/chat.css @@ -518,8 +518,8 @@ body:not(.loading) #loading { .message .time { font-family: "Comic Code", ui-monospace, "Cascadia Mono", "Segoe UI Mono", "Ubuntu Mono", "Roboto Mono", Menlo, Monaco, Consolas, monospace; - font-size: 11px; - line-height: 12px; + font-size: 10px; + line-height: 10px; position: absolute; top: 3px; right: 3px; @@ -1199,6 +1199,10 @@ label[for="iterations"] { background-image: url(icons/iterations.svg); } +label[for="provider-sorting"] { + background-image: url(icons/provider.svg); +} + label[for="reasoning-effort"] { background-image: url(icons/reasoning.svg); } diff --git a/static/css/dropdown.css b/static/css/dropdown.css index f1a7195..170e7d5 100644 --- a/static/css/dropdown.css +++ b/static/css/dropdown.css @@ -6,6 +6,7 @@ font-size: 14px; white-space: nowrap; max-width: 160px; + min-width: 60px; } .dropdown .selected { diff --git a/static/index.html b/static/index.html index 070dd62..c7ec20b 100644 --- a/static/index.html +++ b/static/index.html @@ -47,7 +47,7 @@