Name sessions opened by handed-off work, and hide empty ones from activity
A session the coordinator's delegation, a routine or a hook opened has no user message and no reply, so it was never named and showed as "Untitled conversation". Tasks now name their session too, and a session with no user message is named from the bot's own messages. Until a session is named, Latest activity shows what it opened with, and sessions with no messages are left out of it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Span from "@moduletrace/twui/layout/Span";
|
||||
import BotAvatar from "@/src/components/general/bot-avatar";
|
||||
import { AppData } from "@/src/data/app-data";
|
||||
import type { BotFace } from "@/src/dict/bot-dict";
|
||||
import botStoneProps from "@/src/utils/bot-stone-props";
|
||||
import SettingsListRow from "@/src/pages/admin/settings/(partials)/settings-list-row";
|
||||
@@ -13,14 +14,18 @@ type Props = {
|
||||
};
|
||||
|
||||
/**
|
||||
* One recent conversation in the workspace: the bot, the session's title,
|
||||
* a preview of its latest message and when it last moved.
|
||||
* One recent conversation in the workspace: the bot, the session's title
|
||||
* (what it opened with until it's named), a preview of its latest message
|
||||
* and when it last moved.
|
||||
*/
|
||||
export default function WorkspaceActivityRow({ workspace_id, item }: Props) {
|
||||
const at = item.last_activity_at || item.created_at;
|
||||
const preview = item.last_message_text
|
||||
? messagePreview({ text: item.last_message_text })
|
||||
: "";
|
||||
const opening = item.first_message_text
|
||||
? messagePreview({ text: item.first_message_text }).slice(0, AppData.BotSessionTitleMaxChars)
|
||||
: "";
|
||||
|
||||
return (
|
||||
<SettingsListRow
|
||||
@@ -31,7 +36,7 @@ export default function WorkspaceActivityRow({ workspace_id, item }: Props) {
|
||||
face={(item.bot_face || "idle") as BotFace}
|
||||
/>
|
||||
}
|
||||
title={item.title || "Untitled conversation"}
|
||||
title={item.title || opening || "Untitled conversation"}
|
||||
href={`/admin/workspaces/${workspace_id}/bots/${item.bot_id}`}
|
||||
badge={item.unread ? "New" : undefined}
|
||||
subtitle={`${item.bot_name || "A bot"}${preview ? ` · ${preview}` : ""}`}
|
||||
|
||||
Reference in New Issue
Block a user