@liip/liipgpt 2.3.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/button/liipgpt-button.iife.js +6 -6
- package/chat/liipgpt-chat.iife.js +36 -34
- package/config/index.cjs +4 -2
- package/config/index.d.ts +51 -40
- package/config/index.js +4 -2
- package/configurator/_app/env.js +1 -1
- package/configurator/_app/immutable/chunks/{rDPv-5wa.js → BgEp-IXK.js} +1 -1
- package/configurator/_app/immutable/chunks/{BFreBUSP.js → BomA0xkn.js} +1 -1
- package/configurator/_app/immutable/chunks/{d6C_eRjd.js → CGt_7eBt.js} +1 -1
- package/configurator/_app/immutable/chunks/{CDspJXXg.js → CVGFiFDF.js} +1 -1
- package/configurator/_app/immutable/chunks/{BsiW2yhN.js → CXdK-dRV.js} +3 -3
- package/configurator/_app/immutable/chunks/Dk65hsuc.js +212 -0
- package/configurator/_app/immutable/chunks/{MKI9-q4y.js → DkjsutUp.js} +1 -1
- package/configurator/_app/immutable/chunks/{DxxpKflm.js → FW73PcT5.js} +1 -1
- package/configurator/_app/immutable/chunks/{CwooIMgw.js → g33UHIPf.js} +1 -1
- package/configurator/_app/immutable/entry/{app.C9zbli2H.js → app.EbRNj2Ex.js} +2 -2
- package/configurator/_app/immutable/entry/start.DEh3tu3P.js +1 -0
- package/configurator/_app/immutable/nodes/{0.q26YI7tQ.js → 0.DQoGmNN3.js} +2 -1
- package/configurator/_app/immutable/nodes/{1.DRaCgLGq.js → 1.DxaWpt7I.js} +1 -1
- package/configurator/_app/immutable/nodes/{2.ByFPCqyU.js → 2.CgyaBcKr.js} +3 -3
- package/configurator/_app/immutable/nodes/{3.D86PdgyZ.js → 3.BEwp3oml.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 +273 -7
- package/index.d.ts +100 -68
- package/index.js +273 -7
- package/package.json +1 -1
- package/configurator/_app/immutable/chunks/BjEMicr6.js +0 -210
- package/configurator/_app/immutable/entry/start.BIL3lTdk.js +0 -1
package/index.cjs
CHANGED
|
@@ -10425,7 +10425,8 @@ var svgsSchema = exports_external.record(exports_external.enum([
|
|
|
10425
10425
|
"speechInput",
|
|
10426
10426
|
"listUnordered",
|
|
10427
10427
|
"lightMode",
|
|
10428
|
-
"darkMode"
|
|
10428
|
+
"darkMode",
|
|
10429
|
+
"avatarLarge"
|
|
10429
10430
|
]), exports_external.string());
|
|
10430
10431
|
var tokensSchema = exports_external.object({
|
|
10431
10432
|
font: fontSchema.optional(),
|
|
@@ -10680,7 +10681,8 @@ var completeChatConfigSchema = exports_external.object({
|
|
|
10680
10681
|
buttonHref: exports_external.string().optional(),
|
|
10681
10682
|
addQueryToUrlParams: exports_external.boolean().optional(),
|
|
10682
10683
|
renderKatex: exports_external.boolean().optional(),
|
|
10683
|
-
reflectLanguageInPath: exports_external.boolean().optional()
|
|
10684
|
+
reflectLanguageInPath: exports_external.boolean().optional(),
|
|
10685
|
+
sendReferrer: exports_external.enum(["all", "own", "none"]).optional()
|
|
10684
10686
|
});
|
|
10685
10687
|
var chatConfigSchema = completeChatConfigSchema.partial();
|
|
10686
10688
|
var chatConfigSchemaWithLegacyThemeName = chatConfigSchema.and(exports_external.object({
|
|
@@ -10748,14 +10750,277 @@ var getUserData = async (restClient) => {
|
|
|
10748
10750
|
}
|
|
10749
10751
|
};
|
|
10750
10752
|
|
|
10753
|
+
// node_modules/.pnpm/sse.js@2.7.2/node_modules/sse.js/lib/sse.js
|
|
10754
|
+
var exports_sse = {};
|
|
10755
|
+
__export(exports_sse, {
|
|
10756
|
+
SSE: () => SSE
|
|
10757
|
+
});
|
|
10758
|
+
var SSE = function(url, options2) {
|
|
10759
|
+
if (!(this instanceof SSE)) {
|
|
10760
|
+
return new SSE(url, options2);
|
|
10761
|
+
}
|
|
10762
|
+
this.url = url;
|
|
10763
|
+
options2 = options2 || {};
|
|
10764
|
+
this.headers = options2.headers || {};
|
|
10765
|
+
this.payload = options2.payload !== undefined ? options2.payload : "";
|
|
10766
|
+
this.method = options2.method || this.payload && "POST" || "GET";
|
|
10767
|
+
this.withCredentials = !!options2.withCredentials;
|
|
10768
|
+
this.debug = !!options2.debug;
|
|
10769
|
+
this.autoReconnect = options2.autoReconnect !== undefined ? options2.autoReconnect : false;
|
|
10770
|
+
this.reconnectDelay = options2.reconnectDelay !== undefined ? options2.reconnectDelay : 3000;
|
|
10771
|
+
this.maxRetries = options2.maxRetries !== undefined ? options2.maxRetries : null;
|
|
10772
|
+
this.retryCount = 0;
|
|
10773
|
+
this.reconnectTimer = null;
|
|
10774
|
+
this.useLastEventId = options2.useLastEventId !== undefined ? options2.useLastEventId : true;
|
|
10775
|
+
this.FIELD_SEPARATOR = ":";
|
|
10776
|
+
this.listeners = {};
|
|
10777
|
+
this.xhr = null;
|
|
10778
|
+
this.readyState = SSE.INITIALIZING;
|
|
10779
|
+
this.progress = 0;
|
|
10780
|
+
this.chunk = "";
|
|
10781
|
+
this.lastEventId = "";
|
|
10782
|
+
this.addEventListener = function(type, listener) {
|
|
10783
|
+
if (this.listeners[type] === undefined) {
|
|
10784
|
+
this.listeners[type] = [];
|
|
10785
|
+
}
|
|
10786
|
+
if (this.listeners[type].indexOf(listener) === -1) {
|
|
10787
|
+
this.listeners[type].push(listener);
|
|
10788
|
+
}
|
|
10789
|
+
};
|
|
10790
|
+
this.removeEventListener = function(type, listener) {
|
|
10791
|
+
if (this.listeners[type] === undefined) {
|
|
10792
|
+
return;
|
|
10793
|
+
}
|
|
10794
|
+
const filtered = [];
|
|
10795
|
+
this.listeners[type].forEach(function(element2) {
|
|
10796
|
+
if (element2 !== listener) {
|
|
10797
|
+
filtered.push(element2);
|
|
10798
|
+
}
|
|
10799
|
+
});
|
|
10800
|
+
if (filtered.length === 0) {
|
|
10801
|
+
delete this.listeners[type];
|
|
10802
|
+
} else {
|
|
10803
|
+
this.listeners[type] = filtered;
|
|
10804
|
+
}
|
|
10805
|
+
};
|
|
10806
|
+
this.dispatchEvent = function(e) {
|
|
10807
|
+
if (!e) {
|
|
10808
|
+
return true;
|
|
10809
|
+
}
|
|
10810
|
+
if (this.debug) {
|
|
10811
|
+
console.debug(e);
|
|
10812
|
+
}
|
|
10813
|
+
e.source = this;
|
|
10814
|
+
const onHandler = "on" + e.type;
|
|
10815
|
+
if (this.hasOwnProperty(onHandler)) {
|
|
10816
|
+
this[onHandler].call(this, e);
|
|
10817
|
+
if (e.defaultPrevented) {
|
|
10818
|
+
return false;
|
|
10819
|
+
}
|
|
10820
|
+
}
|
|
10821
|
+
if (this.listeners[e.type]) {
|
|
10822
|
+
return this.listeners[e.type].every(function(callback) {
|
|
10823
|
+
callback(e);
|
|
10824
|
+
return !e.defaultPrevented;
|
|
10825
|
+
});
|
|
10826
|
+
}
|
|
10827
|
+
return true;
|
|
10828
|
+
};
|
|
10829
|
+
this._markClosed = function() {
|
|
10830
|
+
this.xhr = null;
|
|
10831
|
+
this.progress = 0;
|
|
10832
|
+
this.chunk = "";
|
|
10833
|
+
this._setReadyState(SSE.CLOSED);
|
|
10834
|
+
if (this.autoReconnect) {
|
|
10835
|
+
if (this.maxRetries !== null && this.retryCount >= this.maxRetries) {
|
|
10836
|
+
if (this.debug) {
|
|
10837
|
+
console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`);
|
|
10838
|
+
}
|
|
10839
|
+
this.autoReconnect = false;
|
|
10840
|
+
this.close();
|
|
10841
|
+
return;
|
|
10842
|
+
}
|
|
10843
|
+
if (this.reconnectTimer) {
|
|
10844
|
+
clearTimeout(this.reconnectTimer);
|
|
10845
|
+
}
|
|
10846
|
+
if (this.debug) {
|
|
10847
|
+
console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount + 1}${this.maxRetries ? "/" + this.maxRetries : ""})`);
|
|
10848
|
+
}
|
|
10849
|
+
this.reconnectTimer = setTimeout(() => {
|
|
10850
|
+
this.reconnectTimer = null;
|
|
10851
|
+
this.retryCount++;
|
|
10852
|
+
this.stream();
|
|
10853
|
+
}, this.reconnectDelay);
|
|
10854
|
+
}
|
|
10855
|
+
};
|
|
10856
|
+
this._setReadyState = function(state2) {
|
|
10857
|
+
const event2 = new CustomEvent("readystatechange");
|
|
10858
|
+
event2.readyState = state2;
|
|
10859
|
+
this.readyState = state2;
|
|
10860
|
+
this.dispatchEvent(event2);
|
|
10861
|
+
};
|
|
10862
|
+
this._onStreamFailure = function(e) {
|
|
10863
|
+
const event2 = new CustomEvent("error");
|
|
10864
|
+
event2.responseCode = e.currentTarget.status;
|
|
10865
|
+
event2.data = e.currentTarget.response;
|
|
10866
|
+
this.dispatchEvent(event2);
|
|
10867
|
+
this._markClosed();
|
|
10868
|
+
};
|
|
10869
|
+
this._onStreamAbort = function() {
|
|
10870
|
+
this.dispatchEvent(new CustomEvent("abort"));
|
|
10871
|
+
this._markClosed();
|
|
10872
|
+
};
|
|
10873
|
+
this._onStreamProgress = function(e) {
|
|
10874
|
+
if (!this.xhr) {
|
|
10875
|
+
return;
|
|
10876
|
+
}
|
|
10877
|
+
if (this.xhr.status < 200 || this.xhr.status >= 300) {
|
|
10878
|
+
this._onStreamFailure(e);
|
|
10879
|
+
return;
|
|
10880
|
+
}
|
|
10881
|
+
this.retryCount = 0;
|
|
10882
|
+
const data = this.xhr.responseText.substring(this.progress);
|
|
10883
|
+
this.progress += data.length;
|
|
10884
|
+
const parts = (this.chunk + data).split(/(\r\n\r\n|\r\r|\n\n)/g);
|
|
10885
|
+
const lastPart = parts.pop();
|
|
10886
|
+
parts.forEach(function(part) {
|
|
10887
|
+
if (part.trim().length > 0) {
|
|
10888
|
+
this.dispatchEvent(this._parseEventChunk(part));
|
|
10889
|
+
}
|
|
10890
|
+
}.bind(this));
|
|
10891
|
+
this.chunk = lastPart;
|
|
10892
|
+
};
|
|
10893
|
+
this._onStreamLoaded = function(e) {
|
|
10894
|
+
this._onStreamProgress(e);
|
|
10895
|
+
this.dispatchEvent(this._parseEventChunk(this.chunk));
|
|
10896
|
+
this.chunk = "";
|
|
10897
|
+
this._markClosed();
|
|
10898
|
+
};
|
|
10899
|
+
this._parseEventChunk = function(chunk) {
|
|
10900
|
+
if (!chunk || chunk.length === 0) {
|
|
10901
|
+
return null;
|
|
10902
|
+
}
|
|
10903
|
+
if (this.debug) {
|
|
10904
|
+
console.debug(chunk);
|
|
10905
|
+
}
|
|
10906
|
+
const e = { id: null, retry: null, data: null, event: null };
|
|
10907
|
+
chunk.split(/\n|\r\n|\r/).forEach(function(line) {
|
|
10908
|
+
const index2 = line.indexOf(this.FIELD_SEPARATOR);
|
|
10909
|
+
let field, value;
|
|
10910
|
+
if (index2 > 0) {
|
|
10911
|
+
const skip = line[index2 + 1] === " " ? 2 : 1;
|
|
10912
|
+
field = line.substring(0, index2);
|
|
10913
|
+
value = line.substring(index2 + skip);
|
|
10914
|
+
} else if (index2 < 0) {
|
|
10915
|
+
field = line;
|
|
10916
|
+
value = "";
|
|
10917
|
+
} else {
|
|
10918
|
+
return;
|
|
10919
|
+
}
|
|
10920
|
+
if (!(field in e)) {
|
|
10921
|
+
return;
|
|
10922
|
+
}
|
|
10923
|
+
if (field === "data" && e[field] !== null) {
|
|
10924
|
+
e["data"] += `
|
|
10925
|
+
` + value;
|
|
10926
|
+
} else {
|
|
10927
|
+
e[field] = value;
|
|
10928
|
+
}
|
|
10929
|
+
}.bind(this));
|
|
10930
|
+
if (e.data === null) {
|
|
10931
|
+
return null;
|
|
10932
|
+
}
|
|
10933
|
+
if (e.id !== null) {
|
|
10934
|
+
this.lastEventId = e.id;
|
|
10935
|
+
}
|
|
10936
|
+
const event2 = new CustomEvent(e.event || "message");
|
|
10937
|
+
event2.id = e.id;
|
|
10938
|
+
event2.data = e.data || "";
|
|
10939
|
+
event2.lastEventId = this.lastEventId;
|
|
10940
|
+
return event2;
|
|
10941
|
+
};
|
|
10942
|
+
this._onReadyStateChange = function() {
|
|
10943
|
+
if (!this.xhr) {
|
|
10944
|
+
return;
|
|
10945
|
+
}
|
|
10946
|
+
if (this.xhr.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
|
10947
|
+
const headers = {};
|
|
10948
|
+
const headerPairs = this.xhr.getAllResponseHeaders().trim().split(`\r
|
|
10949
|
+
`);
|
|
10950
|
+
for (const headerPair of headerPairs) {
|
|
10951
|
+
const [key2, ...valueParts] = headerPair.split(":");
|
|
10952
|
+
const value = valueParts.join(":").trim();
|
|
10953
|
+
headers[key2.trim().toLowerCase()] = headers[key2.trim().toLowerCase()] || [];
|
|
10954
|
+
headers[key2.trim().toLowerCase()].push(value);
|
|
10955
|
+
}
|
|
10956
|
+
const event2 = new CustomEvent("open");
|
|
10957
|
+
event2.responseCode = this.xhr.status;
|
|
10958
|
+
event2.headers = headers;
|
|
10959
|
+
this.dispatchEvent(event2);
|
|
10960
|
+
this._setReadyState(SSE.OPEN);
|
|
10961
|
+
}
|
|
10962
|
+
};
|
|
10963
|
+
this.stream = function() {
|
|
10964
|
+
if (this.xhr) {
|
|
10965
|
+
return;
|
|
10966
|
+
}
|
|
10967
|
+
this._setReadyState(SSE.CONNECTING);
|
|
10968
|
+
this.xhr = new XMLHttpRequest;
|
|
10969
|
+
this.xhr.addEventListener("progress", this._onStreamProgress.bind(this));
|
|
10970
|
+
this.xhr.addEventListener("load", this._onStreamLoaded.bind(this));
|
|
10971
|
+
this.xhr.addEventListener("readystatechange", this._onReadyStateChange.bind(this));
|
|
10972
|
+
this.xhr.addEventListener("error", this._onStreamFailure.bind(this));
|
|
10973
|
+
this.xhr.addEventListener("abort", this._onStreamAbort.bind(this));
|
|
10974
|
+
this.xhr.open(this.method, this.url);
|
|
10975
|
+
for (let header in this.headers) {
|
|
10976
|
+
this.xhr.setRequestHeader(header, this.headers[header]);
|
|
10977
|
+
}
|
|
10978
|
+
if (this.useLastEventId && this.lastEventId.length > 0) {
|
|
10979
|
+
this.xhr.setRequestHeader("Last-Event-ID", this.lastEventId);
|
|
10980
|
+
}
|
|
10981
|
+
this.xhr.withCredentials = this.withCredentials;
|
|
10982
|
+
this.xhr.send(this.payload);
|
|
10983
|
+
};
|
|
10984
|
+
this.close = function() {
|
|
10985
|
+
if (this.readyState === SSE.CLOSED) {
|
|
10986
|
+
return;
|
|
10987
|
+
}
|
|
10988
|
+
if (this.reconnectTimer) {
|
|
10989
|
+
clearTimeout(this.reconnectTimer);
|
|
10990
|
+
this.reconnectTimer = null;
|
|
10991
|
+
}
|
|
10992
|
+
this.autoReconnect = false;
|
|
10993
|
+
this.xhr.abort();
|
|
10994
|
+
};
|
|
10995
|
+
if (options2.start === undefined || options2.start) {
|
|
10996
|
+
this.stream();
|
|
10997
|
+
}
|
|
10998
|
+
};
|
|
10999
|
+
SSE.INITIALIZING = -1;
|
|
11000
|
+
SSE.CONNECTING = 0;
|
|
11001
|
+
SSE.OPEN = 1;
|
|
11002
|
+
SSE.CLOSED = 2;
|
|
11003
|
+
if (typeof exports_sse !== "undefined") {
|
|
11004
|
+
exports_sse.SSE = SSE;
|
|
11005
|
+
}
|
|
11006
|
+
|
|
10751
11007
|
// src/lib/client/api/sse-subscription.ts
|
|
10752
11008
|
class SseSubscription {
|
|
10753
11009
|
options;
|
|
11010
|
+
payload;
|
|
10754
11011
|
eventSource;
|
|
10755
11012
|
triggeredOnClose = false;
|
|
10756
|
-
constructor(url, options2) {
|
|
11013
|
+
constructor(url, options2, payload) {
|
|
10757
11014
|
this.options = options2;
|
|
10758
|
-
this.
|
|
11015
|
+
this.payload = payload;
|
|
11016
|
+
const sseoptions = { headers: { "content-type": "application/json" } };
|
|
11017
|
+
if (payload) {
|
|
11018
|
+
sseoptions.payload = JSON.stringify(payload);
|
|
11019
|
+
}
|
|
11020
|
+
if (options2.apiKey) {
|
|
11021
|
+
sseoptions.headers["api-key"] = options2.apiKey;
|
|
11022
|
+
}
|
|
11023
|
+
this.eventSource = new (options2.EventSource ?? SSE)(url, sseoptions);
|
|
10759
11024
|
this.eventSource.onmessage = (event2) => {
|
|
10760
11025
|
try {
|
|
10761
11026
|
const data = JSON.parse(event2.data);
|
|
@@ -10806,10 +11071,10 @@ class RestClient {
|
|
|
10806
11071
|
return this.options.speechRecognitionApiKey;
|
|
10807
11072
|
}
|
|
10808
11073
|
async subscribeSse(path, params = {}, options2) {
|
|
10809
|
-
const
|
|
11074
|
+
const payload = removeUndefinedValues(params);
|
|
10810
11075
|
if (this.options.apiKey)
|
|
10811
|
-
|
|
10812
|
-
return new SseSubscription(`${this.options.apiUrl}${path}
|
|
11076
|
+
options2.apiKey = this.options.apiKey;
|
|
11077
|
+
return new SseSubscription(`${this.options.apiUrl}${path}`, options2, payload);
|
|
10813
11078
|
}
|
|
10814
11079
|
async fetchData(path, validator, params = {}, options2 = {}) {
|
|
10815
11080
|
const url = `${this.options.apiUrl}${path}?${new URLSearchParams(removeUndefinedValues(params)).toString()}`;
|
|
@@ -11039,6 +11304,7 @@ class LiipGPTClientPrimitive {
|
|
|
11039
11304
|
lang: options2.lang,
|
|
11040
11305
|
model: options2.model,
|
|
11041
11306
|
feature: options2.features?.join(","),
|
|
11307
|
+
referrer: options2.referrer,
|
|
11042
11308
|
chat: "true",
|
|
11043
11309
|
version: "2"
|
|
11044
11310
|
}, {
|