|
@@ -131,7 +131,6 @@ export interface MessageProps {
|
|
|
parts: PartType[]
|
|
parts: PartType[]
|
|
|
actions?: UserActions
|
|
actions?: UserActions
|
|
|
showAssistantCopyPartID?: string | null
|
|
showAssistantCopyPartID?: string | null
|
|
|
- interrupted?: boolean
|
|
|
|
|
showReasoningSummaries?: boolean
|
|
showReasoningSummaries?: boolean
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -691,12 +690,7 @@ export function Message(props: MessageProps) {
|
|
|
<Switch>
|
|
<Switch>
|
|
|
<Match when={props.message.role === "user" && props.message}>
|
|
<Match when={props.message.role === "user" && props.message}>
|
|
|
{(userMessage) => (
|
|
{(userMessage) => (
|
|
|
- <UserMessageDisplay
|
|
|
|
|
- message={userMessage() as UserMessage}
|
|
|
|
|
- parts={props.parts}
|
|
|
|
|
- actions={props.actions}
|
|
|
|
|
- interrupted={props.interrupted}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <UserMessageDisplay message={userMessage() as UserMessage} parts={props.parts} actions={props.actions} />
|
|
|
)}
|
|
)}
|
|
|
</Match>
|
|
</Match>
|
|
|
<Match when={props.message.role === "assistant" && props.message}>
|
|
<Match when={props.message.role === "assistant" && props.message}>
|
|
@@ -887,12 +881,7 @@ function ContextToolGroup(props: { parts: ToolPart[]; busy?: boolean }) {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function UserMessageDisplay(props: {
|
|
|
|
|
- message: UserMessage
|
|
|
|
|
- parts: PartType[]
|
|
|
|
|
- actions?: UserActions
|
|
|
|
|
- interrupted?: boolean
|
|
|
|
|
-}) {
|
|
|
|
|
|
|
+export function UserMessageDisplay(props: { message: UserMessage; parts: PartType[]; actions?: UserActions }) {
|
|
|
const data = useData()
|
|
const data = useData()
|
|
|
const dialog = useDialog()
|
|
const dialog = useDialog()
|
|
|
const i18n = useI18n()
|
|
const i18n = useI18n()
|
|
@@ -947,10 +936,7 @@ export function UserMessageDisplay(props: {
|
|
|
return items.filter((x) => !!x).join("\u00A0\u00B7\u00A0")
|
|
return items.filter((x) => !!x).join("\u00A0\u00B7\u00A0")
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- const metaTail = createMemo(() => {
|
|
|
|
|
- const items = [stamp(), props.interrupted ? i18n.t("ui.message.interrupted") : ""]
|
|
|
|
|
- return items.filter((x) => !!x).join("\u00A0\u00B7\u00A0")
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const metaTail = stamp
|
|
|
|
|
|
|
|
const openImagePreview = (url: string, alt?: string) => {
|
|
const openImagePreview = (url: string, alt?: string) => {
|
|
|
dialog.show(() => <ImagePreview src={url} alt={alt} />)
|
|
dialog.show(() => <ImagePreview src={url} alt={alt} />)
|
|
@@ -981,7 +967,7 @@ export function UserMessageDisplay(props: {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <div data-component="user-message" data-interrupted={props.interrupted ? "" : undefined}>
|
|
|
|
|
|
|
+ <div data-component="user-message">
|
|
|
<Show when={attachments().length > 0}>
|
|
<Show when={attachments().length > 0}>
|
|
|
<div data-slot="user-message-attachments">
|
|
<div data-slot="user-message-attachments">
|
|
|
<For each={attachments()}>
|
|
<For each={attachments()}>
|
|
@@ -1021,7 +1007,7 @@ export function UserMessageDisplay(props: {
|
|
|
<HighlightedText text={text()} references={inlineFiles()} agents={agents()} />
|
|
<HighlightedText text={text()} references={inlineFiles()} agents={agents()} />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div data-slot="user-message-copy-wrapper" data-interrupted={props.interrupted ? "" : undefined}>
|
|
|
|
|
|
|
+ <div data-slot="user-message-copy-wrapper">
|
|
|
<Show when={metaHead() || metaTail()}>
|
|
<Show when={metaHead() || metaTail()}>
|
|
|
<span data-slot="user-message-meta-wrap">
|
|
<span data-slot="user-message-meta-wrap">
|
|
|
<Show when={metaHead()}>
|
|
<Show when={metaHead()}>
|
|
@@ -1305,14 +1291,13 @@ PART_MAPPING["tool"] = function ToolPartDisplay(props) {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-PART_MAPPING["compaction"] = function CompactionPartDisplay() {
|
|
|
|
|
- const i18n = useI18n()
|
|
|
|
|
|
|
+export function MessageDivider(props: { label: string }) {
|
|
|
return (
|
|
return (
|
|
|
<div data-component="compaction-part">
|
|
<div data-component="compaction-part">
|
|
|
<div data-slot="compaction-part-divider">
|
|
<div data-slot="compaction-part-divider">
|
|
|
<span data-slot="compaction-part-line" />
|
|
<span data-slot="compaction-part-line" />
|
|
|
<span data-slot="compaction-part-label" class="text-12-regular text-text-weak">
|
|
<span data-slot="compaction-part-label" class="text-12-regular text-text-weak">
|
|
|
- {i18n.t("ui.messagePart.compaction")}
|
|
|
|
|
|
|
+ {props.label}
|
|
|
</span>
|
|
</span>
|
|
|
<span data-slot="compaction-part-line" />
|
|
<span data-slot="compaction-part-line" />
|
|
|
</div>
|
|
</div>
|
|
@@ -1320,6 +1305,11 @@ PART_MAPPING["compaction"] = function CompactionPartDisplay() {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+PART_MAPPING["compaction"] = function CompactionPartDisplay() {
|
|
|
|
|
+ const i18n = useI18n()
|
|
|
|
|
+ return <MessageDivider label={i18n.t("ui.messagePart.compaction")} />
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
PART_MAPPING["text"] = function TextPartDisplay(props) {
|
|
PART_MAPPING["text"] = function TextPartDisplay(props) {
|
|
|
const data = useData()
|
|
const data = useData()
|
|
|
const i18n = useI18n()
|
|
const i18n = useI18n()
|