Skip to content

[pull] main from lobehub:main#416

Merged
pull[bot] merged 3 commits into
code:mainfrom
lobehub:main
Sep 4, 2025
Merged

[pull] main from lobehub:main#416
pull[bot] merged 3 commits into
code:mainfrom
lobehub:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Sep 4, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

MapleEve and others added 3 commits September 4, 2025 23:47
…9041)

* ✨ feat: add NewAPI as a router provider for multi-model aggregation

* Update packages/model-runtime/src/newapi/index.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update packages/model-runtime/src/newapi/index.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update packages/model-runtime/src/newapi/index.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update packages/model-runtime/src/newapi/index.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* 🐛 fix: correct baseURL configuration and add comprehensive tests for NewAPI

- Fix baseURL handling to avoid double /v1 path
- Add url-join for proper URL concatenation
- Simplify router models functions using Array.from and filter
- Add comprehensive test coverage with 100% branch coverage
- Fix TypeScript type issues in tests

* 🧪 test: implement 100% branch coverage for NewAPI runtime

- Add comprehensive test suite with 44 test cases
- Achieve 100% branch coverage for all conditional logic
- Test all provider detection, pricing calculation, and data handling branches
- Fix TypeScript type errors with proper type annotations
- Maintain all 44 tests passing with zero errors
- Cover handlePayload, getProviderFromOwnedBy, and models function branches
- No business code modifications - test-only changes

* 🔨 fix: adjust for review comment #9041 (review)

* 🐛 fix: resolve NewAPI baseURL transmission issue with dynamic routers configuration

- Extend RouterRuntime to support dynamic routers: RouterInstance[] | ((options) => RouterInstance[])
- Refactor NewAPI from IIFE closure to dynamic configuration function
- Fix timing issue where routers were configured before baseURL was available
- Add comprehensive tests for dynamic routers functionality
- Resolve 'Invalid URL input: v1/models' error by ensuring user baseURL propagates correctly
- Maintain backward compatibility with static routers arrays

Tests: NewAPI (44→45), RouterRuntime (15→17), all passing
## [Version&nbsp;1.123.0](v1.122.7...v1.123.0)
<sup>Released on **2025-09-04**</sup>

#### ✨ Features

- **misc**: Add NewAPI as a router provider for multi-model aggregation.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's improved

* **misc**: Add NewAPI as a router provider for multi-model aggregation, closes [#9041](#9041) [/github.com//pull/9041#pullrequestreview-3183464594](https://github.com//github.com/lobehub/lobe-chat/pull/9041/issues/pullrequestreview-3183464594) ([7e291c2](7e291c2))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@pull pull Bot locked and limited conversation to collaborators Sep 4, 2025
@pull pull Bot added the ⤵️ pull label Sep 4, 2025
@pull pull Bot merged commit 837065f into code:main Sep 4, 2025
6 of 9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants