@agents24/chat-react 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/styles.css CHANGED
@@ -209,10 +209,22 @@ button.a24-tool-trigger:focus-visible { outline: 2px solid var(--a24-focus); out
209
209
  .a24-timeline-error { padding-inline: 6px; }
210
210
  .a24-ask-user--resolved { padding-inline: 6px; }
211
211
  .a24-chat-message { display: flex; flex-direction: column; gap: .5rem; min-width: 0; width: 100%; }
212
- .a24-chat-message--user { margin-inline-start: auto; max-width: 80%; }
212
+ .a24-chat-message--user { max-width: 100%; }
213
213
  .a24-chat-message--assistant { max-width: 100%; }
214
+ .a24-chat-attachment-rows { align-self: flex-end; display: flex; flex-direction: column; gap: .375rem; max-width: 100%; min-width: 0; width: 100%; }
215
+ .a24-chat-attachments { align-self: stretch; justify-content: safe flex-end; max-width: 100%; scrollbar-width: none; width: 100%; }
216
+ .a24-chat-attachments[dir="rtl"] { justify-content: safe flex-start; }
217
+ .a24-chat-attachment { align-items: center; border-radius: var(--radius, .75rem); flex-wrap: nowrap; max-width: min(22rem, 100%); min-height: 2.5rem; padding: .375rem .625rem !important; }
218
+ .a24-chat-attachment-icon { border-radius: 0 !important; height: 1.75rem; width: 1.75rem; }
219
+ .a24-chat-attachment-icon svg { display: block; height: 100%; width: 100%; }
220
+ .a24-chat-attachment-content { overflow: hidden; }
221
+ .a24-chat-image-attachment { border: 0; border-radius: var(--radius, .75rem); height: 6rem; min-width: 6rem; overflow: hidden; padding: 0 !important; width: 6rem; }
222
+ .a24-chat-image-media { border-radius: inherit; height: 6rem; opacity: 1 !important; width: 6rem !important; }
223
+ .a24-chat-image-media img { height: 100%; object-fit: cover; width: 100%; }
224
+ .a24-chat-image-spinner { color: var(--a24-muted); }
225
+ .a24-chat-image-remove { align-items: center; background: color-mix(in srgb, var(--a24-background) 88%, transparent); border: 0; border-radius: .375rem; color: var(--a24-text); display: inline-flex; height: 1.5rem; justify-content: center; position: absolute; right: .375rem; top: .375rem; width: 1.5rem; z-index: 2; }
214
226
  .a24-chat-message-content { display: flex; flex-direction: column; max-width: 100%; min-width: 0; }
215
- .a24-chat-message-content--user { align-self: flex-end; overflow: visible; width: fit-content; }
227
+ .a24-chat-message-content--user { align-self: flex-end; max-width: 80%; overflow: visible; width: fit-content; }
216
228
  .a24-chat-message-content--assistant { overflow: visible; width: 100%; }
217
229
  .a24-message-response > :first-child { margin-top: 0; }
218
230
  .a24-message-response > :last-child { margin-bottom: 0; }
@@ -28,8 +28,20 @@ export type ChatAttachmentData = Agents24ChatAttachment & {
28
28
  export type ChatAttachmentProps = React.ComponentProps<typeof Attachment> & {
29
29
  data: ChatAttachmentData;
30
30
  onRemove?: () => void;
31
+ resolveContent?: ChatAttachmentContentResolver;
31
32
  };
32
- export declare function ChatAttachment({ data, onRemove, orientation, ...props }: ChatAttachmentProps): React.ReactElement;
33
+ export type ChatAttachmentContentResult = {
34
+ url: string;
35
+ validUntil?: string | null;
36
+ };
37
+ export type ChatAttachmentContentResolver = (attachment: ChatAttachmentData, signal: AbortSignal) => Promise<ChatAttachmentContentResult>;
38
+ export declare function ChatAttachment({ className, data, onRemove, orientation, resolveContent, ...props }: ChatAttachmentProps): React.ReactElement;
33
39
  export type ChatAttachmentsProps = React.ComponentProps<typeof AttachmentGroup>;
34
40
  export declare function ChatAttachments({ children, className, ...props }: ChatAttachmentsProps): React.ReactElement | null;
35
- export { ChatAttachment as MessageAttachment, ChatAttachments as MessageAttachments, ChatMessage as Message, ChatMessageAction as MessageAction, ChatMessageActions as MessageActions, ChatMessageContent as MessageContent, };
41
+ export type ChatAttachmentRowsProps = Omit<React.ComponentProps<"div">, "children"> & {
42
+ attachments: readonly ChatAttachmentData[];
43
+ onRemove?: (attachment: ChatAttachmentData) => void;
44
+ resolveContent?: ChatAttachmentContentResolver;
45
+ };
46
+ export declare function ChatAttachmentRows({ attachments, className, dir, onRemove, resolveContent, ...props }: ChatAttachmentRowsProps): React.ReactElement | null;
47
+ export { ChatAttachment as MessageAttachment, ChatAttachmentRows as MessageAttachmentRows, ChatAttachments as MessageAttachments, ChatMessage as Message, ChatMessageAction as MessageAction, ChatMessageActions as MessageActions, ChatMessageContent as MessageContent, };
@@ -1,13 +1,6 @@
1
1
  import * as React from "react";
2
- import type { ChatAttachment } from "../types";
3
- export type AgentChatComposerFile = ChatAttachment & {
4
- id: string;
5
- type: "file";
6
- url: string;
7
- filename: string;
8
- mediaType: string;
9
- source: File;
10
- };
2
+ import { type AgentChatComposerFile } from "./composer-attachments";
3
+ export type { AgentChatComposerFile } from "./composer-attachments";
11
4
  export type AgentChatComposerSubmit = {
12
5
  text: string;
13
6
  files: AgentChatComposerFile[];
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { ChatHitlPart, ChatHitlResponse, ChatMessage } from "../types";
3
+ import { type ChatAttachmentContentResolver } from "./adapters";
3
4
  import { type AgentChatMessageActionHandlers } from "./agent-chat-actions";
4
5
  import { type AgentChatPartActionState, type AgentChatTimelineComponent } from "./agent-response-timeline";
5
6
  export type AgentChatUserMessageContentProps = {
@@ -14,6 +15,7 @@ export type AgentChatMessageProps = {
14
15
  additionalActions?: React.ReactNode;
15
16
  actions?: React.ReactNode;
16
17
  actionsClassName?: string;
18
+ attachmentContentResolver?: ChatAttachmentContentResolver;
17
19
  className?: string;
18
20
  contentClassName?: string;
19
21
  dir?: "ltr" | "rtl";
@@ -39,4 +41,4 @@ export type AgentChatMessageProps = {
39
41
  };
40
42
  export declare function shouldCollapseUserMessage(content: string, threshold?: number | null | undefined): boolean;
41
43
  export declare function AgentChatUserMessageContent({ collapsedLines, collapseThreshold, content, showLessLabel, showMoreLabel, }: AgentChatUserMessageContentProps): import("react/jsx-runtime").JSX.Element;
42
- export declare function AgentChatMessage({ actionHandlers, additionalActions, actions, actionsClassName, className, contentClassName, dir, getHitlActionState, message, nodeActivityMode, onHitlAction, Timeline, renderAssistantContent, renderUserContent, showAssistantAttachments, streamingMessageId, userMessageCollapsedLines, userMessageContent, userMessageCollapseThreshold, userMessageShowLessLabel, userMessageShowMoreLabel, }: AgentChatMessageProps): import("react/jsx-runtime").JSX.Element;
44
+ export declare function AgentChatMessage({ actionHandlers, additionalActions, actions, actionsClassName, attachmentContentResolver, className, contentClassName, dir, getHitlActionState, message, nodeActivityMode, onHitlAction, Timeline, renderAssistantContent, renderUserContent, showAssistantAttachments, streamingMessageId, userMessageCollapsedLines, userMessageContent, userMessageCollapseThreshold, userMessageShowLessLabel, userMessageShowMoreLabel, }: AgentChatMessageProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { ChatAttachment } from "../types";
2
+ export type AgentChatComposerFile = ChatAttachment & {
3
+ id: string;
4
+ type: "file";
5
+ url: string;
6
+ filename: string;
7
+ mediaType: string;
8
+ source: File;
9
+ };
10
+ export declare function createAgentChatComposerFile(file: File): AgentChatComposerFile;
11
+ export declare function revokeAgentChatComposerFiles(files: readonly AgentChatComposerFile[]): void;