teodor-new-chat-ui 4.1.48 → 4.1.50

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.
@@ -1,7 +1,9 @@
1
+ import React from 'react';
1
2
  interface MarkdownContentProps {
2
3
  content: string;
3
4
  className?: string;
4
5
  allowHtml?: boolean;
6
+ style?: React.CSSProperties;
5
7
  }
6
- export declare function MarkdownContent({ content, className, allowHtml, }: MarkdownContentProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function MarkdownContent({ content, className, allowHtml, style, }: MarkdownContentProps): import("react/jsx-runtime").JSX.Element;
7
9
  export default MarkdownContent;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ChatPageExample.tsx
3
+ *
4
+ * Example showing how to use TestChatApp with LangGraphThreadManager sidebar
5
+ */
6
+ export declare function ChatPageExample(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export interface LangChainComponentProps {
2
+ threadId?: string | null;
3
+ onThreadIdChange?: (threadId: string | null) => void;
4
+ apiUrl?: string;
5
+ assistantId?: string;
6
+ }
7
+ export default function LangChainComponent({ threadId: controlledThreadId, onThreadIdChange, apiUrl, assistantId, }: LangChainComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export interface LangChainComponentProps {
2
+ threadId?: string | null;
3
+ onThreadIdChange?: (threadId: string | null) => void;
4
+ apiUrl?: string;
5
+ assistantId?: string;
6
+ }
7
+ export default function LangChainComponent({ threadId: controlledThreadId, onThreadIdChange, apiUrl, assistantId, }: LangChainComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import type { ChatMessage } from '@/types/api';
3
+ export interface LangChainMessageComponentProps {
4
+ message: ChatMessage;
5
+ metadata?: Record<string, unknown>;
6
+ isStreaming?: boolean;
7
+ streamingText?: string;
8
+ className?: string;
9
+ onRequestEdit?: (args: {
10
+ message: ChatMessage;
11
+ metadata?: Record<string, unknown> | undefined;
12
+ draft: string;
13
+ }) => void;
14
+ onRequestRegenerate?: (args: {
15
+ message: ChatMessage;
16
+ metadata?: Record<string, unknown> | undefined;
17
+ }) => void;
18
+ onSelectBranchOption?: (args: {
19
+ message: ChatMessage;
20
+ metadata?: Record<string, unknown> | undefined;
21
+ option: string;
22
+ }) => void;
23
+ footerContent?: React.ReactNode;
24
+ }
25
+ export declare function LangChainMessageComponent({ message, metadata, isStreaming, streamingText, className, onRequestEdit, onRequestRegenerate, onSelectBranchOption, footerContent, }: LangChainMessageComponentProps): import("react/jsx-runtime").JSX.Element;
26
+ export default LangChainMessageComponent;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * LangChainMessageList - Simplified message list for useStream hook
3
+ *
4
+ * Designed specifically for LangChain SDK's useStream hook.
5
+ * Renders messages with streaming support and minimal dependencies.
6
+ */
7
+ import React from 'react';
8
+ import type { ChatMessage } from '@/types/api';
9
+ export interface LangChainMessageListProps {
10
+ messages: ChatMessage[];
11
+ isStreaming?: boolean;
12
+ streamingText?: string;
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ emptyMessage?: React.ReactNode;
16
+ messageMetadata?: Array<any | undefined>;
17
+ renderMessageFooter?: (message: ChatMessage, info: {
18
+ index: number;
19
+ metadata?: any;
20
+ isStreaming: boolean;
21
+ }) => React.ReactNode;
22
+ onRequestEditMessage?: (args: {
23
+ message: ChatMessage;
24
+ metadata?: any;
25
+ draft: string;
26
+ }) => void;
27
+ onRequestRegenerateMessage?: (args: {
28
+ message: ChatMessage;
29
+ metadata?: any;
30
+ }) => void;
31
+ onBranchSelect?: (args: {
32
+ message: ChatMessage;
33
+ metadata?: any;
34
+ option: string;
35
+ }) => void;
36
+ }
37
+ export declare const LangChainMessageList: React.ForwardRefExoticComponent<LangChainMessageListProps & React.RefAttributes<HTMLDivElement>>;
38
+ export default LangChainMessageList;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ThreadManager.tsx (LangGraph-focused variant)
3
+ *
4
+ * A thread sidebar component built specifically for LangGraph + useStream
5
+ * No external dependencies on the old ChatSessionProvider
6
+ */
7
+ import type { ThreadInfo } from '../hooks/useLangGraphThreadManager';
8
+ export interface LangGraphThreadManagerProps {
9
+ className?: string;
10
+ showCreateButton?: boolean;
11
+ showDeleteButton?: boolean;
12
+ showEditTitle?: boolean;
13
+ maxHeight?: string;
14
+ customStyles?: {
15
+ container?: string;
16
+ threadList?: string;
17
+ threadItem?: string;
18
+ activeThread?: string;
19
+ createButton?: string;
20
+ header?: string;
21
+ };
22
+ threads: ThreadInfo[];
23
+ currentThreadId: string | null;
24
+ isLoading: boolean;
25
+ onThreadSelect: (threadId: string) => void;
26
+ onThreadCreate?: (threadId: string | null) => void;
27
+ onThreadDelete: (threadId: string) => void;
28
+ onThreadRename: (threadId: string, title: string) => Promise<void>;
29
+ onCreateNew?: () => Promise<string | null | void>;
30
+ }
31
+ export declare function LangGraphThreadManager({ className, showCreateButton, showDeleteButton, showEditTitle, maxHeight, customStyles, threads, currentThreadId, isLoading, onThreadSelect, onThreadCreate, onThreadDelete, onThreadRename, onCreateNew, }: LangGraphThreadManagerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * useLangGraphThreadManager.ts
3
+ *
4
+ * A lightweight thread manager hook for LangGraph-based applications.
5
+ * Works directly with the useStream hook from @langchain/langgraph-sdk/react
6
+ *
7
+ * Key features:
8
+ * - Manage thread lifecycle (create, list, switch, delete)
9
+ * - Fetch initial thread state from /threads/{id}
10
+ * - Cache threads locally to avoid flashing
11
+ * - Optimistic updates for better UX
12
+ */
13
+ export interface ThreadInfo {
14
+ threadId: string;
15
+ title: string;
16
+ createdAt?: string;
17
+ updatedAt?: string;
18
+ messageCount?: number;
19
+ }
20
+ export interface UseLangGraphThreadManagerOptions {
21
+ apiUrl: string;
22
+ assistantId: string;
23
+ }
24
+ export interface UseLangGraphThreadManagerReturn {
25
+ threads: ThreadInfo[];
26
+ currentThreadId: string | null;
27
+ isLoading: boolean;
28
+ error: Error | null;
29
+ setCurrentThreadId: (id: string | null) => void;
30
+ createThread: (title?: string) => Promise<string>;
31
+ deleteThread: (threadId: string) => Promise<void>;
32
+ updateThreadTitle: (threadId: string, title: string) => Promise<void>;
33
+ refreshThreads: (options?: {
34
+ suppressLoading?: boolean;
35
+ }) => Promise<void>;
36
+ loadThreadState: (threadId: string) => Promise<any>;
37
+ persistThreadsCache: (threads?: ThreadInfo[], currentThreadId?: string | null) => void;
38
+ }
39
+ /**
40
+ * LangGraph-focused thread manager
41
+ *
42
+ * Usage:
43
+ * ```tsx
44
+ * const threadManager = useLangGraphThreadManager({
45
+ * apiUrl: 'http://localhost:8001',
46
+ * assistantId: 'my-langgraph-agent',
47
+ * });
48
+ *
49
+ * // Use with useStream
50
+ * const stream = useStream({
51
+ * apiUrl: threadManager.apiUrl,
52
+ * assistantId: threadManager.assistantId,
53
+ * threadId: threadManager.currentThreadId,
54
+ * });
55
+ * ```
56
+ */
57
+ export declare function useLangGraphThreadManager({ apiUrl, assistantId, }: UseLangGraphThreadManagerOptions): UseLangGraphThreadManagerReturn;
@@ -7,7 +7,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
7
7
  declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
8
8
  declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
9
  declare const sheetVariants: (props?: {
10
- side?: "top" | "bottom" | "right" | "left";
10
+ side?: "left" | "right" | "bottom" | "top";
11
11
  } & import("class-variance-authority/dist/types").ClassProp) => string;
12
12
  interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
13
13
  }
@@ -20,5 +20,5 @@ export interface ChatProvidersProps {
20
20
  }
21
21
  export declare function ChatProviders({ children, apiConfig, initialThreadId, autoLoadInitial, disableAutoRestore, enableFileAgentRouting, fileAgentId, onError, onThreadChange, }: ChatProvidersProps): import("react/jsx-runtime").JSX.Element;
22
22
  export { useApi } from './providers/ApiProvider';
23
- export { useStream, useThreads, useMessages } from './providers/ChatSessionProvider';
24
- export type { ApiContextValue, StreamContextValue, ThreadContextValue, MessagesContextValue, SendOptions, } from './types';
23
+ export { useStream, useThreads, useThreadState } from './providers/ChatSessionProvider';
24
+ export type { ApiContextValue, StreamContextValue, ThreadsContextValue, ThreadStateContextValue, SendOptions, } from './types';
@@ -9,7 +9,7 @@
9
9
  */
10
10
  export { ChatProviders } from './ChatProviders';
11
11
  export { ApiProvider, useApi } from './providers/ApiProvider';
12
- export { ChatSessionProvider, useHasChatSession, useMessages, useStream, useThreads } from './providers/ChatSessionProvider';
12
+ export { ChatSessionProvider, useHasChatSession, useThreadState, useStream, useThreads } from './providers/ChatSessionProvider';
13
13
  export { useMessagesReducer } from './reducers/MessageReducer';
14
14
  export type { ReducerStreamEvent } from './reducers/MessageReducer';
15
- export type { SendOptions, ApiContextValue, StreamContextValue, MessagesContextValue, ThreadContextValue, CoordinatorOptions, } from '@/types/api';
15
+ export type { SendOptions, ApiContextValue, StreamContextValue, ThreadStateContextValue, ThreadsContextValue, CoordinatorOptions, } from '@/types/api';
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { MessagesContextValue, StreamContextValue, ThreadContextValue } from '@/types/api';
2
+ import type { StreamContextValue, ThreadsContextValue, ThreadStateContextValue } from '@/types/api';
3
3
  interface ChatSessionProviderPropsBase {
4
4
  children: ReactNode;
5
5
  initialThreadId?: string | null;
@@ -12,8 +12,8 @@ interface ChatSessionProviderPropsBase {
12
12
  }
13
13
  export type ChatSessionProviderProps = ChatSessionProviderPropsBase;
14
14
  export declare function ChatSessionProvider({ children, initialThreadId, autoLoadInitial, disableAutoRestore, enableFileAgentRouting, fileAgentId, onError, onThreadChange, }: ChatSessionProviderProps): import("react/jsx-runtime").JSX.Element;
15
- export declare function useThreads(): ThreadContextValue;
16
- export declare function useMessages(): MessagesContextValue;
15
+ export declare function useThreads(): ThreadsContextValue;
16
+ export declare function useThreadState(): ThreadStateContextValue;
17
17
  export declare function useStream(): StreamContextValue;
18
18
  export declare function useHasChatSession(): boolean;
19
19
  export {};
@@ -1 +1 @@
1
- export type { ApiContextValue, StreamContextValue, MessagesContextValue, ThreadContextValue, SendOptions, StreamEvent, MessageAction, StreamAction, ThreadAction, CoordinatorOptions, } from '@/types/api';
1
+ export type { ApiContextValue, StreamContextValue, ThreadsContextValue, ThreadStateContextValue, SendOptions, StreamEvent, MessageAction, StreamAction, ThreadAction, CoordinatorOptions, } from '@/types/api';