@aikaara/chat-sdk 0.1.0
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/cdn/aikaara-chat.iife.js +502 -0
- package/dist/headless-CjIUiswe.cjs +1 -0
- package/dist/headless-DzI-CcOZ.mjs +557 -0
- package/dist/headless.cjs +1 -0
- package/dist/headless.d.ts +243 -0
- package/dist/headless.mjs +11 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +354 -0
- package/dist/index.mjs +52 -0
- package/dist/ui.cjs +502 -0
- package/dist/ui.d.ts +182 -0
- package/dist/ui.mjs +994 -0
- package/package.json +41 -0
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
export declare class AikaaraChatBubble extends HTMLElement {
|
|
2
|
+
private shadow;
|
|
3
|
+
constructor();
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
private render;
|
|
6
|
+
setIcon(svgOrText: string): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export declare class AikaaraChatHeader extends HTMLElement {
|
|
10
|
+
private shadow;
|
|
11
|
+
static get observedAttributes(): string[];
|
|
12
|
+
constructor();
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
attributeChangedCallback(): void;
|
|
15
|
+
private render;
|
|
16
|
+
setStatus(status: string): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare class AikaaraChatInput extends HTMLElement {
|
|
20
|
+
private shadow;
|
|
21
|
+
private textarea;
|
|
22
|
+
private sendBtn;
|
|
23
|
+
private _disabled;
|
|
24
|
+
constructor();
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
set disabled(val: boolean);
|
|
27
|
+
get disabled(): boolean;
|
|
28
|
+
focus(): void;
|
|
29
|
+
clear(): void;
|
|
30
|
+
private handleSend;
|
|
31
|
+
private autoGrow;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare class AikaaraChatWidget extends HTMLElement {
|
|
35
|
+
private shadow;
|
|
36
|
+
private controller;
|
|
37
|
+
private _config;
|
|
38
|
+
static get observedAttributes(): string[];
|
|
39
|
+
constructor();
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
disconnectedCallback(): void;
|
|
42
|
+
attributeChangedCallback(_name: string, oldVal: string, newVal: string): void;
|
|
43
|
+
configure(config: Partial<WidgetConfig>): void;
|
|
44
|
+
private getConfig;
|
|
45
|
+
private render;
|
|
46
|
+
private initController;
|
|
47
|
+
private darkenColor;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare class AikaaraErrorBanner extends HTMLElement {
|
|
51
|
+
private shadow;
|
|
52
|
+
private container;
|
|
53
|
+
private dismissTimer;
|
|
54
|
+
constructor();
|
|
55
|
+
connectedCallback(): void;
|
|
56
|
+
show(message: string, autoDismissMs?: number): void;
|
|
57
|
+
hide(): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare class AikaaraMessageBubble extends HTMLElement {
|
|
61
|
+
private shadow;
|
|
62
|
+
static get observedAttributes(): string[];
|
|
63
|
+
constructor();
|
|
64
|
+
connectedCallback(): void;
|
|
65
|
+
attributeChangedCallback(): void;
|
|
66
|
+
private render;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare class AikaaraMessageList extends HTMLElement {
|
|
70
|
+
private shadow;
|
|
71
|
+
private container;
|
|
72
|
+
private welcomeMessage;
|
|
73
|
+
private showTimestamps;
|
|
74
|
+
constructor();
|
|
75
|
+
connectedCallback(): void;
|
|
76
|
+
setWelcomeMessage(message: string): void;
|
|
77
|
+
setShowTimestamps(show: boolean): void;
|
|
78
|
+
renderMessages(messages: Message[]): void;
|
|
79
|
+
addMessage(message: Message): void;
|
|
80
|
+
updateStreamingContent(content: string): void;
|
|
81
|
+
finalizeStreaming(): void;
|
|
82
|
+
showTypingIndicator(): void;
|
|
83
|
+
removeTypingIndicator(): void;
|
|
84
|
+
private appendMessageElement;
|
|
85
|
+
private scrollToBottom;
|
|
86
|
+
private formatTime;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export declare class AikaaraStreamingMessage extends HTMLElement {
|
|
90
|
+
private shadow;
|
|
91
|
+
private bubble;
|
|
92
|
+
constructor();
|
|
93
|
+
connectedCallback(): void;
|
|
94
|
+
updateContent(content: string): void;
|
|
95
|
+
finalize(): void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export declare class AikaaraTypingIndicator extends HTMLElement {
|
|
99
|
+
private shadow;
|
|
100
|
+
constructor();
|
|
101
|
+
connectedCallback(): void;
|
|
102
|
+
show(): void;
|
|
103
|
+
hide(): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
declare interface ChatClientConfig extends ConnectionConfig {
|
|
107
|
+
apiKey?: string;
|
|
108
|
+
conversationId?: string;
|
|
109
|
+
systemPromptId?: number;
|
|
110
|
+
channel?: 'widget' | 'api';
|
|
111
|
+
onMessage?: (message: Message) => void;
|
|
112
|
+
onStatusChange?: (status: string) => void;
|
|
113
|
+
onError?: (error: Error) => void;
|
|
114
|
+
onStreamUpdate?: (delta: string, fullContent: string) => void;
|
|
115
|
+
onConnectionStateChange?: (state: ConnectionState) => void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare interface ConnectionConfig {
|
|
119
|
+
baseUrl: string;
|
|
120
|
+
userToken: string;
|
|
121
|
+
reconnect?: boolean;
|
|
122
|
+
maxReconnectAttempts?: number;
|
|
123
|
+
reconnectInterval?: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
|
|
127
|
+
|
|
128
|
+
declare interface Message {
|
|
129
|
+
id: string;
|
|
130
|
+
conversationId: string;
|
|
131
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
132
|
+
content: string;
|
|
133
|
+
toolCalls?: ToolCall[];
|
|
134
|
+
toolCallResults?: ToolCallResult;
|
|
135
|
+
tokensInput?: number;
|
|
136
|
+
tokensOutput?: number;
|
|
137
|
+
metadata?: Record<string, unknown>;
|
|
138
|
+
createdAt: string;
|
|
139
|
+
status?: 'sending' | 'sent' | 'streaming' | 'complete' | 'error';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare function registerComponents(): void;
|
|
143
|
+
|
|
144
|
+
declare interface ToolCall {
|
|
145
|
+
id: string;
|
|
146
|
+
type: 'function';
|
|
147
|
+
function: {
|
|
148
|
+
name: string;
|
|
149
|
+
arguments: string;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare interface ToolCallResult {
|
|
154
|
+
tool_call_id: string;
|
|
155
|
+
content: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare interface WidgetConfig extends ChatClientConfig {
|
|
159
|
+
position?: 'bottom-right' | 'bottom-left';
|
|
160
|
+
offset?: {
|
|
161
|
+
x: number;
|
|
162
|
+
y: number;
|
|
163
|
+
};
|
|
164
|
+
width?: number;
|
|
165
|
+
height?: number;
|
|
166
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
167
|
+
primaryColor?: string;
|
|
168
|
+
fontFamily?: string;
|
|
169
|
+
borderRadius?: number;
|
|
170
|
+
title?: string;
|
|
171
|
+
subtitle?: string;
|
|
172
|
+
avatarUrl?: string;
|
|
173
|
+
welcomeMessage?: string;
|
|
174
|
+
placeholder?: string;
|
|
175
|
+
showTimestamps?: boolean;
|
|
176
|
+
persistConversation?: boolean;
|
|
177
|
+
showBubble?: boolean;
|
|
178
|
+
bubbleText?: string;
|
|
179
|
+
bubbleIcon?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export { }
|