mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-31 00:03:01 +03:00
fix(webui): keep actions hidden while turn id resolves
This commit is contained in:
@@ -147,7 +147,7 @@ export function ThreadMessages({
|
|||||||
unit.type === "activity"
|
unit.type === "activity"
|
||||||
? liveActivityClusterIndices.has(index)
|
? liveActivityClusterIndices.has(index)
|
||||||
: isStreaming && (
|
: isStreaming && (
|
||||||
unit.message.turnId
|
unit.message.turnId && activeTurnId !== null
|
||||||
? unit.message.turnId === activeTurnId
|
? unit.message.turnId === activeTurnId
|
||||||
: index > currentTurnStartIndex
|
: index > currentTurnStartIndex
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1171,6 +1171,27 @@ describe("ThreadMessages", () => {
|
|||||||
.not.toBeInTheDocument();
|
.not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("falls back to the latest user boundary while the active turn id is pending", () => {
|
||||||
|
const { container } = render(
|
||||||
|
<ThreadMessages
|
||||||
|
messages={[
|
||||||
|
{ id: "old-user", role: "user", content: "old question", turnId: "old", createdAt: 1 },
|
||||||
|
{ id: "old", role: "assistant", content: "old answer", turnId: "old", createdAt: 2 },
|
||||||
|
{ id: "new-user", role: "user", content: "new question", turnId: "new", createdAt: 3 },
|
||||||
|
{ id: "live", role: "assistant", content: "live slice", turnId: "new", createdAt: 4 },
|
||||||
|
]}
|
||||||
|
isStreaming
|
||||||
|
activeTurnId={null}
|
||||||
|
onForkFromMessage={vi.fn()}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(container.querySelectorAll('[data-assistant-footer] [aria-label="Copy"]'))
|
||||||
|
.toHaveLength(1);
|
||||||
|
expect(container.querySelectorAll('[data-assistant-footer] [aria-label="Fork"]'))
|
||||||
|
.toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
it("shows copy on adjacent assistant text slices", () => {
|
it("shows copy on adjacent assistant text slices", () => {
|
||||||
const messages: UIMessage[] = [
|
const messages: UIMessage[] = [
|
||||||
{ id: "a1", role: "assistant", content: "part one", createdAt: 1 },
|
{ id: "a1", role: "assistant", content: "part one", createdAt: 1 },
|
||||||
|
|||||||
Reference in New Issue
Block a user