@liip/liipgpt 1.0.0-rc.9 → 1.0.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.
Files changed (59) hide show
  1. package/README.md +4 -129
  2. package/button/liipgpt-button.iife.js +231 -0
  3. package/chat/liipgpt-chat.iife.js +293 -802
  4. package/config/index.cjs +4307 -0
  5. package/config/index.d.ts +9437 -949
  6. package/config/index.js +3457 -2248
  7. package/configurator/_app/env.js +1 -0
  8. package/configurator/_app/immutable/chunks/8PzG14q7.js +4 -0
  9. package/configurator/_app/immutable/chunks/BMvVlUrl.js +15 -0
  10. package/configurator/_app/immutable/chunks/BcMr1Isb.js +58 -0
  11. package/configurator/_app/immutable/chunks/BiXZbQqO.js +1 -0
  12. package/configurator/_app/immutable/chunks/Blpq5ghW.js +3 -0
  13. package/configurator/_app/immutable/chunks/C6QPkKVb.js +1 -0
  14. package/configurator/_app/immutable/chunks/Crb1ifvw.js +364 -0
  15. package/configurator/_app/immutable/chunks/CthtHExI.js +28 -0
  16. package/configurator/_app/immutable/chunks/D5wkZK_2.js +1 -0
  17. package/configurator/_app/immutable/chunks/DUt8zN7X.js +1 -0
  18. package/configurator/_app/immutable/chunks/DpWDGuko.js +1 -0
  19. package/configurator/_app/immutable/chunks/Dq6jck_i.js +1 -0
  20. package/configurator/_app/immutable/chunks/HtQdmN-S.js +1 -0
  21. package/configurator/_app/immutable/chunks/NZTpNUN0.js +1 -0
  22. package/configurator/_app/immutable/chunks/lxJsdCDD.js +1 -0
  23. package/configurator/_app/immutable/entry/app.DLjyDu01.js +2 -0
  24. package/configurator/_app/immutable/entry/start.Dri2trH_.js +1 -0
  25. package/configurator/_app/immutable/nodes/0.Cu_Gc0Ri.js +58 -0
  26. package/configurator/_app/immutable/nodes/1.CMbEHgX0.js +1 -0
  27. package/configurator/_app/immutable/nodes/2.gQZZQ4pa.js +1 -0
  28. package/configurator/_app/immutable/nodes/3.CnRlwgWw.js +897 -0
  29. package/configurator/_app/version.json +1 -0
  30. package/configurator/favicon.png +0 -0
  31. package/configurator/index.html +38 -0
  32. package/configurator/sidebar.html +38 -0
  33. package/index.cjs +10757 -0
  34. package/index.d.ts +14291 -0
  35. package/index.js +10736 -0
  36. package/package.json +20 -13
  37. package/chat/index.html +0 -242
  38. package/config/index.umd.cjs +0 -1
  39. package/lib/config/chat-config.d.ts +0 -957
  40. package/lib/config/clamp.d.ts +0 -3
  41. package/lib/config/config-definition.d.ts +0 -1635
  42. package/lib/config/css-variables.d.ts +0 -9
  43. package/lib/config/custom-css.d.ts +0 -1
  44. package/lib/config/demo-chat-history.d.ts +0 -78
  45. package/lib/config/simple-config.d.ts +0 -458
  46. package/lib/config/translations-definition.d.ts +0 -221
  47. package/lib/config/types-index.d.ts +0 -3
  48. package/lib/config/utils.d.ts +0 -23
  49. package/lib/lib/agnostic-storage.d.ts +0 -1
  50. package/lib/lib/chat-message-types.d.ts +0 -53
  51. package/lib/lib/feedback.d.ts +0 -0
  52. package/lib/lib/index.d.ts +0 -3
  53. package/lib/lib/liipgpt-client.d.ts +0 -92
  54. package/lib/lib/markdown.d.ts +0 -2
  55. package/lib/lib/message-store.d.ts +0 -15
  56. package/lib/lib/sse-v2-types.d.ts +0 -57
  57. package/lib/lib/utils.d.ts +0 -2
  58. package/lib/liipgpt-client.js +0 -5570
  59. package/lib/liipgpt-client.umd.cjs +0 -59
@@ -1,221 +0,0 @@
1
- import { PartialDeep } from 'type-fest';
2
- import { z } from 'zod';
3
- export declare const errorTranslationDefinition: z.ZodObject<{
4
- blocked: z.ZodString;
5
- maintenance: z.ZodString;
6
- 'rate-limit': z.ZodString;
7
- 'server-error': z.ZodString;
8
- 'too-short': z.ZodString;
9
- 'too-long': z.ZodString;
10
- 'quota-reached': z.ZodString;
11
- aborted: z.ZodString;
12
- 'sse-error': z.ZodString;
13
- 'client-error': z.ZodString;
14
- 'unexpected-call': z.ZodString;
15
- 'incomplete-error': z.ZodString;
16
- }, "strip", z.ZodTypeAny, {
17
- aborted: string;
18
- maintenance: string;
19
- blocked: string;
20
- 'rate-limit': string;
21
- 'server-error': string;
22
- 'too-short': string;
23
- 'too-long': string;
24
- 'quota-reached': string;
25
- 'unexpected-call': string;
26
- 'sse-error': string;
27
- 'client-error': string;
28
- 'incomplete-error': string;
29
- }, {
30
- aborted: string;
31
- maintenance: string;
32
- blocked: string;
33
- 'rate-limit': string;
34
- 'server-error': string;
35
- 'too-short': string;
36
- 'too-long': string;
37
- 'quota-reached': string;
38
- 'unexpected-call': string;
39
- 'sse-error': string;
40
- 'client-error': string;
41
- 'incomplete-error': string;
42
- }>;
43
- export declare const translationDefinition: z.ZodObject<{
44
- predefinedQuestions: z.ZodString;
45
- introductionTitle: z.ZodString;
46
- introductionDisclaimer: z.ZodOptional<z.ZodString>;
47
- referenceTitle: z.ZodString;
48
- chatInputPlaceholder: z.ZodString;
49
- chatInputSubmit: z.ZodString;
50
- referenceLink: z.ZodString;
51
- newChat: z.ZodString;
52
- maintenanceModeError: z.ZodString;
53
- messageBotLoading: z.ZodString;
54
- messageBotError: z.ZodString;
55
- messageBotDefaultError: z.ZodString;
56
- chatFooterText: z.ZodOptional<z.ZodString>;
57
- scrollToBottom: z.ZodString;
58
- openMenu: z.ZodString;
59
- closeMenu: z.ZodString;
60
- closeChat: z.ZodString;
61
- send: z.ZodString;
62
- thankYouForFeedback: z.ZodString;
63
- giveFeedback: z.ZodString;
64
- sendFeedback: z.ZodString;
65
- feedbackFailed: z.ZodString;
66
- feedbackFormTitle: z.ZodString;
67
- feedbackFormMessage: z.ZodString;
68
- feedbackFormMessagePlaceholder: z.ZodString;
69
- feedbackFormEmail: z.ZodString;
70
- feedbackFormEmailPlaceholder: z.ZodString;
71
- answerGood: z.ZodString;
72
- answerBad: z.ZodString;
73
- classificationSubmit: z.ZodString;
74
- classificationThankYou: z.ZodString;
75
- classificationTitle: z.ZodString;
76
- selectLanguage: z.ZodString;
77
- languageNames: z.ZodRecord<z.ZodString, z.ZodString>;
78
- errors: z.ZodObject<{
79
- blocked: z.ZodString;
80
- maintenance: z.ZodString;
81
- 'rate-limit': z.ZodString;
82
- 'server-error': z.ZodString;
83
- 'too-short': z.ZodString;
84
- 'too-long': z.ZodString;
85
- 'quota-reached': z.ZodString;
86
- aborted: z.ZodString;
87
- 'sse-error': z.ZodString;
88
- 'client-error': z.ZodString;
89
- 'unexpected-call': z.ZodString;
90
- 'incomplete-error': z.ZodString;
91
- }, "strip", z.ZodTypeAny, {
92
- aborted: string;
93
- maintenance: string;
94
- blocked: string;
95
- 'rate-limit': string;
96
- 'server-error': string;
97
- 'too-short': string;
98
- 'too-long': string;
99
- 'quota-reached': string;
100
- 'unexpected-call': string;
101
- 'sse-error': string;
102
- 'client-error': string;
103
- 'incomplete-error': string;
104
- }, {
105
- aborted: string;
106
- maintenance: string;
107
- blocked: string;
108
- 'rate-limit': string;
109
- 'server-error': string;
110
- 'too-short': string;
111
- 'too-long': string;
112
- 'quota-reached': string;
113
- 'unexpected-call': string;
114
- 'sse-error': string;
115
- 'client-error': string;
116
- 'incomplete-error': string;
117
- }>;
118
- }, "strip", z.ZodTypeAny, {
119
- chatInputSubmit: string;
120
- predefinedQuestions: string;
121
- errors: {
122
- aborted: string;
123
- maintenance: string;
124
- blocked: string;
125
- 'rate-limit': string;
126
- 'server-error': string;
127
- 'too-short': string;
128
- 'too-long': string;
129
- 'quota-reached': string;
130
- 'unexpected-call': string;
131
- 'sse-error': string;
132
- 'client-error': string;
133
- 'incomplete-error': string;
134
- };
135
- introductionTitle: string;
136
- referenceTitle: string;
137
- chatInputPlaceholder: string;
138
- referenceLink: string;
139
- newChat: string;
140
- maintenanceModeError: string;
141
- messageBotLoading: string;
142
- messageBotError: string;
143
- messageBotDefaultError: string;
144
- scrollToBottom: string;
145
- openMenu: string;
146
- closeMenu: string;
147
- closeChat: string;
148
- send: string;
149
- thankYouForFeedback: string;
150
- giveFeedback: string;
151
- sendFeedback: string;
152
- feedbackFailed: string;
153
- feedbackFormTitle: string;
154
- feedbackFormMessage: string;
155
- feedbackFormMessagePlaceholder: string;
156
- feedbackFormEmail: string;
157
- feedbackFormEmailPlaceholder: string;
158
- answerGood: string;
159
- answerBad: string;
160
- classificationSubmit: string;
161
- classificationThankYou: string;
162
- classificationTitle: string;
163
- selectLanguage: string;
164
- languageNames: Record<string, string>;
165
- introductionDisclaimer?: string | undefined;
166
- chatFooterText?: string | undefined;
167
- }, {
168
- chatInputSubmit: string;
169
- predefinedQuestions: string;
170
- errors: {
171
- aborted: string;
172
- maintenance: string;
173
- blocked: string;
174
- 'rate-limit': string;
175
- 'server-error': string;
176
- 'too-short': string;
177
- 'too-long': string;
178
- 'quota-reached': string;
179
- 'unexpected-call': string;
180
- 'sse-error': string;
181
- 'client-error': string;
182
- 'incomplete-error': string;
183
- };
184
- introductionTitle: string;
185
- referenceTitle: string;
186
- chatInputPlaceholder: string;
187
- referenceLink: string;
188
- newChat: string;
189
- maintenanceModeError: string;
190
- messageBotLoading: string;
191
- messageBotError: string;
192
- messageBotDefaultError: string;
193
- scrollToBottom: string;
194
- openMenu: string;
195
- closeMenu: string;
196
- closeChat: string;
197
- send: string;
198
- thankYouForFeedback: string;
199
- giveFeedback: string;
200
- sendFeedback: string;
201
- feedbackFailed: string;
202
- feedbackFormTitle: string;
203
- feedbackFormMessage: string;
204
- feedbackFormMessagePlaceholder: string;
205
- feedbackFormEmail: string;
206
- feedbackFormEmailPlaceholder: string;
207
- answerGood: string;
208
- answerBad: string;
209
- classificationSubmit: string;
210
- classificationThankYou: string;
211
- classificationTitle: string;
212
- selectLanguage: string;
213
- languageNames: Record<string, string>;
214
- introductionDisclaimer?: string | undefined;
215
- chatFooterText?: string | undefined;
216
- }>;
217
- export type Language = 'en' | 'de' | 'fr' | 'it';
218
- export type Translation = z.infer<typeof translationDefinition>;
219
- export type ErrorTranslation = z.infer<typeof errorTranslationDefinition>;
220
- export type Translations = Record<Language, Translation>;
221
- export type TranslationsPartial = PartialDeep<Translations>;
@@ -1,3 +0,0 @@
1
- export type { SimpleTheme } from './simple-config';
2
- export type { Translations, Translation } from './translations-definition';
3
- export { type ChatConfig, chatConfigSchema } from './chat-config';
@@ -1,23 +0,0 @@
1
- export declare const extractFolderName: (path: string) => string;
2
- export declare const SEARCH_PARAM_QUESTION = "q";
3
- export declare enum PageState {
4
- Start = "start",
5
- Chat = "chat"
6
- }
7
- /**
8
- * Useful when two elements have a fadeIn/fadeOut animation
9
- * simultaneously in a parent container. Allows the element
10
- * with fadeOut to no longer occupy space in the DOM, being
11
- * positioned in absolute as soon as it starts it's fadeOut.
12
- *
13
- * Requires relative positioning of the parent.
14
- */
15
- export declare function absoluteFadeOut(node: HTMLElement, { delay, duration, resetTop }: {
16
- delay?: number | undefined;
17
- duration?: number | undefined;
18
- resetTop?: boolean | undefined;
19
- }): {
20
- delay: number;
21
- duration: number;
22
- css: (t: number) => string;
23
- };
@@ -1 +0,0 @@
1
- export declare const agnosticStorage: Storage;
@@ -1,53 +0,0 @@
1
- import { ServerError } from '../../../../../src/lib/sse-v2-types';
2
- export type Reference = {
3
- url: string;
4
- referencesIndex: {
5
- all: number;
6
- used?: number;
7
- };
8
- considered: boolean;
9
- display: {
10
- card: {
11
- title?: string;
12
- description?: string;
13
- badge?: string;
14
- breadcrumb?: string[];
15
- };
16
- listItem: {
17
- title?: string;
18
- description?: string;
19
- badge?: string;
20
- breadcrumb?: string[];
21
- };
22
- };
23
- };
24
- export type References = {
25
- all: Reference[];
26
- used: Reference[];
27
- };
28
- export type ChatMessageBotStreaming = {
29
- type: 'bot';
30
- /**
31
- * ISO Timestamp
32
- */
33
- time: string;
34
- id: string;
35
- state: 'streaming' | 'done';
36
- message: {
37
- markdown: string;
38
- html: string;
39
- };
40
- references: References;
41
- errors: ChatErrors[];
42
- };
43
- export type ChatMessageBotLoading = Omit<ChatMessageBotStreaming, 'id' | 'state'> & {
44
- id?: string;
45
- state: 'loading';
46
- };
47
- export type ChatMessageBotRaw = ChatMessageBotLoading | ChatMessageBotStreaming;
48
- export type ChatMessageBot = ChatMessageBotRaw | (Omit<ChatMessageBotRaw, 'id'> & {
49
- id: undefined;
50
- incomplete: true;
51
- });
52
- export type ChatErrors = ServerError | 'sse-error' | 'client-error' | 'unexpected-call' | 'incomplete-error';
53
- export type OnError = (error: ChatErrors) => void;
File without changes
@@ -1,3 +0,0 @@
1
- export * from './liipgpt-client';
2
- export * from './chat-message-types';
3
- export * from '../config/chat-config';
@@ -1,92 +0,0 @@
1
- import { ClassificationConfig, MenuItem, PredefinedQuestion } from '../../../../../src/config/chat-config';
2
- import { Readable } from 'svelte/store';
3
- import { Constructor } from 'type-fest';
4
- import { ChatMessageBot, OnError } from './chat-message-types';
5
- type LiipGPTClientOptions = {
6
- apiUrl: string;
7
- apiKey?: string;
8
- strict?: boolean;
9
- EventSource?: Constructor<EventSource>;
10
- };
11
- export type Language = 'en' | 'de' | 'fr' | 'it';
12
- export type ReferenceData = {
13
- url: string;
14
- title?: string;
15
- referenceNumber: number;
16
- usedNumber?: number;
17
- domainName: string;
18
- breadcrumb: string[];
19
- generated: {
20
- summary: string;
21
- };
22
- };
23
- export type Sources = {
24
- all: ReferenceData[];
25
- used: ReferenceData[];
26
- };
27
- type PredefinedQuestionsParams = {
28
- url: string;
29
- language: string;
30
- };
31
- type MenuParams = {
32
- url: string;
33
- language: string;
34
- };
35
- export type ChatOptions = {
36
- model?: string;
37
- lang?: string;
38
- features?: string[];
39
- version?: string;
40
- onError?: OnError;
41
- };
42
- export type QuickFeedbackType = 'positive' | 'negative';
43
- export type QuickFeedback = {
44
- messageId?: string;
45
- feedback: QuickFeedbackType;
46
- };
47
- type Feedback = {
48
- messageId?: string;
49
- email?: string;
50
- body: string;
51
- };
52
- export type Classification = {
53
- impact?: number;
54
- quality?: number;
55
- };
56
- type ClassificationRequest = Classification & {
57
- messageId?: string;
58
- };
59
- type ClientMetadata = {
60
- mode: 'ready';
61
- userId: string;
62
- conversationId: string;
63
- } | {
64
- mode: 'maintenance';
65
- };
66
- export declare class LiipGPTClient {
67
- private readonly apiUrl;
68
- private readonly apiKey;
69
- private readonly strict;
70
- private readonly EventSource;
71
- lastRequestId: string | undefined;
72
- private idToQuestionsMap;
73
- metadata: Promise<ClientMetadata>;
74
- constructor({ apiUrl, apiKey, strict, EventSource: EventSourceOption }: LiipGPTClientOptions);
75
- private getUserData;
76
- static getInstance(): LiipGPTClient | undefined;
77
- private postData;
78
- private fetchData;
79
- private fetchSSE;
80
- quickFeedback(feedback: QuickFeedback): Promise<Response>;
81
- feedback(feedback: Feedback): Promise<Response>;
82
- getClassification(params?: Record<string, string | undefined>): Promise<ClassificationConfig | undefined>;
83
- classification({ impact, quality, messageId }: ClassificationRequest): Promise<Response>;
84
- getPredefinedQuestions(params: PredefinedQuestionsParams): Promise<PredefinedQuestion[]>;
85
- private getChatConfig;
86
- getMenu(params: MenuParams): Promise<MenuItem[]>;
87
- getUsedLanguages(): Promise<Language[]>;
88
- private chatInternal;
89
- chat(message: string, options?: ChatOptions): Readable<ChatMessageBot>;
90
- search(query: string, options?: ChatOptions): Readable<ChatMessageBot>;
91
- }
92
- export {};
@@ -1,2 +0,0 @@
1
- import { References } from '../../../../../src/lib/chat-message-types';
2
- export declare const toHTML: (markdown: string, references: References) => string;
@@ -1,15 +0,0 @@
1
- import { ChatErrors, ChatMessageBot, ChatMessageBotStreaming, OnError } from '../../../../../src/lib/chat-message-types';
2
- import { SseReference } from '../../../../../src/lib/sse-v2-types';
3
- import { Readable } from 'svelte/store';
4
- export declare const hasId: (message: ChatMessageBot) => message is ChatMessageBotStreaming;
5
- export declare class MessageStore {
6
- private onError?;
7
- private store;
8
- constructor(onError?: OnError | undefined);
9
- pushError(error: ChatErrors): void;
10
- updateRequestId(id: string): void;
11
- updateText(text: string): void;
12
- finishMessage(): void;
13
- addReference(reference: SseReference): void;
14
- getReadable(): Readable<ChatMessageBot>;
15
- }
@@ -1,57 +0,0 @@
1
- interface UsedLinks {
2
- url: string;
3
- title: string;
4
- type?: string;
5
- image?: string;
6
- smallImage?: string;
7
- date?: Date;
8
- description?: string;
9
- considered: boolean;
10
- similarity?: number;
11
- content?: string;
12
- contentDescription?: boolean;
13
- fromFullTextSearch?: boolean;
14
- summary?: string;
15
- doNotSendLink?: boolean;
16
- }
17
- export type SseReference = Omit<UsedLinks, 'content'>;
18
- export type ServerError = 'blocked' | 'maintenance' | 'rate-limit' | 'server-error' | 'too-short' | 'too-long' | 'quota-reached' | 'aborted';
19
- export type SseMessageV2 = {
20
- type: 'text';
21
- text: string;
22
- } | {
23
- type: 'state';
24
- state: 'retrieve' | 'interpret' | 'generate-prompt' | 'generate-answer' | 'retry' | 'no-guarantee' | 'maybe-bad-rating' | 'no-question' | 'no-search' | 'analyze';
25
- message?: string;
26
- } | {
27
- type: 'unexpected-call';
28
- key?: string;
29
- value: unknown;
30
- } | {
31
- type: 'error';
32
- error: ServerError;
33
- message?: string;
34
- } | {
35
- type: 'reference';
36
- reference: SseReference;
37
- } | {
38
- type: 'tokens-per-second';
39
- tps: number;
40
- } | {
41
- type: 'id';
42
- for: 'request' | 'thread' | 'user';
43
- id: string;
44
- } | {
45
- type: 'retrieval-question';
46
- question: string;
47
- } | {
48
- type: 'language';
49
- language: string;
50
- } | {
51
- type: 'answer-done';
52
- } | {
53
- type: 'done';
54
- } | {
55
- type: 'ignore';
56
- };
57
- export {};
@@ -1,2 +0,0 @@
1
- export declare const removeUndefinedValues: (obj: Record<string, unknown>) => Record<string, string>;
2
- export declare const getDomainName: (url: string) => string;