server : only enable token timestamps when the response needs them
max_len defaults to 60 in the server, and that only takes effect on the token timestamps path. Until v1.8.3 token timestamps were limited to verbose_json, so the default never reached other formats. #3679 removed that condition, which left every response wrapped at 60 characters, on a token boundary rather than a word one. Resolve the default after the other parameters and enable it only for verbose_json, or when max_len or split_on_word was asked for. Clients passing max_len with any format still get wrapping.
This commit is contained in:
parent
592feef04a
commit
d6f2c0f49e
|
|
@ -554,8 +554,6 @@ void get_req_parameters(const Request & req, whisper_params & params)
|
|||
if (req.has_file("token_timestamps"))
|
||||
{
|
||||
params.token_timestamps = parse_str_to_bool(req.get_file_value("token_timestamps").content);
|
||||
} else {
|
||||
params.token_timestamps = !params.no_timestamps;
|
||||
}
|
||||
if (req.has_file("language"))
|
||||
{
|
||||
|
|
@ -625,6 +623,17 @@ void get_req_parameters(const Request & req, whisper_params & params)
|
|||
{
|
||||
params.no_language_probabilities = parse_str_to_bool(req.get_file_value("no_language_probabilities").content);
|
||||
}
|
||||
|
||||
// resolved last, since it depends on response_format / max_len / split_on_word above.
|
||||
// token timestamps also drive the max_len segment wrapping in whisper_full(), so turning
|
||||
// them on unconditionally makes the max_len fallback below wrap every response at 60
|
||||
// characters - on a token boundary, i.e. mid-word. Only default them on when the response
|
||||
// actually carries per-token data (verbose_json) or wrapping was asked for.
|
||||
if (!req.has_file("token_timestamps"))
|
||||
{
|
||||
params.token_timestamps = !params.no_timestamps &&
|
||||
(params.response_format == vjson_format || params.max_len > 0 || params.split_on_word);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
Loading…
Reference in New Issue