fix: keep loaded tool output when the tail page only has its shell

List responses ask the server to elide large tool output
(`x-openchamber-part-shells: v1`): the part comes back as an empty text
plus an `openchamberContentShell` marker, and the full text is fetched
when a step is expanded. Every tail refresh (a turn starting, the app
returning) then replaced the loaded message with that shell again, so an
expanded step fell back to "无输出" — the more the session was used, the
more it looked like shell steps never had output.

reloadTail now keeps an already-loaded tool part when the server's copy of
that part is a shell (matched by position and call id), and the pending
state reads "输出较大,正在载入…" instead of claiming there was no output.
Version 0.3.7 (code 307).
This commit is contained in:
blumia committed 2026-11-20 09:18:04 +08:00
1 parent 6c00e5e026
commit fbadf6f858
5 files changed
+68 -4

No files matched your search

+9 -1
View File
@@ -770,6 +770,10 @@ class _ChatScreenState extends State<ChatScreen> {
final shell = _isShell(p);
final command = shell ? '${input['command'] ?? ''}'.trim() : '';
final output = toolOutput(p);
// A big output arrives as an empty shell until the message is fetched;
// that is not the same as a command that printed nothing.
final shelled = shell &&
(p.state?.metadata?.containsKey('openchamberContentShell') ?? false);
const mono = TextStyle(fontSize: 12, height: 1.45, fontFamily: 'monospace');
return Padding(
padding: const EdgeInsets.fromLTRB(10, 2, 10, 8),
@@ -796,7 +800,11 @@ class _ChatScreenState extends State<ChatScreen> {
),
if (extras.isNotEmpty) const SizedBox(height: 4),
SelectableText(
output.isEmpty ? (shell ? '无输出' : '无内容') : output,
output.isNotEmpty
? output
: shelled
? '输出较大,正在载入…'
: (shell ? '无输出' : '无内容'),
style: mono.copyWith(
color: p.state?.error != null
? theme.colorScheme.error