Commit e4d082d
authored
feat: add reasoning_rewrite adapter and debounced inputs (#446)
## Summary of Changes
This Pull Request introduces the **`reasoning_rewrite` Provider
Adapter** and a highly reusable **`DebouncedInput`** UI component to
solve two distinct operational and performance issues in Plexus.
### 1. The `reasoning_rewrite` Adapter (Backend)
Different LLM backends expect reasoning configurations via various
custom keys (e.g., `enable_thinking`, `budget_tokens`, or
`thinking.type`).
* **Final State:** The backend now includes a declarative
`reasoning_rewrite` adapter that maps unified reasoning properties
(`reasoning.enabled`, `reasoning.effort`) to provider-specific layouts
in outbound request payloads, and then strips the unified values
afterward if configured.
* **Safety & Correctness:**
* Uses `structuredClone(payload)` upon first mutation to deeply clone
request bodies. This prevents any in-place mutation of nested objects in
the original payload, keeping request-retries and downstream logging
100% stable.
* Extensively tested with 718 custom test scenarios (including
DeepSeek-R1 sequential stripping and mapping scenarios).
### 2. High-Performance `DebouncedInput` Shared UI (Frontend)
To solve rendering overhead when typing in heavy model-level or
provider-level editor forms:
* **Final State:** Added a reusable `DebouncedInput` component under
`packages/frontend/src/components/ui/DebouncedInput.tsx`. It wraps the
standard Input, holding local text state and propagating updates via a
300ms debounce.
* **Performance Upgrades Applied:**
* **`reasoning_rewrite` Adapter:** Source, when conditions, and target
rewrites now use debounced inputs.
* **`model_override` Adapter:** Rewrite target and trigger condition
key-value fields now use debounced inputs.
* **Per-Model "Extra Body Fields":** Key-value inputs are now debounced.
* **Provider-Level Stall Detection Overrides:** Replaced five duplicate
manual state draft hooks and custom blur logic with `DebouncedInput`.
* **Provider-Level Headers & "Extra Body Fields":** Key-value inputs are
now debounced.
All type checking, OpenAPI schemas, biome formatting, and test suites
are 100% green and verified.12 files changed
Lines changed: 1969 additions & 136 deletions
File tree
- docs/openapi/components/schemas
- packages
- backend/src
- transformers/adapters
- __tests__
- frontend/src
- components
- providers
- ui
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
231 | 242 | | |
232 | 243 | | |
233 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
120 | 173 | | |
121 | 174 | | |
122 | 175 | | |
| |||
0 commit comments