@liip/liipgpt 3.10.0 → 3.10.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.
- package/chat/liipgpt-chat.iife.js +11 -11
- package/chat/liipgpt-chat.js +17 -17
- package/configurator/_app/env.js +1 -1
- package/configurator/_app/immutable/chunks/{DoB1D_8H.js → BCTlyu24.js} +1 -1
- package/configurator/_app/immutable/chunks/{N6jOC-pH.js → CEQ1bB5L.js} +9 -9
- package/configurator/_app/immutable/chunks/{CQKQgM16.js → CQC77dRm.js} +1 -1
- package/configurator/_app/immutable/chunks/{cTsTcg30.js → Czs7C_Nk.js} +1 -1
- package/configurator/_app/immutable/chunks/{cZD35eXJ.js → DJ6Fj3Kz.js} +1 -1
- package/configurator/_app/immutable/chunks/{Bp2fQKa2.js → JiiUWewn.js} +1 -1
- package/configurator/_app/immutable/chunks/{DGoyvn3J.js → uVttJl7C.js} +1 -1
- package/configurator/_app/immutable/entry/{app.C8tlSXPA.js → app.QI93c1tL.js} +2 -2
- package/configurator/_app/immutable/entry/start.pulOZOjC.js +1 -0
- package/configurator/_app/immutable/nodes/{0.DCB0I300.js → 0.DPQcht_Z.js} +1 -1
- package/configurator/_app/immutable/nodes/{1.B1zFGe7K.js → 1.B0bi6UL_.js} +1 -1
- package/configurator/_app/immutable/nodes/{2.CrdD7F_a.js → 2.CqOoLsTF.js} +3 -3
- package/configurator/_app/immutable/nodes/{3.W2IWRGSL.js → 3.DZ6mlpth.js} +1 -1
- package/configurator/_app/version.json +1 -1
- package/configurator/index.html +6 -6
- package/configurator/sidebar.html +6 -6
- package/index.cjs +277 -277
- package/index.js +276 -276
- package/package.json +1 -1
- package/configurator/_app/immutable/entry/start.CuNeX-jt.js +0 -1
package/index.js
CHANGED
|
@@ -17,17 +17,17 @@ var {
|
|
|
17
17
|
construct
|
|
18
18
|
} = typeof Reflect !== "undefined" && Reflect;
|
|
19
19
|
if (!freeze) {
|
|
20
|
-
freeze = function
|
|
20
|
+
freeze = function freeze(x) {
|
|
21
21
|
return x;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
if (!seal) {
|
|
25
|
-
seal = function
|
|
25
|
+
seal = function seal(x) {
|
|
26
26
|
return x;
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
if (!apply) {
|
|
30
|
-
apply = function
|
|
30
|
+
apply = function apply(func, thisArg) {
|
|
31
31
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2;_key < _len; _key++) {
|
|
32
32
|
args[_key - 2] = arguments[_key];
|
|
33
33
|
}
|
|
@@ -35,7 +35,7 @@ if (!apply) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
if (!construct) {
|
|
38
|
-
construct = function
|
|
38
|
+
construct = function construct(Func) {
|
|
39
39
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++) {
|
|
40
40
|
args[_key2 - 1] = arguments[_key2];
|
|
41
41
|
}
|
|
@@ -187,10 +187,10 @@ var NODE_TYPE = {
|
|
|
187
187
|
documentFragment: 11,
|
|
188
188
|
notation: 12
|
|
189
189
|
};
|
|
190
|
-
var getGlobal = function
|
|
190
|
+
var getGlobal = function getGlobal() {
|
|
191
191
|
return typeof window === "undefined" ? null : window;
|
|
192
192
|
};
|
|
193
|
-
var _createTrustedTypesPolicy = function
|
|
193
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
194
194
|
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
|
|
195
195
|
return null;
|
|
196
196
|
}
|
|
@@ -202,8 +202,8 @@ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes
|
|
|
202
202
|
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
203
203
|
try {
|
|
204
204
|
return trustedTypes.createPolicy(policyName, {
|
|
205
|
-
createHTML(
|
|
206
|
-
return
|
|
205
|
+
createHTML(html) {
|
|
206
|
+
return html;
|
|
207
207
|
},
|
|
208
208
|
createScriptURL(scriptUrl) {
|
|
209
209
|
return scriptUrl;
|
|
@@ -214,7 +214,7 @@ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes
|
|
|
214
214
|
return null;
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
|
-
var _createHooksMap = function
|
|
217
|
+
var _createHooksMap = function _createHooksMap() {
|
|
218
218
|
return {
|
|
219
219
|
afterSanitizeAttributes: [],
|
|
220
220
|
afterSanitizeElements: [],
|
|
@@ -278,14 +278,14 @@ function createDOMPurify() {
|
|
|
278
278
|
let hooks = _createHooksMap();
|
|
279
279
|
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== undefined;
|
|
280
280
|
const {
|
|
281
|
-
MUSTACHE_EXPR
|
|
282
|
-
ERB_EXPR
|
|
283
|
-
TMPLIT_EXPR
|
|
284
|
-
DATA_ATTR
|
|
285
|
-
ARIA_ATTR
|
|
286
|
-
IS_SCRIPT_OR_DATA
|
|
287
|
-
ATTR_WHITESPACE
|
|
288
|
-
CUSTOM_ELEMENT
|
|
281
|
+
MUSTACHE_EXPR,
|
|
282
|
+
ERB_EXPR,
|
|
283
|
+
TMPLIT_EXPR,
|
|
284
|
+
DATA_ATTR,
|
|
285
|
+
ARIA_ATTR,
|
|
286
|
+
IS_SCRIPT_OR_DATA,
|
|
287
|
+
ATTR_WHITESPACE,
|
|
288
|
+
CUSTOM_ELEMENT
|
|
289
289
|
} = EXPRESSIONS;
|
|
290
290
|
let {
|
|
291
291
|
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
@@ -370,10 +370,10 @@ function createDOMPurify() {
|
|
|
370
370
|
let transformCaseFunc = null;
|
|
371
371
|
let CONFIG = null;
|
|
372
372
|
const formElement = document2.createElement("form");
|
|
373
|
-
const isRegexOrFunction = function
|
|
373
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
374
374
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
375
375
|
};
|
|
376
|
-
const _parseConfig = function
|
|
376
|
+
const _parseConfig = function _parseConfig() {
|
|
377
377
|
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
378
378
|
if (CONFIG && CONFIG === cfg) {
|
|
379
379
|
return;
|
|
@@ -526,7 +526,7 @@ function createDOMPurify() {
|
|
|
526
526
|
};
|
|
527
527
|
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
528
528
|
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
529
|
-
const _checkValidNamespace = function
|
|
529
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
530
530
|
let parent = getParentNode(element);
|
|
531
531
|
if (!parent || !parent.tagName) {
|
|
532
532
|
parent = {
|
|
@@ -571,7 +571,7 @@ function createDOMPurify() {
|
|
|
571
571
|
}
|
|
572
572
|
return false;
|
|
573
573
|
};
|
|
574
|
-
const _forceRemove = function
|
|
574
|
+
const _forceRemove = function _forceRemove(node) {
|
|
575
575
|
arrayPush(DOMPurify.removed, {
|
|
576
576
|
element: node
|
|
577
577
|
});
|
|
@@ -581,7 +581,7 @@ function createDOMPurify() {
|
|
|
581
581
|
remove(node);
|
|
582
582
|
}
|
|
583
583
|
};
|
|
584
|
-
const _removeAttribute = function
|
|
584
|
+
const _removeAttribute = function _removeAttribute(name, element) {
|
|
585
585
|
try {
|
|
586
586
|
arrayPush(DOMPurify.removed, {
|
|
587
587
|
attribute: element.getAttributeNode(name),
|
|
@@ -606,7 +606,7 @@ function createDOMPurify() {
|
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
};
|
|
609
|
-
const _initDocument = function
|
|
609
|
+
const _initDocument = function _initDocument(dirty) {
|
|
610
610
|
let doc = null;
|
|
611
611
|
let leadingWhitespace = null;
|
|
612
612
|
if (FORCE_BODY) {
|
|
@@ -639,21 +639,21 @@ function createDOMPurify() {
|
|
|
639
639
|
}
|
|
640
640
|
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
641
641
|
};
|
|
642
|
-
const _createNodeIterator = function
|
|
642
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
643
643
|
return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
644
644
|
};
|
|
645
|
-
const _isClobbered = function
|
|
645
|
+
const _isClobbered = function _isClobbered(element) {
|
|
646
646
|
return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
|
|
647
647
|
};
|
|
648
|
-
const _isNode = function
|
|
648
|
+
const _isNode = function _isNode(value) {
|
|
649
649
|
return typeof Node2 === "function" && value instanceof Node2;
|
|
650
650
|
};
|
|
651
|
-
function _executeHooks(
|
|
652
|
-
arrayForEach(
|
|
651
|
+
function _executeHooks(hooks, currentNode, data) {
|
|
652
|
+
arrayForEach(hooks, (hook) => {
|
|
653
653
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
const _sanitizeElements = function
|
|
656
|
+
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
657
657
|
let content = null;
|
|
658
658
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
659
659
|
if (_isClobbered(currentNode)) {
|
|
@@ -711,7 +711,7 @@ function createDOMPurify() {
|
|
|
711
711
|
}
|
|
712
712
|
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
713
713
|
content = currentNode.textContent;
|
|
714
|
-
arrayForEach([
|
|
714
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
|
|
715
715
|
content = stringReplace(content, expr, " ");
|
|
716
716
|
});
|
|
717
717
|
if (currentNode.textContent !== content) {
|
|
@@ -724,16 +724,16 @@ function createDOMPurify() {
|
|
|
724
724
|
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
725
725
|
return false;
|
|
726
726
|
};
|
|
727
|
-
const _isValidAttribute = function
|
|
727
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
728
728
|
if (FORBID_ATTR[lcName]) {
|
|
729
729
|
return false;
|
|
730
730
|
}
|
|
731
731
|
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && ((value in document2) || (value in formElement))) {
|
|
732
732
|
return false;
|
|
733
733
|
}
|
|
734
|
-
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(
|
|
734
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName))
|
|
735
735
|
;
|
|
736
|
-
else if (ALLOW_ARIA_ATTR && regExpTest(
|
|
736
|
+
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName))
|
|
737
737
|
;
|
|
738
738
|
else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag))
|
|
739
739
|
;
|
|
@@ -745,21 +745,21 @@ function createDOMPurify() {
|
|
|
745
745
|
}
|
|
746
746
|
} else if (URI_SAFE_ATTRIBUTES[lcName])
|
|
747
747
|
;
|
|
748
|
-
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value,
|
|
748
|
+
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, "")))
|
|
749
749
|
;
|
|
750
750
|
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
|
|
751
751
|
;
|
|
752
|
-
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(
|
|
752
|
+
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, "")))
|
|
753
753
|
;
|
|
754
754
|
else if (value) {
|
|
755
755
|
return false;
|
|
756
756
|
}
|
|
757
757
|
return true;
|
|
758
758
|
};
|
|
759
|
-
const _isBasicCustomElement = function
|
|
760
|
-
return tagName !== "annotation-xml" && stringMatch(tagName,
|
|
759
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
760
|
+
return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT);
|
|
761
761
|
};
|
|
762
|
-
const _sanitizeAttributes = function
|
|
762
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
763
763
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
764
764
|
const {
|
|
765
765
|
attributes
|
|
@@ -815,7 +815,7 @@ function createDOMPurify() {
|
|
|
815
815
|
continue;
|
|
816
816
|
}
|
|
817
817
|
if (SAFE_FOR_TEMPLATES) {
|
|
818
|
-
arrayForEach([
|
|
818
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
|
|
819
819
|
value = stringReplace(value, expr, " ");
|
|
820
820
|
});
|
|
821
821
|
}
|
|
@@ -859,7 +859,7 @@ function createDOMPurify() {
|
|
|
859
859
|
}
|
|
860
860
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
861
861
|
};
|
|
862
|
-
const _sanitizeShadowDOM = function
|
|
862
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
863
863
|
let shadowNode = null;
|
|
864
864
|
const shadowIterator = _createNodeIterator(fragment);
|
|
865
865
|
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
@@ -868,7 +868,7 @@ function createDOMPurify() {
|
|
|
868
868
|
_sanitizeElements(shadowNode);
|
|
869
869
|
_sanitizeAttributes(shadowNode);
|
|
870
870
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
871
|
-
|
|
871
|
+
_sanitizeShadowDOM(shadowNode.content);
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
874
|
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
@@ -963,7 +963,7 @@ function createDOMPurify() {
|
|
|
963
963
|
` + serializedHTML;
|
|
964
964
|
}
|
|
965
965
|
if (SAFE_FOR_TEMPLATES) {
|
|
966
|
-
arrayForEach([
|
|
966
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
|
|
967
967
|
serializedHTML = stringReplace(serializedHTML, expr, " ");
|
|
968
968
|
});
|
|
969
969
|
}
|
|
@@ -1240,17 +1240,17 @@ var escapeReplacements = {
|
|
|
1240
1240
|
"'": "'"
|
|
1241
1241
|
};
|
|
1242
1242
|
var getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
1243
|
-
function escape2(
|
|
1243
|
+
function escape2(html2, encode) {
|
|
1244
1244
|
if (encode) {
|
|
1245
|
-
if (other.escapeTest.test(
|
|
1246
|
-
return
|
|
1245
|
+
if (other.escapeTest.test(html2)) {
|
|
1246
|
+
return html2.replace(other.escapeReplace, getEscapeReplacement);
|
|
1247
1247
|
}
|
|
1248
1248
|
} else {
|
|
1249
|
-
if (other.escapeTestNoEncode.test(
|
|
1250
|
-
return
|
|
1249
|
+
if (other.escapeTestNoEncode.test(html2)) {
|
|
1250
|
+
return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
|
|
1251
1251
|
}
|
|
1252
1252
|
}
|
|
1253
|
-
return
|
|
1253
|
+
return html2;
|
|
1254
1254
|
}
|
|
1255
1255
|
function cleanUrl(href) {
|
|
1256
1256
|
try {
|
|
@@ -1335,26 +1335,26 @@ function findClosingBracket(str, b) {
|
|
|
1335
1335
|
function outputLink(cap, link2, raw, lexer2, rules) {
|
|
1336
1336
|
const href = link2.href;
|
|
1337
1337
|
const title = link2.title || null;
|
|
1338
|
-
const
|
|
1338
|
+
const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
|
|
1339
1339
|
lexer2.state.inLink = true;
|
|
1340
1340
|
const token = {
|
|
1341
1341
|
type: cap[0].charAt(0) === "!" ? "image" : "link",
|
|
1342
1342
|
raw,
|
|
1343
1343
|
href,
|
|
1344
1344
|
title,
|
|
1345
|
-
text
|
|
1346
|
-
tokens: lexer2.inlineTokens(
|
|
1345
|
+
text,
|
|
1346
|
+
tokens: lexer2.inlineTokens(text)
|
|
1347
1347
|
};
|
|
1348
1348
|
lexer2.state.inLink = false;
|
|
1349
1349
|
return token;
|
|
1350
1350
|
}
|
|
1351
|
-
function indentCodeCompensation(raw,
|
|
1351
|
+
function indentCodeCompensation(raw, text, rules) {
|
|
1352
1352
|
const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
|
|
1353
1353
|
if (matchIndentToCode === null) {
|
|
1354
|
-
return
|
|
1354
|
+
return text;
|
|
1355
1355
|
}
|
|
1356
1356
|
const indentToCode = matchIndentToCode[1];
|
|
1357
|
-
return
|
|
1357
|
+
return text.split(`
|
|
1358
1358
|
`).map((node) => {
|
|
1359
1359
|
const matchIndentInNode = node.match(rules.other.beginningSpace);
|
|
1360
1360
|
if (matchIndentInNode === null) {
|
|
@@ -1387,13 +1387,13 @@ var _Tokenizer = class {
|
|
|
1387
1387
|
code(src) {
|
|
1388
1388
|
const cap = this.rules.block.code.exec(src);
|
|
1389
1389
|
if (cap) {
|
|
1390
|
-
const
|
|
1390
|
+
const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
1391
1391
|
return {
|
|
1392
1392
|
type: "code",
|
|
1393
1393
|
raw: cap[0],
|
|
1394
1394
|
codeBlockStyle: "indented",
|
|
1395
|
-
text: !this.options.pedantic ? rtrim(
|
|
1396
|
-
`) :
|
|
1395
|
+
text: !this.options.pedantic ? rtrim(text, `
|
|
1396
|
+
`) : text
|
|
1397
1397
|
};
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
@@ -1401,33 +1401,33 @@ var _Tokenizer = class {
|
|
|
1401
1401
|
const cap = this.rules.block.fences.exec(src);
|
|
1402
1402
|
if (cap) {
|
|
1403
1403
|
const raw = cap[0];
|
|
1404
|
-
const
|
|
1404
|
+
const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
|
|
1405
1405
|
return {
|
|
1406
1406
|
type: "code",
|
|
1407
1407
|
raw,
|
|
1408
1408
|
lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
|
|
1409
|
-
text
|
|
1409
|
+
text
|
|
1410
1410
|
};
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
heading(src) {
|
|
1414
1414
|
const cap = this.rules.block.heading.exec(src);
|
|
1415
1415
|
if (cap) {
|
|
1416
|
-
let
|
|
1417
|
-
if (this.rules.other.endingHash.test(
|
|
1418
|
-
const trimmed = rtrim(
|
|
1416
|
+
let text = cap[2].trim();
|
|
1417
|
+
if (this.rules.other.endingHash.test(text)) {
|
|
1418
|
+
const trimmed = rtrim(text, "#");
|
|
1419
1419
|
if (this.options.pedantic) {
|
|
1420
|
-
|
|
1420
|
+
text = trimmed.trim();
|
|
1421
1421
|
} else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
|
|
1422
|
-
|
|
1422
|
+
text = trimmed.trim();
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
return {
|
|
1426
1426
|
type: "heading",
|
|
1427
1427
|
raw: cap[0],
|
|
1428
1428
|
depth: cap[1].length,
|
|
1429
|
-
text
|
|
1430
|
-
tokens: this.lexer.inline(
|
|
1429
|
+
text,
|
|
1430
|
+
tokens: this.lexer.inline(text)
|
|
1431
1431
|
};
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
@@ -1448,7 +1448,7 @@ var _Tokenizer = class {
|
|
|
1448
1448
|
`).split(`
|
|
1449
1449
|
`);
|
|
1450
1450
|
let raw = "";
|
|
1451
|
-
let
|
|
1451
|
+
let text = "";
|
|
1452
1452
|
const tokens = [];
|
|
1453
1453
|
while (lines.length > 0) {
|
|
1454
1454
|
let inBlockquote = false;
|
|
@@ -1471,7 +1471,7 @@ var _Tokenizer = class {
|
|
|
1471
1471
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1472
1472
|
raw = raw ? `${raw}
|
|
1473
1473
|
${currentRaw}` : currentRaw;
|
|
1474
|
-
|
|
1474
|
+
text = text ? `${text}
|
|
1475
1475
|
${currentText}` : currentText;
|
|
1476
1476
|
const top = this.lexer.state.top;
|
|
1477
1477
|
this.lexer.state.top = true;
|
|
@@ -1491,7 +1491,7 @@ ${currentText}` : currentText;
|
|
|
1491
1491
|
const newToken = this.blockquote(newText);
|
|
1492
1492
|
tokens[tokens.length - 1] = newToken;
|
|
1493
1493
|
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
|
1494
|
-
|
|
1494
|
+
text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
|
|
1495
1495
|
break;
|
|
1496
1496
|
} else if (lastToken?.type === "list") {
|
|
1497
1497
|
const oldToken = lastToken;
|
|
@@ -1501,7 +1501,7 @@ ${currentText}` : currentText;
|
|
|
1501
1501
|
const newToken = this.list(newText);
|
|
1502
1502
|
tokens[tokens.length - 1] = newToken;
|
|
1503
1503
|
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
|
1504
|
-
|
|
1504
|
+
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
1505
1505
|
lines = newText.substring(tokens.at(-1).raw.length).split(`
|
|
1506
1506
|
`);
|
|
1507
1507
|
continue;
|
|
@@ -1511,7 +1511,7 @@ ${currentText}` : currentText;
|
|
|
1511
1511
|
type: "blockquote",
|
|
1512
1512
|
raw,
|
|
1513
1513
|
tokens,
|
|
1514
|
-
text
|
|
1514
|
+
text
|
|
1515
1515
|
};
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
@@ -1780,13 +1780,13 @@ ${currentText}` : currentText;
|
|
|
1780
1780
|
paragraph(src) {
|
|
1781
1781
|
const cap = this.rules.block.paragraph.exec(src);
|
|
1782
1782
|
if (cap) {
|
|
1783
|
-
const
|
|
1783
|
+
const text = cap[1].charAt(cap[1].length - 1) === `
|
|
1784
1784
|
` ? cap[1].slice(0, -1) : cap[1];
|
|
1785
1785
|
return {
|
|
1786
1786
|
type: "paragraph",
|
|
1787
1787
|
raw: cap[0],
|
|
1788
|
-
text
|
|
1789
|
-
tokens: this.lexer.inline(
|
|
1788
|
+
text,
|
|
1789
|
+
tokens: this.lexer.inline(text)
|
|
1790
1790
|
};
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
@@ -1890,11 +1890,11 @@ ${currentText}` : currentText;
|
|
|
1890
1890
|
const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
1891
1891
|
const link2 = links[linkString.toLowerCase()];
|
|
1892
1892
|
if (!link2) {
|
|
1893
|
-
const
|
|
1893
|
+
const text = cap[0].charAt(0);
|
|
1894
1894
|
return {
|
|
1895
1895
|
type: "text",
|
|
1896
|
-
raw:
|
|
1897
|
-
text
|
|
1896
|
+
raw: text,
|
|
1897
|
+
text
|
|
1898
1898
|
};
|
|
1899
1899
|
}
|
|
1900
1900
|
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
@@ -1934,20 +1934,20 @@ ${currentText}` : currentText;
|
|
|
1934
1934
|
const lastCharLength = [...match[0]][0].length;
|
|
1935
1935
|
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
1936
1936
|
if (Math.min(lLength, rLength) % 2) {
|
|
1937
|
-
const
|
|
1937
|
+
const text2 = raw.slice(1, -1);
|
|
1938
1938
|
return {
|
|
1939
1939
|
type: "em",
|
|
1940
1940
|
raw,
|
|
1941
|
-
text:
|
|
1942
|
-
tokens: this.lexer.inlineTokens(
|
|
1941
|
+
text: text2,
|
|
1942
|
+
tokens: this.lexer.inlineTokens(text2)
|
|
1943
1943
|
};
|
|
1944
1944
|
}
|
|
1945
|
-
const
|
|
1945
|
+
const text = raw.slice(2, -2);
|
|
1946
1946
|
return {
|
|
1947
1947
|
type: "strong",
|
|
1948
1948
|
raw,
|
|
1949
|
-
text
|
|
1950
|
-
tokens: this.lexer.inlineTokens(
|
|
1949
|
+
text,
|
|
1950
|
+
tokens: this.lexer.inlineTokens(text)
|
|
1951
1951
|
};
|
|
1952
1952
|
}
|
|
1953
1953
|
}
|
|
@@ -1955,16 +1955,16 @@ ${currentText}` : currentText;
|
|
|
1955
1955
|
codespan(src) {
|
|
1956
1956
|
const cap = this.rules.inline.code.exec(src);
|
|
1957
1957
|
if (cap) {
|
|
1958
|
-
let
|
|
1959
|
-
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(
|
|
1960
|
-
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(
|
|
1958
|
+
let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
1959
|
+
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
1960
|
+
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
1961
1961
|
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
1962
|
-
|
|
1962
|
+
text = text.substring(1, text.length - 1);
|
|
1963
1963
|
}
|
|
1964
1964
|
return {
|
|
1965
1965
|
type: "codespan",
|
|
1966
1966
|
raw: cap[0],
|
|
1967
|
-
text
|
|
1967
|
+
text
|
|
1968
1968
|
};
|
|
1969
1969
|
}
|
|
1970
1970
|
}
|
|
@@ -1991,24 +1991,24 @@ ${currentText}` : currentText;
|
|
|
1991
1991
|
autolink(src) {
|
|
1992
1992
|
const cap = this.rules.inline.autolink.exec(src);
|
|
1993
1993
|
if (cap) {
|
|
1994
|
-
let
|
|
1994
|
+
let text, href;
|
|
1995
1995
|
if (cap[2] === "@") {
|
|
1996
|
-
|
|
1997
|
-
href = "mailto:" +
|
|
1996
|
+
text = cap[1];
|
|
1997
|
+
href = "mailto:" + text;
|
|
1998
1998
|
} else {
|
|
1999
|
-
|
|
2000
|
-
href =
|
|
1999
|
+
text = cap[1];
|
|
2000
|
+
href = text;
|
|
2001
2001
|
}
|
|
2002
2002
|
return {
|
|
2003
2003
|
type: "link",
|
|
2004
2004
|
raw: cap[0],
|
|
2005
|
-
text
|
|
2005
|
+
text,
|
|
2006
2006
|
href,
|
|
2007
2007
|
tokens: [
|
|
2008
2008
|
{
|
|
2009
2009
|
type: "text",
|
|
2010
|
-
raw:
|
|
2011
|
-
text
|
|
2010
|
+
raw: text,
|
|
2011
|
+
text
|
|
2012
2012
|
}
|
|
2013
2013
|
]
|
|
2014
2014
|
};
|
|
@@ -2017,17 +2017,17 @@ ${currentText}` : currentText;
|
|
|
2017
2017
|
url(src) {
|
|
2018
2018
|
let cap;
|
|
2019
2019
|
if (cap = this.rules.inline.url.exec(src)) {
|
|
2020
|
-
let
|
|
2020
|
+
let text, href;
|
|
2021
2021
|
if (cap[2] === "@") {
|
|
2022
|
-
|
|
2023
|
-
href = "mailto:" +
|
|
2022
|
+
text = cap[0];
|
|
2023
|
+
href = "mailto:" + text;
|
|
2024
2024
|
} else {
|
|
2025
2025
|
let prevCapZero;
|
|
2026
2026
|
do {
|
|
2027
2027
|
prevCapZero = cap[0];
|
|
2028
2028
|
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
|
2029
2029
|
} while (prevCapZero !== cap[0]);
|
|
2030
|
-
|
|
2030
|
+
text = cap[0];
|
|
2031
2031
|
if (cap[1] === "www.") {
|
|
2032
2032
|
href = "http://" + cap[0];
|
|
2033
2033
|
} else {
|
|
@@ -2037,13 +2037,13 @@ ${currentText}` : currentText;
|
|
|
2037
2037
|
return {
|
|
2038
2038
|
type: "link",
|
|
2039
2039
|
raw: cap[0],
|
|
2040
|
-
text
|
|
2040
|
+
text,
|
|
2041
2041
|
href,
|
|
2042
2042
|
tokens: [
|
|
2043
2043
|
{
|
|
2044
2044
|
type: "text",
|
|
2045
|
-
raw:
|
|
2046
|
-
text
|
|
2045
|
+
raw: text,
|
|
2046
|
+
text
|
|
2047
2047
|
}
|
|
2048
2048
|
]
|
|
2049
2049
|
};
|
|
@@ -2431,9 +2431,9 @@ var _Renderer = class {
|
|
|
2431
2431
|
space(token) {
|
|
2432
2432
|
return "";
|
|
2433
2433
|
}
|
|
2434
|
-
code({ text
|
|
2434
|
+
code({ text, lang, escaped }) {
|
|
2435
2435
|
const langString = (lang || "").match(other.notSpaceStart)?.[0];
|
|
2436
|
-
const code =
|
|
2436
|
+
const code = text.replace(other.endingNewline, "") + `
|
|
2437
2437
|
`;
|
|
2438
2438
|
if (!langString) {
|
|
2439
2439
|
return "<pre><code>" + (escaped ? code : escape2(code, true)) + `</code></pre>
|
|
@@ -2448,8 +2448,8 @@ var _Renderer = class {
|
|
|
2448
2448
|
${body}</blockquote>
|
|
2449
2449
|
`;
|
|
2450
2450
|
}
|
|
2451
|
-
html({ text
|
|
2452
|
-
return
|
|
2451
|
+
html({ text }) {
|
|
2452
|
+
return text;
|
|
2453
2453
|
}
|
|
2454
2454
|
heading({ tokens, depth }) {
|
|
2455
2455
|
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
|
|
@@ -2531,9 +2531,9 @@ ${body}</blockquote>
|
|
|
2531
2531
|
` + body + `</table>
|
|
2532
2532
|
`;
|
|
2533
2533
|
}
|
|
2534
|
-
tablerow({ text
|
|
2534
|
+
tablerow({ text }) {
|
|
2535
2535
|
return `<tr>
|
|
2536
|
-
${
|
|
2536
|
+
${text}</tr>
|
|
2537
2537
|
`;
|
|
2538
2538
|
}
|
|
2539
2539
|
tablecell(token) {
|
|
@@ -2549,8 +2549,8 @@ ${text2}</tr>
|
|
|
2549
2549
|
em({ tokens }) {
|
|
2550
2550
|
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
2551
2551
|
}
|
|
2552
|
-
codespan({ text
|
|
2553
|
-
return `<code>${escape2(
|
|
2552
|
+
codespan({ text }) {
|
|
2553
|
+
return `<code>${escape2(text, true)}</code>`;
|
|
2554
2554
|
}
|
|
2555
2555
|
br(token) {
|
|
2556
2556
|
return "<br>";
|
|
@@ -2559,29 +2559,29 @@ ${text2}</tr>
|
|
|
2559
2559
|
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
2560
2560
|
}
|
|
2561
2561
|
link({ href, title, tokens }) {
|
|
2562
|
-
const
|
|
2562
|
+
const text = this.parser.parseInline(tokens);
|
|
2563
2563
|
const cleanHref = cleanUrl(href);
|
|
2564
2564
|
if (cleanHref === null) {
|
|
2565
|
-
return
|
|
2565
|
+
return text;
|
|
2566
2566
|
}
|
|
2567
2567
|
href = cleanHref;
|
|
2568
2568
|
let out = '<a href="' + href + '"';
|
|
2569
2569
|
if (title) {
|
|
2570
2570
|
out += ' title="' + escape2(title) + '"';
|
|
2571
2571
|
}
|
|
2572
|
-
out += ">" +
|
|
2572
|
+
out += ">" + text + "</a>";
|
|
2573
2573
|
return out;
|
|
2574
2574
|
}
|
|
2575
|
-
image({ href, title, text
|
|
2575
|
+
image({ href, title, text, tokens }) {
|
|
2576
2576
|
if (tokens) {
|
|
2577
|
-
|
|
2577
|
+
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
2578
2578
|
}
|
|
2579
2579
|
const cleanHref = cleanUrl(href);
|
|
2580
2580
|
if (cleanHref === null) {
|
|
2581
|
-
return escape2(
|
|
2581
|
+
return escape2(text);
|
|
2582
2582
|
}
|
|
2583
2583
|
href = cleanHref;
|
|
2584
|
-
let out = `<img src="${href}" alt="${
|
|
2584
|
+
let out = `<img src="${href}" alt="${text}"`;
|
|
2585
2585
|
if (title) {
|
|
2586
2586
|
out += ` title="${escape2(title)}"`;
|
|
2587
2587
|
}
|
|
@@ -2593,29 +2593,29 @@ ${text2}</tr>
|
|
|
2593
2593
|
}
|
|
2594
2594
|
};
|
|
2595
2595
|
var _TextRenderer = class {
|
|
2596
|
-
strong({ text
|
|
2597
|
-
return
|
|
2596
|
+
strong({ text }) {
|
|
2597
|
+
return text;
|
|
2598
2598
|
}
|
|
2599
|
-
em({ text
|
|
2600
|
-
return
|
|
2599
|
+
em({ text }) {
|
|
2600
|
+
return text;
|
|
2601
2601
|
}
|
|
2602
|
-
codespan({ text
|
|
2603
|
-
return
|
|
2602
|
+
codespan({ text }) {
|
|
2603
|
+
return text;
|
|
2604
2604
|
}
|
|
2605
|
-
del({ text
|
|
2606
|
-
return
|
|
2605
|
+
del({ text }) {
|
|
2606
|
+
return text;
|
|
2607
2607
|
}
|
|
2608
|
-
html({ text
|
|
2609
|
-
return
|
|
2608
|
+
html({ text }) {
|
|
2609
|
+
return text;
|
|
2610
2610
|
}
|
|
2611
|
-
text({ text
|
|
2612
|
-
return
|
|
2611
|
+
text({ text }) {
|
|
2612
|
+
return text;
|
|
2613
2613
|
}
|
|
2614
|
-
link({ text
|
|
2615
|
-
return "" +
|
|
2614
|
+
link({ text }) {
|
|
2615
|
+
return "" + text;
|
|
2616
2616
|
}
|
|
2617
|
-
image({ text
|
|
2618
|
-
return "" +
|
|
2617
|
+
image({ text }) {
|
|
2618
|
+
return "" + text;
|
|
2619
2619
|
}
|
|
2620
2620
|
br() {
|
|
2621
2621
|
return "";
|
|
@@ -2805,8 +2805,8 @@ var _Hooks = class {
|
|
|
2805
2805
|
preprocess(markdown) {
|
|
2806
2806
|
return markdown;
|
|
2807
2807
|
}
|
|
2808
|
-
postprocess(
|
|
2809
|
-
return
|
|
2808
|
+
postprocess(html2) {
|
|
2809
|
+
return html2;
|
|
2810
2810
|
}
|
|
2811
2811
|
processAllTokens(tokens) {
|
|
2812
2812
|
return tokens;
|
|
@@ -3050,7 +3050,7 @@ var Marked = class {
|
|
|
3050
3050
|
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
3051
3051
|
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
3052
3052
|
if (opt.async) {
|
|
3053
|
-
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((
|
|
3053
|
+
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
|
|
3054
3054
|
}
|
|
3055
3055
|
try {
|
|
3056
3056
|
if (opt.hooks) {
|
|
@@ -3063,11 +3063,11 @@ var Marked = class {
|
|
|
3063
3063
|
if (opt.walkTokens) {
|
|
3064
3064
|
this.walkTokens(tokens, opt.walkTokens);
|
|
3065
3065
|
}
|
|
3066
|
-
let
|
|
3066
|
+
let html2 = parser2(tokens, opt);
|
|
3067
3067
|
if (opt.hooks) {
|
|
3068
|
-
|
|
3068
|
+
html2 = opt.hooks.postprocess(html2);
|
|
3069
3069
|
}
|
|
3070
|
-
return
|
|
3070
|
+
return html2;
|
|
3071
3071
|
} catch (e) {
|
|
3072
3072
|
return throwError(e);
|
|
3073
3073
|
}
|
|
@@ -3176,9 +3176,9 @@ class MarkdownRenderer {
|
|
|
3176
3176
|
currentReferences = emptyChatReferences;
|
|
3177
3177
|
lastUsedIndex = 0;
|
|
3178
3178
|
DomPurity;
|
|
3179
|
-
constructor(
|
|
3180
|
-
this.marked = new Marked({ async: false, breaks: true }).use(this.createFootnoteExtension(), ...
|
|
3181
|
-
this.DomPurity = getDomPurify(
|
|
3179
|
+
constructor(options = {}) {
|
|
3180
|
+
this.marked = new Marked({ async: false, breaks: true }).use(this.createFootnoteExtension(), ...options.extensions ?? []);
|
|
3181
|
+
this.DomPurity = getDomPurify(options.window, options.newTabSrText);
|
|
3182
3182
|
}
|
|
3183
3183
|
createFootnoteExtension = () => {
|
|
3184
3184
|
const self = this;
|
|
@@ -3235,9 +3235,9 @@ class MarkdownRenderer {
|
|
|
3235
3235
|
}
|
|
3236
3236
|
toHTML(markdown, references) {
|
|
3237
3237
|
this.currentReferences = references;
|
|
3238
|
-
const
|
|
3238
|
+
const html = this.parse(markdown);
|
|
3239
3239
|
this.currentReferences = emptyChatReferences;
|
|
3240
|
-
return
|
|
3240
|
+
return html;
|
|
3241
3241
|
}
|
|
3242
3242
|
}
|
|
3243
3243
|
// node_modules/.bun/esm-env@1.2.2/node_modules/esm-env/true.js
|
|
@@ -3334,7 +3334,7 @@ var subscriber_queue = [];
|
|
|
3334
3334
|
function writable(value, start = noop) {
|
|
3335
3335
|
let stop = null;
|
|
3336
3336
|
const subscribers = new Set;
|
|
3337
|
-
function
|
|
3337
|
+
function set(new_value) {
|
|
3338
3338
|
if (safe_not_equal(value, new_value)) {
|
|
3339
3339
|
value = new_value;
|
|
3340
3340
|
if (stop) {
|
|
@@ -3353,13 +3353,13 @@ function writable(value, start = noop) {
|
|
|
3353
3353
|
}
|
|
3354
3354
|
}
|
|
3355
3355
|
function update(fn) {
|
|
3356
|
-
|
|
3356
|
+
set(fn(value));
|
|
3357
3357
|
}
|
|
3358
3358
|
function subscribe(run, invalidate = noop) {
|
|
3359
3359
|
const subscriber = [run, invalidate];
|
|
3360
3360
|
subscribers.add(subscriber);
|
|
3361
3361
|
if (subscribers.size === 1) {
|
|
3362
|
-
stop = start(
|
|
3362
|
+
stop = start(set, update) || noop;
|
|
3363
3363
|
}
|
|
3364
3364
|
run(value);
|
|
3365
3365
|
return () => {
|
|
@@ -3370,7 +3370,7 @@ function writable(value, start = noop) {
|
|
|
3370
3370
|
}
|
|
3371
3371
|
};
|
|
3372
3372
|
}
|
|
3373
|
-
return { set
|
|
3373
|
+
return { set, update, subscribe };
|
|
3374
3374
|
}
|
|
3375
3375
|
|
|
3376
3376
|
// node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/store.js
|
|
@@ -3471,9 +3471,9 @@ var getDomainName = (url) => {
|
|
|
3471
3471
|
};
|
|
3472
3472
|
|
|
3473
3473
|
// src/lib/client/utils/html-to-text.ts
|
|
3474
|
-
function htmlToText(
|
|
3475
|
-
const
|
|
3476
|
-
return
|
|
3474
|
+
function htmlToText(html) {
|
|
3475
|
+
const text = html.replace(/<[^>]*>/g, "").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"');
|
|
3476
|
+
return text;
|
|
3477
3477
|
}
|
|
3478
3478
|
|
|
3479
3479
|
// src/lib/client/chat-result-builder.ts
|
|
@@ -3511,17 +3511,17 @@ class ChatResultBuilder {
|
|
|
3511
3511
|
store;
|
|
3512
3512
|
content = new FutureValue;
|
|
3513
3513
|
backendSendsMappedRefs = false;
|
|
3514
|
-
constructor(
|
|
3515
|
-
this.options =
|
|
3514
|
+
constructor(options) {
|
|
3515
|
+
this.options = options;
|
|
3516
3516
|
this.store = writable({
|
|
3517
|
-
id:
|
|
3517
|
+
id: options.id,
|
|
3518
3518
|
state: "loading",
|
|
3519
3519
|
errors: [],
|
|
3520
3520
|
type: "bot",
|
|
3521
3521
|
time: new Date().toISOString(),
|
|
3522
3522
|
message: { markdown: "", html: "", text: "" },
|
|
3523
3523
|
references: { all: [], used: [], unused: [] },
|
|
3524
|
-
retrievalQuestion:
|
|
3524
|
+
retrievalQuestion: options.userQuestion
|
|
3525
3525
|
});
|
|
3526
3526
|
}
|
|
3527
3527
|
pushError(error) {
|
|
@@ -3534,14 +3534,14 @@ class ChatResultBuilder {
|
|
|
3534
3534
|
id
|
|
3535
3535
|
}));
|
|
3536
3536
|
}
|
|
3537
|
-
updateText(
|
|
3537
|
+
updateText(text) {
|
|
3538
3538
|
this.store.update((current) => {
|
|
3539
|
-
const nextMarkdown = current.message.markdown +
|
|
3540
|
-
const
|
|
3539
|
+
const nextMarkdown = current.message.markdown + text;
|
|
3540
|
+
const html = this.options.markdownRenderer.toHTML(nextMarkdown, current.references);
|
|
3541
3541
|
return {
|
|
3542
3542
|
...current,
|
|
3543
3543
|
state: "streaming",
|
|
3544
|
-
message: { markdown: nextMarkdown, html
|
|
3544
|
+
message: { markdown: nextMarkdown, html, text: "" }
|
|
3545
3545
|
};
|
|
3546
3546
|
});
|
|
3547
3547
|
}
|
|
@@ -3676,8 +3676,8 @@ class Conversation {
|
|
|
3676
3676
|
subscribe(callback) {
|
|
3677
3677
|
return this.state.subscribe(callback);
|
|
3678
3678
|
}
|
|
3679
|
-
chat(question,
|
|
3680
|
-
const chatResponse = this.clientPrimitive.chat(this.id, question,
|
|
3679
|
+
chat(question, options = {}) {
|
|
3680
|
+
const chatResponse = this.clientPrimitive.chat(this.id, question, options);
|
|
3681
3681
|
this.history.push(chatResponse);
|
|
3682
3682
|
this.latestRequest.setValue({ question, response: chatResponse });
|
|
3683
3683
|
return chatResponse;
|
|
@@ -4455,10 +4455,10 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
4455
4455
|
|
|
4456
4456
|
// node_modules/.bun/uuid@13.0.0/node_modules/uuid/dist/v7.js
|
|
4457
4457
|
var _state = {};
|
|
4458
|
-
function v7(
|
|
4458
|
+
function v7(options, buf, offset) {
|
|
4459
4459
|
let bytes;
|
|
4460
|
-
if (
|
|
4461
|
-
bytes = v7Bytes(
|
|
4460
|
+
if (options) {
|
|
4461
|
+
bytes = v7Bytes(options.random ?? options.rng?.() ?? rng(), options.msecs, options.seq, buf, offset);
|
|
4462
4462
|
} else {
|
|
4463
4463
|
const now = Date.now();
|
|
4464
4464
|
const rnds = rng();
|
|
@@ -4467,19 +4467,19 @@ function v7(options2, buf, offset) {
|
|
|
4467
4467
|
}
|
|
4468
4468
|
return buf ?? unsafeStringify(bytes);
|
|
4469
4469
|
}
|
|
4470
|
-
function updateV7State(
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
if (now >
|
|
4474
|
-
|
|
4475
|
-
|
|
4470
|
+
function updateV7State(state, now, rnds) {
|
|
4471
|
+
state.msecs ??= -Infinity;
|
|
4472
|
+
state.seq ??= 0;
|
|
4473
|
+
if (now > state.msecs) {
|
|
4474
|
+
state.seq = rnds[6] << 23 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
|
|
4475
|
+
state.msecs = now;
|
|
4476
4476
|
} else {
|
|
4477
|
-
|
|
4478
|
-
if (
|
|
4479
|
-
|
|
4477
|
+
state.seq = state.seq + 1 | 0;
|
|
4478
|
+
if (state.seq === 0) {
|
|
4479
|
+
state.msecs++;
|
|
4480
4480
|
}
|
|
4481
4481
|
}
|
|
4482
|
-
return
|
|
4482
|
+
return state;
|
|
4483
4483
|
}
|
|
4484
4484
|
function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
4485
4485
|
if (rnds.length < 16) {
|
|
@@ -4577,23 +4577,23 @@ var getUserData = async (restClient, startParameters) => {
|
|
|
4577
4577
|
};
|
|
4578
4578
|
|
|
4579
4579
|
// node_modules/.bun/sse.js@2.8.0/node_modules/sse.js/lib/sse.js
|
|
4580
|
-
var SSE = function(url,
|
|
4580
|
+
var SSE = function(url, options) {
|
|
4581
4581
|
if (!(this instanceof SSE)) {
|
|
4582
|
-
return new SSE(url,
|
|
4582
|
+
return new SSE(url, options);
|
|
4583
4583
|
}
|
|
4584
4584
|
this.url = url;
|
|
4585
|
-
|
|
4586
|
-
this.headers =
|
|
4587
|
-
this.payload =
|
|
4588
|
-
this.method =
|
|
4589
|
-
this.withCredentials = !!
|
|
4590
|
-
this.debug = !!
|
|
4591
|
-
this.autoReconnect =
|
|
4592
|
-
this.reconnectDelay =
|
|
4593
|
-
this.maxRetries =
|
|
4585
|
+
options = options || {};
|
|
4586
|
+
this.headers = options.headers || {};
|
|
4587
|
+
this.payload = options.payload !== undefined ? options.payload : "";
|
|
4588
|
+
this.method = options.method || this.payload && "POST" || "GET";
|
|
4589
|
+
this.withCredentials = !!options.withCredentials;
|
|
4590
|
+
this.debug = !!options.debug;
|
|
4591
|
+
this.autoReconnect = options.autoReconnect !== undefined ? options.autoReconnect : false;
|
|
4592
|
+
this.reconnectDelay = options.reconnectDelay !== undefined ? options.reconnectDelay : 3000;
|
|
4593
|
+
this.maxRetries = options.maxRetries !== undefined ? options.maxRetries : null;
|
|
4594
4594
|
this.retryCount = 0;
|
|
4595
4595
|
this.reconnectTimer = null;
|
|
4596
|
-
this.useLastEventId =
|
|
4596
|
+
this.useLastEventId = options.useLastEventId !== undefined ? options.useLastEventId : true;
|
|
4597
4597
|
this.FIELD_SEPARATOR = ":";
|
|
4598
4598
|
this.listeners = {};
|
|
4599
4599
|
this.xhr = null;
|
|
@@ -4676,10 +4676,10 @@ var SSE = function(url, options2) {
|
|
|
4676
4676
|
}, this.reconnectDelay);
|
|
4677
4677
|
}
|
|
4678
4678
|
};
|
|
4679
|
-
this._setReadyState = function(
|
|
4679
|
+
this._setReadyState = function(state) {
|
|
4680
4680
|
const event = new CustomEvent("readystatechange");
|
|
4681
|
-
event.readyState =
|
|
4682
|
-
this.readyState =
|
|
4681
|
+
event.readyState = state;
|
|
4682
|
+
this.readyState = state;
|
|
4683
4683
|
this.dispatchEvent(event);
|
|
4684
4684
|
};
|
|
4685
4685
|
this._onStreamFailure = function(e) {
|
|
@@ -4823,7 +4823,7 @@ var SSE = function(url, options2) {
|
|
|
4823
4823
|
this.xhr.abort();
|
|
4824
4824
|
}
|
|
4825
4825
|
};
|
|
4826
|
-
if (
|
|
4826
|
+
if (options.start === undefined || options.start) {
|
|
4827
4827
|
this.stream();
|
|
4828
4828
|
}
|
|
4829
4829
|
};
|
|
@@ -4838,27 +4838,27 @@ class SseSubscription {
|
|
|
4838
4838
|
payload;
|
|
4839
4839
|
eventSource;
|
|
4840
4840
|
triggeredOnClose = false;
|
|
4841
|
-
constructor(url,
|
|
4842
|
-
this.options =
|
|
4841
|
+
constructor(url, options, payload) {
|
|
4842
|
+
this.options = options;
|
|
4843
4843
|
this.payload = payload;
|
|
4844
4844
|
const sseoptions = { headers: { "content-type": "application/json" } };
|
|
4845
4845
|
if (payload) {
|
|
4846
4846
|
sseoptions.payload = JSON.stringify(payload);
|
|
4847
4847
|
}
|
|
4848
|
-
if (
|
|
4849
|
-
sseoptions.headers["api-key"] =
|
|
4848
|
+
if (options.apiKey) {
|
|
4849
|
+
sseoptions.headers["api-key"] = options.apiKey;
|
|
4850
4850
|
}
|
|
4851
|
-
this.eventSource = new (
|
|
4851
|
+
this.eventSource = new (options.EventSource ?? SSE)(url, sseoptions);
|
|
4852
4852
|
this.eventSource.onmessage = (event) => {
|
|
4853
4853
|
try {
|
|
4854
4854
|
const data = JSON.parse(event.data);
|
|
4855
|
-
|
|
4855
|
+
options.onMessage(data);
|
|
4856
4856
|
} catch (error) {
|
|
4857
|
-
|
|
4857
|
+
options.onError(new CustomEvent("parse-error", { detail: error }));
|
|
4858
4858
|
}
|
|
4859
4859
|
};
|
|
4860
4860
|
this.eventSource.onerror = (event) => {
|
|
4861
|
-
|
|
4861
|
+
options.onError(event);
|
|
4862
4862
|
if (this.isClosed()) {
|
|
4863
4863
|
this.close();
|
|
4864
4864
|
}
|
|
@@ -4883,8 +4883,8 @@ var removeUndefinedValues = (obj) => Object.fromEntries(Object.entries(obj).filt
|
|
|
4883
4883
|
// src/lib/client/api/rest-client.ts
|
|
4884
4884
|
class RestClient {
|
|
4885
4885
|
options;
|
|
4886
|
-
constructor(
|
|
4887
|
-
this.options =
|
|
4886
|
+
constructor(options) {
|
|
4887
|
+
this.options = options;
|
|
4888
4888
|
}
|
|
4889
4889
|
getDefaultHeaders(additional = {}) {
|
|
4890
4890
|
const headers = {
|
|
@@ -4898,17 +4898,17 @@ class RestClient {
|
|
|
4898
4898
|
get speechRecognitionApiKey() {
|
|
4899
4899
|
return this.options.speechRecognitionApiKey;
|
|
4900
4900
|
}
|
|
4901
|
-
async subscribeSse(path, params = {},
|
|
4901
|
+
async subscribeSse(path, params = {}, options) {
|
|
4902
4902
|
const payload = removeUndefinedValues(params);
|
|
4903
4903
|
if (this.options.apiKey)
|
|
4904
|
-
|
|
4905
|
-
return new SseSubscription(`${this.options.apiUrl}${path}`,
|
|
4904
|
+
options.apiKey = this.options.apiKey;
|
|
4905
|
+
return new SseSubscription(`${this.options.apiUrl}${path}`, options, payload);
|
|
4906
4906
|
}
|
|
4907
|
-
async fetchData(path, validator, params = {},
|
|
4907
|
+
async fetchData(path, validator, params = {}, options = {}) {
|
|
4908
4908
|
const url = `${this.options.apiUrl}${path}?${new URLSearchParams(removeUndefinedValues(params)).toString()}`;
|
|
4909
4909
|
const opts = {
|
|
4910
|
-
...
|
|
4911
|
-
headers: this.getDefaultHeaders(
|
|
4910
|
+
...options,
|
|
4911
|
+
headers: this.getDefaultHeaders(options?.headers)
|
|
4912
4912
|
};
|
|
4913
4913
|
const response = await fetch(url, opts);
|
|
4914
4914
|
if (!response.ok) {
|
|
@@ -4981,30 +4981,30 @@ var linkSchema = z8.union([linkLegacySchema, searchReferenceSchema]);
|
|
|
4981
4981
|
var searchEndpointSchema = z8.object({
|
|
4982
4982
|
links: z8.array(linkSchema)
|
|
4983
4983
|
});
|
|
4984
|
-
var mapLinkToSearchReference = (
|
|
4985
|
-
if ("metadata" in
|
|
4986
|
-
return
|
|
4984
|
+
var mapLinkToSearchReference = (link) => {
|
|
4985
|
+
if ("metadata" in link)
|
|
4986
|
+
return link;
|
|
4987
4987
|
console.warn("Please upgrade your backend you are currently using an old api feature.");
|
|
4988
|
-
const metadata =
|
|
4989
|
-
if (
|
|
4990
|
-
metadata.fromFullTextSearch =
|
|
4991
|
-
if (
|
|
4992
|
-
metadata.rerank =
|
|
4988
|
+
const metadata = link.orgMetadata ?? {};
|
|
4989
|
+
if (link?.fromFullTextSearch)
|
|
4990
|
+
metadata.fromFullTextSearch = link?.fromFullTextSearch;
|
|
4991
|
+
if (link?.rerank)
|
|
4992
|
+
metadata.rerank = link?.rerank;
|
|
4993
4993
|
let breadcrumbs = [];
|
|
4994
|
-
let title =
|
|
4995
|
-
if (
|
|
4996
|
-
const all =
|
|
4994
|
+
let title = link.title ?? "";
|
|
4995
|
+
if (link.title && link.title.includes(" > ")) {
|
|
4996
|
+
const all = link.title.split(" > ");
|
|
4997
4997
|
title = all.pop() ?? "";
|
|
4998
4998
|
breadcrumbs = all;
|
|
4999
4999
|
}
|
|
5000
5000
|
return {
|
|
5001
|
-
url:
|
|
5001
|
+
url: link.url ?? "",
|
|
5002
5002
|
title,
|
|
5003
|
-
score:
|
|
5003
|
+
score: link.similarity || 0,
|
|
5004
5004
|
breadcrumbs,
|
|
5005
5005
|
metadata,
|
|
5006
|
-
description:
|
|
5007
|
-
date:
|
|
5006
|
+
description: link.content,
|
|
5007
|
+
date: link.date
|
|
5008
5008
|
};
|
|
5009
5009
|
};
|
|
5010
5010
|
|
|
@@ -5049,37 +5049,37 @@ var MS_PER_CHAR = 7;
|
|
|
5049
5049
|
var MIN_DELAY_MS = 8;
|
|
5050
5050
|
var MAX_DELAY_MS = 160;
|
|
5051
5051
|
var START_DELAY_MS = 750;
|
|
5052
|
-
var tokenize = (
|
|
5052
|
+
var tokenize = (text) => {
|
|
5053
5053
|
const tokens = [];
|
|
5054
5054
|
let i = 0;
|
|
5055
|
-
while (i <
|
|
5056
|
-
const ch =
|
|
5055
|
+
while (i < text.length) {
|
|
5056
|
+
const ch = text[i];
|
|
5057
5057
|
if (ch === "<") {
|
|
5058
|
-
const end =
|
|
5058
|
+
const end = text.indexOf(">", i);
|
|
5059
5059
|
if (end !== -1) {
|
|
5060
|
-
tokens.push({ type: "tag", value:
|
|
5060
|
+
tokens.push({ type: "tag", value: text.slice(i, end + 1) });
|
|
5061
5061
|
i = end + 1;
|
|
5062
5062
|
continue;
|
|
5063
5063
|
}
|
|
5064
5064
|
}
|
|
5065
5065
|
if (/\s/.test(ch)) {
|
|
5066
|
-
let
|
|
5067
|
-
while (
|
|
5068
|
-
|
|
5069
|
-
tokens.push({ type: "space", value:
|
|
5070
|
-
i =
|
|
5066
|
+
let j = i;
|
|
5067
|
+
while (j < text.length && /\s/.test(text[j]))
|
|
5068
|
+
j++;
|
|
5069
|
+
tokens.push({ type: "space", value: text.slice(i, j) });
|
|
5070
|
+
i = j;
|
|
5071
5071
|
continue;
|
|
5072
5072
|
}
|
|
5073
5073
|
let j = i;
|
|
5074
|
-
while (j <
|
|
5074
|
+
while (j < text.length && !/\s/.test(text[j]) && text[j] !== "<")
|
|
5075
5075
|
j++;
|
|
5076
|
-
tokens.push({ type: "word", value:
|
|
5076
|
+
tokens.push({ type: "word", value: text.slice(i, j) });
|
|
5077
5077
|
i = j;
|
|
5078
5078
|
}
|
|
5079
5079
|
return tokens;
|
|
5080
5080
|
};
|
|
5081
|
-
var splitForTyping = (
|
|
5082
|
-
const tokens = tokenize(
|
|
5081
|
+
var splitForTyping = (text) => {
|
|
5082
|
+
const tokens = tokenize(text);
|
|
5083
5083
|
const emissions = [];
|
|
5084
5084
|
let current = "";
|
|
5085
5085
|
let hasWord = false;
|
|
@@ -5108,8 +5108,8 @@ class FakeTypingQueue {
|
|
|
5108
5108
|
constructor(onText) {
|
|
5109
5109
|
this.onText = onText;
|
|
5110
5110
|
}
|
|
5111
|
-
ingestText(
|
|
5112
|
-
const chunks = splitForTyping(
|
|
5111
|
+
ingestText(text) {
|
|
5112
|
+
const chunks = splitForTyping(text);
|
|
5113
5113
|
if (chunks.length >= TYPING_MIN_CHUNKS) {
|
|
5114
5114
|
for (const chunk of chunks) {
|
|
5115
5115
|
this.queue.push({ kind: "text", chunk, delayMs: delayForChunk(chunk) });
|
|
@@ -5117,7 +5117,7 @@ class FakeTypingQueue {
|
|
|
5117
5117
|
this.kickoff();
|
|
5118
5118
|
return;
|
|
5119
5119
|
}
|
|
5120
|
-
this.runAfterTyping(() => this.onText(
|
|
5120
|
+
this.runAfterTyping(() => this.onText(text));
|
|
5121
5121
|
}
|
|
5122
5122
|
runAfterTyping(fn) {
|
|
5123
5123
|
if (this.queue.length === 0 && !this.isProcessing) {
|
|
@@ -5184,19 +5184,19 @@ class LiipGPTClientPrimitive {
|
|
|
5184
5184
|
markedExtensions = [];
|
|
5185
5185
|
_newTabSrText;
|
|
5186
5186
|
chatTimeout;
|
|
5187
|
-
constructor(
|
|
5188
|
-
this.chatTimeout =
|
|
5187
|
+
constructor(options) {
|
|
5188
|
+
this.chatTimeout = options.chatTimeout ?? DEFAULT_CHAT_TIMEOUT;
|
|
5189
5189
|
const restOptions = {
|
|
5190
|
-
apiUrl:
|
|
5191
|
-
apiKey:
|
|
5192
|
-
speechRecognitionApiKey:
|
|
5193
|
-
strict:
|
|
5194
|
-
EventSource:
|
|
5190
|
+
apiUrl: options.apiUrl,
|
|
5191
|
+
apiKey: options.apiKey,
|
|
5192
|
+
speechRecognitionApiKey: options.speechRecognitionApiKey,
|
|
5193
|
+
strict: options.strict ?? false,
|
|
5194
|
+
EventSource: options.EventSource ?? EventSource
|
|
5195
5195
|
};
|
|
5196
5196
|
const restClient = new RestClient(restOptions);
|
|
5197
5197
|
this.internalData = {
|
|
5198
5198
|
restClient,
|
|
5199
|
-
metadata: getUserData(restClient,
|
|
5199
|
+
metadata: getUserData(restClient, options.startParameters),
|
|
5200
5200
|
searchResponseMap: new Map,
|
|
5201
5201
|
chatResponseMap: new Map,
|
|
5202
5202
|
conversationMap: new Map
|
|
@@ -5205,8 +5205,8 @@ class LiipGPTClientPrimitive {
|
|
|
5205
5205
|
setMarkedExtensions(...extensions) {
|
|
5206
5206
|
this.markedExtensions = extensions;
|
|
5207
5207
|
}
|
|
5208
|
-
setNewTabSrText(
|
|
5209
|
-
this._newTabSrText =
|
|
5208
|
+
setNewTabSrText(text) {
|
|
5209
|
+
this._newTabSrText = text;
|
|
5210
5210
|
}
|
|
5211
5211
|
getMetadata() {
|
|
5212
5212
|
return this.internalData.metadata;
|
|
@@ -5216,7 +5216,7 @@ class LiipGPTClientPrimitive {
|
|
|
5216
5216
|
this.renderers.set(conversationId, new MarkdownRenderer({ extensions: this.markedExtensions, newTabSrText: this._newTabSrText }));
|
|
5217
5217
|
return conversationId;
|
|
5218
5218
|
}
|
|
5219
|
-
chat(conversationId, question,
|
|
5219
|
+
chat(conversationId, question, options = {}) {
|
|
5220
5220
|
const content = new FutureValue;
|
|
5221
5221
|
const requestId = v7_default();
|
|
5222
5222
|
const readyForFeedback = new Flag;
|
|
@@ -5224,7 +5224,7 @@ class LiipGPTClientPrimitive {
|
|
|
5224
5224
|
const chatResultBuilder = new ChatResultBuilder({
|
|
5225
5225
|
id: requestId,
|
|
5226
5226
|
onError: (error) => {
|
|
5227
|
-
|
|
5227
|
+
options.onError?.(error);
|
|
5228
5228
|
},
|
|
5229
5229
|
onFinish: (message) => {
|
|
5230
5230
|
content.setValue(message);
|
|
@@ -5240,7 +5240,7 @@ class LiipGPTClientPrimitive {
|
|
|
5240
5240
|
};
|
|
5241
5241
|
const subscription = new FutureValue;
|
|
5242
5242
|
const typingQueue = new FakeTypingQueue((chunk) => chatResultBuilder.updateText(chunk));
|
|
5243
|
-
const timeout =
|
|
5243
|
+
const timeout = options.timeout ?? this.chatTimeout;
|
|
5244
5244
|
let timeoutId;
|
|
5245
5245
|
let timedOut = false;
|
|
5246
5246
|
const stopWatchdog = () => {
|
|
@@ -5278,15 +5278,15 @@ class LiipGPTClientPrimitive {
|
|
|
5278
5278
|
uID: metadata.userId,
|
|
5279
5279
|
cID: conversationId,
|
|
5280
5280
|
rID: requestId,
|
|
5281
|
-
lang:
|
|
5282
|
-
feature:
|
|
5283
|
-
referrer:
|
|
5284
|
-
source:
|
|
5285
|
-
...
|
|
5286
|
-
...
|
|
5287
|
-
...
|
|
5288
|
-
...
|
|
5289
|
-
...
|
|
5281
|
+
lang: options.lang,
|
|
5282
|
+
feature: options.features?.join(","),
|
|
5283
|
+
referrer: options.referrer,
|
|
5284
|
+
source: options.source,
|
|
5285
|
+
...options.selectorValues ?? {},
|
|
5286
|
+
...options.mode ? { mode: options.mode } : {},
|
|
5287
|
+
...options.cache ? { cache: true } : {},
|
|
5288
|
+
...options.predefinedQuestionId ? { predefinedQuestionId: options.predefinedQuestionId } : {},
|
|
5289
|
+
...options.switchQuestionId ? { switchQuestionId: options.switchQuestionId } : {},
|
|
5290
5290
|
chat: "true",
|
|
5291
5291
|
version: "2"
|
|
5292
5292
|
}, {
|
|
@@ -5328,7 +5328,7 @@ class LiipGPTClientPrimitive {
|
|
|
5328
5328
|
typingQueue.runAfterTyping(() => {
|
|
5329
5329
|
chatResultBuilder.finishMessage();
|
|
5330
5330
|
readyForFeedback.resolve();
|
|
5331
|
-
subscription.then((
|
|
5331
|
+
subscription.then((s) => s.close());
|
|
5332
5332
|
});
|
|
5333
5333
|
break;
|
|
5334
5334
|
case "unexpected-call":
|
|
@@ -5351,10 +5351,10 @@ class LiipGPTClientPrimitive {
|
|
|
5351
5351
|
typingQueue.runAfterTyping(() => chatResultBuilder.setNoFeedback());
|
|
5352
5352
|
break;
|
|
5353
5353
|
case "component":
|
|
5354
|
-
typingQueue.runWithWarmup(() =>
|
|
5354
|
+
typingQueue.runWithWarmup(() => options.onEmbed?.(data));
|
|
5355
5355
|
break;
|
|
5356
5356
|
}
|
|
5357
|
-
typingQueue.runAfterTyping(() =>
|
|
5357
|
+
typingQueue.runAfterTyping(() => options.onMessage?.(data));
|
|
5358
5358
|
},
|
|
5359
5359
|
onError: (event) => {
|
|
5360
5360
|
console.error(" sse-error:", event);
|
|
@@ -5434,24 +5434,24 @@ class LiipGPTClientPrimitive {
|
|
|
5434
5434
|
};
|
|
5435
5435
|
await this.internalData.restClient.postData("/customform", answerFormRequest);
|
|
5436
5436
|
}
|
|
5437
|
-
async userAction(userAction,
|
|
5437
|
+
async userAction(userAction, options = {}) {
|
|
5438
5438
|
const metadata = await this.internalData.metadata;
|
|
5439
5439
|
if (metadata.mode !== "ready")
|
|
5440
5440
|
throw new Error("Can not post user action unless we are in ready mode");
|
|
5441
5441
|
const request = {
|
|
5442
5442
|
uID: metadata.userId,
|
|
5443
|
-
cID:
|
|
5444
|
-
lang:
|
|
5443
|
+
cID: options.conversationId,
|
|
5444
|
+
lang: options.lang,
|
|
5445
5445
|
userAction
|
|
5446
5446
|
};
|
|
5447
5447
|
await this.internalData.restClient.postData("/assistant/userAction", request);
|
|
5448
5448
|
}
|
|
5449
|
-
async search(query,
|
|
5449
|
+
async search(query, options = {}) {
|
|
5450
5450
|
const metadata = await this.internalData.metadata;
|
|
5451
5451
|
const uID = metadata.mode === "ready" ? metadata.userId : undefined;
|
|
5452
5452
|
const { links } = await this.internalData.restClient.fetchData("/assistant/search", searchEndpointSchema, {
|
|
5453
|
-
modelId:
|
|
5454
|
-
lang:
|
|
5453
|
+
modelId: options.model,
|
|
5454
|
+
lang: options.language,
|
|
5455
5455
|
query,
|
|
5456
5456
|
mapResults: "true",
|
|
5457
5457
|
uID
|
|
@@ -5476,9 +5476,9 @@ class LiipGPTClientPrimitive {
|
|
|
5476
5476
|
const data = await this.internalData.restClient.fetchData("/topics/questions", predefinedQuestionsResponseSchema, params);
|
|
5477
5477
|
return data.predefinedQuestions;
|
|
5478
5478
|
}
|
|
5479
|
-
async transcribeAudio(audioBlob,
|
|
5479
|
+
async transcribeAudio(audioBlob, options = {}) {
|
|
5480
5480
|
const metadata = await this.internalData.metadata;
|
|
5481
|
-
const language =
|
|
5481
|
+
const language = options.lang || "de-CH";
|
|
5482
5482
|
if (metadata.mode === "maintenance") {
|
|
5483
5483
|
throw new Error("Can not transcribe audio in maintenance mode");
|
|
5484
5484
|
}
|
|
@@ -5516,8 +5516,8 @@ class LiipGPTClientPrimitive {
|
|
|
5516
5516
|
// src/lib/client/liipgpt-client.ts
|
|
5517
5517
|
class LiipGPTClient {
|
|
5518
5518
|
clientPrimitive;
|
|
5519
|
-
constructor(
|
|
5520
|
-
this.clientPrimitive = new LiipGPTClientPrimitive(
|
|
5519
|
+
constructor(options) {
|
|
5520
|
+
this.clientPrimitive = new LiipGPTClientPrimitive(options);
|
|
5521
5521
|
}
|
|
5522
5522
|
getMetadata() {
|
|
5523
5523
|
return this.clientPrimitive.getMetadata();
|
|
@@ -5525,8 +5525,8 @@ class LiipGPTClient {
|
|
|
5525
5525
|
createConversation() {
|
|
5526
5526
|
return new Conversation(this.clientPrimitive);
|
|
5527
5527
|
}
|
|
5528
|
-
search(query,
|
|
5529
|
-
return this.clientPrimitive.search(query,
|
|
5528
|
+
search(query, options = {}) {
|
|
5529
|
+
return this.clientPrimitive.search(query, options);
|
|
5530
5530
|
}
|
|
5531
5531
|
getChatConfig() {
|
|
5532
5532
|
return this.clientPrimitive.getChatConfig();
|