Commit 5c5a893
authored
Fix preserveReasoning flag to control API reasoning inclusion (#9453)
* feat: store reasoning in conversation history for all providers
* refactor: address review feedback
- Move comments inside else block
- Combine reasoning checks into single if block
- Make comments more concise
* refactor: make comments more concise
* Fix preserveReasoning flag to control API reasoning inclusion
Changes:
1. Removed hardcoded <think> tag logic in streaming
- Previously hardcoded reasoning into assistant message text
- Now passes reasoning to addToApiConversationHistory as parameter
2. Updated buildCleanConversationHistory to respect preserveReasoning flag
- When preserveReasoning: true → reasoning block included in API requests
- When preserveReasoning: false/undefined → reasoning stripped from API
- Reasoning stored in history for all cases
3. Added temporary debug logs to base-openai-compatible-provider.ts
- Shows preserveReasoning flag value
- Logs reasoning blocks in incoming messages
- Logs <think> tags in converted messages sent to API
* Fix: Use api.getModel() directly instead of cachedStreamingModel
Addresses review comment: cachedStreamingModel is set during streaming but
buildCleanConversationHistory is called before streaming starts. Using the
cached value could cause stale model info when switching models between requests.
Now directly uses this.api.getModel().info.preserveReasoning to ensure we
always check the current model's flag, not a potentially stale cached value.
* Clean up comments in Task.ts
Removed outdated comment regarding model's preserveReasoning flag.
* fix: remove unnecessary reasoningBlock variable in task reasoning logic1 parent 7715158 commit 5c5a893
1 file changed
+17
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2660 | 2660 | | |
2661 | 2661 | | |
2662 | 2662 | | |
2663 | | - | |
2664 | | - | |
2665 | | - | |
2666 | | - | |
2667 | | - | |
2668 | | - | |
2669 | | - | |
2670 | 2663 | | |
2671 | 2664 | | |
2672 | 2665 | | |
2673 | 2666 | | |
2674 | | - | |
| 2667 | + | |
2675 | 2668 | | |
2676 | 2669 | | |
2677 | | - | |
| 2670 | + | |
2678 | 2671 | | |
2679 | 2672 | | |
2680 | 2673 | | |
| |||
3439 | 3432 | | |
3440 | 3433 | | |
3441 | 3434 | | |
3442 | | - | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
3443 | 3439 | | |
3444 | 3440 | | |
3445 | | - | |
3446 | | - | |
3447 | | - | |
3448 | | - | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
3449 | 3444 | | |
3450 | | - | |
| 3445 | + | |
| 3446 | + | |
| 3447 | + | |
| 3448 | + | |
| 3449 | + | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
3451 | 3453 | | |
3452 | 3454 | | |
3453 | 3455 | | |
| |||
0 commit comments