A refresh landed on a new empty chat with the conversation a click away in
the list. The open chat's id is remembered per account and reopened on
load; New chat forgets it; a chat deleted elsewhere is quietly gone.
DeepSeek models think by default: measured on ds-deepseek-v4.1-flash, a
three-sentence clinical answer spent 301 reasoning tokens and 2.9 s before
writing and gave the same answer in 0.9 s with thinking off. The assistant's
reasoning effort now comes from CLINICAL_ASSISTANT_REASONING_EFFORT ('low'
as before; 'none' switches thinking off where a model allows it, sent as
DeepSeek's own thinking field through LiteLLM).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fZGJNyDvERbMgS2Uc2msP
27 lines
1.8 KiB
JavaScript
27 lines
1.8 KiB
JavaScript
// A refresh reopens the chat the person was in, per account; "New chat"
|
|
// forgets it; a chat deleted elsewhere is simply gone.
|
|
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const src = fs.readFileSync(path.join(__dirname, '..', 'public/js/clinicalAssistant.js'), 'utf8');
|
|
|
|
test('the open chat is remembered when it is loaded or saved, and forgotten on a new chat', () => {
|
|
assert.match(src, /var OPEN_CHAT_KEY = 'ped_assistant_open_chat'/);
|
|
assert.match(src, /modelStorageKey\(OPEN_CHAT_KEY\)/, 'scoped to the account like the model choice');
|
|
const load = src.slice(src.indexOf('function loadSavedChat'), src.indexOf('function restoreSavedChat'));
|
|
assert.match(load, /rememberOpenChat\(currentChatId\)/);
|
|
const save = src.slice(src.indexOf('function performAutosave'), src.indexOf('function performAutosave') + 900);
|
|
assert.match(save, /if \(data\.id\) currentChatId = data\.id;\s*\n\s*rememberOpenChat\(currentChatId\)/);
|
|
const clear = src.slice(src.indexOf('function performClearConversation'), src.indexOf('function cancelAssistantSearch'));
|
|
assert.match(clear, /currentChatId = null;\s*\n\s*rememberOpenChat\(null\)/);
|
|
});
|
|
|
|
test('the page reopens it on load, quietly, and forgets a chat that no longer exists', () => {
|
|
const init = src.slice(src.indexOf('function initIfNeeded'), src.indexOf('function onceOnDocument'));
|
|
assert.match(init, /loadExamples\(\);\s*\n\s*restoreOpenChat\(\);/);
|
|
const restore = src.slice(src.indexOf('function restoreOpenChat'), src.indexOf('function restoreOpenChat') + 900);
|
|
assert.match(restore, /fetchSavedAssistantChat\(id\)/);
|
|
assert.match(restore, /\.catch\(function \(\) \{ rememberOpenChat\(null\); \}\)/);
|
|
assert.doesNotMatch(restore, /showToast/, 'a missing chat is not an error to announce');
|
|
});
|