There is 1 comment.
 
 
LLM AI Integration / cid:jira-generated-image-avatar-69ccda62-bd64-40de-a36a-8935d81e6f49 LLMAI-170 Open

Chat fails on models that reject an explicit temperature

 
View issue   ·   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-84738f14-3e62-4c27-a7db-2193a362b93e Sebastian Elsner on 17/Aug/26 18:40
 

Some findings from reproducing this on 0.9 that I think change what the fix should look like.

The value 0 is hard-coded in four places, not one

The symptom is really "the UI always sends a temperature of 0", and no PromptDB setting can override it:

  • AI.Code.Javascript:978 – the "prompt not found" sentinel reset
  • AI.Code.Javascript:1248 – cleared-selection reset
  • AI.Code.Javascript:1291 – initial state in initFormEvent()
  • chatWidget.js:10 – the widget's userSettings default

The fourth matters most operationally: chatWidget.js ships inside a webjar, so an administrator cannot patch it the way they can patch a wiki page, and there is no server-side setting for the widget's initial temperature (it is per-browser localStorage). So every user in a fresh browser starts at 0. On a model that rejects 0, the only admin-side remedy is to change the model.

Omitting the parameter already works end to end

RequestHelper.prepareRequest builds the outgoing body with objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL), so a null temperature on ChatCompletionRequest is dropped from the request to the provider. No serialization change is needed to support "unset" – only a way to actually leave it unset.

There is already an accidental code path that does this

In AI.Code.Javascript around line 1146:

let temp;
if (paramView) {
    const sliderTempVal = parseFloat(document.querySelector('#sliderTemp').value);
    const promptTempVal = parseFloat(promptData.temperature);
    if (sliderTempVal !== promptTempVal)
        temp = sliderTempVal;
}
else
    temp = promptData.temperature;

When the settings panel has been opened and the slider equals the prompt's temperature, temp is never assigned. Number(undefined) is NaN, JSON.stringify emits a null, and NON_NULL then drops it – so this is currently the only path that works on a restricted model, by accident.

The same block is also why setting the prompt's Temperature field appears to do nothing: once paramView is true the slider overrides the prompt's value, and the slider was initialised from the 0 fallback.

Suggested shape

Treat "no temperature" as a first-class state rather than defaulting to 0 – omit the field unless a user explicitly sets one, in both UIs, and expose it server-side so the widget's default is configurable rather than compiled in.

Environment: XWiki 18.6.0, ai-llm 0.9, OpenAI-compatible server, gpt-5.6-luna (rejects a temperature of 0, accepts only the default). Worked around locally by switching the configured chat model to 4o-mini, which accepts 0.