Commit c09f2d2
committed
fix: ensure system message is loaded before every AI request
reasonWithCustomJsModel() and reasonWithBuiltInModelViaJs() - the two
functions that build the payload for the WebView's JS AI callers -
read _systemMessage.value directly without ever calling
ensureInitialized() first. Every other reasoning path (offline model,
regular GOOGLE SDK path, Puter) already calls ensureInitialized()
before touching _systemMessage.
Since these two functions cover every online built-in model plus all
custom JSON-defined models, _systemMessage.value could still be the
initial empty string on the very first turn after process start (or
any time isInitialized was reset), so the system message (and by
extension the database entry headings, which are sent together with
it in the same payload/system slot) silently failed to reach the AI.
Adding ensureInitialized(context) at the top of each coroutine loads
the persisted system message from SharedPreferences before the
payload (systemMessage + databaseEntries) is built and emitted to JS.1 parent 82cf730 commit c09f2d2
1 file changed
Lines changed: 2 additions & 0 deletions
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1518 | 1518 | | |
1519 | 1519 | | |
1520 | 1520 | | |
| 1521 | + | |
1521 | 1522 | | |
1522 | 1523 | | |
1523 | 1524 | | |
| |||
1641 | 1642 | | |
1642 | 1643 | | |
1643 | 1644 | | |
| 1645 | + | |
1644 | 1646 | | |
1645 | 1647 | | |
1646 | 1648 | | |
| |||
0 commit comments