Commit 8d6ad73
fix(server): empty --chat-template-file falls back to hardcoded template
The usage text added in the previous commit promised:
--chat-template-file <path> Load a Jinja chat template file.
Overrides the hardcoded Qwen3/Laguna
renderer. Empty or missing falls back
to the hardcoded template.
… but the CLI parser was aborting startup with `return 1` whenever the
file length was <= 0, contradicting the "empty falls back" half of the
promise.
Behavior change: when --chat-template-file points at a 0-byte file we
now log a warning and leave ServerConfig::chat_template_src empty, so
http_server.cpp's chat handler falls through to render_chat_template()
(the hardcoded QWEN3/LAGUNA path) as documented. Non-empty files are
unchanged; short-read errors still abort.
This makes scripted launches resilient to a transient empty template
file (e.g. a half-written sed pipe, a checked-out-but-not-populated
template path) — the server starts and serves with the hardcoded
template instead of refusing to come up.
Identified by cubic.1 parent 469f6e6 commit 8d6ad73
1 file changed
Lines changed: 17 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
164 | 169 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
174 | 182 | | |
175 | | - | |
176 | | - | |
177 | 183 | | |
178 | 184 | | |
179 | 185 | | |
| |||
0 commit comments