Files
cobble/src/pages/admin/bots/[bot_id]/(partials)/carried-over-chip.tsx
T
tbenandClaude Opus 5.5 cc109bc361 Carry conversations into new sessions with a visible summary
- Bots get continue_in_new_session: the bot writes a title and summary,
  the session closes for good (read-only) and the new one opens with the
  summary as a "Carried over from the last session" message that links
  back to the old session.
- Continue in new session (conversation menu, sessions modal) and the
  automatic rollover at the session length do the same; New session now
  starts a fresh, unlinked session.
- Session length is an app setting in Settings > General.
- ?session_id= opens a session; a carried-over one shows a bar linking to
  where the conversation went on instead of the composer.
- The thread can open the previous session above the current one (shown
  only, never in the prompt), and replies get search_past_sessions and
  read_past_session.
- Sessions are named from their opening messages, not their latest, and
  a carried summary is labelled as the earlier session's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 05:35:52 +01:00

36 lines
1.3 KiB
TypeScript

import { History } from "lucide-react";
import Button from "@moduletrace/twui/layout/Button";
import conversationHref from "@/src/utils/conversation-href";
type Props = {
bot_id: number | string;
workspace_id?: number | string | null;
/**
* The session the summary carries on from.
*/
session_id: number | string;
};
/**
* Heads the summary that opens a session the bot moved the conversation
* into (`continue_in_new_session`), and opens the session it carries on
* from to read. The thread's "Show the previous session" shows the same
* messages in place; this is the other way there, on purpose.
*/
export default function CarriedOverChip({ bot_id, workspace_id, session_id }: Props) {
return (
<Button
type="button"
variant="outlined"
color="gray"
size="smaller"
title="Open the session this one carries on from"
href={conversationHref({ bot_id, workspace_id, session_id })}
beforeIcon={<History size={14} aria-hidden className="shrink-0" />}
className="inline-flex h-6 gap-1.5! flex-nowrap align-middle px-2! text-[11px] font-bold whitespace-nowrap text-ink dark:text-ink bg-transparent hover:bg-sunken"
>
Carried over from the last session
</Button>
);
}