refactor(web): rename trajectory detail tabs source→raw and origin→source

The markdown raw-source tab becomes Raw and the message-origin tab becomes
Source, keeping the renamed identifiers, labels, and overview links in sync.
This commit is contained in:
_Kerman
2026-08-11 11:53:28 +08:00
parent fa2dce28ce
commit ec9a08f1e2

View File

@@ -155,8 +155,8 @@ type DetailTab =
| 'tools' | 'tools'
| 'overview' | 'overview'
| 'rendered' | 'rendered'
| 'raw'
| 'source' | 'source'
| 'origin'
| 'input' | 'input'
| 'output' | 'output'
| 'schema' | 'schema'
@@ -782,7 +782,7 @@ function RequestOptions({
) )
} }
function messageOriginLabel(source: unknown): string { function messageSourceLabel(source: unknown): string {
if (typeof source !== 'object' || source === null || Array.isArray(source)) { if (typeof source !== 'object' || source === null || Array.isArray(source)) {
return 'Unknown' return 'Unknown'
} }
@@ -805,16 +805,16 @@ function messageOriginLabel(source: unknown): string {
return `${kind[0]?.toUpperCase() ?? ''}${kind.slice(1)}` return `${kind[0]?.toUpperCase() ?? ''}${kind.slice(1)}`
} }
function MessageOrigin({ record }: { record: TableRecord }) { function MessageSource({ record }: { record: TableRecord }) {
const source = record.cell.messageSource const source = record.cell.messageSource
if (source === undefined) return <p className={css.noPayload}>Origin not recorded</p> if (source === undefined) return <p className={css.noPayload}>Source not recorded</p>
const data = typeof source === 'object' && source !== null const data = typeof source === 'object' && source !== null
? source ? source
: { value: source } : { value: source }
return ( return (
<JsonTree <JsonTree
data={data} data={data}
label="Message origin JSON" label="Message source JSON"
className={css.jsonPayload} className={css.jsonPayload}
/> />
) )
@@ -879,17 +879,17 @@ function detailTabs(record: TableRecord): readonly DetailTabItem[] {
if (record.cell.kind === 'compacted') { if (record.cell.kind === 'compacted') {
return [ return [
{ id: 'overview', label: 'Summary' }, { id: 'overview', label: 'Summary' },
{ id: 'source', label: 'Raw Output' }, { id: 'raw', label: 'Raw Output' },
] ]
} }
if (isMarkdownRecord(record)) { if (isMarkdownRecord(record)) {
return [ return [
{ id: 'overview', label: 'Summary' }, { id: 'overview', label: 'Summary' },
{ id: 'rendered', label: 'Preview' }, { id: 'rendered', label: 'Preview' },
{ id: 'source', label: 'Source' }, { id: 'raw', label: 'Raw' },
...(record.cell.messageSource === undefined ...(record.cell.messageSource === undefined
? [] ? []
: [{ id: 'origin', label: 'Origin' } as const]), : [{ id: 'source', label: 'Source' } as const]),
] ]
} }
return [ return [
@@ -2772,14 +2772,14 @@ export function TrajectoryTable({
> >
{selected.cell.messageSource !== undefined && ( {selected.cell.messageSource !== undefined && (
<div> <div>
<dt>Origin</dt> <dt>Source</dt>
<dd className={css.overviewParentLinks}> <dd className={css.overviewParentLinks}>
<button <button
type="button" type="button"
className={css.overviewHierarchyNavLink} className={css.overviewHierarchyNavLink}
onClick={() => { activateTab('origin') }} onClick={() => { activateTab('source') }}
> >
<span>{messageOriginLabel(selected.cell.messageSource)}</span> <span>{messageSourceLabel(selected.cell.messageSource)}</span>
<IconChevronRightOutline14 <IconChevronRightOutline14
className={css.overviewHierarchyJumpIconTight} className={css.overviewHierarchyJumpIconTight}
size={11} size={11}
@@ -2792,7 +2792,7 @@ export function TrajectoryTable({
<div> <div>
<dt> <dt>
{selectedAssistantRequestTarget !== undefined {selectedAssistantRequestTarget !== undefined
? 'Origin' ? 'Source'
: 'Hierarchy'} : 'Hierarchy'}
</dt> </dt>
<dd className={css.overviewParentLinks}> <dd className={css.overviewParentLinks}>
@@ -2916,7 +2916,7 @@ export function TrajectoryTable({
onOpenCall={openCallSummary} onOpenCall={openCallSummary}
/> />
)} )}
{!promptSelected && selected !== undefined && activeTab === 'source' && ( {!promptSelected && selected !== undefined && activeTab === 'raw' && (
<MarkdownRecordContent <MarkdownRecordContent
record={selected} record={selected}
rendered={false} rendered={false}
@@ -2925,8 +2925,8 @@ export function TrajectoryTable({
onOpenCall={openCallSummary} onOpenCall={openCallSummary}
/> />
)} )}
{!promptSelected && selected !== undefined && activeTab === 'origin' && ( {!promptSelected && selected !== undefined && activeTab === 'source' && (
<MessageOrigin record={selected} /> <MessageSource record={selected} />
)} )}
{!promptSelected && selected !== undefined && activeTab === 'input' && ( {!promptSelected && selected !== undefined && activeTab === 'input' && (
<RecordPayload record={selected} direction="input" /> <RecordPayload record={selected} direction="input" />