mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-18 03:30:39 +09:00
Reuse chat-style run feed on dashboard
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
b5e177df7e
commit
950ea065ae
7 changed files with 191 additions and 35 deletions
64
ui/src/components/RunChatSurface.tsx
Normal file
64
ui/src/components/RunChatSurface.tsx
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import { useMemo } from "react";
|
||||
import type { TranscriptEntry } from "../adapters";
|
||||
import type { LiveRunForIssue } from "../api/heartbeats";
|
||||
import { IssueChatThread } from "./IssueChatThread";
|
||||
import type { IssueChatLinkedRun } from "../lib/issue-chat-messages";
|
||||
|
||||
function isRunActive(run: LiveRunForIssue) {
|
||||
return run.status === "queued" || run.status === "running";
|
||||
}
|
||||
|
||||
interface RunChatSurfaceProps {
|
||||
run: LiveRunForIssue;
|
||||
transcript: TranscriptEntry[];
|
||||
hasOutput: boolean;
|
||||
companyId?: string | null;
|
||||
}
|
||||
|
||||
export function RunChatSurface({
|
||||
run,
|
||||
transcript,
|
||||
hasOutput,
|
||||
companyId,
|
||||
}: RunChatSurfaceProps) {
|
||||
const active = isRunActive(run);
|
||||
const liveRuns = active ? [run] : [];
|
||||
const linkedRuns = useMemo<IssueChatLinkedRun[]>(
|
||||
() =>
|
||||
active
|
||||
? []
|
||||
: [{
|
||||
runId: run.id,
|
||||
status: run.status,
|
||||
agentId: run.agentId,
|
||||
agentName: run.agentName,
|
||||
createdAt: run.createdAt,
|
||||
startedAt: run.startedAt,
|
||||
finishedAt: run.finishedAt,
|
||||
}],
|
||||
[active, run],
|
||||
);
|
||||
const transcriptsByRunId = useMemo(
|
||||
() => new Map([[run.id, transcript as readonly TranscriptEntry[]]]),
|
||||
[run.id, transcript],
|
||||
);
|
||||
|
||||
return (
|
||||
<IssueChatThread
|
||||
comments={[]}
|
||||
linkedRuns={linkedRuns}
|
||||
timelineEvents={[]}
|
||||
liveRuns={liveRuns}
|
||||
companyId={companyId}
|
||||
onAdd={async () => {}}
|
||||
showComposer={false}
|
||||
showJumpToLatest={false}
|
||||
variant="embedded"
|
||||
emptyMessage={active ? "Waiting for run output..." : "No run output captured."}
|
||||
enableLiveTranscriptPolling={false}
|
||||
transcriptsByRunId={transcriptsByRunId}
|
||||
hasOutputForRun={(runId) => runId === run.id && hasOutput}
|
||||
includeSucceededRunsWithoutOutput
|
||||
/>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue