@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.cjs
CHANGED
|
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
18
18
|
return cached;
|
|
19
19
|
}
|
|
20
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
22
|
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
23
23
|
for (let key of __getOwnPropNames(mod))
|
|
24
24
|
if (!__hasOwnProp.call(to, key))
|
|
@@ -114,17 +114,17 @@ var {
|
|
|
114
114
|
construct
|
|
115
115
|
} = typeof Reflect !== "undefined" && Reflect;
|
|
116
116
|
if (!freeze) {
|
|
117
|
-
freeze = function
|
|
117
|
+
freeze = function freeze(x) {
|
|
118
118
|
return x;
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
if (!seal) {
|
|
122
|
-
seal = function
|
|
122
|
+
seal = function seal(x) {
|
|
123
123
|
return x;
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
if (!apply) {
|
|
127
|
-
apply = function
|
|
127
|
+
apply = function apply(func, thisArg) {
|
|
128
128
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2;_key < _len; _key++) {
|
|
129
129
|
args[_key - 2] = arguments[_key];
|
|
130
130
|
}
|
|
@@ -132,7 +132,7 @@ if (!apply) {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
if (!construct) {
|
|
135
|
-
construct = function
|
|
135
|
+
construct = function construct(Func) {
|
|
136
136
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++) {
|
|
137
137
|
args[_key2 - 1] = arguments[_key2];
|
|
138
138
|
}
|
|
@@ -284,10 +284,10 @@ var NODE_TYPE = {
|
|
|
284
284
|
documentFragment: 11,
|
|
285
285
|
notation: 12
|
|
286
286
|
};
|
|
287
|
-
var getGlobal = function
|
|
287
|
+
var getGlobal = function getGlobal() {
|
|
288
288
|
return typeof window === "undefined" ? null : window;
|
|
289
289
|
};
|
|
290
|
-
var _createTrustedTypesPolicy = function
|
|
290
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
291
291
|
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
|
|
292
292
|
return null;
|
|
293
293
|
}
|
|
@@ -299,8 +299,8 @@ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes
|
|
|
299
299
|
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
300
300
|
try {
|
|
301
301
|
return trustedTypes.createPolicy(policyName, {
|
|
302
|
-
createHTML(
|
|
303
|
-
return
|
|
302
|
+
createHTML(html) {
|
|
303
|
+
return html;
|
|
304
304
|
},
|
|
305
305
|
createScriptURL(scriptUrl) {
|
|
306
306
|
return scriptUrl;
|
|
@@ -311,7 +311,7 @@ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes
|
|
|
311
311
|
return null;
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
|
-
var _createHooksMap = function
|
|
314
|
+
var _createHooksMap = function _createHooksMap() {
|
|
315
315
|
return {
|
|
316
316
|
afterSanitizeAttributes: [],
|
|
317
317
|
afterSanitizeElements: [],
|
|
@@ -375,14 +375,14 @@ function createDOMPurify() {
|
|
|
375
375
|
let hooks = _createHooksMap();
|
|
376
376
|
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== undefined;
|
|
377
377
|
const {
|
|
378
|
-
MUSTACHE_EXPR
|
|
379
|
-
ERB_EXPR
|
|
380
|
-
TMPLIT_EXPR
|
|
381
|
-
DATA_ATTR
|
|
382
|
-
ARIA_ATTR
|
|
383
|
-
IS_SCRIPT_OR_DATA
|
|
384
|
-
ATTR_WHITESPACE
|
|
385
|
-
CUSTOM_ELEMENT
|
|
378
|
+
MUSTACHE_EXPR,
|
|
379
|
+
ERB_EXPR,
|
|
380
|
+
TMPLIT_EXPR,
|
|
381
|
+
DATA_ATTR,
|
|
382
|
+
ARIA_ATTR,
|
|
383
|
+
IS_SCRIPT_OR_DATA,
|
|
384
|
+
ATTR_WHITESPACE,
|
|
385
|
+
CUSTOM_ELEMENT
|
|
386
386
|
} = EXPRESSIONS;
|
|
387
387
|
let {
|
|
388
388
|
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
@@ -467,10 +467,10 @@ function createDOMPurify() {
|
|
|
467
467
|
let transformCaseFunc = null;
|
|
468
468
|
let CONFIG = null;
|
|
469
469
|
const formElement = document2.createElement("form");
|
|
470
|
-
const isRegexOrFunction = function
|
|
470
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
471
471
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
472
472
|
};
|
|
473
|
-
const _parseConfig = function
|
|
473
|
+
const _parseConfig = function _parseConfig() {
|
|
474
474
|
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
475
475
|
if (CONFIG && CONFIG === cfg) {
|
|
476
476
|
return;
|
|
@@ -623,7 +623,7 @@ function createDOMPurify() {
|
|
|
623
623
|
};
|
|
624
624
|
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
625
625
|
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
626
|
-
const _checkValidNamespace = function
|
|
626
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
627
627
|
let parent = getParentNode(element);
|
|
628
628
|
if (!parent || !parent.tagName) {
|
|
629
629
|
parent = {
|
|
@@ -668,7 +668,7 @@ function createDOMPurify() {
|
|
|
668
668
|
}
|
|
669
669
|
return false;
|
|
670
670
|
};
|
|
671
|
-
const _forceRemove = function
|
|
671
|
+
const _forceRemove = function _forceRemove(node) {
|
|
672
672
|
arrayPush(DOMPurify.removed, {
|
|
673
673
|
element: node
|
|
674
674
|
});
|
|
@@ -678,7 +678,7 @@ function createDOMPurify() {
|
|
|
678
678
|
remove(node);
|
|
679
679
|
}
|
|
680
680
|
};
|
|
681
|
-
const _removeAttribute = function
|
|
681
|
+
const _removeAttribute = function _removeAttribute(name, element) {
|
|
682
682
|
try {
|
|
683
683
|
arrayPush(DOMPurify.removed, {
|
|
684
684
|
attribute: element.getAttributeNode(name),
|
|
@@ -703,7 +703,7 @@ function createDOMPurify() {
|
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
};
|
|
706
|
-
const _initDocument = function
|
|
706
|
+
const _initDocument = function _initDocument(dirty) {
|
|
707
707
|
let doc = null;
|
|
708
708
|
let leadingWhitespace = null;
|
|
709
709
|
if (FORCE_BODY) {
|
|
@@ -736,21 +736,21 @@ function createDOMPurify() {
|
|
|
736
736
|
}
|
|
737
737
|
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
738
738
|
};
|
|
739
|
-
const _createNodeIterator = function
|
|
739
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
740
740
|
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);
|
|
741
741
|
};
|
|
742
|
-
const _isClobbered = function
|
|
742
|
+
const _isClobbered = function _isClobbered(element) {
|
|
743
743
|
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");
|
|
744
744
|
};
|
|
745
|
-
const _isNode = function
|
|
745
|
+
const _isNode = function _isNode(value) {
|
|
746
746
|
return typeof Node2 === "function" && value instanceof Node2;
|
|
747
747
|
};
|
|
748
|
-
function _executeHooks(
|
|
749
|
-
arrayForEach(
|
|
748
|
+
function _executeHooks(hooks, currentNode, data) {
|
|
749
|
+
arrayForEach(hooks, (hook) => {
|
|
750
750
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
|
-
const _sanitizeElements = function
|
|
753
|
+
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
754
754
|
let content = null;
|
|
755
755
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
756
756
|
if (_isClobbered(currentNode)) {
|
|
@@ -808,7 +808,7 @@ function createDOMPurify() {
|
|
|
808
808
|
}
|
|
809
809
|
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
810
810
|
content = currentNode.textContent;
|
|
811
|
-
arrayForEach([
|
|
811
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
|
|
812
812
|
content = stringReplace(content, expr, " ");
|
|
813
813
|
});
|
|
814
814
|
if (currentNode.textContent !== content) {
|
|
@@ -821,16 +821,16 @@ function createDOMPurify() {
|
|
|
821
821
|
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
822
822
|
return false;
|
|
823
823
|
};
|
|
824
|
-
const _isValidAttribute = function
|
|
824
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
825
825
|
if (FORBID_ATTR[lcName]) {
|
|
826
826
|
return false;
|
|
827
827
|
}
|
|
828
828
|
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && ((value in document2) || (value in formElement))) {
|
|
829
829
|
return false;
|
|
830
830
|
}
|
|
831
|
-
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(
|
|
831
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName))
|
|
832
832
|
;
|
|
833
|
-
else if (ALLOW_ARIA_ATTR && regExpTest(
|
|
833
|
+
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName))
|
|
834
834
|
;
|
|
835
835
|
else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag))
|
|
836
836
|
;
|
|
@@ -842,21 +842,21 @@ function createDOMPurify() {
|
|
|
842
842
|
}
|
|
843
843
|
} else if (URI_SAFE_ATTRIBUTES[lcName])
|
|
844
844
|
;
|
|
845
|
-
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value,
|
|
845
|
+
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, "")))
|
|
846
846
|
;
|
|
847
847
|
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
|
|
848
848
|
;
|
|
849
|
-
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(
|
|
849
|
+
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, "")))
|
|
850
850
|
;
|
|
851
851
|
else if (value) {
|
|
852
852
|
return false;
|
|
853
853
|
}
|
|
854
854
|
return true;
|
|
855
855
|
};
|
|
856
|
-
const _isBasicCustomElement = function
|
|
857
|
-
return tagName !== "annotation-xml" && stringMatch(tagName,
|
|
856
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
857
|
+
return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT);
|
|
858
858
|
};
|
|
859
|
-
const _sanitizeAttributes = function
|
|
859
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
860
860
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
861
861
|
const {
|
|
862
862
|
attributes
|
|
@@ -912,7 +912,7 @@ function createDOMPurify() {
|
|
|
912
912
|
continue;
|
|
913
913
|
}
|
|
914
914
|
if (SAFE_FOR_TEMPLATES) {
|
|
915
|
-
arrayForEach([
|
|
915
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
|
|
916
916
|
value = stringReplace(value, expr, " ");
|
|
917
917
|
});
|
|
918
918
|
}
|
|
@@ -956,7 +956,7 @@ function createDOMPurify() {
|
|
|
956
956
|
}
|
|
957
957
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
958
958
|
};
|
|
959
|
-
const _sanitizeShadowDOM = function
|
|
959
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
960
960
|
let shadowNode = null;
|
|
961
961
|
const shadowIterator = _createNodeIterator(fragment);
|
|
962
962
|
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
@@ -965,7 +965,7 @@ function createDOMPurify() {
|
|
|
965
965
|
_sanitizeElements(shadowNode);
|
|
966
966
|
_sanitizeAttributes(shadowNode);
|
|
967
967
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
968
|
-
|
|
968
|
+
_sanitizeShadowDOM(shadowNode.content);
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
971
|
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
@@ -1060,7 +1060,7 @@ function createDOMPurify() {
|
|
|
1060
1060
|
` + serializedHTML;
|
|
1061
1061
|
}
|
|
1062
1062
|
if (SAFE_FOR_TEMPLATES) {
|
|
1063
|
-
arrayForEach([
|
|
1063
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {
|
|
1064
1064
|
serializedHTML = stringReplace(serializedHTML, expr, " ");
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
@@ -1337,17 +1337,17 @@ var escapeReplacements = {
|
|
|
1337
1337
|
"'": "'"
|
|
1338
1338
|
};
|
|
1339
1339
|
var getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
1340
|
-
function escape2(
|
|
1340
|
+
function escape2(html2, encode) {
|
|
1341
1341
|
if (encode) {
|
|
1342
|
-
if (other.escapeTest.test(
|
|
1343
|
-
return
|
|
1342
|
+
if (other.escapeTest.test(html2)) {
|
|
1343
|
+
return html2.replace(other.escapeReplace, getEscapeReplacement);
|
|
1344
1344
|
}
|
|
1345
1345
|
} else {
|
|
1346
|
-
if (other.escapeTestNoEncode.test(
|
|
1347
|
-
return
|
|
1346
|
+
if (other.escapeTestNoEncode.test(html2)) {
|
|
1347
|
+
return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
|
-
return
|
|
1350
|
+
return html2;
|
|
1351
1351
|
}
|
|
1352
1352
|
function cleanUrl(href) {
|
|
1353
1353
|
try {
|
|
@@ -1432,26 +1432,26 @@ function findClosingBracket(str, b) {
|
|
|
1432
1432
|
function outputLink(cap, link2, raw, lexer2, rules) {
|
|
1433
1433
|
const href = link2.href;
|
|
1434
1434
|
const title = link2.title || null;
|
|
1435
|
-
const
|
|
1435
|
+
const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
|
|
1436
1436
|
lexer2.state.inLink = true;
|
|
1437
1437
|
const token = {
|
|
1438
1438
|
type: cap[0].charAt(0) === "!" ? "image" : "link",
|
|
1439
1439
|
raw,
|
|
1440
1440
|
href,
|
|
1441
1441
|
title,
|
|
1442
|
-
text
|
|
1443
|
-
tokens: lexer2.inlineTokens(
|
|
1442
|
+
text,
|
|
1443
|
+
tokens: lexer2.inlineTokens(text)
|
|
1444
1444
|
};
|
|
1445
1445
|
lexer2.state.inLink = false;
|
|
1446
1446
|
return token;
|
|
1447
1447
|
}
|
|
1448
|
-
function indentCodeCompensation(raw,
|
|
1448
|
+
function indentCodeCompensation(raw, text, rules) {
|
|
1449
1449
|
const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
|
|
1450
1450
|
if (matchIndentToCode === null) {
|
|
1451
|
-
return
|
|
1451
|
+
return text;
|
|
1452
1452
|
}
|
|
1453
1453
|
const indentToCode = matchIndentToCode[1];
|
|
1454
|
-
return
|
|
1454
|
+
return text.split(`
|
|
1455
1455
|
`).map((node) => {
|
|
1456
1456
|
const matchIndentInNode = node.match(rules.other.beginningSpace);
|
|
1457
1457
|
if (matchIndentInNode === null) {
|
|
@@ -1484,13 +1484,13 @@ var _Tokenizer = class {
|
|
|
1484
1484
|
code(src) {
|
|
1485
1485
|
const cap = this.rules.block.code.exec(src);
|
|
1486
1486
|
if (cap) {
|
|
1487
|
-
const
|
|
1487
|
+
const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
1488
1488
|
return {
|
|
1489
1489
|
type: "code",
|
|
1490
1490
|
raw: cap[0],
|
|
1491
1491
|
codeBlockStyle: "indented",
|
|
1492
|
-
text: !this.options.pedantic ? rtrim(
|
|
1493
|
-
`) :
|
|
1492
|
+
text: !this.options.pedantic ? rtrim(text, `
|
|
1493
|
+
`) : text
|
|
1494
1494
|
};
|
|
1495
1495
|
}
|
|
1496
1496
|
}
|
|
@@ -1498,33 +1498,33 @@ var _Tokenizer = class {
|
|
|
1498
1498
|
const cap = this.rules.block.fences.exec(src);
|
|
1499
1499
|
if (cap) {
|
|
1500
1500
|
const raw = cap[0];
|
|
1501
|
-
const
|
|
1501
|
+
const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
|
|
1502
1502
|
return {
|
|
1503
1503
|
type: "code",
|
|
1504
1504
|
raw,
|
|
1505
1505
|
lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
|
|
1506
|
-
text
|
|
1506
|
+
text
|
|
1507
1507
|
};
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
1510
|
heading(src) {
|
|
1511
1511
|
const cap = this.rules.block.heading.exec(src);
|
|
1512
1512
|
if (cap) {
|
|
1513
|
-
let
|
|
1514
|
-
if (this.rules.other.endingHash.test(
|
|
1515
|
-
const trimmed = rtrim(
|
|
1513
|
+
let text = cap[2].trim();
|
|
1514
|
+
if (this.rules.other.endingHash.test(text)) {
|
|
1515
|
+
const trimmed = rtrim(text, "#");
|
|
1516
1516
|
if (this.options.pedantic) {
|
|
1517
|
-
|
|
1517
|
+
text = trimmed.trim();
|
|
1518
1518
|
} else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
|
|
1519
|
-
|
|
1519
|
+
text = trimmed.trim();
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
1522
1522
|
return {
|
|
1523
1523
|
type: "heading",
|
|
1524
1524
|
raw: cap[0],
|
|
1525
1525
|
depth: cap[1].length,
|
|
1526
|
-
text
|
|
1527
|
-
tokens: this.lexer.inline(
|
|
1526
|
+
text,
|
|
1527
|
+
tokens: this.lexer.inline(text)
|
|
1528
1528
|
};
|
|
1529
1529
|
}
|
|
1530
1530
|
}
|
|
@@ -1545,7 +1545,7 @@ var _Tokenizer = class {
|
|
|
1545
1545
|
`).split(`
|
|
1546
1546
|
`);
|
|
1547
1547
|
let raw = "";
|
|
1548
|
-
let
|
|
1548
|
+
let text = "";
|
|
1549
1549
|
const tokens = [];
|
|
1550
1550
|
while (lines.length > 0) {
|
|
1551
1551
|
let inBlockquote = false;
|
|
@@ -1568,7 +1568,7 @@ var _Tokenizer = class {
|
|
|
1568
1568
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1569
1569
|
raw = raw ? `${raw}
|
|
1570
1570
|
${currentRaw}` : currentRaw;
|
|
1571
|
-
|
|
1571
|
+
text = text ? `${text}
|
|
1572
1572
|
${currentText}` : currentText;
|
|
1573
1573
|
const top = this.lexer.state.top;
|
|
1574
1574
|
this.lexer.state.top = true;
|
|
@@ -1588,7 +1588,7 @@ ${currentText}` : currentText;
|
|
|
1588
1588
|
const newToken = this.blockquote(newText);
|
|
1589
1589
|
tokens[tokens.length - 1] = newToken;
|
|
1590
1590
|
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
|
1591
|
-
|
|
1591
|
+
text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
|
|
1592
1592
|
break;
|
|
1593
1593
|
} else if (lastToken?.type === "list") {
|
|
1594
1594
|
const oldToken = lastToken;
|
|
@@ -1598,7 +1598,7 @@ ${currentText}` : currentText;
|
|
|
1598
1598
|
const newToken = this.list(newText);
|
|
1599
1599
|
tokens[tokens.length - 1] = newToken;
|
|
1600
1600
|
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
|
1601
|
-
|
|
1601
|
+
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
1602
1602
|
lines = newText.substring(tokens.at(-1).raw.length).split(`
|
|
1603
1603
|
`);
|
|
1604
1604
|
continue;
|
|
@@ -1608,7 +1608,7 @@ ${currentText}` : currentText;
|
|
|
1608
1608
|
type: "blockquote",
|
|
1609
1609
|
raw,
|
|
1610
1610
|
tokens,
|
|
1611
|
-
text
|
|
1611
|
+
text
|
|
1612
1612
|
};
|
|
1613
1613
|
}
|
|
1614
1614
|
}
|
|
@@ -1877,13 +1877,13 @@ ${currentText}` : currentText;
|
|
|
1877
1877
|
paragraph(src) {
|
|
1878
1878
|
const cap = this.rules.block.paragraph.exec(src);
|
|
1879
1879
|
if (cap) {
|
|
1880
|
-
const
|
|
1880
|
+
const text = cap[1].charAt(cap[1].length - 1) === `
|
|
1881
1881
|
` ? cap[1].slice(0, -1) : cap[1];
|
|
1882
1882
|
return {
|
|
1883
1883
|
type: "paragraph",
|
|
1884
1884
|
raw: cap[0],
|
|
1885
|
-
text
|
|
1886
|
-
tokens: this.lexer.inline(
|
|
1885
|
+
text,
|
|
1886
|
+
tokens: this.lexer.inline(text)
|
|
1887
1887
|
};
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
@@ -1987,11 +1987,11 @@ ${currentText}` : currentText;
|
|
|
1987
1987
|
const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
1988
1988
|
const link2 = links[linkString.toLowerCase()];
|
|
1989
1989
|
if (!link2) {
|
|
1990
|
-
const
|
|
1990
|
+
const text = cap[0].charAt(0);
|
|
1991
1991
|
return {
|
|
1992
1992
|
type: "text",
|
|
1993
|
-
raw:
|
|
1994
|
-
text
|
|
1993
|
+
raw: text,
|
|
1994
|
+
text
|
|
1995
1995
|
};
|
|
1996
1996
|
}
|
|
1997
1997
|
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
@@ -2031,20 +2031,20 @@ ${currentText}` : currentText;
|
|
|
2031
2031
|
const lastCharLength = [...match[0]][0].length;
|
|
2032
2032
|
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
2033
2033
|
if (Math.min(lLength, rLength) % 2) {
|
|
2034
|
-
const
|
|
2034
|
+
const text2 = raw.slice(1, -1);
|
|
2035
2035
|
return {
|
|
2036
2036
|
type: "em",
|
|
2037
2037
|
raw,
|
|
2038
|
-
text:
|
|
2039
|
-
tokens: this.lexer.inlineTokens(
|
|
2038
|
+
text: text2,
|
|
2039
|
+
tokens: this.lexer.inlineTokens(text2)
|
|
2040
2040
|
};
|
|
2041
2041
|
}
|
|
2042
|
-
const
|
|
2042
|
+
const text = raw.slice(2, -2);
|
|
2043
2043
|
return {
|
|
2044
2044
|
type: "strong",
|
|
2045
2045
|
raw,
|
|
2046
|
-
text
|
|
2047
|
-
tokens: this.lexer.inlineTokens(
|
|
2046
|
+
text,
|
|
2047
|
+
tokens: this.lexer.inlineTokens(text)
|
|
2048
2048
|
};
|
|
2049
2049
|
}
|
|
2050
2050
|
}
|
|
@@ -2052,16 +2052,16 @@ ${currentText}` : currentText;
|
|
|
2052
2052
|
codespan(src) {
|
|
2053
2053
|
const cap = this.rules.inline.code.exec(src);
|
|
2054
2054
|
if (cap) {
|
|
2055
|
-
let
|
|
2056
|
-
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(
|
|
2057
|
-
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(
|
|
2055
|
+
let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
2056
|
+
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
2057
|
+
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
2058
2058
|
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
2059
|
-
|
|
2059
|
+
text = text.substring(1, text.length - 1);
|
|
2060
2060
|
}
|
|
2061
2061
|
return {
|
|
2062
2062
|
type: "codespan",
|
|
2063
2063
|
raw: cap[0],
|
|
2064
|
-
text
|
|
2064
|
+
text
|
|
2065
2065
|
};
|
|
2066
2066
|
}
|
|
2067
2067
|
}
|
|
@@ -2088,24 +2088,24 @@ ${currentText}` : currentText;
|
|
|
2088
2088
|
autolink(src) {
|
|
2089
2089
|
const cap = this.rules.inline.autolink.exec(src);
|
|
2090
2090
|
if (cap) {
|
|
2091
|
-
let
|
|
2091
|
+
let text, href;
|
|
2092
2092
|
if (cap[2] === "@") {
|
|
2093
|
-
|
|
2094
|
-
href = "mailto:" +
|
|
2093
|
+
text = cap[1];
|
|
2094
|
+
href = "mailto:" + text;
|
|
2095
2095
|
} else {
|
|
2096
|
-
|
|
2097
|
-
href =
|
|
2096
|
+
text = cap[1];
|
|
2097
|
+
href = text;
|
|
2098
2098
|
}
|
|
2099
2099
|
return {
|
|
2100
2100
|
type: "link",
|
|
2101
2101
|
raw: cap[0],
|
|
2102
|
-
text
|
|
2102
|
+
text,
|
|
2103
2103
|
href,
|
|
2104
2104
|
tokens: [
|
|
2105
2105
|
{
|
|
2106
2106
|
type: "text",
|
|
2107
|
-
raw:
|
|
2108
|
-
text
|
|
2107
|
+
raw: text,
|
|
2108
|
+
text
|
|
2109
2109
|
}
|
|
2110
2110
|
]
|
|
2111
2111
|
};
|
|
@@ -2114,17 +2114,17 @@ ${currentText}` : currentText;
|
|
|
2114
2114
|
url(src) {
|
|
2115
2115
|
let cap;
|
|
2116
2116
|
if (cap = this.rules.inline.url.exec(src)) {
|
|
2117
|
-
let
|
|
2117
|
+
let text, href;
|
|
2118
2118
|
if (cap[2] === "@") {
|
|
2119
|
-
|
|
2120
|
-
href = "mailto:" +
|
|
2119
|
+
text = cap[0];
|
|
2120
|
+
href = "mailto:" + text;
|
|
2121
2121
|
} else {
|
|
2122
2122
|
let prevCapZero;
|
|
2123
2123
|
do {
|
|
2124
2124
|
prevCapZero = cap[0];
|
|
2125
2125
|
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
|
2126
2126
|
} while (prevCapZero !== cap[0]);
|
|
2127
|
-
|
|
2127
|
+
text = cap[0];
|
|
2128
2128
|
if (cap[1] === "www.") {
|
|
2129
2129
|
href = "http://" + cap[0];
|
|
2130
2130
|
} else {
|
|
@@ -2134,13 +2134,13 @@ ${currentText}` : currentText;
|
|
|
2134
2134
|
return {
|
|
2135
2135
|
type: "link",
|
|
2136
2136
|
raw: cap[0],
|
|
2137
|
-
text
|
|
2137
|
+
text,
|
|
2138
2138
|
href,
|
|
2139
2139
|
tokens: [
|
|
2140
2140
|
{
|
|
2141
2141
|
type: "text",
|
|
2142
|
-
raw:
|
|
2143
|
-
text
|
|
2142
|
+
raw: text,
|
|
2143
|
+
text
|
|
2144
2144
|
}
|
|
2145
2145
|
]
|
|
2146
2146
|
};
|
|
@@ -2528,9 +2528,9 @@ var _Renderer = class {
|
|
|
2528
2528
|
space(token) {
|
|
2529
2529
|
return "";
|
|
2530
2530
|
}
|
|
2531
|
-
code({ text
|
|
2531
|
+
code({ text, lang, escaped }) {
|
|
2532
2532
|
const langString = (lang || "").match(other.notSpaceStart)?.[0];
|
|
2533
|
-
const code =
|
|
2533
|
+
const code = text.replace(other.endingNewline, "") + `
|
|
2534
2534
|
`;
|
|
2535
2535
|
if (!langString) {
|
|
2536
2536
|
return "<pre><code>" + (escaped ? code : escape2(code, true)) + `</code></pre>
|
|
@@ -2545,8 +2545,8 @@ var _Renderer = class {
|
|
|
2545
2545
|
${body}</blockquote>
|
|
2546
2546
|
`;
|
|
2547
2547
|
}
|
|
2548
|
-
html({ text
|
|
2549
|
-
return
|
|
2548
|
+
html({ text }) {
|
|
2549
|
+
return text;
|
|
2550
2550
|
}
|
|
2551
2551
|
heading({ tokens, depth }) {
|
|
2552
2552
|
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
|
|
@@ -2628,9 +2628,9 @@ ${body}</blockquote>
|
|
|
2628
2628
|
` + body + `</table>
|
|
2629
2629
|
`;
|
|
2630
2630
|
}
|
|
2631
|
-
tablerow({ text
|
|
2631
|
+
tablerow({ text }) {
|
|
2632
2632
|
return `<tr>
|
|
2633
|
-
${
|
|
2633
|
+
${text}</tr>
|
|
2634
2634
|
`;
|
|
2635
2635
|
}
|
|
2636
2636
|
tablecell(token) {
|
|
@@ -2646,8 +2646,8 @@ ${text2}</tr>
|
|
|
2646
2646
|
em({ tokens }) {
|
|
2647
2647
|
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
2648
2648
|
}
|
|
2649
|
-
codespan({ text
|
|
2650
|
-
return `<code>${escape2(
|
|
2649
|
+
codespan({ text }) {
|
|
2650
|
+
return `<code>${escape2(text, true)}</code>`;
|
|
2651
2651
|
}
|
|
2652
2652
|
br(token) {
|
|
2653
2653
|
return "<br>";
|
|
@@ -2656,29 +2656,29 @@ ${text2}</tr>
|
|
|
2656
2656
|
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
2657
2657
|
}
|
|
2658
2658
|
link({ href, title, tokens }) {
|
|
2659
|
-
const
|
|
2659
|
+
const text = this.parser.parseInline(tokens);
|
|
2660
2660
|
const cleanHref = cleanUrl(href);
|
|
2661
2661
|
if (cleanHref === null) {
|
|
2662
|
-
return
|
|
2662
|
+
return text;
|
|
2663
2663
|
}
|
|
2664
2664
|
href = cleanHref;
|
|
2665
2665
|
let out = '<a href="' + href + '"';
|
|
2666
2666
|
if (title) {
|
|
2667
2667
|
out += ' title="' + escape2(title) + '"';
|
|
2668
2668
|
}
|
|
2669
|
-
out += ">" +
|
|
2669
|
+
out += ">" + text + "</a>";
|
|
2670
2670
|
return out;
|
|
2671
2671
|
}
|
|
2672
|
-
image({ href, title, text
|
|
2672
|
+
image({ href, title, text, tokens }) {
|
|
2673
2673
|
if (tokens) {
|
|
2674
|
-
|
|
2674
|
+
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
2675
2675
|
}
|
|
2676
2676
|
const cleanHref = cleanUrl(href);
|
|
2677
2677
|
if (cleanHref === null) {
|
|
2678
|
-
return escape2(
|
|
2678
|
+
return escape2(text);
|
|
2679
2679
|
}
|
|
2680
2680
|
href = cleanHref;
|
|
2681
|
-
let out = `<img src="${href}" alt="${
|
|
2681
|
+
let out = `<img src="${href}" alt="${text}"`;
|
|
2682
2682
|
if (title) {
|
|
2683
2683
|
out += ` title="${escape2(title)}"`;
|
|
2684
2684
|
}
|
|
@@ -2690,29 +2690,29 @@ ${text2}</tr>
|
|
|
2690
2690
|
}
|
|
2691
2691
|
};
|
|
2692
2692
|
var _TextRenderer = class {
|
|
2693
|
-
strong({ text
|
|
2694
|
-
return
|
|
2693
|
+
strong({ text }) {
|
|
2694
|
+
return text;
|
|
2695
2695
|
}
|
|
2696
|
-
em({ text
|
|
2697
|
-
return
|
|
2696
|
+
em({ text }) {
|
|
2697
|
+
return text;
|
|
2698
2698
|
}
|
|
2699
|
-
codespan({ text
|
|
2700
|
-
return
|
|
2699
|
+
codespan({ text }) {
|
|
2700
|
+
return text;
|
|
2701
2701
|
}
|
|
2702
|
-
del({ text
|
|
2703
|
-
return
|
|
2702
|
+
del({ text }) {
|
|
2703
|
+
return text;
|
|
2704
2704
|
}
|
|
2705
|
-
html({ text
|
|
2706
|
-
return
|
|
2705
|
+
html({ text }) {
|
|
2706
|
+
return text;
|
|
2707
2707
|
}
|
|
2708
|
-
text({ text
|
|
2709
|
-
return
|
|
2708
|
+
text({ text }) {
|
|
2709
|
+
return text;
|
|
2710
2710
|
}
|
|
2711
|
-
link({ text
|
|
2712
|
-
return "" +
|
|
2711
|
+
link({ text }) {
|
|
2712
|
+
return "" + text;
|
|
2713
2713
|
}
|
|
2714
|
-
image({ text
|
|
2715
|
-
return "" +
|
|
2714
|
+
image({ text }) {
|
|
2715
|
+
return "" + text;
|
|
2716
2716
|
}
|
|
2717
2717
|
br() {
|
|
2718
2718
|
return "";
|
|
@@ -2902,8 +2902,8 @@ var _Hooks = class {
|
|
|
2902
2902
|
preprocess(markdown) {
|
|
2903
2903
|
return markdown;
|
|
2904
2904
|
}
|
|
2905
|
-
postprocess(
|
|
2906
|
-
return
|
|
2905
|
+
postprocess(html2) {
|
|
2906
|
+
return html2;
|
|
2907
2907
|
}
|
|
2908
2908
|
processAllTokens(tokens) {
|
|
2909
2909
|
return tokens;
|
|
@@ -3147,7 +3147,7 @@ var Marked = class {
|
|
|
3147
3147
|
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
3148
3148
|
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
3149
3149
|
if (opt.async) {
|
|
3150
|
-
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((
|
|
3150
|
+
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);
|
|
3151
3151
|
}
|
|
3152
3152
|
try {
|
|
3153
3153
|
if (opt.hooks) {
|
|
@@ -3160,11 +3160,11 @@ var Marked = class {
|
|
|
3160
3160
|
if (opt.walkTokens) {
|
|
3161
3161
|
this.walkTokens(tokens, opt.walkTokens);
|
|
3162
3162
|
}
|
|
3163
|
-
let
|
|
3163
|
+
let html2 = parser2(tokens, opt);
|
|
3164
3164
|
if (opt.hooks) {
|
|
3165
|
-
|
|
3165
|
+
html2 = opt.hooks.postprocess(html2);
|
|
3166
3166
|
}
|
|
3167
|
-
return
|
|
3167
|
+
return html2;
|
|
3168
3168
|
} catch (e) {
|
|
3169
3169
|
return throwError(e);
|
|
3170
3170
|
}
|
|
@@ -3273,9 +3273,9 @@ class MarkdownRenderer {
|
|
|
3273
3273
|
currentReferences = emptyChatReferences;
|
|
3274
3274
|
lastUsedIndex = 0;
|
|
3275
3275
|
DomPurity;
|
|
3276
|
-
constructor(
|
|
3277
|
-
this.marked = new Marked({ async: false, breaks: true }).use(this.createFootnoteExtension(), ...
|
|
3278
|
-
this.DomPurity = getDomPurify(
|
|
3276
|
+
constructor(options = {}) {
|
|
3277
|
+
this.marked = new Marked({ async: false, breaks: true }).use(this.createFootnoteExtension(), ...options.extensions ?? []);
|
|
3278
|
+
this.DomPurity = getDomPurify(options.window, options.newTabSrText);
|
|
3279
3279
|
}
|
|
3280
3280
|
createFootnoteExtension = () => {
|
|
3281
3281
|
const self = this;
|
|
@@ -3332,9 +3332,9 @@ class MarkdownRenderer {
|
|
|
3332
3332
|
}
|
|
3333
3333
|
toHTML(markdown, references) {
|
|
3334
3334
|
this.currentReferences = references;
|
|
3335
|
-
const
|
|
3335
|
+
const html = this.parse(markdown);
|
|
3336
3336
|
this.currentReferences = emptyChatReferences;
|
|
3337
|
-
return
|
|
3337
|
+
return html;
|
|
3338
3338
|
}
|
|
3339
3339
|
}
|
|
3340
3340
|
// node_modules/.bun/esm-env@1.2.2/node_modules/esm-env/true.js
|
|
@@ -3431,7 +3431,7 @@ var subscriber_queue = [];
|
|
|
3431
3431
|
function writable(value, start = noop) {
|
|
3432
3432
|
let stop = null;
|
|
3433
3433
|
const subscribers = new Set;
|
|
3434
|
-
function
|
|
3434
|
+
function set(new_value) {
|
|
3435
3435
|
if (safe_not_equal(value, new_value)) {
|
|
3436
3436
|
value = new_value;
|
|
3437
3437
|
if (stop) {
|
|
@@ -3450,13 +3450,13 @@ function writable(value, start = noop) {
|
|
|
3450
3450
|
}
|
|
3451
3451
|
}
|
|
3452
3452
|
function update(fn) {
|
|
3453
|
-
|
|
3453
|
+
set(fn(value));
|
|
3454
3454
|
}
|
|
3455
3455
|
function subscribe(run, invalidate = noop) {
|
|
3456
3456
|
const subscriber = [run, invalidate];
|
|
3457
3457
|
subscribers.add(subscriber);
|
|
3458
3458
|
if (subscribers.size === 1) {
|
|
3459
|
-
stop = start(
|
|
3459
|
+
stop = start(set, update) || noop;
|
|
3460
3460
|
}
|
|
3461
3461
|
run(value);
|
|
3462
3462
|
return () => {
|
|
@@ -3467,7 +3467,7 @@ function writable(value, start = noop) {
|
|
|
3467
3467
|
}
|
|
3468
3468
|
};
|
|
3469
3469
|
}
|
|
3470
|
-
return { set
|
|
3470
|
+
return { set, update, subscribe };
|
|
3471
3471
|
}
|
|
3472
3472
|
|
|
3473
3473
|
// node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/store.js
|
|
@@ -3568,9 +3568,9 @@ var getDomainName = (url) => {
|
|
|
3568
3568
|
};
|
|
3569
3569
|
|
|
3570
3570
|
// src/lib/client/utils/html-to-text.ts
|
|
3571
|
-
function htmlToText(
|
|
3572
|
-
const
|
|
3573
|
-
return
|
|
3571
|
+
function htmlToText(html) {
|
|
3572
|
+
const text = html.replace(/<[^>]*>/g, "").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"');
|
|
3573
|
+
return text;
|
|
3574
3574
|
}
|
|
3575
3575
|
|
|
3576
3576
|
// src/lib/client/chat-result-builder.ts
|
|
@@ -3608,17 +3608,17 @@ class ChatResultBuilder {
|
|
|
3608
3608
|
store;
|
|
3609
3609
|
content = new FutureValue;
|
|
3610
3610
|
backendSendsMappedRefs = false;
|
|
3611
|
-
constructor(
|
|
3612
|
-
this.options =
|
|
3611
|
+
constructor(options) {
|
|
3612
|
+
this.options = options;
|
|
3613
3613
|
this.store = writable({
|
|
3614
|
-
id:
|
|
3614
|
+
id: options.id,
|
|
3615
3615
|
state: "loading",
|
|
3616
3616
|
errors: [],
|
|
3617
3617
|
type: "bot",
|
|
3618
3618
|
time: new Date().toISOString(),
|
|
3619
3619
|
message: { markdown: "", html: "", text: "" },
|
|
3620
3620
|
references: { all: [], used: [], unused: [] },
|
|
3621
|
-
retrievalQuestion:
|
|
3621
|
+
retrievalQuestion: options.userQuestion
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
3624
3624
|
pushError(error) {
|
|
@@ -3631,14 +3631,14 @@ class ChatResultBuilder {
|
|
|
3631
3631
|
id
|
|
3632
3632
|
}));
|
|
3633
3633
|
}
|
|
3634
|
-
updateText(
|
|
3634
|
+
updateText(text) {
|
|
3635
3635
|
this.store.update((current) => {
|
|
3636
|
-
const nextMarkdown = current.message.markdown +
|
|
3637
|
-
const
|
|
3636
|
+
const nextMarkdown = current.message.markdown + text;
|
|
3637
|
+
const html = this.options.markdownRenderer.toHTML(nextMarkdown, current.references);
|
|
3638
3638
|
return {
|
|
3639
3639
|
...current,
|
|
3640
3640
|
state: "streaming",
|
|
3641
|
-
message: { markdown: nextMarkdown, html
|
|
3641
|
+
message: { markdown: nextMarkdown, html, text: "" }
|
|
3642
3642
|
};
|
|
3643
3643
|
});
|
|
3644
3644
|
}
|
|
@@ -3773,8 +3773,8 @@ class Conversation {
|
|
|
3773
3773
|
subscribe(callback) {
|
|
3774
3774
|
return this.state.subscribe(callback);
|
|
3775
3775
|
}
|
|
3776
|
-
chat(question,
|
|
3777
|
-
const chatResponse = this.clientPrimitive.chat(this.id, question,
|
|
3776
|
+
chat(question, options = {}) {
|
|
3777
|
+
const chatResponse = this.clientPrimitive.chat(this.id, question, options);
|
|
3778
3778
|
this.history.push(chatResponse);
|
|
3779
3779
|
this.latestRequest.setValue({ question, response: chatResponse });
|
|
3780
3780
|
return chatResponse;
|
|
@@ -4552,10 +4552,10 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
4552
4552
|
|
|
4553
4553
|
// node_modules/.bun/uuid@13.0.0/node_modules/uuid/dist/v7.js
|
|
4554
4554
|
var _state = {};
|
|
4555
|
-
function v7(
|
|
4555
|
+
function v7(options, buf, offset) {
|
|
4556
4556
|
let bytes;
|
|
4557
|
-
if (
|
|
4558
|
-
bytes = v7Bytes(
|
|
4557
|
+
if (options) {
|
|
4558
|
+
bytes = v7Bytes(options.random ?? options.rng?.() ?? rng(), options.msecs, options.seq, buf, offset);
|
|
4559
4559
|
} else {
|
|
4560
4560
|
const now = Date.now();
|
|
4561
4561
|
const rnds = rng();
|
|
@@ -4564,19 +4564,19 @@ function v7(options2, buf, offset) {
|
|
|
4564
4564
|
}
|
|
4565
4565
|
return buf ?? unsafeStringify(bytes);
|
|
4566
4566
|
}
|
|
4567
|
-
function updateV7State(
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
if (now >
|
|
4571
|
-
|
|
4572
|
-
|
|
4567
|
+
function updateV7State(state, now, rnds) {
|
|
4568
|
+
state.msecs ??= -Infinity;
|
|
4569
|
+
state.seq ??= 0;
|
|
4570
|
+
if (now > state.msecs) {
|
|
4571
|
+
state.seq = rnds[6] << 23 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
|
|
4572
|
+
state.msecs = now;
|
|
4573
4573
|
} else {
|
|
4574
|
-
|
|
4575
|
-
if (
|
|
4576
|
-
|
|
4574
|
+
state.seq = state.seq + 1 | 0;
|
|
4575
|
+
if (state.seq === 0) {
|
|
4576
|
+
state.msecs++;
|
|
4577
4577
|
}
|
|
4578
4578
|
}
|
|
4579
|
-
return
|
|
4579
|
+
return state;
|
|
4580
4580
|
}
|
|
4581
4581
|
function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
4582
4582
|
if (rnds.length < 16) {
|
|
@@ -4674,23 +4674,23 @@ var getUserData = async (restClient, startParameters) => {
|
|
|
4674
4674
|
};
|
|
4675
4675
|
|
|
4676
4676
|
// node_modules/.bun/sse.js@2.8.0/node_modules/sse.js/lib/sse.js
|
|
4677
|
-
var SSE = function(url,
|
|
4677
|
+
var SSE = function(url, options) {
|
|
4678
4678
|
if (!(this instanceof SSE)) {
|
|
4679
|
-
return new SSE(url,
|
|
4679
|
+
return new SSE(url, options);
|
|
4680
4680
|
}
|
|
4681
4681
|
this.url = url;
|
|
4682
|
-
|
|
4683
|
-
this.headers =
|
|
4684
|
-
this.payload =
|
|
4685
|
-
this.method =
|
|
4686
|
-
this.withCredentials = !!
|
|
4687
|
-
this.debug = !!
|
|
4688
|
-
this.autoReconnect =
|
|
4689
|
-
this.reconnectDelay =
|
|
4690
|
-
this.maxRetries =
|
|
4682
|
+
options = options || {};
|
|
4683
|
+
this.headers = options.headers || {};
|
|
4684
|
+
this.payload = options.payload !== undefined ? options.payload : "";
|
|
4685
|
+
this.method = options.method || this.payload && "POST" || "GET";
|
|
4686
|
+
this.withCredentials = !!options.withCredentials;
|
|
4687
|
+
this.debug = !!options.debug;
|
|
4688
|
+
this.autoReconnect = options.autoReconnect !== undefined ? options.autoReconnect : false;
|
|
4689
|
+
this.reconnectDelay = options.reconnectDelay !== undefined ? options.reconnectDelay : 3000;
|
|
4690
|
+
this.maxRetries = options.maxRetries !== undefined ? options.maxRetries : null;
|
|
4691
4691
|
this.retryCount = 0;
|
|
4692
4692
|
this.reconnectTimer = null;
|
|
4693
|
-
this.useLastEventId =
|
|
4693
|
+
this.useLastEventId = options.useLastEventId !== undefined ? options.useLastEventId : true;
|
|
4694
4694
|
this.FIELD_SEPARATOR = ":";
|
|
4695
4695
|
this.listeners = {};
|
|
4696
4696
|
this.xhr = null;
|
|
@@ -4773,10 +4773,10 @@ var SSE = function(url, options2) {
|
|
|
4773
4773
|
}, this.reconnectDelay);
|
|
4774
4774
|
}
|
|
4775
4775
|
};
|
|
4776
|
-
this._setReadyState = function(
|
|
4776
|
+
this._setReadyState = function(state) {
|
|
4777
4777
|
const event = new CustomEvent("readystatechange");
|
|
4778
|
-
event.readyState =
|
|
4779
|
-
this.readyState =
|
|
4778
|
+
event.readyState = state;
|
|
4779
|
+
this.readyState = state;
|
|
4780
4780
|
this.dispatchEvent(event);
|
|
4781
4781
|
};
|
|
4782
4782
|
this._onStreamFailure = function(e) {
|
|
@@ -4920,7 +4920,7 @@ var SSE = function(url, options2) {
|
|
|
4920
4920
|
this.xhr.abort();
|
|
4921
4921
|
}
|
|
4922
4922
|
};
|
|
4923
|
-
if (
|
|
4923
|
+
if (options.start === undefined || options.start) {
|
|
4924
4924
|
this.stream();
|
|
4925
4925
|
}
|
|
4926
4926
|
};
|
|
@@ -4935,27 +4935,27 @@ class SseSubscription {
|
|
|
4935
4935
|
payload;
|
|
4936
4936
|
eventSource;
|
|
4937
4937
|
triggeredOnClose = false;
|
|
4938
|
-
constructor(url,
|
|
4939
|
-
this.options =
|
|
4938
|
+
constructor(url, options, payload) {
|
|
4939
|
+
this.options = options;
|
|
4940
4940
|
this.payload = payload;
|
|
4941
4941
|
const sseoptions = { headers: { "content-type": "application/json" } };
|
|
4942
4942
|
if (payload) {
|
|
4943
4943
|
sseoptions.payload = JSON.stringify(payload);
|
|
4944
4944
|
}
|
|
4945
|
-
if (
|
|
4946
|
-
sseoptions.headers["api-key"] =
|
|
4945
|
+
if (options.apiKey) {
|
|
4946
|
+
sseoptions.headers["api-key"] = options.apiKey;
|
|
4947
4947
|
}
|
|
4948
|
-
this.eventSource = new (
|
|
4948
|
+
this.eventSource = new (options.EventSource ?? SSE)(url, sseoptions);
|
|
4949
4949
|
this.eventSource.onmessage = (event) => {
|
|
4950
4950
|
try {
|
|
4951
4951
|
const data = JSON.parse(event.data);
|
|
4952
|
-
|
|
4952
|
+
options.onMessage(data);
|
|
4953
4953
|
} catch (error) {
|
|
4954
|
-
|
|
4954
|
+
options.onError(new CustomEvent("parse-error", { detail: error }));
|
|
4955
4955
|
}
|
|
4956
4956
|
};
|
|
4957
4957
|
this.eventSource.onerror = (event) => {
|
|
4958
|
-
|
|
4958
|
+
options.onError(event);
|
|
4959
4959
|
if (this.isClosed()) {
|
|
4960
4960
|
this.close();
|
|
4961
4961
|
}
|
|
@@ -4980,8 +4980,8 @@ var removeUndefinedValues = (obj) => Object.fromEntries(Object.entries(obj).filt
|
|
|
4980
4980
|
// src/lib/client/api/rest-client.ts
|
|
4981
4981
|
class RestClient {
|
|
4982
4982
|
options;
|
|
4983
|
-
constructor(
|
|
4984
|
-
this.options =
|
|
4983
|
+
constructor(options) {
|
|
4984
|
+
this.options = options;
|
|
4985
4985
|
}
|
|
4986
4986
|
getDefaultHeaders(additional = {}) {
|
|
4987
4987
|
const headers = {
|
|
@@ -4995,17 +4995,17 @@ class RestClient {
|
|
|
4995
4995
|
get speechRecognitionApiKey() {
|
|
4996
4996
|
return this.options.speechRecognitionApiKey;
|
|
4997
4997
|
}
|
|
4998
|
-
async subscribeSse(path, params = {},
|
|
4998
|
+
async subscribeSse(path, params = {}, options) {
|
|
4999
4999
|
const payload = removeUndefinedValues(params);
|
|
5000
5000
|
if (this.options.apiKey)
|
|
5001
|
-
|
|
5002
|
-
return new SseSubscription(`${this.options.apiUrl}${path}`,
|
|
5001
|
+
options.apiKey = this.options.apiKey;
|
|
5002
|
+
return new SseSubscription(`${this.options.apiUrl}${path}`, options, payload);
|
|
5003
5003
|
}
|
|
5004
|
-
async fetchData(path, validator, params = {},
|
|
5004
|
+
async fetchData(path, validator, params = {}, options = {}) {
|
|
5005
5005
|
const url = `${this.options.apiUrl}${path}?${new URLSearchParams(removeUndefinedValues(params)).toString()}`;
|
|
5006
5006
|
const opts = {
|
|
5007
|
-
...
|
|
5008
|
-
headers: this.getDefaultHeaders(
|
|
5007
|
+
...options,
|
|
5008
|
+
headers: this.getDefaultHeaders(options?.headers)
|
|
5009
5009
|
};
|
|
5010
5010
|
const response = await fetch(url, opts);
|
|
5011
5011
|
if (!response.ok) {
|
|
@@ -5078,30 +5078,30 @@ var linkSchema = import_mini8.z.union([linkLegacySchema, searchReferenceSchema])
|
|
|
5078
5078
|
var searchEndpointSchema = import_mini8.z.object({
|
|
5079
5079
|
links: import_mini8.z.array(linkSchema)
|
|
5080
5080
|
});
|
|
5081
|
-
var mapLinkToSearchReference = (
|
|
5082
|
-
if ("metadata" in
|
|
5083
|
-
return
|
|
5081
|
+
var mapLinkToSearchReference = (link) => {
|
|
5082
|
+
if ("metadata" in link)
|
|
5083
|
+
return link;
|
|
5084
5084
|
console.warn("Please upgrade your backend you are currently using an old api feature.");
|
|
5085
|
-
const metadata =
|
|
5086
|
-
if (
|
|
5087
|
-
metadata.fromFullTextSearch =
|
|
5088
|
-
if (
|
|
5089
|
-
metadata.rerank =
|
|
5085
|
+
const metadata = link.orgMetadata ?? {};
|
|
5086
|
+
if (link?.fromFullTextSearch)
|
|
5087
|
+
metadata.fromFullTextSearch = link?.fromFullTextSearch;
|
|
5088
|
+
if (link?.rerank)
|
|
5089
|
+
metadata.rerank = link?.rerank;
|
|
5090
5090
|
let breadcrumbs = [];
|
|
5091
|
-
let title =
|
|
5092
|
-
if (
|
|
5093
|
-
const all =
|
|
5091
|
+
let title = link.title ?? "";
|
|
5092
|
+
if (link.title && link.title.includes(" > ")) {
|
|
5093
|
+
const all = link.title.split(" > ");
|
|
5094
5094
|
title = all.pop() ?? "";
|
|
5095
5095
|
breadcrumbs = all;
|
|
5096
5096
|
}
|
|
5097
5097
|
return {
|
|
5098
|
-
url:
|
|
5098
|
+
url: link.url ?? "",
|
|
5099
5099
|
title,
|
|
5100
|
-
score:
|
|
5100
|
+
score: link.similarity || 0,
|
|
5101
5101
|
breadcrumbs,
|
|
5102
5102
|
metadata,
|
|
5103
|
-
description:
|
|
5104
|
-
date:
|
|
5103
|
+
description: link.content,
|
|
5104
|
+
date: link.date
|
|
5105
5105
|
};
|
|
5106
5106
|
};
|
|
5107
5107
|
|
|
@@ -5146,37 +5146,37 @@ var MS_PER_CHAR = 7;
|
|
|
5146
5146
|
var MIN_DELAY_MS = 8;
|
|
5147
5147
|
var MAX_DELAY_MS = 160;
|
|
5148
5148
|
var START_DELAY_MS = 750;
|
|
5149
|
-
var tokenize = (
|
|
5149
|
+
var tokenize = (text) => {
|
|
5150
5150
|
const tokens = [];
|
|
5151
5151
|
let i = 0;
|
|
5152
|
-
while (i <
|
|
5153
|
-
const ch =
|
|
5152
|
+
while (i < text.length) {
|
|
5153
|
+
const ch = text[i];
|
|
5154
5154
|
if (ch === "<") {
|
|
5155
|
-
const end =
|
|
5155
|
+
const end = text.indexOf(">", i);
|
|
5156
5156
|
if (end !== -1) {
|
|
5157
|
-
tokens.push({ type: "tag", value:
|
|
5157
|
+
tokens.push({ type: "tag", value: text.slice(i, end + 1) });
|
|
5158
5158
|
i = end + 1;
|
|
5159
5159
|
continue;
|
|
5160
5160
|
}
|
|
5161
5161
|
}
|
|
5162
5162
|
if (/\s/.test(ch)) {
|
|
5163
|
-
let
|
|
5164
|
-
while (
|
|
5165
|
-
|
|
5166
|
-
tokens.push({ type: "space", value:
|
|
5167
|
-
i =
|
|
5163
|
+
let j = i;
|
|
5164
|
+
while (j < text.length && /\s/.test(text[j]))
|
|
5165
|
+
j++;
|
|
5166
|
+
tokens.push({ type: "space", value: text.slice(i, j) });
|
|
5167
|
+
i = j;
|
|
5168
5168
|
continue;
|
|
5169
5169
|
}
|
|
5170
5170
|
let j = i;
|
|
5171
|
-
while (j <
|
|
5171
|
+
while (j < text.length && !/\s/.test(text[j]) && text[j] !== "<")
|
|
5172
5172
|
j++;
|
|
5173
|
-
tokens.push({ type: "word", value:
|
|
5173
|
+
tokens.push({ type: "word", value: text.slice(i, j) });
|
|
5174
5174
|
i = j;
|
|
5175
5175
|
}
|
|
5176
5176
|
return tokens;
|
|
5177
5177
|
};
|
|
5178
|
-
var splitForTyping = (
|
|
5179
|
-
const tokens = tokenize(
|
|
5178
|
+
var splitForTyping = (text) => {
|
|
5179
|
+
const tokens = tokenize(text);
|
|
5180
5180
|
const emissions = [];
|
|
5181
5181
|
let current = "";
|
|
5182
5182
|
let hasWord = false;
|
|
@@ -5205,8 +5205,8 @@ class FakeTypingQueue {
|
|
|
5205
5205
|
constructor(onText) {
|
|
5206
5206
|
this.onText = onText;
|
|
5207
5207
|
}
|
|
5208
|
-
ingestText(
|
|
5209
|
-
const chunks = splitForTyping(
|
|
5208
|
+
ingestText(text) {
|
|
5209
|
+
const chunks = splitForTyping(text);
|
|
5210
5210
|
if (chunks.length >= TYPING_MIN_CHUNKS) {
|
|
5211
5211
|
for (const chunk of chunks) {
|
|
5212
5212
|
this.queue.push({ kind: "text", chunk, delayMs: delayForChunk(chunk) });
|
|
@@ -5214,7 +5214,7 @@ class FakeTypingQueue {
|
|
|
5214
5214
|
this.kickoff();
|
|
5215
5215
|
return;
|
|
5216
5216
|
}
|
|
5217
|
-
this.runAfterTyping(() => this.onText(
|
|
5217
|
+
this.runAfterTyping(() => this.onText(text));
|
|
5218
5218
|
}
|
|
5219
5219
|
runAfterTyping(fn) {
|
|
5220
5220
|
if (this.queue.length === 0 && !this.isProcessing) {
|
|
@@ -5281,19 +5281,19 @@ class LiipGPTClientPrimitive {
|
|
|
5281
5281
|
markedExtensions = [];
|
|
5282
5282
|
_newTabSrText;
|
|
5283
5283
|
chatTimeout;
|
|
5284
|
-
constructor(
|
|
5285
|
-
this.chatTimeout =
|
|
5284
|
+
constructor(options) {
|
|
5285
|
+
this.chatTimeout = options.chatTimeout ?? DEFAULT_CHAT_TIMEOUT;
|
|
5286
5286
|
const restOptions = {
|
|
5287
|
-
apiUrl:
|
|
5288
|
-
apiKey:
|
|
5289
|
-
speechRecognitionApiKey:
|
|
5290
|
-
strict:
|
|
5291
|
-
EventSource:
|
|
5287
|
+
apiUrl: options.apiUrl,
|
|
5288
|
+
apiKey: options.apiKey,
|
|
5289
|
+
speechRecognitionApiKey: options.speechRecognitionApiKey,
|
|
5290
|
+
strict: options.strict ?? false,
|
|
5291
|
+
EventSource: options.EventSource ?? EventSource
|
|
5292
5292
|
};
|
|
5293
5293
|
const restClient = new RestClient(restOptions);
|
|
5294
5294
|
this.internalData = {
|
|
5295
5295
|
restClient,
|
|
5296
|
-
metadata: getUserData(restClient,
|
|
5296
|
+
metadata: getUserData(restClient, options.startParameters),
|
|
5297
5297
|
searchResponseMap: new Map,
|
|
5298
5298
|
chatResponseMap: new Map,
|
|
5299
5299
|
conversationMap: new Map
|
|
@@ -5302,8 +5302,8 @@ class LiipGPTClientPrimitive {
|
|
|
5302
5302
|
setMarkedExtensions(...extensions) {
|
|
5303
5303
|
this.markedExtensions = extensions;
|
|
5304
5304
|
}
|
|
5305
|
-
setNewTabSrText(
|
|
5306
|
-
this._newTabSrText =
|
|
5305
|
+
setNewTabSrText(text) {
|
|
5306
|
+
this._newTabSrText = text;
|
|
5307
5307
|
}
|
|
5308
5308
|
getMetadata() {
|
|
5309
5309
|
return this.internalData.metadata;
|
|
@@ -5313,7 +5313,7 @@ class LiipGPTClientPrimitive {
|
|
|
5313
5313
|
this.renderers.set(conversationId, new MarkdownRenderer({ extensions: this.markedExtensions, newTabSrText: this._newTabSrText }));
|
|
5314
5314
|
return conversationId;
|
|
5315
5315
|
}
|
|
5316
|
-
chat(conversationId, question,
|
|
5316
|
+
chat(conversationId, question, options = {}) {
|
|
5317
5317
|
const content = new FutureValue;
|
|
5318
5318
|
const requestId = v7_default();
|
|
5319
5319
|
const readyForFeedback = new Flag;
|
|
@@ -5321,7 +5321,7 @@ class LiipGPTClientPrimitive {
|
|
|
5321
5321
|
const chatResultBuilder = new ChatResultBuilder({
|
|
5322
5322
|
id: requestId,
|
|
5323
5323
|
onError: (error) => {
|
|
5324
|
-
|
|
5324
|
+
options.onError?.(error);
|
|
5325
5325
|
},
|
|
5326
5326
|
onFinish: (message) => {
|
|
5327
5327
|
content.setValue(message);
|
|
@@ -5337,7 +5337,7 @@ class LiipGPTClientPrimitive {
|
|
|
5337
5337
|
};
|
|
5338
5338
|
const subscription = new FutureValue;
|
|
5339
5339
|
const typingQueue = new FakeTypingQueue((chunk) => chatResultBuilder.updateText(chunk));
|
|
5340
|
-
const timeout =
|
|
5340
|
+
const timeout = options.timeout ?? this.chatTimeout;
|
|
5341
5341
|
let timeoutId;
|
|
5342
5342
|
let timedOut = false;
|
|
5343
5343
|
const stopWatchdog = () => {
|
|
@@ -5375,15 +5375,15 @@ class LiipGPTClientPrimitive {
|
|
|
5375
5375
|
uID: metadata.userId,
|
|
5376
5376
|
cID: conversationId,
|
|
5377
5377
|
rID: requestId,
|
|
5378
|
-
lang:
|
|
5379
|
-
feature:
|
|
5380
|
-
referrer:
|
|
5381
|
-
source:
|
|
5382
|
-
...
|
|
5383
|
-
...
|
|
5384
|
-
...
|
|
5385
|
-
...
|
|
5386
|
-
...
|
|
5378
|
+
lang: options.lang,
|
|
5379
|
+
feature: options.features?.join(","),
|
|
5380
|
+
referrer: options.referrer,
|
|
5381
|
+
source: options.source,
|
|
5382
|
+
...options.selectorValues ?? {},
|
|
5383
|
+
...options.mode ? { mode: options.mode } : {},
|
|
5384
|
+
...options.cache ? { cache: true } : {},
|
|
5385
|
+
...options.predefinedQuestionId ? { predefinedQuestionId: options.predefinedQuestionId } : {},
|
|
5386
|
+
...options.switchQuestionId ? { switchQuestionId: options.switchQuestionId } : {},
|
|
5387
5387
|
chat: "true",
|
|
5388
5388
|
version: "2"
|
|
5389
5389
|
}, {
|
|
@@ -5425,7 +5425,7 @@ class LiipGPTClientPrimitive {
|
|
|
5425
5425
|
typingQueue.runAfterTyping(() => {
|
|
5426
5426
|
chatResultBuilder.finishMessage();
|
|
5427
5427
|
readyForFeedback.resolve();
|
|
5428
|
-
subscription.then((
|
|
5428
|
+
subscription.then((s) => s.close());
|
|
5429
5429
|
});
|
|
5430
5430
|
break;
|
|
5431
5431
|
case "unexpected-call":
|
|
@@ -5448,10 +5448,10 @@ class LiipGPTClientPrimitive {
|
|
|
5448
5448
|
typingQueue.runAfterTyping(() => chatResultBuilder.setNoFeedback());
|
|
5449
5449
|
break;
|
|
5450
5450
|
case "component":
|
|
5451
|
-
typingQueue.runWithWarmup(() =>
|
|
5451
|
+
typingQueue.runWithWarmup(() => options.onEmbed?.(data));
|
|
5452
5452
|
break;
|
|
5453
5453
|
}
|
|
5454
|
-
typingQueue.runAfterTyping(() =>
|
|
5454
|
+
typingQueue.runAfterTyping(() => options.onMessage?.(data));
|
|
5455
5455
|
},
|
|
5456
5456
|
onError: (event) => {
|
|
5457
5457
|
console.error(" sse-error:", event);
|
|
@@ -5531,24 +5531,24 @@ class LiipGPTClientPrimitive {
|
|
|
5531
5531
|
};
|
|
5532
5532
|
await this.internalData.restClient.postData("/customform", answerFormRequest);
|
|
5533
5533
|
}
|
|
5534
|
-
async userAction(userAction,
|
|
5534
|
+
async userAction(userAction, options = {}) {
|
|
5535
5535
|
const metadata = await this.internalData.metadata;
|
|
5536
5536
|
if (metadata.mode !== "ready")
|
|
5537
5537
|
throw new Error("Can not post user action unless we are in ready mode");
|
|
5538
5538
|
const request = {
|
|
5539
5539
|
uID: metadata.userId,
|
|
5540
|
-
cID:
|
|
5541
|
-
lang:
|
|
5540
|
+
cID: options.conversationId,
|
|
5541
|
+
lang: options.lang,
|
|
5542
5542
|
userAction
|
|
5543
5543
|
};
|
|
5544
5544
|
await this.internalData.restClient.postData("/assistant/userAction", request);
|
|
5545
5545
|
}
|
|
5546
|
-
async search(query,
|
|
5546
|
+
async search(query, options = {}) {
|
|
5547
5547
|
const metadata = await this.internalData.metadata;
|
|
5548
5548
|
const uID = metadata.mode === "ready" ? metadata.userId : undefined;
|
|
5549
5549
|
const { links } = await this.internalData.restClient.fetchData("/assistant/search", searchEndpointSchema, {
|
|
5550
|
-
modelId:
|
|
5551
|
-
lang:
|
|
5550
|
+
modelId: options.model,
|
|
5551
|
+
lang: options.language,
|
|
5552
5552
|
query,
|
|
5553
5553
|
mapResults: "true",
|
|
5554
5554
|
uID
|
|
@@ -5573,9 +5573,9 @@ class LiipGPTClientPrimitive {
|
|
|
5573
5573
|
const data = await this.internalData.restClient.fetchData("/topics/questions", predefinedQuestionsResponseSchema, params);
|
|
5574
5574
|
return data.predefinedQuestions;
|
|
5575
5575
|
}
|
|
5576
|
-
async transcribeAudio(audioBlob,
|
|
5576
|
+
async transcribeAudio(audioBlob, options = {}) {
|
|
5577
5577
|
const metadata = await this.internalData.metadata;
|
|
5578
|
-
const language =
|
|
5578
|
+
const language = options.lang || "de-CH";
|
|
5579
5579
|
if (metadata.mode === "maintenance") {
|
|
5580
5580
|
throw new Error("Can not transcribe audio in maintenance mode");
|
|
5581
5581
|
}
|
|
@@ -5613,8 +5613,8 @@ class LiipGPTClientPrimitive {
|
|
|
5613
5613
|
// src/lib/client/liipgpt-client.ts
|
|
5614
5614
|
class LiipGPTClient {
|
|
5615
5615
|
clientPrimitive;
|
|
5616
|
-
constructor(
|
|
5617
|
-
this.clientPrimitive = new LiipGPTClientPrimitive(
|
|
5616
|
+
constructor(options) {
|
|
5617
|
+
this.clientPrimitive = new LiipGPTClientPrimitive(options);
|
|
5618
5618
|
}
|
|
5619
5619
|
getMetadata() {
|
|
5620
5620
|
return this.clientPrimitive.getMetadata();
|
|
@@ -5622,8 +5622,8 @@ class LiipGPTClient {
|
|
|
5622
5622
|
createConversation() {
|
|
5623
5623
|
return new Conversation(this.clientPrimitive);
|
|
5624
5624
|
}
|
|
5625
|
-
search(query,
|
|
5626
|
-
return this.clientPrimitive.search(query,
|
|
5625
|
+
search(query, options = {}) {
|
|
5626
|
+
return this.clientPrimitive.search(query, options);
|
|
5627
5627
|
}
|
|
5628
5628
|
getChatConfig() {
|
|
5629
5629
|
return this.clientPrimitive.getChatConfig();
|