@sciol/xyzen 0.0.7 → 0.0.9
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/app/App.d.ts +1 -0
- package/dist/app/Xyzen.d.ts +1 -0
- package/dist/components/layouts/XyzenChat.d.ts +1 -0
- package/dist/components/layouts/XyzenHistory.d.ts +1 -0
- package/dist/components/layouts/XyzenNodes.d.ts +1 -0
- package/dist/components/layouts/components/ChatBubble.d.ts +14 -0
- package/dist/components/layouts/components/ChatInput.d.ts +9 -0
- package/dist/components/layouts/components/EmptyChat.d.ts +3 -0
- package/dist/components/layouts/components/WelcomeMessage.d.ts +30 -0
- package/dist/context/XyzenProvider.d.ts +1 -0
- package/dist/hooks/useTheme.d.ts +6 -0
- package/dist/index.d.ts +2 -1
- package/dist/lib/Markdown.d.ts +6 -0
- package/dist/lib/formatDate.d.ts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/service/xyzenService.d.ts +16 -0
- package/dist/store/xyzenStore.d.ts +81 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Xyzen(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function XyzenChat(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function XyzenHistory(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function XyzenNodes(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface Message {
|
|
3
|
+
id: string;
|
|
4
|
+
sender: string;
|
|
5
|
+
content: string;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
isCurrentUser?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface ChatBubbleProps {
|
|
11
|
+
message: Message;
|
|
12
|
+
}
|
|
13
|
+
declare const ChatBubble: React.FC<ChatBubbleProps>;
|
|
14
|
+
export default ChatBubble;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface ChatInputProps {
|
|
3
|
+
onSendMessage: (message: string) => void;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
onHeightChange?: (height: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ChatInput: React.FC<ChatInputProps>;
|
|
9
|
+
export default ChatInput;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ChatData {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
assistant?: string;
|
|
6
|
+
assistant_name?: string;
|
|
7
|
+
messages_count: number;
|
|
8
|
+
last_message?: {
|
|
9
|
+
content: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
};
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
is_pinned: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface Assistant {
|
|
17
|
+
id: string;
|
|
18
|
+
key?: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
iconType: string;
|
|
22
|
+
iconColor: string;
|
|
23
|
+
category: string;
|
|
24
|
+
chats?: ChatData[];
|
|
25
|
+
}
|
|
26
|
+
interface WelcomeMessageProps {
|
|
27
|
+
assistant?: Assistant | null;
|
|
28
|
+
}
|
|
29
|
+
declare const WelcomeMessage: React.FC<WelcomeMessageProps>;
|
|
30
|
+
export default WelcomeMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export { Xyzen } from './app/App';
|
|
2
|
+
export { useXyzen } from './store/xyzenStore';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatTime(dateString: string): string;
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Message } from '../store/xyzenStore';
|
|
2
|
+
interface StatusChangePayload {
|
|
3
|
+
connected: boolean;
|
|
4
|
+
error: string | null;
|
|
5
|
+
}
|
|
6
|
+
type ServiceCallback<T> = (payload: T) => void;
|
|
7
|
+
declare class XyzenService {
|
|
8
|
+
private ws;
|
|
9
|
+
private onMessageCallback;
|
|
10
|
+
private onStatusChangeCallback;
|
|
11
|
+
connect(sessionId: string, topicId: string, onMessage: ServiceCallback<Message>, onStatusChange: ServiceCallback<StatusChangePayload>): void;
|
|
12
|
+
sendMessage(message: string): void;
|
|
13
|
+
disconnect(): void;
|
|
14
|
+
}
|
|
15
|
+
declare const xyzenService: XyzenService;
|
|
16
|
+
export default xyzenService;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface Message {
|
|
2
|
+
id: string;
|
|
3
|
+
content: string;
|
|
4
|
+
sender: "user" | "assistant" | "system";
|
|
5
|
+
timestamp: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ChatChannel {
|
|
8
|
+
id: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
messages: Message[];
|
|
12
|
+
assistantId?: string;
|
|
13
|
+
connected: boolean;
|
|
14
|
+
error: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface ChatHistoryItem {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
assistantTitle: string;
|
|
21
|
+
lastMessage?: string;
|
|
22
|
+
isPinned: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface Assistant {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
}
|
|
29
|
+
export interface User {
|
|
30
|
+
username: string;
|
|
31
|
+
avatar: string;
|
|
32
|
+
}
|
|
33
|
+
export type Theme = "light" | "dark" | "system";
|
|
34
|
+
interface XyzenState {
|
|
35
|
+
isXyzenOpen: boolean;
|
|
36
|
+
panelWidth: number;
|
|
37
|
+
activeChatChannel: string | null;
|
|
38
|
+
user: User | null;
|
|
39
|
+
activeTabIndex: number;
|
|
40
|
+
theme: Theme;
|
|
41
|
+
chatHistory: ChatHistoryItem[];
|
|
42
|
+
chatHistoryLoading: boolean;
|
|
43
|
+
channels: Record<string, ChatChannel>;
|
|
44
|
+
assistants: Assistant[];
|
|
45
|
+
toggleXyzen: () => void;
|
|
46
|
+
openXyzen: () => void;
|
|
47
|
+
closeXyzen: () => void;
|
|
48
|
+
setPanelWidth: (width: number) => void;
|
|
49
|
+
setActiveChatChannel: (channelUUID: string | null) => void;
|
|
50
|
+
setTabIndex: (index: number) => void;
|
|
51
|
+
setTheme: (theme: Theme) => void;
|
|
52
|
+
fetchChatHistory: () => Promise<void>;
|
|
53
|
+
togglePinChat: (chatId: string) => void;
|
|
54
|
+
connectToChannel: (sessionId: string, topicId: string) => void;
|
|
55
|
+
disconnectFromChannel: () => void;
|
|
56
|
+
sendMessage: (message: string) => void;
|
|
57
|
+
createDefaultChannel: () => Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
export declare const useXyzen: import('zustand').UseBoundStore<Omit<Omit<import('zustand').StoreApi<XyzenState>, "persist"> & {
|
|
60
|
+
persist: {
|
|
61
|
+
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<XyzenState, {
|
|
62
|
+
panelWidth: number;
|
|
63
|
+
isXyzenOpen: boolean;
|
|
64
|
+
theme: Theme;
|
|
65
|
+
}>>) => void;
|
|
66
|
+
clearStorage: () => void;
|
|
67
|
+
rehydrate: () => Promise<void> | void;
|
|
68
|
+
hasHydrated: () => boolean;
|
|
69
|
+
onHydrate: (fn: (state: XyzenState) => void) => () => void;
|
|
70
|
+
onFinishHydration: (fn: (state: XyzenState) => void) => () => void;
|
|
71
|
+
getOptions: () => Partial<import('zustand/middleware').PersistOptions<XyzenState, {
|
|
72
|
+
panelWidth: number;
|
|
73
|
+
isXyzenOpen: boolean;
|
|
74
|
+
theme: Theme;
|
|
75
|
+
}>>;
|
|
76
|
+
};
|
|
77
|
+
}, "setState"> & {
|
|
78
|
+
setState(nextStateOrUpdater: XyzenState | Partial<XyzenState> | ((state: import('immer').WritableDraft<XyzenState>) => void), shouldReplace?: false): void;
|
|
79
|
+
setState(nextStateOrUpdater: XyzenState | ((state: import('immer').WritableDraft<XyzenState>) => void), shouldReplace: true): void;
|
|
80
|
+
}>;
|
|
81
|
+
export {};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sciol/xyzen",
|
|
3
3
|
"packageManager": "yarn@1.22.22",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.9",
|
|
6
6
|
"description": "A modern, lightweight, and extensible chat component for React.",
|
|
7
7
|
"author": "Haohui <harveyque@outlook.com>",
|
|
8
8
|
"license": "GPL-3.0-only",
|