teodor-new-chat-ui 4.3.87 → 4.3.89
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/context/index.d.ts +2 -2
- package/dist/context/reducers/MessageReducer.d.ts +1 -1
- package/dist/index.esm.js +2997 -2984
- package/dist/index.umd.js +35 -34
- package/dist/lib/message-utils.d.ts +17 -0
- package/dist/types/api.d.ts +1 -7
- package/package.json +1 -1
- package/dist/components/chat/MessageReducer.d.ts +0 -0
- package/dist/components/langgraph_sdk_pack/components/ChatPageExample.d.ts +0 -6
- package/dist/components/langgraph_sdk_pack/components/LangChainComponent copy.d.ts +0 -7
- package/dist/components/langgraph_sdk_pack/components/LangChainComponent.d.ts +0 -7
- package/dist/components/langgraph_sdk_pack/components/LangChainMessageComponent.d.ts +0 -26
- package/dist/components/langgraph_sdk_pack/components/LangChainMessageList.d.ts +0 -38
- package/dist/components/langgraph_sdk_pack/components/LangGraphThreadManager.d.ts +0 -31
- package/dist/components/langgraph_sdk_pack/hooks/useLangGraphThreadManager.d.ts +0 -57
|
@@ -17,3 +17,20 @@ export declare function sanitizeForDisplay(x: any): any;
|
|
|
17
17
|
* Pretty print content for display
|
|
18
18
|
*/
|
|
19
19
|
export declare function pretty(x: any): string;
|
|
20
|
+
/**
|
|
21
|
+
* Detect if content looks like markdown (has markdown indicators)
|
|
22
|
+
*/
|
|
23
|
+
export declare function looksLikeMarkdown(text: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Intelligently format tool output - markdown if it looks like it, otherwise raw
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatToolOutput(x: any): {
|
|
28
|
+
content: string;
|
|
29
|
+
isMarkdown: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Extract content from tool output, handling wrapped formats like content="..."
|
|
33
|
+
* If the input is a string that looks like JSON, parse it
|
|
34
|
+
* If it's an object with a 'content' property, extract that
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractToolContent(x: any): any;
|
package/dist/types/api.d.ts
CHANGED
|
@@ -23,18 +23,12 @@ export type ToolCallPart = {
|
|
|
23
23
|
name: string;
|
|
24
24
|
args: Record<string, unknown>;
|
|
25
25
|
};
|
|
26
|
-
export type ToolEndPart = {
|
|
27
|
-
type: "tool_end";
|
|
28
|
-
toolCallId: string;
|
|
29
|
-
output: unknown;
|
|
30
|
-
error?: string;
|
|
31
|
-
};
|
|
32
26
|
export type InterruptPart = {
|
|
33
27
|
type: "interrupt";
|
|
34
28
|
value?: any;
|
|
35
29
|
[key: string]: unknown;
|
|
36
30
|
};
|
|
37
|
-
export type MessagePart = TextPart | ImagePart | FilePart | ToolCallPart |
|
|
31
|
+
export type MessagePart = TextPart | ImagePart | FilePart | ToolCallPart | InterruptPart;
|
|
38
32
|
export interface ChatMessage {
|
|
39
33
|
id: string;
|
|
40
34
|
role: Role;
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,26 +0,0 @@
|
|
|
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;
|
|
@@ -1,38 +0,0 @@
|
|
|
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;
|
|
@@ -1,31 +0,0 @@
|
|
|
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;
|
|
@@ -1,57 +0,0 @@
|
|
|
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;
|