Skip to content
Open
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
29 changes: 23 additions & 6 deletions apps/web/src/components/chat/TimelineWorkEntryRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import { Link } from "@tanstack/react-router";
import { notificationChildThreadId } from "@t3tools/client-runtime/state/thread-execution";
import {
resolveViewedImageAsset,
resolveWorkEntryToolPresentation,
toolGroupAction,
workEntryViewedImagePath,
Expand All @@ -51,6 +52,7 @@ import {
workLogEntryIsToolLike,
} from "../../session-logic";
import ChatMarkdown from "../ChatMarkdown";
import { ChatMarkdownAssetImage } from "./ChatMarkdownMedia";
import type { ExpandedImagePreview } from "./ExpandedImagePreview";
import { workGroupImageGallery } from "./markdownImageGallery";
import { CircleAlertIcon, XIcon, RotateCcwIcon } from "lucide-react";
Expand Down Expand Up @@ -254,7 +256,7 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
const ctx = use(TimelineRowCtx);
const gt = useGT();
const m = useMessages();
const { onImageExpand, timestampFormat } = ctx;
const { threadRef, onImageExpand, timestampFormat } = ctx;
const { retryableWorkspacePreparationRunIds, onRetryWorkspacePreparation } = ctx;
const threadTarget = useThreadReadTarget(workEntry, ctx.activeThreadEnvironmentId);
const createdThread =
Expand Down Expand Up @@ -398,13 +400,16 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
: skill
? (skill.args ?? null)
: undefined;
const viewedImagePath = workEntryViewedImagePath(workEntry);
const viewedImage =
viewedImagePath && threadRef
? resolveViewedImageAsset(viewedImagePath, { threadId: threadRef.threadId, workspaceRoot })
: null;
const groupViewedImages = groupView?.viewedImages;
// Images in this entry's expanded body page through the group's viewed images, like its strip.
// Images in this entry's expanded body page through the group's viewed images.
const expandImage = groupViewedImages
? (preview: ExpandedImagePreview) =>
onImageExpand(
workGroupImageGallery(groupViewedImages, workEntryViewedImagePath(workEntry), preview),
)
onImageExpand(workGroupImageGallery(groupViewedImages, viewedImagePath, preview))
: onImageExpand;
const inspectedItem =
plainOutput === undefined &&
Expand All @@ -428,6 +433,7 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
Boolean(
expandedBody ||
inspectedItem ||
viewedImage ||
workEntry.questionAnswer ||
plainOutputFetches ||
(isReasoning && workEntry.detail?.trim()),
Expand Down Expand Up @@ -619,8 +625,19 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
!isReasoning &&
!workEntry.questionAnswer &&
canExpandProjectedItem &&
(expandedBody || inspectedItem || plainOutputFetches) ? (
(expandedBody || inspectedItem || viewedImage || plainOutputFetches) ? (
<WorkLogDetails kind="panel">
{viewedImage && threadRef ? (
<ChatMarkdownAssetImage
environmentId={threadRef.environmentId}
resource={viewedImage.resource}
alt={viewedImage.alt}
srcFragment={viewedImage.srcFragment}
workspaceRoot={workspaceRoot}
maxHeightRem={16}
onImageExpand={expandImage}
/>
) : null}
{inspectedItem ? (
<V2ItemInspector
onInitialOutputReady={onInitialOutputReady}
Expand Down
Loading