@nexo-labs/chat-agent 1.6.20 → 1.7.1
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/react.d.mts +87 -7
- package/dist/react.d.mts.map +1 -1
- package/dist/react.mjs +1634 -1177
- package/dist/react.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -5
- package/src/components/ChatHistoryList.tsx +191 -0
- package/src/components/ChatInterface.tsx +31 -85
- package/src/components/ChatMenuDropdown.tsx +130 -75
- package/src/components/DocumentSelector.tsx +97 -173
- package/src/components/FloatingChatManager.tsx +14 -3
- package/src/components/FloatingChatPanel.tsx +107 -81
- package/src/components/SourcesList.tsx +240 -226
- package/src/components/UsageDisplay.tsx +79 -14
- package/src/components/assistant-ui/index.ts +3 -0
- package/src/components/assistant-ui/markdown-text.tsx +16 -0
- package/src/components/assistant-ui/thinking-indicator.tsx +81 -0
- package/src/components/assistant-ui/thread.tsx +440 -0
- package/src/components/buttons/FloatingChatButton.tsx +91 -30
- package/src/components/buttons/ViewMoreLink.tsx +21 -34
- package/src/components/chat-context.tsx +25 -1
- package/src/hooks/useAssistantRuntime.ts +296 -0
- package/src/hooks/useChatSession.ts +137 -44
- package/src/lib/utils.ts +6 -0
- package/src/react.ts +7 -0
- package/src/styles/input.css +163 -20
- package/src/types/components.tsx +3 -2
- package/dist/server.d.mts +0 -103
- package/dist/server.d.mts.map +0 -1
- package/dist/server.mjs +0 -280
- package/dist/server.mjs.map +0 -1
- package/src/components/ChatInput.tsx +0 -40
- package/src/components/ChatMessages.tsx +0 -103
- package/src/components/MainButton.tsx +0 -98
- package/src/components/icons/ArticleIcon.tsx +0 -28
- package/src/components/icons/BookIcon.tsx +0 -26
- package/src/components/icons/ChevronDownIcon.tsx +0 -26
- package/src/components/icons/CloseXIcon.tsx +0 -33
- package/src/components/icons/ExpandIcon.tsx +0 -32
- package/src/components/icons/ListIcon.tsx +0 -23
- package/src/components/icons/SearchIcon.tsx +0 -25
- package/src/components/icons/index.ts +0 -7
- package/src/server.ts +0 -20
- package/src/usage/limits.ts +0 -284
- package/src/usage/token-calculator.ts +0 -188
package/dist/react.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
1
|
+
import React$1, { FC, ReactNode } from "react";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import * as _assistant_ui_react0 from "@assistant-ui/react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/chat-context.d.ts
|
|
6
6
|
|
|
@@ -17,17 +17,18 @@ declare const ChatProvider: ({
|
|
|
17
17
|
*/
|
|
18
18
|
interface LinkComponentProps {
|
|
19
19
|
href: string;
|
|
20
|
-
children: React.ReactNode;
|
|
20
|
+
children: React$1.ReactNode;
|
|
21
21
|
onClick?: () => void;
|
|
22
22
|
className?: string;
|
|
23
23
|
target?: string;
|
|
24
24
|
'aria-label'?: string;
|
|
25
|
+
title?: string;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Type for a Link component that can be injected from outside
|
|
28
29
|
* Default fallback is a regular <a> tag
|
|
29
30
|
*/
|
|
30
|
-
type LinkComponent = React.ComponentType<LinkComponentProps>;
|
|
31
|
+
type LinkComponent = React$1.ComponentType<LinkComponentProps>;
|
|
31
32
|
/**
|
|
32
33
|
* Props for an Image component that can be injected
|
|
33
34
|
* Compatible with next/image and regular <img> tags
|
|
@@ -43,13 +44,20 @@ interface ImageComponentProps {
|
|
|
43
44
|
* Type for an Image component that can be injected from outside
|
|
44
45
|
* Default fallback is a regular <img> tag
|
|
45
46
|
*/
|
|
46
|
-
type ImageComponent = React.ComponentType<ImageComponentProps>;
|
|
47
|
+
type ImageComponent = React$1.ComponentType<ImageComponentProps>;
|
|
47
48
|
//#endregion
|
|
48
49
|
//#region src/components/FloatingChatManager.d.ts
|
|
50
|
+
/**
|
|
51
|
+
* Minimal user type - consumer provides their own user type
|
|
52
|
+
*/
|
|
53
|
+
interface User {
|
|
54
|
+
id: string | number;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
49
57
|
interface FloatingChatManagerProps {
|
|
50
58
|
aiIcon: string;
|
|
51
59
|
useUser: () => {
|
|
52
|
-
user:
|
|
60
|
+
user: User | null;
|
|
53
61
|
};
|
|
54
62
|
generateHref: (props: {
|
|
55
63
|
type: string;
|
|
@@ -69,5 +77,77 @@ declare const FloatingChatManager: ({
|
|
|
69
77
|
ImageComponent
|
|
70
78
|
}: FloatingChatManagerProps) => react_jsx_runtime0.JSX.Element | null;
|
|
71
79
|
//#endregion
|
|
72
|
-
|
|
80
|
+
//#region src/components/assistant-ui/thread.d.ts
|
|
81
|
+
interface ThreadProps {
|
|
82
|
+
runtime: ReturnType<typeof _assistant_ui_react0.useExternalStoreRuntime>;
|
|
83
|
+
welcomeTitle?: string;
|
|
84
|
+
welcomeSubtitle?: string;
|
|
85
|
+
generateHref: (props: {
|
|
86
|
+
type: string;
|
|
87
|
+
value: {
|
|
88
|
+
id: number;
|
|
89
|
+
slug?: string | null;
|
|
90
|
+
};
|
|
91
|
+
}) => string;
|
|
92
|
+
LinkComponent?: LinkComponent;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Main Thread component styled for Oraculo de Escohotado
|
|
96
|
+
*/
|
|
97
|
+
declare const Thread: FC<ThreadProps>;
|
|
98
|
+
declare const Composer: FC;
|
|
99
|
+
declare const UserMessage: FC;
|
|
100
|
+
declare const AssistantMessage: FC;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/components/assistant-ui/markdown-text.d.ts
|
|
103
|
+
interface MarkdownTextProps {
|
|
104
|
+
text: string;
|
|
105
|
+
}
|
|
106
|
+
declare const MarkdownText: FC<MarkdownTextProps>;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/hooks/useAssistantRuntime.d.ts
|
|
109
|
+
interface Source {
|
|
110
|
+
id: string;
|
|
111
|
+
title: string;
|
|
112
|
+
slug: string;
|
|
113
|
+
type: 'article' | 'book';
|
|
114
|
+
chunkIndex: number;
|
|
115
|
+
relevanceScore: number;
|
|
116
|
+
content: string;
|
|
117
|
+
excerpt?: string;
|
|
118
|
+
}
|
|
119
|
+
interface Message {
|
|
120
|
+
role: 'user' | 'assistant';
|
|
121
|
+
content: string;
|
|
122
|
+
timestamp: Date;
|
|
123
|
+
sources?: Source[];
|
|
124
|
+
}
|
|
125
|
+
interface Document {
|
|
126
|
+
id: string;
|
|
127
|
+
title: string;
|
|
128
|
+
slug: string;
|
|
129
|
+
type: 'article' | 'book';
|
|
130
|
+
collection: string;
|
|
131
|
+
}
|
|
132
|
+
interface UseAssistantRuntimeProps {
|
|
133
|
+
messages: Message[];
|
|
134
|
+
setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
|
|
135
|
+
conversationId: string | null;
|
|
136
|
+
setConversationId: (id: string | null) => void;
|
|
137
|
+
selectedDocuments: Document[];
|
|
138
|
+
selectedAgent: string | null;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Hook that creates an assistant-ui runtime from existing chat hooks
|
|
142
|
+
*/
|
|
143
|
+
declare function useAssistantRuntime({
|
|
144
|
+
messages,
|
|
145
|
+
setMessages,
|
|
146
|
+
conversationId,
|
|
147
|
+
setConversationId,
|
|
148
|
+
selectedDocuments,
|
|
149
|
+
selectedAgent
|
|
150
|
+
}: UseAssistantRuntimeProps): any;
|
|
151
|
+
//#endregion
|
|
152
|
+
export { AssistantMessage, ChatProvider, Composer, FloatingChatManager, MarkdownText, Thread, UserMessage, useAssistantRuntime };
|
|
73
153
|
//# sourceMappingURL=react.d.mts.map
|
package/dist/react.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.mts","names":[],"sources":["../src/components/chat-context.tsx","../src/types/components.tsx","../src/components/FloatingChatManager.tsx"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"react.d.mts","names":[],"sources":["../src/components/chat-context.tsx","../src/types/components.tsx","../src/components/FloatingChatManager.tsx","../src/components/assistant-ui/thread.tsx","../src/components/assistant-ui/markdown-text.tsx","../src/hooks/useAssistantRuntime.ts"],"sourcesContent":[],"mappings":";;;;;;AG8BoB,cH0BP,YG1BO,EAAA,CAAA;EAAA;AAMpB,CANoB,EAAA;EAAa,QAAA,EH0BsB,SG1BtB;AAMjC,CAAA,EAAA,GHoBkE,kBAAA,CAAA,GAAA,CAAA,OGpB3C;;;;;;;AHoBV,UClDI,kBAAA,CDiLhB;EA/HwB,IAAA,EAAA,MAAA;EAA8B,QAAA,EChD3C,OAAA,CAAM,SDgDqC;EAAW,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EA+HjE,SAAA,CAAA,EAAA,MAAA;;;;ACjLD;AAcA;AAMA;AAYA;;KAlBY,aAAA,GAAgB,OAAA,CAAM,cAAc;;ACfsB;AAKxD;;AASI,UDOD,mBAAA,CCPC;EACC,GAAA,EAAA,MAAA;EAAc,GAAA,EAAA,MAAA;EAG3B,KAAA,CAAA,EAAA,MAAA;EAAmB,MAAA,CAAA,EAAA,MAAA;EAAA,SAAA,CAAA,EAAA,MAAA;;;;;;AAME,KDSf,cAAA,GAAiB,OAAA,CAAM,aCTR,CDSsB,mBCTtB,CAAA;;;;;;UAnBjB,IAAA;EF8CG,EAAA,EAAA,MAAA,GAAA,MA+HZ;EA/HwB,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;UEzCf,wBAAA,CFyCwD;EA+HjE,MAAA,EAAA,MAAA;;UEtKwB;;EDXR,YAAA,EAAA,CAAA,KAAA,EAAkB;IAcvB,IAAA,EAAA,MAAa;IAMR,KAAA,EAAA;MAYL,EAAA,EAAA,MAAc;;;;EC5BhB,aAAI,CAAA,EASI,aATJ;EAKJ,cAAA,CAAA,EAKS,cALe;;cAQ5B,mBAJY,EAAA,CAAA;EAAA,MAAA;EAAA,OAAA;EAAA,YAAA;EAAA,aAAA;E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