@liip/liipgpt 3.10.0-rc.2 → 3.10.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.
Files changed (30) hide show
  1. package/chat/liipgpt-chat.iife.js +14 -14
  2. package/chat/liipgpt-chat.js +19 -19
  3. package/configurator/_app/env.js +1 -1
  4. package/configurator/_app/immutable/chunks/BE15eIcX.js +61 -0
  5. package/configurator/_app/immutable/chunks/{CgnKIljY.js → Bp2fQKa2.js} +1 -1
  6. package/configurator/_app/immutable/chunks/{DOmHuVAd.js → C3nFRFkd.js} +1 -1
  7. package/configurator/_app/immutable/chunks/CQKQgM16.js +1 -0
  8. package/configurator/_app/immutable/chunks/{Dojw3mHu.js → DGoyvn3J.js} +1 -1
  9. package/configurator/_app/immutable/chunks/{CiRZ9UnK.js → DoB1D_8H.js} +1 -1
  10. package/configurator/_app/immutable/chunks/{DAKT0Hmi.js → N6jOC-pH.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{k0QB3my2.js → cTsTcg30.js} +1 -1
  12. package/configurator/_app/immutable/chunks/{DUEYj7Tq.js → cZD35eXJ.js} +1 -1
  13. package/configurator/_app/immutable/entry/{app.FlyB4DsO.js → app.C8tlSXPA.js} +2 -2
  14. package/configurator/_app/immutable/entry/start.CuNeX-jt.js +1 -0
  15. package/configurator/_app/immutable/nodes/{0.CTF3xmQA.js → 0.DCB0I300.js} +1 -1
  16. package/configurator/_app/immutable/nodes/{1.BSQ6HX7R.js → 1.B1zFGe7K.js} +1 -1
  17. package/configurator/_app/immutable/nodes/{2.C6z1AFjm.js → 2.CrdD7F_a.js} +3 -3
  18. package/configurator/_app/immutable/nodes/{3.D5oG7yIJ.js → 3.W2IWRGSL.js} +1 -1
  19. package/configurator/_app/version.json +1 -1
  20. package/configurator/index.html +6 -6
  21. package/configurator/sidebar.html +6 -6
  22. package/index.cjs +39 -0
  23. package/index.d.ts +11 -0
  24. package/index.js +39 -0
  25. package/package.json +1 -1
  26. package/search-summary/liipgpt-search-summary.iife.js +3 -3
  27. package/search-summary/liipgpt-search-summary.js +1 -1
  28. package/configurator/_app/immutable/chunks/DZ7HiB-Q.js +0 -61
  29. package/configurator/_app/immutable/chunks/g-mSZff4.js +0 -1
  30. package/configurator/_app/immutable/entry/start.DGSyFGK8.js +0 -1
@@ -4,12 +4,12 @@
4
4
  <meta charset="utf-8" />
5
5
  <link rel="icon" href="./favicon.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <link href="./_app/immutable/entry/start.DGSyFGK8.js" rel="modulepreload">
8
- <link href="./_app/immutable/chunks/g-mSZff4.js" rel="modulepreload">
7
+ <link href="./_app/immutable/entry/start.CuNeX-jt.js" rel="modulepreload">
8
+ <link href="./_app/immutable/chunks/CQKQgM16.js" rel="modulepreload">
9
9
  <link href="./_app/immutable/chunks/rEsbAd0y.js" rel="modulepreload">
10
10
  <link href="./_app/immutable/chunks/CibALFW0.js" rel="modulepreload">
11
11
  <link href="./_app/immutable/chunks/Bo0U8J3e.js" rel="modulepreload">
12
- <link href="./_app/immutable/entry/app.FlyB4DsO.js" rel="modulepreload">
12
+ <link href="./_app/immutable/entry/app.C8tlSXPA.js" rel="modulepreload">
13
13
  <link href="./_app/immutable/chunks/DjVmpym-.js" rel="modulepreload">
14
14
  <link href="./_app/immutable/chunks/CFKVnMbq.js" rel="modulepreload">
15
15
 
@@ -18,7 +18,7 @@
18
18
  <div style="display: contents">
19
19
  <script>
20
20
  {
21
- __sveltekit_bk2eo = {
21
+ __sveltekit_1wpgoac = {
22
22
  base: new URL(".", location).pathname.slice(0, -1),
23
23
  assets: "/configurator"
24
24
  };
@@ -26,8 +26,8 @@
26
26
  const element = document.currentScript.parentElement;
27
27
 
28
28
  Promise.all([
29
- import("./_app/immutable/entry/start.DGSyFGK8.js"),
30
- import("./_app/immutable/entry/app.FlyB4DsO.js")
29
+ import("./_app/immutable/entry/start.CuNeX-jt.js"),
30
+ import("./_app/immutable/entry/app.C8tlSXPA.js")
31
31
  ]).then(([kit, app]) => {
32
32
  kit.start(app, element);
33
33
  });
@@ -4,12 +4,12 @@
4
4
  <meta charset="utf-8" />
5
5
  <link rel="icon" href="./favicon.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <link href="./_app/immutable/entry/start.DGSyFGK8.js" rel="modulepreload">
8
- <link href="./_app/immutable/chunks/g-mSZff4.js" rel="modulepreload">
7
+ <link href="./_app/immutable/entry/start.CuNeX-jt.js" rel="modulepreload">
8
+ <link href="./_app/immutable/chunks/CQKQgM16.js" rel="modulepreload">
9
9
  <link href="./_app/immutable/chunks/rEsbAd0y.js" rel="modulepreload">
10
10
  <link href="./_app/immutable/chunks/CibALFW0.js" rel="modulepreload">
11
11
  <link href="./_app/immutable/chunks/Bo0U8J3e.js" rel="modulepreload">
12
- <link href="./_app/immutable/entry/app.FlyB4DsO.js" rel="modulepreload">
12
+ <link href="./_app/immutable/entry/app.C8tlSXPA.js" rel="modulepreload">
13
13
  <link href="./_app/immutable/chunks/DjVmpym-.js" rel="modulepreload">
14
14
  <link href="./_app/immutable/chunks/CFKVnMbq.js" rel="modulepreload">
15
15
 
@@ -18,7 +18,7 @@
18
18
  <div style="display: contents">
19
19
  <script>
20
20
  {
21
- __sveltekit_bk2eo = {
21
+ __sveltekit_1wpgoac = {
22
22
  base: new URL(".", location).pathname.slice(0, -1),
23
23
  assets: "/configurator"
24
24
  };
@@ -26,8 +26,8 @@
26
26
  const element = document.currentScript.parentElement;
27
27
 
28
28
  Promise.all([
29
- import("./_app/immutable/entry/start.DGSyFGK8.js"),
30
- import("./_app/immutable/entry/app.FlyB4DsO.js")
29
+ import("./_app/immutable/entry/start.CuNeX-jt.js"),
30
+ import("./_app/immutable/entry/app.C8tlSXPA.js")
31
31
  ]).then(([kit, app]) => {
32
32
  kit.start(app, element);
33
33
  });
package/index.cjs CHANGED
@@ -5273,12 +5273,16 @@ class SearchResponse {
5273
5273
  }
5274
5274
 
5275
5275
  // src/lib/client/liipgpt-client-primitive.ts
5276
+ var DEFAULT_CHAT_TIMEOUT = 45000;
5277
+
5276
5278
  class LiipGPTClientPrimitive {
5277
5279
  internalData;
5278
5280
  renderers = new Map;
5279
5281
  markedExtensions = [];
5280
5282
  _newTabSrText;
5283
+ chatTimeout;
5281
5284
  constructor(options2) {
5285
+ this.chatTimeout = options2.chatTimeout ?? DEFAULT_CHAT_TIMEOUT;
5282
5286
  const restOptions = {
5283
5287
  apiUrl: options2.apiUrl,
5284
5288
  apiKey: options2.apiKey,
@@ -5327,10 +5331,40 @@ class LiipGPTClientPrimitive {
5327
5331
  });
5328
5332
  const abort = async () => {
5329
5333
  await readyForFeedback;
5334
+ if (timedOut && !subscription.getCurrentValue())
5335
+ return;
5330
5336
  (await subscription).close();
5331
5337
  };
5332
5338
  const subscription = new FutureValue;
5333
5339
  const typingQueue = new FakeTypingQueue((chunk) => chatResultBuilder.updateText(chunk));
5340
+ const timeout = options2.timeout ?? this.chatTimeout;
5341
+ let timeoutId;
5342
+ let timedOut = false;
5343
+ const stopWatchdog = () => {
5344
+ if (timeoutId !== undefined)
5345
+ clearTimeout(timeoutId);
5346
+ timeoutId = undefined;
5347
+ };
5348
+ const onTimeout = () => {
5349
+ timedOut = true;
5350
+ timeoutId = undefined;
5351
+ console.error(`No SSE activity for ${timeout}ms, giving up on chat request ${requestId}`);
5352
+ typingQueue.clear();
5353
+ chatResultBuilder.pushError("sse-error");
5354
+ const openSubscription = subscription.getCurrentValue();
5355
+ if (openSubscription) {
5356
+ openSubscription.close();
5357
+ return;
5358
+ }
5359
+ chatResultBuilder.finishMessage();
5360
+ readyForFeedback.resolve();
5361
+ };
5362
+ const restartWatchdog = () => {
5363
+ stopWatchdog();
5364
+ if (timeout > 0 && !timedOut)
5365
+ timeoutId = setTimeout(onTimeout, timeout);
5366
+ };
5367
+ restartWatchdog();
5334
5368
  (async () => {
5335
5369
  const metadata = await this.internalData.metadata;
5336
5370
  if (metadata.mode === "maintenance") {
@@ -5354,6 +5388,7 @@ class LiipGPTClientPrimitive {
5354
5388
  version: "2"
5355
5389
  }, {
5356
5390
  onClose: () => {
5391
+ stopWatchdog();
5357
5392
  typingQueue.clear();
5358
5393
  chatResultBuilder.finishMessage();
5359
5394
  readyForFeedback.resolve();
@@ -5361,6 +5396,7 @@ class LiipGPTClientPrimitive {
5361
5396
  },
5362
5397
  onMessage: (d) => {
5363
5398
  const data = d;
5399
+ restartWatchdog();
5364
5400
  switch (data.type) {
5365
5401
  case "error":
5366
5402
  typingQueue.runAfterTyping(() => chatResultBuilder.pushError(data.error));
@@ -5385,6 +5421,7 @@ class LiipGPTClientPrimitive {
5385
5421
  break;
5386
5422
  case "done":
5387
5423
  case "answer-done":
5424
+ stopWatchdog();
5388
5425
  typingQueue.runAfterTyping(() => {
5389
5426
  chatResultBuilder.finishMessage();
5390
5427
  readyForFeedback.resolve();
@@ -5425,6 +5462,8 @@ class LiipGPTClientPrimitive {
5425
5462
  }
5426
5463
  });
5427
5464
  subscription.setValue(s);
5465
+ if (timedOut)
5466
+ s.close();
5428
5467
  })();
5429
5468
  const chatResponse = new ChatResponse({
5430
5469
  question,
package/index.d.ts CHANGED
@@ -10032,6 +10032,14 @@ export type LiipGPTClientOptions = {
10032
10032
  strict?: boolean;
10033
10033
  EventSource?: Constructor<EventSource>;
10034
10034
  startParameters?: Record<string, unknown>;
10035
+ /**
10036
+ * Give up on a chat request when its SSE stream stays silent for this many milliseconds.
10037
+ * The watchdog is reset by every incoming SSE message and stops once the answer is complete,
10038
+ * so it only fires on a stalled stream — not on a slow but healthy one. Set to 0 to disable.
10039
+ *
10040
+ * @default 45000
10041
+ */
10042
+ chatTimeout?: number;
10035
10043
  };
10036
10044
  export type Language = "en" | "de" | "fr" | "it";
10037
10045
  export type ReferenceData = {
@@ -10067,6 +10075,8 @@ export type ChatOptions = {
10067
10075
  selectorValues?: Record<string, string | string[] | Record<string, unknown>>;
10068
10076
  predefinedQuestionId?: string;
10069
10077
  switchQuestionId?: string;
10078
+ /** Overrides the client's `chatTimeout` for this request. Set to 0 to disable. */
10079
+ timeout?: number;
10070
10080
  onError?: OnError;
10071
10081
  onMessage?: (message: SseMessageV2) => void;
10072
10082
  onEmbed?: (embed: ChatMessageEmbed) => void;
@@ -10161,6 +10171,7 @@ declare class LiipGPTClientPrimitive {
10161
10171
  private renderers;
10162
10172
  private markedExtensions;
10163
10173
  private _newTabSrText?;
10174
+ private readonly chatTimeout;
10164
10175
  constructor(options: LiipGPTClientOptions);
10165
10176
  setMarkedExtensions(...extensions: MarkedExtension[]): void;
10166
10177
  setNewTabSrText(text: string): void;
package/index.js CHANGED
@@ -5176,12 +5176,16 @@ class SearchResponse {
5176
5176
  }
5177
5177
 
5178
5178
  // src/lib/client/liipgpt-client-primitive.ts
5179
+ var DEFAULT_CHAT_TIMEOUT = 45000;
5180
+
5179
5181
  class LiipGPTClientPrimitive {
5180
5182
  internalData;
5181
5183
  renderers = new Map;
5182
5184
  markedExtensions = [];
5183
5185
  _newTabSrText;
5186
+ chatTimeout;
5184
5187
  constructor(options2) {
5188
+ this.chatTimeout = options2.chatTimeout ?? DEFAULT_CHAT_TIMEOUT;
5185
5189
  const restOptions = {
5186
5190
  apiUrl: options2.apiUrl,
5187
5191
  apiKey: options2.apiKey,
@@ -5230,10 +5234,40 @@ class LiipGPTClientPrimitive {
5230
5234
  });
5231
5235
  const abort = async () => {
5232
5236
  await readyForFeedback;
5237
+ if (timedOut && !subscription.getCurrentValue())
5238
+ return;
5233
5239
  (await subscription).close();
5234
5240
  };
5235
5241
  const subscription = new FutureValue;
5236
5242
  const typingQueue = new FakeTypingQueue((chunk) => chatResultBuilder.updateText(chunk));
5243
+ const timeout = options2.timeout ?? this.chatTimeout;
5244
+ let timeoutId;
5245
+ let timedOut = false;
5246
+ const stopWatchdog = () => {
5247
+ if (timeoutId !== undefined)
5248
+ clearTimeout(timeoutId);
5249
+ timeoutId = undefined;
5250
+ };
5251
+ const onTimeout = () => {
5252
+ timedOut = true;
5253
+ timeoutId = undefined;
5254
+ console.error(`No SSE activity for ${timeout}ms, giving up on chat request ${requestId}`);
5255
+ typingQueue.clear();
5256
+ chatResultBuilder.pushError("sse-error");
5257
+ const openSubscription = subscription.getCurrentValue();
5258
+ if (openSubscription) {
5259
+ openSubscription.close();
5260
+ return;
5261
+ }
5262
+ chatResultBuilder.finishMessage();
5263
+ readyForFeedback.resolve();
5264
+ };
5265
+ const restartWatchdog = () => {
5266
+ stopWatchdog();
5267
+ if (timeout > 0 && !timedOut)
5268
+ timeoutId = setTimeout(onTimeout, timeout);
5269
+ };
5270
+ restartWatchdog();
5237
5271
  (async () => {
5238
5272
  const metadata = await this.internalData.metadata;
5239
5273
  if (metadata.mode === "maintenance") {
@@ -5257,6 +5291,7 @@ class LiipGPTClientPrimitive {
5257
5291
  version: "2"
5258
5292
  }, {
5259
5293
  onClose: () => {
5294
+ stopWatchdog();
5260
5295
  typingQueue.clear();
5261
5296
  chatResultBuilder.finishMessage();
5262
5297
  readyForFeedback.resolve();
@@ -5264,6 +5299,7 @@ class LiipGPTClientPrimitive {
5264
5299
  },
5265
5300
  onMessage: (d) => {
5266
5301
  const data = d;
5302
+ restartWatchdog();
5267
5303
  switch (data.type) {
5268
5304
  case "error":
5269
5305
  typingQueue.runAfterTyping(() => chatResultBuilder.pushError(data.error));
@@ -5288,6 +5324,7 @@ class LiipGPTClientPrimitive {
5288
5324
  break;
5289
5325
  case "done":
5290
5326
  case "answer-done":
5327
+ stopWatchdog();
5291
5328
  typingQueue.runAfterTyping(() => {
5292
5329
  chatResultBuilder.finishMessage();
5293
5330
  readyForFeedback.resolve();
@@ -5328,6 +5365,8 @@ class LiipGPTClientPrimitive {
5328
5365
  }
5329
5366
  });
5330
5367
  subscription.setValue(s);
5368
+ if (timedOut)
5369
+ s.close();
5331
5370
  })();
5332
5371
  const chatResponse = new ChatResponse({
5333
5372
  question,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liip/liipgpt",
3
- "version": "3.10.0-rc.2",
3
+ "version": "3.10.0",
4
4
  "description": "LiipGPT Chat and Library",
5
5
  "type": "module",
6
6
  "exports": {