@doderasoftware/restify-ai 0.1.0-beta.6 → 0.1.0-beta.8
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/README.md +855 -262
- package/dist/components/AiAvatar.vue.d.ts.map +1 -1
- package/dist/components/AiChatDrawer.vue.d.ts +3 -3
- package/dist/components/AiChatDrawer.vue.d.ts.map +1 -1
- package/dist/components/AiEmptyState.vue.d.ts.map +1 -1
- package/dist/components/ChatInput.vue.d.ts.map +1 -1
- package/dist/components/ChatMessage.vue.d.ts.map +1 -1
- package/dist/components/ChatMessageActions.vue.d.ts.map +1 -1
- package/dist/components/ErrorBoundary.vue.d.ts +74 -0
- package/dist/components/ErrorBoundary.vue.d.ts.map +1 -0
- package/dist/components/MentionList.vue.d.ts.map +1 -1
- package/dist/components/UserAvatar.vue.d.ts.map +1 -1
- package/dist/components/drawer/ConfirmDialog.vue.d.ts.map +1 -1
- package/dist/components/drawer/DrawerHeader.vue.d.ts.map +1 -1
- package/dist/components/drawer/DrawerMessageList.vue.d.ts.map +1 -1
- package/dist/components/drawer/SetupGuide.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/AttachmentsPreview.vue.d.ts.map +1 -1
- package/dist/components/input/InputActions.vue.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/restify-ai.js +1191 -1135
- package/dist/restify-ai.umd.cjs +42 -42
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/storage.d.ts +30 -0
- package/dist/store/storage.d.ts.map +1 -0
- package/dist/store/store.d.ts +247 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/utils.d.ts +23 -0
- package/dist/store/utils.d.ts.map +1 -0
- package/dist/store.d.ts +1 -246
- package/dist/store.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/api.d.ts +43 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/chat.d.ts +56 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/dist/types/config.d.ts +167 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/index.d.ts +15 -599
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mentions.d.ts +34 -0
- package/dist/types/mentions.d.ts.map +1 -0
- package/dist/types/setup.d.ts +13 -0
- package/dist/types/setup.d.ts.map +1 -0
- package/dist/types/slots.d.ts +33 -0
- package/dist/types/slots.d.ts.map +1 -0
- package/dist/types/suggestions.d.ts +32 -0
- package/dist/types/suggestions.d.ts.map +1 -0
- package/dist/types/texts.d.ts +56 -0
- package/dist/types/texts.d.ts.map +1 -0
- package/dist/types/ui.d.ts +101 -0
- package/dist/types/ui.d.ts.map +1 -0
- package/package.json +11 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ChatMessage, ChatAttachment, SetupState } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare function saveChatHistory(history: ChatMessage[]): void;
|
|
4
|
+
export interface LoadedChatState {
|
|
5
|
+
history: ChatMessage[];
|
|
6
|
+
hasOrphanedUserMessage: boolean;
|
|
7
|
+
orphanedMessage?: {
|
|
8
|
+
question: string;
|
|
9
|
+
attachments: ChatAttachment[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function loadChatHistory(): LoadedChatState;
|
|
13
|
+
export declare function clearStoredChatHistory(): void;
|
|
14
|
+
export declare function saveErrorState(error: {
|
|
15
|
+
message: string | null;
|
|
16
|
+
failedQuestion: string | null;
|
|
17
|
+
failedAttachments: ChatAttachment[] | null;
|
|
18
|
+
}): void;
|
|
19
|
+
export declare function loadErrorState(): {
|
|
20
|
+
message: string | null;
|
|
21
|
+
failedQuestion: string | null;
|
|
22
|
+
failedAttachments: ChatAttachment[] | null;
|
|
23
|
+
} | null;
|
|
24
|
+
export declare function clearErrorState(): void;
|
|
25
|
+
export declare function saveDrawerState(isOpen: boolean): void;
|
|
26
|
+
export declare function loadDrawerState(): boolean;
|
|
27
|
+
export declare function isSetupComplete(): boolean;
|
|
28
|
+
export declare function markSetupComplete(): void;
|
|
29
|
+
export declare function getDefaultSetupState(): SetupState;
|
|
30
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/store/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAiBvE,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAM5D;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,eAAe,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,cAAc,EAAE,CAAA;KAAE,CAAA;CACtE;AAED,wBAAgB,eAAe,IAAI,eAAe,CAoCjD;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAM7C;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,iBAAiB,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAUjJ;AAED,wBAAgB,cAAc,IAAI;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,iBAAiB,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAU7I;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAMrD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAUzC;AAGD,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAED,wBAAgB,oBAAoB,IAAI,UAAU,CASjD"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { EventSourceMessage } from '@microsoft/fetch-event-source';
|
|
2
|
+
import { ChatAttachment, Mention, PageContext, AiStoreState, SetupState } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare const useRestifyAiStore: import('pinia').StoreDefinition<"restifyAiStore", AiStoreState, {
|
|
5
|
+
hasMessages: (state: {
|
|
6
|
+
chatHistoryLimit: number;
|
|
7
|
+
chatHistory: {
|
|
8
|
+
id: string;
|
|
9
|
+
role: import('..').ChatRole | string;
|
|
10
|
+
message: string;
|
|
11
|
+
loading?: boolean | undefined;
|
|
12
|
+
streaming?: boolean | undefined;
|
|
13
|
+
timestamp?: number | undefined;
|
|
14
|
+
created_at?: (string | Date) | undefined;
|
|
15
|
+
attachments?: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
url?: string | undefined;
|
|
19
|
+
type?: string | undefined;
|
|
20
|
+
size?: number | undefined;
|
|
21
|
+
extractedText?: string | undefined;
|
|
22
|
+
uploading?: boolean | undefined;
|
|
23
|
+
progress?: number | undefined;
|
|
24
|
+
previewUrl?: string | undefined;
|
|
25
|
+
}[] | undefined;
|
|
26
|
+
mentions?: {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
metadata?: (Record<string, any> | null) | undefined;
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
uploadedFiles: Record<string, ChatAttachment>;
|
|
34
|
+
loading: boolean;
|
|
35
|
+
showChat: boolean;
|
|
36
|
+
isFullscreen: boolean;
|
|
37
|
+
sending: boolean;
|
|
38
|
+
pageContext: {
|
|
39
|
+
pageType: string;
|
|
40
|
+
entityId?: string | undefined;
|
|
41
|
+
entityType?: string | undefined;
|
|
42
|
+
metadata?: Record<string, any> | undefined;
|
|
43
|
+
routePath?: string | undefined;
|
|
44
|
+
} | null;
|
|
45
|
+
quota: {
|
|
46
|
+
limit: number;
|
|
47
|
+
used: number;
|
|
48
|
+
remaining: number;
|
|
49
|
+
};
|
|
50
|
+
error: {
|
|
51
|
+
message: string | null;
|
|
52
|
+
failedQuestion: string | null;
|
|
53
|
+
failedAttachments?: {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
url?: string | undefined;
|
|
57
|
+
type?: string | undefined;
|
|
58
|
+
size?: number | undefined;
|
|
59
|
+
extractedText?: string | undefined;
|
|
60
|
+
uploading?: boolean | undefined;
|
|
61
|
+
progress?: number | undefined;
|
|
62
|
+
previewUrl?: string | undefined;
|
|
63
|
+
}[] | null | undefined;
|
|
64
|
+
timestamp: number | null;
|
|
65
|
+
quotaExceeded?: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
supportRequestMode: boolean;
|
|
68
|
+
setupState: {
|
|
69
|
+
isActive: boolean;
|
|
70
|
+
currentStep: import('../types').SetupStep;
|
|
71
|
+
testApiKey: string | null;
|
|
72
|
+
connectionStatus: "idle" | "testing" | "connected" | "failed";
|
|
73
|
+
backendConfigured: boolean;
|
|
74
|
+
lastError: string | null;
|
|
75
|
+
};
|
|
76
|
+
} & import('pinia').PiniaCustomStateProperties<AiStoreState>) => boolean;
|
|
77
|
+
isInSetupMode: (state: {
|
|
78
|
+
chatHistoryLimit: number;
|
|
79
|
+
chatHistory: {
|
|
80
|
+
id: string;
|
|
81
|
+
role: import('..').ChatRole | string;
|
|
82
|
+
message: string;
|
|
83
|
+
loading?: boolean | undefined;
|
|
84
|
+
streaming?: boolean | undefined;
|
|
85
|
+
timestamp?: number | undefined;
|
|
86
|
+
created_at?: (string | Date) | undefined;
|
|
87
|
+
attachments?: {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
url?: string | undefined;
|
|
91
|
+
type?: string | undefined;
|
|
92
|
+
size?: number | undefined;
|
|
93
|
+
extractedText?: string | undefined;
|
|
94
|
+
uploading?: boolean | undefined;
|
|
95
|
+
progress?: number | undefined;
|
|
96
|
+
previewUrl?: string | undefined;
|
|
97
|
+
}[] | undefined;
|
|
98
|
+
mentions?: {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
type: string;
|
|
102
|
+
metadata?: (Record<string, any> | null) | undefined;
|
|
103
|
+
}[] | undefined;
|
|
104
|
+
}[];
|
|
105
|
+
uploadedFiles: Record<string, ChatAttachment>;
|
|
106
|
+
loading: boolean;
|
|
107
|
+
showChat: boolean;
|
|
108
|
+
isFullscreen: boolean;
|
|
109
|
+
sending: boolean;
|
|
110
|
+
pageContext: {
|
|
111
|
+
pageType: string;
|
|
112
|
+
entityId?: string | undefined;
|
|
113
|
+
entityType?: string | undefined;
|
|
114
|
+
metadata?: Record<string, any> | undefined;
|
|
115
|
+
routePath?: string | undefined;
|
|
116
|
+
} | null;
|
|
117
|
+
quota: {
|
|
118
|
+
limit: number;
|
|
119
|
+
used: number;
|
|
120
|
+
remaining: number;
|
|
121
|
+
};
|
|
122
|
+
error: {
|
|
123
|
+
message: string | null;
|
|
124
|
+
failedQuestion: string | null;
|
|
125
|
+
failedAttachments?: {
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
url?: string | undefined;
|
|
129
|
+
type?: string | undefined;
|
|
130
|
+
size?: number | undefined;
|
|
131
|
+
extractedText?: string | undefined;
|
|
132
|
+
uploading?: boolean | undefined;
|
|
133
|
+
progress?: number | undefined;
|
|
134
|
+
previewUrl?: string | undefined;
|
|
135
|
+
}[] | null | undefined;
|
|
136
|
+
timestamp: number | null;
|
|
137
|
+
quotaExceeded?: boolean | undefined;
|
|
138
|
+
};
|
|
139
|
+
supportRequestMode: boolean;
|
|
140
|
+
setupState: {
|
|
141
|
+
isActive: boolean;
|
|
142
|
+
currentStep: import('../types').SetupStep;
|
|
143
|
+
testApiKey: string | null;
|
|
144
|
+
connectionStatus: "idle" | "testing" | "connected" | "failed";
|
|
145
|
+
backendConfigured: boolean;
|
|
146
|
+
lastError: string | null;
|
|
147
|
+
};
|
|
148
|
+
} & import('pinia').PiniaCustomStateProperties<AiStoreState>) => boolean;
|
|
149
|
+
canChat: (state: {
|
|
150
|
+
chatHistoryLimit: number;
|
|
151
|
+
chatHistory: {
|
|
152
|
+
id: string;
|
|
153
|
+
role: import('..').ChatRole | string;
|
|
154
|
+
message: string;
|
|
155
|
+
loading?: boolean | undefined;
|
|
156
|
+
streaming?: boolean | undefined;
|
|
157
|
+
timestamp?: number | undefined;
|
|
158
|
+
created_at?: (string | Date) | undefined;
|
|
159
|
+
attachments?: {
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
url?: string | undefined;
|
|
163
|
+
type?: string | undefined;
|
|
164
|
+
size?: number | undefined;
|
|
165
|
+
extractedText?: string | undefined;
|
|
166
|
+
uploading?: boolean | undefined;
|
|
167
|
+
progress?: number | undefined;
|
|
168
|
+
previewUrl?: string | undefined;
|
|
169
|
+
}[] | undefined;
|
|
170
|
+
mentions?: {
|
|
171
|
+
id: string;
|
|
172
|
+
name: string;
|
|
173
|
+
type: string;
|
|
174
|
+
metadata?: (Record<string, any> | null) | undefined;
|
|
175
|
+
}[] | undefined;
|
|
176
|
+
}[];
|
|
177
|
+
uploadedFiles: Record<string, ChatAttachment>;
|
|
178
|
+
loading: boolean;
|
|
179
|
+
showChat: boolean;
|
|
180
|
+
isFullscreen: boolean;
|
|
181
|
+
sending: boolean;
|
|
182
|
+
pageContext: {
|
|
183
|
+
pageType: string;
|
|
184
|
+
entityId?: string | undefined;
|
|
185
|
+
entityType?: string | undefined;
|
|
186
|
+
metadata?: Record<string, any> | undefined;
|
|
187
|
+
routePath?: string | undefined;
|
|
188
|
+
} | null;
|
|
189
|
+
quota: {
|
|
190
|
+
limit: number;
|
|
191
|
+
used: number;
|
|
192
|
+
remaining: number;
|
|
193
|
+
};
|
|
194
|
+
error: {
|
|
195
|
+
message: string | null;
|
|
196
|
+
failedQuestion: string | null;
|
|
197
|
+
failedAttachments?: {
|
|
198
|
+
id: string;
|
|
199
|
+
name: string;
|
|
200
|
+
url?: string | undefined;
|
|
201
|
+
type?: string | undefined;
|
|
202
|
+
size?: number | undefined;
|
|
203
|
+
extractedText?: string | undefined;
|
|
204
|
+
uploading?: boolean | undefined;
|
|
205
|
+
progress?: number | undefined;
|
|
206
|
+
previewUrl?: string | undefined;
|
|
207
|
+
}[] | null | undefined;
|
|
208
|
+
timestamp: number | null;
|
|
209
|
+
quotaExceeded?: boolean | undefined;
|
|
210
|
+
};
|
|
211
|
+
supportRequestMode: boolean;
|
|
212
|
+
setupState: {
|
|
213
|
+
isActive: boolean;
|
|
214
|
+
currentStep: import('../types').SetupStep;
|
|
215
|
+
testApiKey: string | null;
|
|
216
|
+
connectionStatus: "idle" | "testing" | "connected" | "failed";
|
|
217
|
+
backendConfigured: boolean;
|
|
218
|
+
lastError: string | null;
|
|
219
|
+
};
|
|
220
|
+
} & import('pinia').PiniaCustomStateProperties<AiStoreState>) => boolean;
|
|
221
|
+
}, {
|
|
222
|
+
scrollToBottom(): Promise<void>;
|
|
223
|
+
parseStreamContent(event: EventSourceMessage): string | null;
|
|
224
|
+
askQuestion(question: string, attachments?: ChatAttachment[], mentions?: Mention[], isSupportRequest?: boolean): Promise<boolean>;
|
|
225
|
+
cancelRequest(): void;
|
|
226
|
+
clearChatHistory(): void;
|
|
227
|
+
retry(): Promise<boolean>;
|
|
228
|
+
clearError(): void;
|
|
229
|
+
toggleSupportMode(): void;
|
|
230
|
+
fetchQuota(): Promise<void>;
|
|
231
|
+
uploadFile(file: File): Promise<ChatAttachment | null>;
|
|
232
|
+
setPageContext(context: PageContext | null): void;
|
|
233
|
+
toggleDrawer(): void;
|
|
234
|
+
openDrawer(): void;
|
|
235
|
+
closeDrawer(): void;
|
|
236
|
+
startSupportRequest(): void;
|
|
237
|
+
cancelSupportRequest(): void;
|
|
238
|
+
registerUploadedFile(attachment: ChatAttachment): void;
|
|
239
|
+
startSetupMode(): void;
|
|
240
|
+
setSetupStep(step: SetupState["currentStep"]): void;
|
|
241
|
+
setTestApiKey(key: string): void;
|
|
242
|
+
testConnection(): Promise<boolean>;
|
|
243
|
+
completeSetup(): void;
|
|
244
|
+
skipSetup(): void;
|
|
245
|
+
}>;
|
|
246
|
+
export type RestifyAiStore = ReturnType<typeof useRestifyAiStore>;
|
|
247
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACX,YAAY,EACZ,UAAU,EAGX,MAAM,UAAU,CAAA;AA+BjB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwDF,OAAO,CAAC,IAAI,CAAC;8BAQX,kBAAkB,GAAG,MAAM,GAAG,IAAI;0BAQhD,MAAM,gBACH,cAAc,EAAE,aACnB,OAAO,EAAE,qBACD,OAAO,GACxB,OAAO,CAAC,OAAO,CAAC;qBA+OF,IAAI;wBAUD,IAAI;aAWT,OAAO,CAAC,OAAO,CAAC;kBAgBjB,IAAI;yBAWG,IAAI;kBAIL,OAAO,CAAC,IAAI,CAAC;qBAoCV,IAAI,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;4BA0EpC,WAAW,GAAG,IAAI,GAAG,IAAI;oBAIjC,IAAI;kBAMN,IAAI;mBAMH,IAAI;2BAMI,IAAI;4BAIH,IAAI;qCAIK,cAAc,GAAG,IAAI;sBAMpC,IAAI;uBAWH,UAAU,CAAC,aAAa,CAAC,GAAG,IAAI;uBAIhC,MAAM,GAAG,IAAI;sBAIR,OAAO,CAAC,OAAO,CAAC;qBAgDvB,IAAI;iBAOR,IAAI;EAKnB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChatMessage, ChatAttachment } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build full URL with baseUrl support
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildUrl(endpoint: string | undefined): string;
|
|
7
|
+
/**
|
|
8
|
+
* Convert technical errors to user-friendly messages
|
|
9
|
+
*/
|
|
10
|
+
export declare function getUserFriendlyErrorMessage(err: unknown): string;
|
|
11
|
+
/**
|
|
12
|
+
* Default stream parser - supports OpenAI format
|
|
13
|
+
*/
|
|
14
|
+
export declare function defaultParseStreamContent(eventData: string): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Sleep utility for retry delays
|
|
17
|
+
*/
|
|
18
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Extract uploaded files from chat history
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractUploadedFiles(history: ChatMessage[]): Record<string, ChatAttachment>;
|
|
23
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/store/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG3D;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAgB7D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA2BhE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ1E;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAU3F"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,247 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { ChatAttachment, Mention, PageContext, AiStoreState, SetupState } from './types';
|
|
3
|
-
|
|
4
|
-
export declare const useRestifyAiStore: import('pinia').StoreDefinition<"restifyAiStore", AiStoreState, {
|
|
5
|
-
hasMessages: (state: {
|
|
6
|
-
chatHistoryLimit: number;
|
|
7
|
-
chatHistory: {
|
|
8
|
-
id: string;
|
|
9
|
-
role: import('./types').ChatRole | string;
|
|
10
|
-
message: string;
|
|
11
|
-
loading?: boolean | undefined;
|
|
12
|
-
streaming?: boolean | undefined;
|
|
13
|
-
timestamp?: number | undefined;
|
|
14
|
-
created_at?: (string | Date) | undefined;
|
|
15
|
-
attachments?: {
|
|
16
|
-
id: string;
|
|
17
|
-
name: string;
|
|
18
|
-
url?: string | undefined;
|
|
19
|
-
type?: string | undefined;
|
|
20
|
-
size?: number | undefined;
|
|
21
|
-
extractedText?: string | undefined;
|
|
22
|
-
uploading?: boolean | undefined;
|
|
23
|
-
progress?: number | undefined;
|
|
24
|
-
previewUrl?: string | undefined;
|
|
25
|
-
}[] | undefined;
|
|
26
|
-
mentions?: {
|
|
27
|
-
id: string;
|
|
28
|
-
name: string;
|
|
29
|
-
type: string;
|
|
30
|
-
metadata?: (Record<string, any> | null) | undefined;
|
|
31
|
-
}[] | undefined;
|
|
32
|
-
}[];
|
|
33
|
-
uploadedFiles: Record<string, ChatAttachment>;
|
|
34
|
-
loading: boolean;
|
|
35
|
-
showChat: boolean;
|
|
36
|
-
isFullscreen: boolean;
|
|
37
|
-
sending: boolean;
|
|
38
|
-
pageContext: {
|
|
39
|
-
pageType: string;
|
|
40
|
-
entityId?: string | undefined;
|
|
41
|
-
entityType?: string | undefined;
|
|
42
|
-
metadata?: Record<string, any> | undefined;
|
|
43
|
-
routePath?: string | undefined;
|
|
44
|
-
} | null;
|
|
45
|
-
quota: {
|
|
46
|
-
limit: number;
|
|
47
|
-
used: number;
|
|
48
|
-
remaining: number;
|
|
49
|
-
};
|
|
50
|
-
error: {
|
|
51
|
-
message: string | null;
|
|
52
|
-
failedQuestion: string | null;
|
|
53
|
-
failedAttachments?: {
|
|
54
|
-
id: string;
|
|
55
|
-
name: string;
|
|
56
|
-
url?: string | undefined;
|
|
57
|
-
type?: string | undefined;
|
|
58
|
-
size?: number | undefined;
|
|
59
|
-
extractedText?: string | undefined;
|
|
60
|
-
uploading?: boolean | undefined;
|
|
61
|
-
progress?: number | undefined;
|
|
62
|
-
previewUrl?: string | undefined;
|
|
63
|
-
}[] | null | undefined;
|
|
64
|
-
timestamp: number | null;
|
|
65
|
-
quotaExceeded?: boolean | undefined;
|
|
66
|
-
};
|
|
67
|
-
supportRequestMode: boolean;
|
|
68
|
-
setupState: {
|
|
69
|
-
isActive: boolean;
|
|
70
|
-
currentStep: import('./types').SetupStep;
|
|
71
|
-
testApiKey: string | null;
|
|
72
|
-
connectionStatus: "idle" | "testing" | "connected" | "failed";
|
|
73
|
-
backendConfigured: boolean;
|
|
74
|
-
lastError: string | null;
|
|
75
|
-
};
|
|
76
|
-
} & import('pinia').PiniaCustomStateProperties<AiStoreState>) => boolean;
|
|
77
|
-
isInSetupMode: (state: {
|
|
78
|
-
chatHistoryLimit: number;
|
|
79
|
-
chatHistory: {
|
|
80
|
-
id: string;
|
|
81
|
-
role: import('./types').ChatRole | string;
|
|
82
|
-
message: string;
|
|
83
|
-
loading?: boolean | undefined;
|
|
84
|
-
streaming?: boolean | undefined;
|
|
85
|
-
timestamp?: number | undefined;
|
|
86
|
-
created_at?: (string | Date) | undefined;
|
|
87
|
-
attachments?: {
|
|
88
|
-
id: string;
|
|
89
|
-
name: string;
|
|
90
|
-
url?: string | undefined;
|
|
91
|
-
type?: string | undefined;
|
|
92
|
-
size?: number | undefined;
|
|
93
|
-
extractedText?: string | undefined;
|
|
94
|
-
uploading?: boolean | undefined;
|
|
95
|
-
progress?: number | undefined;
|
|
96
|
-
previewUrl?: string | undefined;
|
|
97
|
-
}[] | undefined;
|
|
98
|
-
mentions?: {
|
|
99
|
-
id: string;
|
|
100
|
-
name: string;
|
|
101
|
-
type: string;
|
|
102
|
-
metadata?: (Record<string, any> | null) | undefined;
|
|
103
|
-
}[] | undefined;
|
|
104
|
-
}[];
|
|
105
|
-
uploadedFiles: Record<string, ChatAttachment>;
|
|
106
|
-
loading: boolean;
|
|
107
|
-
showChat: boolean;
|
|
108
|
-
isFullscreen: boolean;
|
|
109
|
-
sending: boolean;
|
|
110
|
-
pageContext: {
|
|
111
|
-
pageType: string;
|
|
112
|
-
entityId?: string | undefined;
|
|
113
|
-
entityType?: string | undefined;
|
|
114
|
-
metadata?: Record<string, any> | undefined;
|
|
115
|
-
routePath?: string | undefined;
|
|
116
|
-
} | null;
|
|
117
|
-
quota: {
|
|
118
|
-
limit: number;
|
|
119
|
-
used: number;
|
|
120
|
-
remaining: number;
|
|
121
|
-
};
|
|
122
|
-
error: {
|
|
123
|
-
message: string | null;
|
|
124
|
-
failedQuestion: string | null;
|
|
125
|
-
failedAttachments?: {
|
|
126
|
-
id: string;
|
|
127
|
-
name: string;
|
|
128
|
-
url?: string | undefined;
|
|
129
|
-
type?: string | undefined;
|
|
130
|
-
size?: number | undefined;
|
|
131
|
-
extractedText?: string | undefined;
|
|
132
|
-
uploading?: boolean | undefined;
|
|
133
|
-
progress?: number | undefined;
|
|
134
|
-
previewUrl?: string | undefined;
|
|
135
|
-
}[] | null | undefined;
|
|
136
|
-
timestamp: number | null;
|
|
137
|
-
quotaExceeded?: boolean | undefined;
|
|
138
|
-
};
|
|
139
|
-
supportRequestMode: boolean;
|
|
140
|
-
setupState: {
|
|
141
|
-
isActive: boolean;
|
|
142
|
-
currentStep: import('./types').SetupStep;
|
|
143
|
-
testApiKey: string | null;
|
|
144
|
-
connectionStatus: "idle" | "testing" | "connected" | "failed";
|
|
145
|
-
backendConfigured: boolean;
|
|
146
|
-
lastError: string | null;
|
|
147
|
-
};
|
|
148
|
-
} & import('pinia').PiniaCustomStateProperties<AiStoreState>) => boolean;
|
|
149
|
-
canChat: (state: {
|
|
150
|
-
chatHistoryLimit: number;
|
|
151
|
-
chatHistory: {
|
|
152
|
-
id: string;
|
|
153
|
-
role: import('./types').ChatRole | string;
|
|
154
|
-
message: string;
|
|
155
|
-
loading?: boolean | undefined;
|
|
156
|
-
streaming?: boolean | undefined;
|
|
157
|
-
timestamp?: number | undefined;
|
|
158
|
-
created_at?: (string | Date) | undefined;
|
|
159
|
-
attachments?: {
|
|
160
|
-
id: string;
|
|
161
|
-
name: string;
|
|
162
|
-
url?: string | undefined;
|
|
163
|
-
type?: string | undefined;
|
|
164
|
-
size?: number | undefined;
|
|
165
|
-
extractedText?: string | undefined;
|
|
166
|
-
uploading?: boolean | undefined;
|
|
167
|
-
progress?: number | undefined;
|
|
168
|
-
previewUrl?: string | undefined;
|
|
169
|
-
}[] | undefined;
|
|
170
|
-
mentions?: {
|
|
171
|
-
id: string;
|
|
172
|
-
name: string;
|
|
173
|
-
type: string;
|
|
174
|
-
metadata?: (Record<string, any> | null) | undefined;
|
|
175
|
-
}[] | undefined;
|
|
176
|
-
}[];
|
|
177
|
-
uploadedFiles: Record<string, ChatAttachment>;
|
|
178
|
-
loading: boolean;
|
|
179
|
-
showChat: boolean;
|
|
180
|
-
isFullscreen: boolean;
|
|
181
|
-
sending: boolean;
|
|
182
|
-
pageContext: {
|
|
183
|
-
pageType: string;
|
|
184
|
-
entityId?: string | undefined;
|
|
185
|
-
entityType?: string | undefined;
|
|
186
|
-
metadata?: Record<string, any> | undefined;
|
|
187
|
-
routePath?: string | undefined;
|
|
188
|
-
} | null;
|
|
189
|
-
quota: {
|
|
190
|
-
limit: number;
|
|
191
|
-
used: number;
|
|
192
|
-
remaining: number;
|
|
193
|
-
};
|
|
194
|
-
error: {
|
|
195
|
-
message: string | null;
|
|
196
|
-
failedQuestion: string | null;
|
|
197
|
-
failedAttachments?: {
|
|
198
|
-
id: string;
|
|
199
|
-
name: string;
|
|
200
|
-
url?: string | undefined;
|
|
201
|
-
type?: string | undefined;
|
|
202
|
-
size?: number | undefined;
|
|
203
|
-
extractedText?: string | undefined;
|
|
204
|
-
uploading?: boolean | undefined;
|
|
205
|
-
progress?: number | undefined;
|
|
206
|
-
previewUrl?: string | undefined;
|
|
207
|
-
}[] | null | undefined;
|
|
208
|
-
timestamp: number | null;
|
|
209
|
-
quotaExceeded?: boolean | undefined;
|
|
210
|
-
};
|
|
211
|
-
supportRequestMode: boolean;
|
|
212
|
-
setupState: {
|
|
213
|
-
isActive: boolean;
|
|
214
|
-
currentStep: import('./types').SetupStep;
|
|
215
|
-
testApiKey: string | null;
|
|
216
|
-
connectionStatus: "idle" | "testing" | "connected" | "failed";
|
|
217
|
-
backendConfigured: boolean;
|
|
218
|
-
lastError: string | null;
|
|
219
|
-
};
|
|
220
|
-
} & import('pinia').PiniaCustomStateProperties<AiStoreState>) => boolean;
|
|
221
|
-
}, {
|
|
222
|
-
scrollToBottom(): Promise<void>;
|
|
223
|
-
parseStreamContent(event: EventSourceMessage): string | null;
|
|
224
|
-
askQuestion(question: string, attachments?: ChatAttachment[], mentions?: Mention[], isSupportRequest?: boolean): Promise<boolean>;
|
|
225
|
-
cancelRequest(): void;
|
|
226
|
-
clearChatHistory(): void;
|
|
227
|
-
retry(): Promise<boolean>;
|
|
228
|
-
clearError(): void;
|
|
229
|
-
toggleSupportMode(): void;
|
|
230
|
-
fetchQuota(): Promise<void>;
|
|
231
|
-
uploadFile(file: File): Promise<ChatAttachment | null>;
|
|
232
|
-
setPageContext(context: PageContext | null): void;
|
|
233
|
-
toggleDrawer(): void;
|
|
234
|
-
openDrawer(): void;
|
|
235
|
-
closeDrawer(): void;
|
|
236
|
-
startSupportRequest(): void;
|
|
237
|
-
cancelSupportRequest(): void;
|
|
238
|
-
registerUploadedFile(attachment: ChatAttachment): void;
|
|
239
|
-
startSetupMode(): void;
|
|
240
|
-
setSetupStep(step: SetupState["currentStep"]): void;
|
|
241
|
-
setTestApiKey(key: string): void;
|
|
242
|
-
testConnection(): Promise<boolean>;
|
|
243
|
-
completeSetup(): void;
|
|
244
|
-
skipSetup(): void;
|
|
245
|
-
}>;
|
|
246
|
-
export type RestifyAiStore = ReturnType<typeof useRestifyAiStore>;
|
|
1
|
+
export { useRestifyAiStore, type RestifyAiStore } from './store/index';
|
|
247
2
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes rai-fade-in-up{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.animate-in{animation:rai-fade-in-up .3s ease-out}.scrollbar-thin::-webkit-scrollbar{width:6px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:#9ca3af80;border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:#9ca3afb3}.dark .scrollbar-thin::-webkit-scrollbar-thumb{background-color:#4b556380}.dark .scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:#4b5563b3}.scrollbar-thin{scrollbar-width:thin;scrollbar-color:rgba(156,163,175,.5) transparent}.dark .scrollbar-thin{scrollbar-color:rgba(75,85,99,.5) transparent}@media (prefers-reduced-motion: reduce){.animate-in{animation:none}}[data-v-
|
|
1
|
+
@keyframes rai-fade-in-up{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.animate-in{animation:rai-fade-in-up .3s ease-out}.scrollbar-thin::-webkit-scrollbar{width:6px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:#9ca3af80;border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:#9ca3afb3}.dark .scrollbar-thin::-webkit-scrollbar-thumb{background-color:#4b556380}.dark .scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:#4b5563b3}.scrollbar-thin{scrollbar-width:thin;scrollbar-color:rgba(156,163,175,.5) transparent}.dark .scrollbar-thin{scrollbar-color:rgba(75,85,99,.5) transparent}@media (prefers-reduced-motion: reduce){.animate-in{animation:none}}[data-v-5f7bccb0] .mention{display:inline-flex;align-items:center;border-radius:.375rem;background-color:#6366f133;padding:.125rem .5rem;font-weight:500;--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-v-5f7bccb0] .bg-primary .mention{background-color:#fff3;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.rai-slide-left-enter-active[data-v-dd240dd4],.rai-slide-left-leave-active[data-v-dd240dd4]{transition:transform .28s cubic-bezier(.32,.72,0,1)}.rai-slide-left-enter-from[data-v-dd240dd4],.rai-slide-left-leave-to[data-v-dd240dd4]{transform:translate(100%)}.rai-slide-right-enter-active[data-v-dd240dd4],.rai-slide-right-leave-active[data-v-dd240dd4]{transition:transform .28s cubic-bezier(.32,.72,0,1)}.rai-slide-right-enter-from[data-v-dd240dd4],.rai-slide-right-leave-to[data-v-dd240dd4]{transform:translate(-100%)}.rai-fade-enter-active[data-v-dd240dd4],.rai-fade-leave-active[data-v-dd240dd4]{transition:opacity .2s ease-out}.rai-fade-enter-from[data-v-dd240dd4],.rai-fade-leave-to[data-v-dd240dd4]{opacity:0}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ChatAttachment, ChatMessage } from './chat';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Request/Response Types for hooks
|
|
5
|
+
*/
|
|
6
|
+
export interface AiRequestPayload {
|
|
7
|
+
question: string;
|
|
8
|
+
history: Array<{
|
|
9
|
+
role: string;
|
|
10
|
+
message: string;
|
|
11
|
+
attachments: ChatAttachment[];
|
|
12
|
+
}>;
|
|
13
|
+
stream: boolean;
|
|
14
|
+
files?: Array<Record<string, unknown>>;
|
|
15
|
+
mentions?: import('./chat').Mention[];
|
|
16
|
+
contact_support?: boolean;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface AiStreamChunk {
|
|
20
|
+
content: string;
|
|
21
|
+
done: boolean;
|
|
22
|
+
raw: unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Lifecycle hooks
|
|
26
|
+
*/
|
|
27
|
+
export type BeforeSendHook = (payload: AiRequestPayload) => AiRequestPayload | Promise<AiRequestPayload>;
|
|
28
|
+
export type AfterResponseHook = (message: ChatMessage) => void | Promise<void>;
|
|
29
|
+
export type OnStreamStartHook = () => void;
|
|
30
|
+
export type OnStreamEndHook = (fullMessage: string) => void;
|
|
31
|
+
export type OnStreamChunkHook = (chunk: AiStreamChunk) => void;
|
|
32
|
+
export type StreamParserFunction = (eventData: string) => string | null;
|
|
33
|
+
export type RequestInterceptor = (url: string, options: RequestInit) => RequestInit | Promise<RequestInit>;
|
|
34
|
+
export type ResponseInterceptor = (response: Response) => Response | Promise<Response>;
|
|
35
|
+
/**
|
|
36
|
+
* Retry configuration
|
|
37
|
+
*/
|
|
38
|
+
export interface RetryConfig {
|
|
39
|
+
maxRetries?: number;
|
|
40
|
+
retryDelay?: number;
|
|
41
|
+
shouldRetry?: (error: Error, attempt: number) => boolean;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEzD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,WAAW,EAAE,cAAc,EAAE,CAAA;KAC9B,CAAC,CAAA;IACF,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,QAAQ,EAAE,OAAO,EAAE,CAAA;IACrC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,OAAO,CAAA;CACb;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AACxG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9E,MAAM,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAA;AAC1C,MAAM,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;AAC3D,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;AAC9D,MAAM,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAC1G,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEtF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;CACzD"}
|