Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export interface BaseSessionMetadata {
title: string;
dateCreated: string;
workspaceDirectory: string;
messageCount?: number;
}

export interface RangeInFile {
Expand Down
5 changes: 5 additions & 0 deletions core/util/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,14 @@ export class HistoryManager {
}

let found = false;
const messageCount = session.history.filter(
(item) => item.message.role === "user",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(item) => item.message.role === "user",

I think for longer agent conversations this will show a number much lower than it should e.g. 1 user message, 20 assistant/tool messages will show 1

Maybe we could count conversational turns or just simple chatHistory.length excluding system message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually when trying out chatHistory.length, it show around 15 counter for a single message conversation which would include tool calls and assistant messages. I think the user will want to know how many followups he did.

@RomneyDa what do you think about replacing the message counter with dots or bars? something like | | | indicating 3 messages or • • • or ● ● ●. when there are more than 7-8 messages (depending on the sidebar width), it will show the counter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's currently counting by filtering for user messages, am I reading that wrong?

Personally I prefer a little number with message icon or similar to dots or bars but I don't have super strong opinions about the design!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes only user messages.

How about putting dots for the initial design? If they do not look good, it can be changed

).length;
for (const sessionMetadata of sessionsList) {
if (sessionMetadata.sessionId === session.sessionId) {
sessionMetadata.title = session.title;
sessionMetadata.workspaceDirectory = session.workspaceDirectory;
sessionMetadata.messageCount = messageCount;
found = true;
break;
}
Expand All @@ -156,6 +160,7 @@ export class HistoryManager {
title: session.title,
dateCreated: String(Date.now()),
workspaceDirectory: session.workspaceDirectory,
messageCount,
};
sessionsList.push(sessionMetadata);
}
Expand Down
15 changes: 14 additions & 1 deletion gui/src/components/History/HistoryTableRow.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
ArrowDownOnSquareIcon,
CloudIcon,
PencilSquareIcon,
TrashIcon,
CloudIcon,
} from "@heroicons/react/24/outline";
import { BaseSessionMetadata } from "core";
import type { RemoteSessionMetadata } from "core/control-plane/client";
Expand All @@ -22,6 +22,7 @@ import {
} from "../../redux/thunks/session";
import { isShareSessionSupported } from "../../util";
import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip";
import { ToolTip } from "../gui/Tooltip";

const shareSessionSupported = isShareSessionSupported();

Expand Down Expand Up @@ -144,6 +145,18 @@ export function HistoryTableRow({
Remote
</span>
)}

{sessionMetadata.messageCount !== undefined && (
<ToolTip
content={`${sessionMetadata.messageCount} message${
sessionMetadata.messageCount === 1 ? " is" : "s are"
} present in this session`}
>
<span className="bg-vsc-background text-secondary-foreground ml-auto inline-flex items-center rounded-full px-2 py-1 text-xs font-medium">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Message counter is placed at the right edge (ml-auto) but the hover action bar is absolutely positioned at the same right edge and stacks above it, causing the counter/tooltip to be obscured when hovering the row.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At gui/src/components/History/HistoryTableRow.tsx, line 155:

<comment>Message counter is placed at the right edge (`ml-auto`) but the hover action bar is absolutely positioned at the same right edge and stacks above it, causing the counter/tooltip to be obscured when hovering the row.</comment>

<file context>
@@ -144,6 +145,18 @@ export function HistoryTableRow({
+                  sessionMetadata.messageCount === 1 ? " is" : "s are"
+                } present in this session`}
+              >
+                <span className="bg-vsc-background text-secondary-foreground ml-auto inline-flex items-center rounded-full px-2 py-1 text-xs font-medium">
+                  {sessionMetadata.messageCount}
+                </span>
</file context>

{sessionMetadata.messageCount}
</span>
</ToolTip>
)}
</div>
)}

Expand Down
Loading