teodor-new-chat-ui 1.2.4 → 1.2.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/api/mockBranchingApi.d.ts +43 -0
- package/dist/components/chat/BranchVisualization.d.ts +10 -0
- package/dist/components/chat/BranchingUI.d.ts +16 -0
- package/dist/components/chat/ChatHeader.d.ts +7 -0
- package/dist/components/chat/ChatProvider.d.ts +31 -1
- package/dist/components/chat/ChatSettingsButton.d.ts +8 -0
- package/dist/components/chat/ChatSettingsDemo.d.ts +2 -0
- package/dist/components/chat/ChatSettingsModal.d.ts +6 -0
- package/dist/components/chat/DevControls.d.ts +5 -0
- package/dist/components/chat/JsonRenderer.d.ts +13 -0
- package/dist/components/chat/JsonRendererConfig.d.ts +49 -0
- package/dist/components/chat/JsonRendererControlPanel.d.ts +6 -0
- package/dist/components/chat/JsonRendererUtils.d.ts +15 -0
- package/dist/components/chat/MessageComponent.d.ts +3 -1
- package/dist/components/chat/MissingDataDemo.d.ts +2 -0
- package/dist/components/chat/MissingDataDetector.d.ts +23 -0
- package/dist/components/chat/SpecializedRenderers.d.ts +17 -0
- package/dist/components/chat/index.d.ts +6 -0
- package/dist/components/chat/useChatJsonSync.d.ts +9 -0
- package/dist/components/demo/JsonRendererDemo.d.ts +2 -0
- package/dist/components/ui/command.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/hooks/useChatMessages.d.ts +1 -1
- package/dist/index.esm.js +9444 -3861
- package/dist/index.umd.js +90 -6
- package/dist/lib/devConfig.d.ts +14 -0
- package/dist/lib/markdown.d.ts +14 -0
- package/dist/lib/validation.d.ts +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface BranchPoint {
|
|
2
|
+
id: string;
|
|
3
|
+
threadId: string;
|
|
4
|
+
parentMessageId: string;
|
|
5
|
+
branchId: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MessageWithBranch {
|
|
10
|
+
id: string;
|
|
11
|
+
threadId: string;
|
|
12
|
+
branchId: string;
|
|
13
|
+
parentMessageId?: string;
|
|
14
|
+
role: 'human' | 'ai' | 'tool';
|
|
15
|
+
content: string;
|
|
16
|
+
timestamp: string;
|
|
17
|
+
branchPoint?: BranchPoint;
|
|
18
|
+
hasAlternatives?: boolean;
|
|
19
|
+
alternativeCount?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ThreadBranch {
|
|
22
|
+
id: string;
|
|
23
|
+
threadId: string;
|
|
24
|
+
parentMessageId: string;
|
|
25
|
+
title: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
messages: MessageWithBranch[];
|
|
28
|
+
isActive: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const mockBranchingApi: {
|
|
31
|
+
getThreadMessages(threadId: string, branchId?: string): Promise<MessageWithBranch[]>;
|
|
32
|
+
getThreadBranches(threadId: string): Promise<ThreadBranch[]>;
|
|
33
|
+
createBranch(threadId: string, parentMessageId: string, title?: string): Promise<ThreadBranch>;
|
|
34
|
+
editMessage(messageId: string, newContent: string, createBranch?: boolean): Promise<{
|
|
35
|
+
message: MessageWithBranch;
|
|
36
|
+
branch?: ThreadBranch;
|
|
37
|
+
}>;
|
|
38
|
+
switchToBranch(threadId: string, branchId: string): Promise<ThreadBranch>;
|
|
39
|
+
addMessage(threadId: string, message: Omit<MessageWithBranch, "id" | "timestamp" | "threadId" | "branchId">): Promise<MessageWithBranch>;
|
|
40
|
+
deleteBranch(branchId: string): Promise<void>;
|
|
41
|
+
getBranchTree(threadId: string): Promise<any>;
|
|
42
|
+
isMessageBefore(messageId: string, beforeMessageId: string): boolean;
|
|
43
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface BranchVisualizationProps {
|
|
2
|
+
threadId: string;
|
|
3
|
+
onBranchSelect?: (branchId: string) => void;
|
|
4
|
+
currentBranchId?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function BranchVisualization({ threadId, onBranchSelect, currentBranchId }: BranchVisualizationProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function BranchTreeVisualization({ threadId }: {
|
|
8
|
+
threadId: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MessageWithBranch } from '../../api/mockBranchingApi';
|
|
2
|
+
interface BranchingUIProps {
|
|
3
|
+
threadId: string;
|
|
4
|
+
currentBranchId?: string;
|
|
5
|
+
onBranchSwitch?: (branchId: string) => void;
|
|
6
|
+
onMessageEdit?: (messageId: string, newContent: string, createBranch: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function BranchingUI({ threadId, currentBranchId, onBranchSwitch, onMessageEdit }: BranchingUIProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface BranchableMessageProps {
|
|
10
|
+
message: MessageWithBranch;
|
|
11
|
+
onCreateBranch?: (messageId: string) => void;
|
|
12
|
+
onEditMessage?: (messageId: string, content: string) => void;
|
|
13
|
+
showBranchingControls?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function BranchableMessage({ message, onCreateBranch, onEditMessage, showBranchingControls }: BranchableMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -10,6 +10,33 @@ export interface Message {
|
|
|
10
10
|
branch_id?: string;
|
|
11
11
|
sequence_number?: number;
|
|
12
12
|
isMarkdown?: boolean;
|
|
13
|
+
agentName?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ChatSettings {
|
|
16
|
+
appearance: {
|
|
17
|
+
theme: 'light' | 'dark' | 'system';
|
|
18
|
+
};
|
|
19
|
+
jsonFormatting: {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
theme: 'professional' | 'clean' | 'minimal' | 'dark';
|
|
22
|
+
compactMode: boolean;
|
|
23
|
+
showIcons: boolean;
|
|
24
|
+
highlightMissingData: boolean;
|
|
25
|
+
missingDataStyle: 'red' | 'yellow' | 'gray';
|
|
26
|
+
maxHeight: number;
|
|
27
|
+
autoDetectStructure: boolean;
|
|
28
|
+
};
|
|
29
|
+
messageDisplay: {
|
|
30
|
+
showTimestamps: boolean;
|
|
31
|
+
showAgentNames: boolean;
|
|
32
|
+
compactMessages: boolean;
|
|
33
|
+
showToolCalls: boolean;
|
|
34
|
+
};
|
|
35
|
+
chatBehavior: {
|
|
36
|
+
autoScroll: boolean;
|
|
37
|
+
soundEnabled: boolean;
|
|
38
|
+
typewriterEffect: boolean;
|
|
39
|
+
};
|
|
13
40
|
}
|
|
14
41
|
export interface Thread {
|
|
15
42
|
id: string;
|
|
@@ -37,17 +64,20 @@ interface ChatState {
|
|
|
37
64
|
loadingThreads: boolean;
|
|
38
65
|
availableBranches: Branch[];
|
|
39
66
|
currentBranch: string | null;
|
|
67
|
+
settings: ChatSettings;
|
|
40
68
|
}
|
|
41
69
|
interface ChatActions {
|
|
42
70
|
selectThread: (threadId: string | null) => void;
|
|
43
71
|
createThread: () => Promise<string>;
|
|
44
72
|
deleteThread: (threadId: string) => Promise<void>;
|
|
45
73
|
updateThreadTitle: (threadId: string, title: string) => Promise<void>;
|
|
46
|
-
sendMessage: (content: string) => Promise<void>;
|
|
74
|
+
sendMessage: (content: string, files?: File[]) => Promise<void>;
|
|
47
75
|
editMessage: (message: Message, newContent: string, rerun?: boolean, editFromInput?: boolean) => Promise<void>;
|
|
48
76
|
regenerateFromMessage: (message: Message, newContent?: string) => Promise<void>;
|
|
49
77
|
stop: () => void;
|
|
50
78
|
switchBranch: (branchId: string) => Promise<void>;
|
|
79
|
+
updateSettings: (settings: Partial<ChatSettings>) => void;
|
|
80
|
+
resetSettings: () => void;
|
|
51
81
|
clearError: () => void;
|
|
52
82
|
refresh: () => Promise<void>;
|
|
53
83
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ChatSettingsButtonProps {
|
|
2
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
3
|
+
variant?: 'floating' | 'inline';
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ChatSettingsButton({ position, variant, size, className }: ChatSettingsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default ChatSettingsButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface JsonRendererProps {
|
|
2
|
+
content: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function isJsonContent(text: string): boolean;
|
|
6
|
+
export declare function shouldRenderAsJson(text: string, config?: any): boolean;
|
|
7
|
+
export declare function extractJsonFromText(text: string): {
|
|
8
|
+
json: any;
|
|
9
|
+
beforeJson: string;
|
|
10
|
+
afterJson: string;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function JsonRenderer({ content, className }: JsonRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default JsonRenderer;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type DeepPartial<T> = {
|
|
3
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
4
|
+
};
|
|
5
|
+
export interface JsonRendererConfig {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
mode: 'auto' | 'manual' | 'preview' | 'raw';
|
|
8
|
+
features: {
|
|
9
|
+
copyButton: boolean;
|
|
10
|
+
expandCollapse: boolean;
|
|
11
|
+
syntaxHighlighting: boolean;
|
|
12
|
+
typeDetection: boolean;
|
|
13
|
+
interactiveElements: boolean;
|
|
14
|
+
};
|
|
15
|
+
visual: {
|
|
16
|
+
theme: 'light' | 'dark' | 'auto';
|
|
17
|
+
compactMode: boolean;
|
|
18
|
+
showIcons: boolean;
|
|
19
|
+
maxHeight: number;
|
|
20
|
+
maxItems: number;
|
|
21
|
+
highlightMissingData: boolean;
|
|
22
|
+
missingDataStyle: 'red' | 'yellow' | 'gray';
|
|
23
|
+
};
|
|
24
|
+
renderers: {
|
|
25
|
+
researchPlan: boolean;
|
|
26
|
+
configuration: boolean;
|
|
27
|
+
errorMessages: boolean;
|
|
28
|
+
metrics: boolean;
|
|
29
|
+
lists: boolean;
|
|
30
|
+
generic: boolean;
|
|
31
|
+
};
|
|
32
|
+
detection: {
|
|
33
|
+
strict: boolean;
|
|
34
|
+
minJsonSize: number;
|
|
35
|
+
allowMixedContent: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare const useJsonRenderer: () => {
|
|
39
|
+
config: JsonRendererConfig;
|
|
40
|
+
updateConfig: (updates: DeepPartial<JsonRendererConfig>) => void;
|
|
41
|
+
resetConfig: () => void;
|
|
42
|
+
getPreset: (preset: string) => void;
|
|
43
|
+
};
|
|
44
|
+
interface JsonRendererProviderProps {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
initialConfig?: DeepPartial<JsonRendererConfig>;
|
|
47
|
+
}
|
|
48
|
+
export declare function JsonRendererProvider({ children, initialConfig }: JsonRendererProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface JsonRendererControlPanelProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
showPresets?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function JsonRendererControlPanel({ className, showPresets }: JsonRendererControlPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default JsonRendererControlPanel;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JsonRendererConfig } from './JsonRendererConfig';
|
|
2
|
+
export declare const JsonRendererPresets: {
|
|
3
|
+
presentation: () => Partial<JsonRendererConfig>;
|
|
4
|
+
disabled: () => Partial<JsonRendererConfig>;
|
|
5
|
+
demo: () => Partial<JsonRendererConfig>;
|
|
6
|
+
minimal: () => Partial<JsonRendererConfig>;
|
|
7
|
+
development: () => Partial<JsonRendererConfig>;
|
|
8
|
+
};
|
|
9
|
+
export declare const JsonUtils: {
|
|
10
|
+
hasStructuredData: (content: string) => boolean;
|
|
11
|
+
getJsonPreview: (content: string, maxLength?: number) => string;
|
|
12
|
+
isValidForRenderer: (content: string, rendererType: string) => boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const setupJsonRenderer: (mode: keyof typeof JsonRendererPresets) => Partial<JsonRendererConfig>;
|
|
15
|
+
export declare const presentationMode: () => Partial<JsonRendererConfig>, disabledMode: () => Partial<JsonRendererConfig>, demoMode: () => Partial<JsonRendererConfig>, minimalMode: () => Partial<JsonRendererConfig>, developmentMode: () => Partial<JsonRendererConfig>;
|
|
@@ -7,6 +7,8 @@ interface MessageComponentProps {
|
|
|
7
7
|
showBranches?: boolean;
|
|
8
8
|
branches?: any[];
|
|
9
9
|
onSwitchBranch?: (branchId: string) => void;
|
|
10
|
+
messageIndex?: number;
|
|
11
|
+
currentBranch?: string;
|
|
10
12
|
}
|
|
11
|
-
export declare function MessageComponent({ message, onRegenerate, onEditMessage, showRegenerate, showBranches, branches, onSwitchBranch }: MessageComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function MessageComponent({ message, onRegenerate, onEditMessage, showRegenerate, showBranches, branches, onSwitchBranch, messageIndex, currentBranch }: MessageComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const MissingDataDetector: {
|
|
2
|
+
missingPatterns: string[];
|
|
3
|
+
isMissingData: (value: any) => boolean;
|
|
4
|
+
getMissingDataStyles: (config: any) => string;
|
|
5
|
+
renderValue: (value: any, config: any) => {
|
|
6
|
+
text: string;
|
|
7
|
+
isMissing: boolean;
|
|
8
|
+
className: string;
|
|
9
|
+
};
|
|
10
|
+
analyzeMissingData: (data: any) => {
|
|
11
|
+
totalFields: number;
|
|
12
|
+
missingFields: number;
|
|
13
|
+
missingPercentage: number;
|
|
14
|
+
missingFieldPaths: string[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const MissingDataWrapper: ({ children, value, config, className }: {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
value: any;
|
|
20
|
+
config: any;
|
|
21
|
+
className?: string;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default MissingDataDetector;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare function ConfigRenderer({ data, config }: {
|
|
2
|
+
data: any;
|
|
3
|
+
config?: any;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function ListRenderer({ data, config }: {
|
|
6
|
+
data: any[];
|
|
7
|
+
config?: any;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function ErrorRenderer({ data, config }: {
|
|
10
|
+
data: any;
|
|
11
|
+
config?: any;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function MetricsRenderer({ data, config }: {
|
|
14
|
+
data: any;
|
|
15
|
+
config?: any;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export { ConfigRenderer, ListRenderer, ErrorRenderer, MetricsRenderer };
|
|
@@ -4,6 +4,12 @@ export { ThreadManager } from './ThreadManager';
|
|
|
4
4
|
export { ChatInterface } from './ChatInterface';
|
|
5
5
|
export { MessageComponent } from './MessageComponent';
|
|
6
6
|
export { ChatWidget } from './ChatWidget';
|
|
7
|
+
export { ChatHeader } from './ChatHeader';
|
|
8
|
+
export { ChatSettingsButton } from './ChatSettingsButton';
|
|
9
|
+
export { ChatSettingsModal } from './ChatSettingsModal';
|
|
10
|
+
export { JsonRenderer } from './JsonRenderer';
|
|
11
|
+
export { JsonRendererProvider, useJsonRenderer } from './JsonRendererConfig';
|
|
12
|
+
export { useChatJsonSync } from './useChatJsonSync';
|
|
7
13
|
export { useChatMessages, useToolMessages, useChatActions } from '../../hooks/useChatMessages';
|
|
8
14
|
export { useStreamMonitor, useToolExtractor, useSearchResults, useFileContents, useCodeExecution } from '../../hooks/useStreamMonitor';
|
|
9
15
|
export type { Message, Thread, Branch } from './ChatProvider';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that synchronizes ChatProvider settings with JsonRenderer configuration
|
|
3
|
+
* This ensures that when users change settings in the chat settings modal,
|
|
4
|
+
* the JSON rendering behavior updates accordingly.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useChatJsonSync(): {
|
|
7
|
+
settings: import("./ChatProvider").ChatSettings;
|
|
8
|
+
};
|
|
9
|
+
export default useChatJsonSync;
|
|
@@ -68,7 +68,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
68
68
|
ref?: React.Ref<HTMLDivElement>;
|
|
69
69
|
} & {
|
|
70
70
|
asChild?: boolean;
|
|
71
|
-
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "
|
|
71
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
|
|
72
72
|
disabled?: boolean;
|
|
73
73
|
onSelect?: (value: string) => void;
|
|
74
74
|
value?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ResizablePrimitive from "react-resizable-panels";
|
|
2
2
|
declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLTextAreaElement | HTMLDivElement |
|
|
3
|
+
declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLTextAreaElement | HTMLDivElement | HTMLParagraphElement | HTMLHeadingElement | HTMLSpanElement | HTMLBRElement | HTMLPreElement | HTMLObjectElement | HTMLUListElement | HTMLOListElement | HTMLLIElement | HTMLQuoteElement | HTMLAnchorElement | HTMLTitleElement | HTMLInputElement | HTMLProgressElement | HTMLSelectElement | HTMLMapElement | HTMLLinkElement | HTMLFormElement | HTMLSlotElement | HTMLStyleElement | HTMLDialogElement | HTMLImageElement | HTMLOptionElement | HTMLTableElement | HTMLDataElement | HTMLLabelElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLBodyElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOutputElement | HTMLScriptElement | HTMLSourceElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
|
|
4
4
|
className?: string | undefined;
|
|
5
5
|
collapsedSize?: number | undefined;
|
|
6
6
|
collapsible?: boolean | undefined;
|
|
@@ -55,7 +55,7 @@ export declare function useChatActions(): {
|
|
|
55
55
|
currentThread: string;
|
|
56
56
|
isLoading: boolean;
|
|
57
57
|
error: string;
|
|
58
|
-
sendMessage: (content: string) => Promise<void>;
|
|
58
|
+
sendMessage: (content: string, files?: File[]) => Promise<void>;
|
|
59
59
|
createThread: () => Promise<string>;
|
|
60
60
|
selectThread: (threadId: string | null) => void;
|
|
61
61
|
deleteThread: (threadId: string) => Promise<void>;
|