Fix the follow-up of #4014 (a variable name already used in Chat.tsx) and two of my tests (#3254 iterator, #3656 raw paths)
This commit is contained in:
1 parent
9a0462a011
commit
96b6068c32
3 files changed
+9
-7
No files matched your search
@@ -215,7 +215,7 @@ export function ChatScreen() {
|
||||
const pinned = useRef(true);
|
||||
/** When the reader last used the wheel, a finger, a key or the scrollbar on the transcript. */
|
||||
const readerInput = useRef(0);
|
||||
const messageCount = useRef(0);
|
||||
const seenMessages = useRef(0);
|
||||
/**
|
||||
* Scrolls to the newest message and stays there.
|
||||
*
|
||||
@@ -273,8 +273,8 @@ export function ChatScreen() {
|
||||
// The reader's own scrolling decides (#4014): a wheel notch is about 100 px and used to land inside a 120 px band that pulled
|
||||
// the view back on every token. `pinned` is set by the scroller's wheel, touch, key and scroll handlers below.
|
||||
const count = session?.messages.length ?? 0;
|
||||
const sent = count > messageCount.current && session?.messages.at(-1)?.role === 'user';
|
||||
messageCount.current = count;
|
||||
const sent = count > seenMessages.current && session?.messages.at(-1)?.role === 'user';
|
||||
seenMessages.current = count;
|
||||
// Sending a message always brings the reader to it, as it did before; only the answer's growth waits for the reader.
|
||||
if (pinned.current || sent)
|
||||
scrollToLatest();
|
||||
|
||||
@@ -17,12 +17,12 @@ def derive(base):
|
||||
|
||||
class OwnLog(unittest.TestCase):
|
||||
def test_the_setup_log_name_is_replaced_by_the_launch_log(self):
|
||||
for name in ("M:/Strata/strata-iq3_xxs.log", "/home/me/strata/strata-q2_0.log", "M:\Strata\strata-iq3_s.log"):
|
||||
for name in ("M:/Strata/strata-iq3_xxs.log", "/home/me/strata/strata-q2_0.log", r"M:\Strata\strata-iq3_s.log"):
|
||||
self.assertEqual(derive({"exe": "e", "args": [], "log": name})["log"], "C:/launch/q2_0.engine.log", name)
|
||||
self.assertEqual(derive({"exe": "e", "args": []})["log"], "C:/launch/q2_0.engine.log")
|
||||
|
||||
def test_a_log_path_the_person_chose_is_kept(self):
|
||||
for name in ("M:/logs/history.log", "/var/log/strata/engine.log", "D:\notes\iq3.txt"):
|
||||
for name in ("M:/logs/history.log", "/var/log/strata/engine.log", r"D:\notes\iq3.txt"):
|
||||
self.assertEqual(derive({"exe": "e", "args": [], "log": name})["log"], name, name)
|
||||
self.assertEqual(runner.own_log_path({"log": "M:/Strata/strata-iq3_xxs.log"}), None)
|
||||
self.assertEqual(runner.own_log_path({"log": ""}), None)
|
||||
|
||||
@@ -180,9 +180,11 @@ class SubreaperOrphans(unittest.TestCase):
|
||||
|
||||
def test_ending_waits_on_the_start_token_not_on_an_empty_command_line(self):
|
||||
record = {"pid": 4242, "token": "t1", "cmd": ["engine", "--serve"]}
|
||||
tokens = iter(["t1", "t1", None]) # still exiting twice, then gone
|
||||
answers = ["t1", "t1"] # still exiting twice, then gone
|
||||
def token(pid):
|
||||
return answers.pop(0) if answers else None
|
||||
with mock.patch.object(procs, "WINDOWS", False), mock.patch.object(procs, "is_same", side_effect=[True, False, False]) as same, \
|
||||
mock.patch.object(procs, "_signal_verified"), mock.patch.object(procs, "start_token", side_effect=lambda pid: next(tokens)), \
|
||||
mock.patch.object(procs, "_signal_verified"), mock.patch.object(procs, "start_token", side_effect=token), \
|
||||
mock.patch.object(procs, "drop_record"), mock.patch.object(procs.time, "sleep"):
|
||||
self.assertEqual(procs.end_one(record, grace=5), "ended")
|
||||
self.assertGreaterEqual(same.call_count, 1)
|
||||
|
||||
Reference in new issue
Block a user