Commit 88b87c0
feat: user-facing temperature setting (#2275)
* feat: user-facing temperature setting for LLM requests
Add a configurable default sampling temperature (0.0–2.0) that users
can set via the web settings UI or API. The setting flows into the
main conversational agent loop via ReasoningContext, replacing the
hardcoded 0.7 default. Per-request temperature (e.g. from the
OpenAI-compatible endpoint) still takes precedence.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: admin-scoped settings fallback for multi-tenant
Admin-set defaults now propagate to all members who haven't overridden
the value themselves. Three layers of change:
1. TenantScope::get_setting_with_admin_fallback() — checks user scope
first, then falls back to __admin__ scope. Used by the dispatcher
for temperature and selected_model.
2. Config::from_db_with_toml() — layers admin-scope settings between
TOML and per-user DB settings during resolution. Priority:
TOML < admin DB < per-user DB.
3. Settings API — GET/PUT/DELETE /api/settings/{key}?scope=admin lets
admins read/write to the shared default scope. Non-admins get 403.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: clamp temperature to 0.0-2.0 before reaching provider
Address review comment on #2275: the backend must guard against
bad DB values and per-request overrides that bypass the frontend
range enforcement. Some providers reject out-of-range temperatures
outright.
Clamped at both the read site (dispatcher reading DB settings) and
the use site (reasoning.rs respond_with_tools) for defense in depth.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: address PR #2275 review feedback
- Strip admin-only LLM keys (ollama_base_url, openai_compatible_base_url,
llm_builtin_overrides, llm_custom_providers) from the admin-scope merge
in `Config::from_db_with_toml` and `Config::re_resolve_llm_with_secrets`
when the resolving user is not an operator. Defense-in-depth so a
non-admin member never inherits private/loopback provider endpoints
from admin defaults.
- Preserve per-request `reason_ctx.temperature` precedence in the
dispatcher: settings-derived temperature only applies when no value
was already set by the API caller. Extract `resolve_settings_temperature`
helper for direct unit testing.
- Add regression tests covering admin-scope strip behavior for both
operator and non-operator paths, plus the temperature precedence rule
including range clamping.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent cd9b60c commit 88b87c0
File tree
12 files changed
+367
-28
lines changed- crates/ironclaw_gateway/static
- i18n
- src
- agent
- channels/web
- handlers
- config
- llm
12 files changed
+367
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7084 | 7084 | | |
7085 | 7085 | | |
7086 | 7086 | | |
| 7087 | + | |
| 7088 | + | |
| 7089 | + | |
| 7090 | + | |
| 7091 | + | |
| 7092 | + | |
7087 | 7093 | | |
7088 | 7094 | | |
7089 | 7095 | | |
| |||
7429 | 7435 | | |
7430 | 7436 | | |
7431 | 7437 | | |
7432 | | - | |
| 7438 | + | |
7433 | 7439 | | |
7434 | 7440 | | |
7435 | | - | |
| 7441 | + | |
7436 | 7442 | | |
7437 | 7443 | | |
7438 | 7444 | | |
7439 | 7445 | | |
7440 | 7446 | | |
7441 | 7447 | | |
7442 | | - | |
| 7448 | + | |
7443 | 7449 | | |
7444 | 7450 | | |
7445 | | - | |
| 7451 | + | |
7446 | 7452 | | |
7447 | 7453 | | |
7448 | 7454 | | |
7449 | 7455 | | |
7450 | | - | |
| 7456 | + | |
7451 | 7457 | | |
7452 | 7458 | | |
7453 | 7459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
524 | 527 | | |
525 | 528 | | |
526 | 529 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
523 | 526 | | |
524 | 527 | | |
525 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
523 | 526 | | |
524 | 527 | | |
525 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
30 | 48 | | |
31 | 49 | | |
32 | 50 | | |
| |||
583 | 601 | | |
584 | 602 | | |
585 | 603 | | |
586 | | - | |
| 604 | + | |
587 | 605 | | |
588 | | - | |
589 | | - | |
| 606 | + | |
| 607 | + | |
590 | 608 | | |
591 | 609 | | |
592 | | - | |
593 | | - | |
594 | 610 | | |
595 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
596 | 629 | | |
597 | 630 | | |
598 | 631 | | |
| |||
1693 | 1726 | | |
1694 | 1727 | | |
1695 | 1728 | | |
1696 | | - | |
| 1729 | + | |
| 1730 | + | |
1697 | 1731 | | |
1698 | 1732 | | |
1699 | 1733 | | |
| |||
3041 | 3075 | | |
3042 | 3076 | | |
3043 | 3077 | | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
3044 | 3119 | | |
3045 | 3120 | | |
3046 | 3121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
20 | 45 | | |
21 | 46 | | |
22 | 47 | | |
| |||
68 | 93 | | |
69 | 94 | | |
70 | 95 | | |
| 96 | + | |
71 | 97 | | |
| 98 | + | |
| 99 | + | |
72 | 100 | | |
73 | 101 | | |
74 | 102 | | |
75 | 103 | | |
76 | 104 | | |
77 | | - | |
| 105 | + | |
78 | 106 | | |
79 | 107 | | |
80 | 108 | | |
| |||
88 | 116 | | |
89 | 117 | | |
90 | 118 | | |
91 | | - | |
| 119 | + | |
92 | 120 | | |
93 | 121 | | |
94 | 122 | | |
| |||
106 | 134 | | |
107 | 135 | | |
108 | 136 | | |
| 137 | + | |
109 | 138 | | |
110 | 139 | | |
| 140 | + | |
111 | 141 | | |
112 | 142 | | |
113 | 143 | | |
| |||
117 | 147 | | |
118 | 148 | | |
119 | 149 | | |
120 | | - | |
| 150 | + | |
121 | 151 | | |
122 | 152 | | |
123 | 153 | | |
124 | 154 | | |
125 | 155 | | |
126 | 156 | | |
127 | 157 | | |
128 | | - | |
| 158 | + | |
129 | 159 | | |
130 | 160 | | |
131 | | - | |
| 161 | + | |
132 | 162 | | |
133 | 163 | | |
134 | 164 | | |
135 | 165 | | |
136 | 166 | | |
137 | | - | |
| 167 | + | |
138 | 168 | | |
139 | 169 | | |
140 | 170 | | |
| |||
241 | 271 | | |
242 | 272 | | |
243 | 273 | | |
| 274 | + | |
244 | 275 | | |
| 276 | + | |
245 | 277 | | |
246 | 278 | | |
247 | 279 | | |
| |||
252 | 284 | | |
253 | 285 | | |
254 | 286 | | |
255 | | - | |
256 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
257 | 293 | | |
258 | 294 | | |
259 | 295 | | |
260 | | - | |
| 296 | + | |
261 | 297 | | |
262 | 298 | | |
263 | 299 | | |
| |||
1217 | 1253 | | |
1218 | 1254 | | |
1219 | 1255 | | |
| 1256 | + | |
1220 | 1257 | | |
1221 | 1258 | | |
1222 | 1259 | | |
| |||
1240 | 1277 | | |
1241 | 1278 | | |
1242 | 1279 | | |
| 1280 | + | |
1243 | 1281 | | |
1244 | 1282 | | |
1245 | 1283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
| 613 | + | |
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
911 | 911 | | |
912 | 912 | | |
913 | 913 | | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
914 | 922 | | |
915 | 923 | | |
916 | 924 | | |
| |||
0 commit comments