refactor: simplify OpenRouter context window selection

- collapse if/else-if into a single condition
- same behavior (no change in functionality)
This commit is contained in:
Neil Vallecer 2026-06-09 23:45:31 +08:00
parent 1425e68636
commit bd648be324

View file

@ -284,9 +284,7 @@ func DiscoverOpenRouter(ctx context.Context, baseURL string) ([]Model, error) {
display = d.ID
}
ctxWin := d.ContextLength
if ctxWin == 0 {
ctxWin = d.TopProvider.ContextLength
} else if d.TopProvider.ContextLength > 0 && d.TopProvider.ContextLength < ctxWin {
if d.TopProvider.ContextLength > 0 && (ctxWin == 0 || d.TopProvider.ContextLength < ctxWin) {
ctxWin = d.TopProvider.ContextLength
}
maxOut := 0