qidian-vue-ui 1.0.81 → 1.0.83
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/dist/components/config-provider/index.d.ts +3 -0
- package/dist/components/config-provider/types.d.ts +2 -0
- package/dist/components/upload/index.vue.d.ts +2 -2
- package/dist/{en-US-art2skwK.mjs → en-US-Cz46iefS.mjs} +2 -2
- package/dist/{en-US-art2skwK.mjs.map → en-US-Cz46iefS.mjs.map} +1 -1
- package/dist/{en-US-VDFbyOjk.js → en-US-_vWm0Hkp.js} +2 -2
- package/dist/{en-US-VDFbyOjk.js.map → en-US-_vWm0Hkp.js.map} +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useAgentChat/index.d.ts +13 -0
- package/dist/hooks/useAgentChat/types.d.ts +41 -0
- package/dist/{index-C7MHjTkw.mjs → index-BII9oZal.mjs} +1051 -19
- package/dist/index-BII9oZal.mjs.map +1 -0
- package/dist/{index-BlJoQteI.js → index-LWHwXGdo.js} +1045 -13
- package/dist/index-LWHwXGdo.js.map +1 -0
- package/dist/qidian-vue-ui.css +13 -7
- package/dist/qidian-vue-ui.js +2 -1
- package/dist/qidian-vue-ui.js.map +1 -1
- package/dist/qidian-vue-ui.mjs +8 -7
- package/dist/{zh-TW-cICAXa5I.js → zh-TW-1dtDvCc9.js} +2 -2
- package/dist/{zh-TW-cICAXa5I.js.map → zh-TW-1dtDvCc9.js.map} +1 -1
- package/dist/{zh-TW-BbvsDYaT.mjs → zh-TW-BAgPvkPl.mjs} +2 -2
- package/dist/{zh-TW-BbvsDYaT.mjs.map → zh-TW-BAgPvkPl.mjs.map} +1 -1
- package/package.json +3 -2
- package/dist/index-BlJoQteI.js.map +0 -1
- package/dist/index-C7MHjTkw.mjs.map +0 -1
|
@@ -1350,6 +1350,8 @@ const isPromise = (val) => {
|
|
|
1350
1350
|
const identifyType = (val) => {
|
|
1351
1351
|
return toTypeStr(val).replace("[object ", "").replace("]", "").toLowerCase();
|
|
1352
1352
|
};
|
|
1353
|
+
function noop() {
|
|
1354
|
+
}
|
|
1353
1355
|
function isEmpty(val) {
|
|
1354
1356
|
if (val == null) return true;
|
|
1355
1357
|
if (typeof val === "string" && val.trim() === "") return true;
|
|
@@ -11649,6 +11651,673 @@ var __extends = /* @__PURE__ */ (function() {
|
|
|
11649
11651
|
})(RSAKey);
|
|
11650
11652
|
var _a;
|
|
11651
11653
|
typeof process !== "undefined" ? (_a = __vite_import_meta_env__1) === null || _a === void 0 ? void 0 : _a.npm_package_version : void 0;
|
|
11654
|
+
class JSONRepairError extends Error {
|
|
11655
|
+
constructor(message, position) {
|
|
11656
|
+
super(`${message} at position ${position}`);
|
|
11657
|
+
this.position = position;
|
|
11658
|
+
}
|
|
11659
|
+
}
|
|
11660
|
+
const codeSpace = 32;
|
|
11661
|
+
const codeNewline = 10;
|
|
11662
|
+
const codeTab = 9;
|
|
11663
|
+
const codeReturn = 13;
|
|
11664
|
+
const codeNonBreakingSpace = 160;
|
|
11665
|
+
const codeEnQuad = 8192;
|
|
11666
|
+
const codeHairSpace = 8202;
|
|
11667
|
+
const codeNarrowNoBreakSpace = 8239;
|
|
11668
|
+
const codeMediumMathematicalSpace = 8287;
|
|
11669
|
+
const codeIdeographicSpace = 12288;
|
|
11670
|
+
function isHex(char) {
|
|
11671
|
+
return /^[0-9A-Fa-f]$/.test(char);
|
|
11672
|
+
}
|
|
11673
|
+
function isDigit(char) {
|
|
11674
|
+
return char >= "0" && char <= "9";
|
|
11675
|
+
}
|
|
11676
|
+
function isValidStringCharacter(char) {
|
|
11677
|
+
return char >= " ";
|
|
11678
|
+
}
|
|
11679
|
+
function isDelimiter(char) {
|
|
11680
|
+
return ",:[]/{}()\n+".includes(char);
|
|
11681
|
+
}
|
|
11682
|
+
function isFunctionNameCharStart(char) {
|
|
11683
|
+
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
|
11684
|
+
}
|
|
11685
|
+
function isFunctionNameChar(char) {
|
|
11686
|
+
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$" || char >= "0" && char <= "9";
|
|
11687
|
+
}
|
|
11688
|
+
const regexUrlStart = /^(http|https|ftp|mailto|file|data|irc):\/\/$/;
|
|
11689
|
+
const regexUrlChar = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
|
|
11690
|
+
function isUnquotedStringDelimiter(char) {
|
|
11691
|
+
return ",[]/{}\n+".includes(char);
|
|
11692
|
+
}
|
|
11693
|
+
function isStartOfValue(char) {
|
|
11694
|
+
return isQuote(char) || regexStartOfValue.test(char);
|
|
11695
|
+
}
|
|
11696
|
+
const regexStartOfValue = /^[[{\w-]$/;
|
|
11697
|
+
function isControlCharacter(char) {
|
|
11698
|
+
return char === "\n" || char === "\r" || char === " " || char === "\b" || char === "\f";
|
|
11699
|
+
}
|
|
11700
|
+
function isWhitespace(text, index2) {
|
|
11701
|
+
const code = text.charCodeAt(index2);
|
|
11702
|
+
return code === codeSpace || code === codeNewline || code === codeTab || code === codeReturn;
|
|
11703
|
+
}
|
|
11704
|
+
function isWhitespaceExceptNewline(text, index2) {
|
|
11705
|
+
const code = text.charCodeAt(index2);
|
|
11706
|
+
return code === codeSpace || code === codeTab || code === codeReturn;
|
|
11707
|
+
}
|
|
11708
|
+
function isSpecialWhitespace(text, index2) {
|
|
11709
|
+
const code = text.charCodeAt(index2);
|
|
11710
|
+
return code === codeNonBreakingSpace || code >= codeEnQuad && code <= codeHairSpace || code === codeNarrowNoBreakSpace || code === codeMediumMathematicalSpace || code === codeIdeographicSpace;
|
|
11711
|
+
}
|
|
11712
|
+
function isQuote(char) {
|
|
11713
|
+
return isDoubleQuoteLike(char) || isSingleQuoteLike(char);
|
|
11714
|
+
}
|
|
11715
|
+
function isDoubleQuoteLike(char) {
|
|
11716
|
+
return char === '"' || char === "“" || char === "”";
|
|
11717
|
+
}
|
|
11718
|
+
function isDoubleQuote(char) {
|
|
11719
|
+
return char === '"';
|
|
11720
|
+
}
|
|
11721
|
+
function isSingleQuoteLike(char) {
|
|
11722
|
+
return char === "'" || char === "‘" || char === "’" || char === "`" || char === "´";
|
|
11723
|
+
}
|
|
11724
|
+
function isSingleQuote(char) {
|
|
11725
|
+
return char === "'";
|
|
11726
|
+
}
|
|
11727
|
+
function stripLastOccurrence(text, textToStrip) {
|
|
11728
|
+
let stripRemainingText = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
11729
|
+
const index2 = text.lastIndexOf(textToStrip);
|
|
11730
|
+
return index2 !== -1 ? text.substring(0, index2) + (stripRemainingText ? "" : text.substring(index2 + 1)) : text;
|
|
11731
|
+
}
|
|
11732
|
+
function insertBeforeLastWhitespace(text, textToInsert) {
|
|
11733
|
+
let index2 = text.length;
|
|
11734
|
+
if (!isWhitespace(text, index2 - 1)) {
|
|
11735
|
+
return text + textToInsert;
|
|
11736
|
+
}
|
|
11737
|
+
while (isWhitespace(text, index2 - 1)) {
|
|
11738
|
+
index2--;
|
|
11739
|
+
}
|
|
11740
|
+
return text.substring(0, index2) + textToInsert + text.substring(index2);
|
|
11741
|
+
}
|
|
11742
|
+
function removeAtIndex(text, start, count) {
|
|
11743
|
+
return text.substring(0, start) + text.substring(start + count);
|
|
11744
|
+
}
|
|
11745
|
+
function endsWithCommaOrNewline(text) {
|
|
11746
|
+
return /[,\n][ \t\r]*$/.test(text);
|
|
11747
|
+
}
|
|
11748
|
+
const controlCharacters = {
|
|
11749
|
+
"\b": "\\b",
|
|
11750
|
+
"\f": "\\f",
|
|
11751
|
+
"\n": "\\n",
|
|
11752
|
+
"\r": "\\r",
|
|
11753
|
+
" ": "\\t"
|
|
11754
|
+
};
|
|
11755
|
+
const escapeCharacters = {
|
|
11756
|
+
'"': '"',
|
|
11757
|
+
"\\": "\\",
|
|
11758
|
+
"/": "/",
|
|
11759
|
+
b: "\b",
|
|
11760
|
+
f: "\f",
|
|
11761
|
+
n: "\n",
|
|
11762
|
+
r: "\r",
|
|
11763
|
+
t: " "
|
|
11764
|
+
// note that \u is handled separately in parseString()
|
|
11765
|
+
};
|
|
11766
|
+
function jsonrepair(text) {
|
|
11767
|
+
let i = 0;
|
|
11768
|
+
let output = "";
|
|
11769
|
+
parseMarkdownCodeBlock(["```", "[```", "{```"]);
|
|
11770
|
+
const processed = parseValue();
|
|
11771
|
+
if (!processed) {
|
|
11772
|
+
throwUnexpectedEnd();
|
|
11773
|
+
}
|
|
11774
|
+
parseMarkdownCodeBlock(["```", "```]", "```}"]);
|
|
11775
|
+
const processedComma = parseCharacter(",");
|
|
11776
|
+
if (processedComma) {
|
|
11777
|
+
parseWhitespaceAndSkipComments();
|
|
11778
|
+
}
|
|
11779
|
+
if (isStartOfValue(text[i]) && endsWithCommaOrNewline(output)) {
|
|
11780
|
+
if (!processedComma) {
|
|
11781
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
11782
|
+
}
|
|
11783
|
+
parseNewlineDelimitedJSON();
|
|
11784
|
+
} else if (processedComma) {
|
|
11785
|
+
output = stripLastOccurrence(output, ",");
|
|
11786
|
+
}
|
|
11787
|
+
while (text[i] === "}" || text[i] === "]") {
|
|
11788
|
+
i++;
|
|
11789
|
+
parseWhitespaceAndSkipComments();
|
|
11790
|
+
}
|
|
11791
|
+
if (i >= text.length) {
|
|
11792
|
+
return output;
|
|
11793
|
+
}
|
|
11794
|
+
throwUnexpectedCharacter();
|
|
11795
|
+
function parseValue() {
|
|
11796
|
+
parseWhitespaceAndSkipComments();
|
|
11797
|
+
const processed2 = parseObject() || parseArray() || parseString() || parseNumber() || parseKeywords() || parseUnquotedString(false) || parseRegex();
|
|
11798
|
+
parseWhitespaceAndSkipComments();
|
|
11799
|
+
return processed2;
|
|
11800
|
+
}
|
|
11801
|
+
function parseWhitespaceAndSkipComments() {
|
|
11802
|
+
let skipNewline = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
11803
|
+
const start = i;
|
|
11804
|
+
let changed = parseWhitespace(skipNewline);
|
|
11805
|
+
do {
|
|
11806
|
+
changed = parseComment();
|
|
11807
|
+
if (changed) {
|
|
11808
|
+
changed = parseWhitespace(skipNewline);
|
|
11809
|
+
}
|
|
11810
|
+
} while (changed);
|
|
11811
|
+
return i > start;
|
|
11812
|
+
}
|
|
11813
|
+
function parseWhitespace(skipNewline) {
|
|
11814
|
+
const _isWhiteSpace = skipNewline ? isWhitespace : isWhitespaceExceptNewline;
|
|
11815
|
+
let whitespace = "";
|
|
11816
|
+
while (true) {
|
|
11817
|
+
if (_isWhiteSpace(text, i)) {
|
|
11818
|
+
whitespace += text[i];
|
|
11819
|
+
i++;
|
|
11820
|
+
} else if (isSpecialWhitespace(text, i)) {
|
|
11821
|
+
whitespace += " ";
|
|
11822
|
+
i++;
|
|
11823
|
+
} else {
|
|
11824
|
+
break;
|
|
11825
|
+
}
|
|
11826
|
+
}
|
|
11827
|
+
if (whitespace.length > 0) {
|
|
11828
|
+
output += whitespace;
|
|
11829
|
+
return true;
|
|
11830
|
+
}
|
|
11831
|
+
return false;
|
|
11832
|
+
}
|
|
11833
|
+
function parseComment() {
|
|
11834
|
+
if (text[i] === "/" && text[i + 1] === "*") {
|
|
11835
|
+
while (i < text.length && !atEndOfBlockComment(text, i)) {
|
|
11836
|
+
i++;
|
|
11837
|
+
}
|
|
11838
|
+
i += 2;
|
|
11839
|
+
return true;
|
|
11840
|
+
}
|
|
11841
|
+
if (text[i] === "/" && text[i + 1] === "/") {
|
|
11842
|
+
while (i < text.length && text[i] !== "\n") {
|
|
11843
|
+
i++;
|
|
11844
|
+
}
|
|
11845
|
+
return true;
|
|
11846
|
+
}
|
|
11847
|
+
return false;
|
|
11848
|
+
}
|
|
11849
|
+
function parseMarkdownCodeBlock(blocks) {
|
|
11850
|
+
if (skipMarkdownCodeBlock(blocks)) {
|
|
11851
|
+
if (isFunctionNameCharStart(text[i])) {
|
|
11852
|
+
while (i < text.length && isFunctionNameChar(text[i])) {
|
|
11853
|
+
i++;
|
|
11854
|
+
}
|
|
11855
|
+
}
|
|
11856
|
+
parseWhitespaceAndSkipComments();
|
|
11857
|
+
return true;
|
|
11858
|
+
}
|
|
11859
|
+
return false;
|
|
11860
|
+
}
|
|
11861
|
+
function skipMarkdownCodeBlock(blocks) {
|
|
11862
|
+
parseWhitespace(true);
|
|
11863
|
+
for (const block of blocks) {
|
|
11864
|
+
const end = i + block.length;
|
|
11865
|
+
if (text.slice(i, end) === block) {
|
|
11866
|
+
i = end;
|
|
11867
|
+
return true;
|
|
11868
|
+
}
|
|
11869
|
+
}
|
|
11870
|
+
return false;
|
|
11871
|
+
}
|
|
11872
|
+
function parseCharacter(char) {
|
|
11873
|
+
if (text[i] === char) {
|
|
11874
|
+
output += text[i];
|
|
11875
|
+
i++;
|
|
11876
|
+
return true;
|
|
11877
|
+
}
|
|
11878
|
+
return false;
|
|
11879
|
+
}
|
|
11880
|
+
function skipCharacter(char) {
|
|
11881
|
+
if (text[i] === char) {
|
|
11882
|
+
i++;
|
|
11883
|
+
return true;
|
|
11884
|
+
}
|
|
11885
|
+
return false;
|
|
11886
|
+
}
|
|
11887
|
+
function skipEscapeCharacter() {
|
|
11888
|
+
return skipCharacter("\\");
|
|
11889
|
+
}
|
|
11890
|
+
function skipEllipsis() {
|
|
11891
|
+
parseWhitespaceAndSkipComments();
|
|
11892
|
+
if (text[i] === "." && text[i + 1] === "." && text[i + 2] === ".") {
|
|
11893
|
+
i += 3;
|
|
11894
|
+
parseWhitespaceAndSkipComments();
|
|
11895
|
+
skipCharacter(",");
|
|
11896
|
+
return true;
|
|
11897
|
+
}
|
|
11898
|
+
return false;
|
|
11899
|
+
}
|
|
11900
|
+
function parseObject() {
|
|
11901
|
+
if (text[i] === "{") {
|
|
11902
|
+
output += "{";
|
|
11903
|
+
i++;
|
|
11904
|
+
parseWhitespaceAndSkipComments();
|
|
11905
|
+
if (skipCharacter(",")) {
|
|
11906
|
+
parseWhitespaceAndSkipComments();
|
|
11907
|
+
}
|
|
11908
|
+
let initial = true;
|
|
11909
|
+
while (i < text.length && text[i] !== "}") {
|
|
11910
|
+
let processedComma2;
|
|
11911
|
+
if (!initial) {
|
|
11912
|
+
processedComma2 = parseCharacter(",");
|
|
11913
|
+
if (!processedComma2) {
|
|
11914
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
11915
|
+
}
|
|
11916
|
+
parseWhitespaceAndSkipComments();
|
|
11917
|
+
} else {
|
|
11918
|
+
processedComma2 = true;
|
|
11919
|
+
initial = false;
|
|
11920
|
+
}
|
|
11921
|
+
skipEllipsis();
|
|
11922
|
+
const processedKey = parseString() || parseUnquotedString(true);
|
|
11923
|
+
if (!processedKey) {
|
|
11924
|
+
if (text[i] === "}" || text[i] === "{" || text[i] === "]" || text[i] === "[" || text[i] === void 0) {
|
|
11925
|
+
output = stripLastOccurrence(output, ",");
|
|
11926
|
+
} else {
|
|
11927
|
+
throwObjectKeyExpected();
|
|
11928
|
+
}
|
|
11929
|
+
break;
|
|
11930
|
+
}
|
|
11931
|
+
parseWhitespaceAndSkipComments();
|
|
11932
|
+
const processedColon = parseCharacter(":");
|
|
11933
|
+
const truncatedText = i >= text.length;
|
|
11934
|
+
if (!processedColon) {
|
|
11935
|
+
if (isStartOfValue(text[i]) || truncatedText) {
|
|
11936
|
+
output = insertBeforeLastWhitespace(output, ":");
|
|
11937
|
+
} else {
|
|
11938
|
+
throwColonExpected();
|
|
11939
|
+
}
|
|
11940
|
+
}
|
|
11941
|
+
const processedValue = parseValue();
|
|
11942
|
+
if (!processedValue) {
|
|
11943
|
+
if (processedColon || truncatedText) {
|
|
11944
|
+
output += "null";
|
|
11945
|
+
} else {
|
|
11946
|
+
throwColonExpected();
|
|
11947
|
+
}
|
|
11948
|
+
}
|
|
11949
|
+
}
|
|
11950
|
+
if (text[i] === "}") {
|
|
11951
|
+
output += "}";
|
|
11952
|
+
i++;
|
|
11953
|
+
} else {
|
|
11954
|
+
output = insertBeforeLastWhitespace(output, "}");
|
|
11955
|
+
}
|
|
11956
|
+
return true;
|
|
11957
|
+
}
|
|
11958
|
+
return false;
|
|
11959
|
+
}
|
|
11960
|
+
function parseArray() {
|
|
11961
|
+
if (text[i] === "[") {
|
|
11962
|
+
output += "[";
|
|
11963
|
+
i++;
|
|
11964
|
+
parseWhitespaceAndSkipComments();
|
|
11965
|
+
if (skipCharacter(",")) {
|
|
11966
|
+
parseWhitespaceAndSkipComments();
|
|
11967
|
+
}
|
|
11968
|
+
let initial = true;
|
|
11969
|
+
while (i < text.length && text[i] !== "]") {
|
|
11970
|
+
if (!initial) {
|
|
11971
|
+
const processedComma2 = parseCharacter(",");
|
|
11972
|
+
if (!processedComma2) {
|
|
11973
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
11974
|
+
}
|
|
11975
|
+
} else {
|
|
11976
|
+
initial = false;
|
|
11977
|
+
}
|
|
11978
|
+
skipEllipsis();
|
|
11979
|
+
const processedValue = parseValue();
|
|
11980
|
+
if (!processedValue) {
|
|
11981
|
+
output = stripLastOccurrence(output, ",");
|
|
11982
|
+
break;
|
|
11983
|
+
}
|
|
11984
|
+
}
|
|
11985
|
+
if (text[i] === "]") {
|
|
11986
|
+
output += "]";
|
|
11987
|
+
i++;
|
|
11988
|
+
} else {
|
|
11989
|
+
output = insertBeforeLastWhitespace(output, "]");
|
|
11990
|
+
}
|
|
11991
|
+
return true;
|
|
11992
|
+
}
|
|
11993
|
+
return false;
|
|
11994
|
+
}
|
|
11995
|
+
function parseNewlineDelimitedJSON() {
|
|
11996
|
+
let initial = true;
|
|
11997
|
+
let processedValue = true;
|
|
11998
|
+
while (processedValue) {
|
|
11999
|
+
if (!initial) {
|
|
12000
|
+
const processedComma2 = parseCharacter(",");
|
|
12001
|
+
if (!processedComma2) {
|
|
12002
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
12003
|
+
}
|
|
12004
|
+
} else {
|
|
12005
|
+
initial = false;
|
|
12006
|
+
}
|
|
12007
|
+
processedValue = parseValue();
|
|
12008
|
+
}
|
|
12009
|
+
if (!processedValue) {
|
|
12010
|
+
output = stripLastOccurrence(output, ",");
|
|
12011
|
+
}
|
|
12012
|
+
output = `[
|
|
12013
|
+
${output}
|
|
12014
|
+
]`;
|
|
12015
|
+
}
|
|
12016
|
+
function parseString() {
|
|
12017
|
+
let stopAtDelimiter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
12018
|
+
let stopAtIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1;
|
|
12019
|
+
let skipEscapeChars = text[i] === "\\";
|
|
12020
|
+
if (skipEscapeChars) {
|
|
12021
|
+
i++;
|
|
12022
|
+
skipEscapeChars = true;
|
|
12023
|
+
}
|
|
12024
|
+
if (isQuote(text[i])) {
|
|
12025
|
+
const isEndQuote = isDoubleQuote(text[i]) ? isDoubleQuote : isSingleQuote(text[i]) ? isSingleQuote : isSingleQuoteLike(text[i]) ? isSingleQuoteLike : isDoubleQuoteLike;
|
|
12026
|
+
const iBefore = i;
|
|
12027
|
+
const oBefore = output.length;
|
|
12028
|
+
let str = '"';
|
|
12029
|
+
i++;
|
|
12030
|
+
while (true) {
|
|
12031
|
+
if (i >= text.length) {
|
|
12032
|
+
const iPrev = prevNonWhitespaceIndex(i - 1);
|
|
12033
|
+
if (!stopAtDelimiter && isDelimiter(text.charAt(iPrev))) {
|
|
12034
|
+
i = iBefore;
|
|
12035
|
+
output = output.substring(0, oBefore);
|
|
12036
|
+
return parseString(true);
|
|
12037
|
+
}
|
|
12038
|
+
str = insertBeforeLastWhitespace(str, '"');
|
|
12039
|
+
output += str;
|
|
12040
|
+
return true;
|
|
12041
|
+
}
|
|
12042
|
+
if (i === stopAtIndex) {
|
|
12043
|
+
str = insertBeforeLastWhitespace(str, '"');
|
|
12044
|
+
output += str;
|
|
12045
|
+
return true;
|
|
12046
|
+
}
|
|
12047
|
+
if (isEndQuote(text[i])) {
|
|
12048
|
+
const iQuote = i;
|
|
12049
|
+
const oQuote = str.length;
|
|
12050
|
+
str += '"';
|
|
12051
|
+
i++;
|
|
12052
|
+
output += str;
|
|
12053
|
+
parseWhitespaceAndSkipComments(false);
|
|
12054
|
+
if (stopAtDelimiter || i >= text.length || isDelimiter(text[i]) || isQuote(text[i]) || isDigit(text[i])) {
|
|
12055
|
+
parseConcatenatedString();
|
|
12056
|
+
return true;
|
|
12057
|
+
}
|
|
12058
|
+
const iPrevChar = prevNonWhitespaceIndex(iQuote - 1);
|
|
12059
|
+
const prevChar = text.charAt(iPrevChar);
|
|
12060
|
+
if (prevChar === ",") {
|
|
12061
|
+
i = iBefore;
|
|
12062
|
+
output = output.substring(0, oBefore);
|
|
12063
|
+
return parseString(false, iPrevChar);
|
|
12064
|
+
}
|
|
12065
|
+
if (isDelimiter(prevChar)) {
|
|
12066
|
+
i = iBefore;
|
|
12067
|
+
output = output.substring(0, oBefore);
|
|
12068
|
+
return parseString(true);
|
|
12069
|
+
}
|
|
12070
|
+
output = output.substring(0, oBefore);
|
|
12071
|
+
i = iQuote + 1;
|
|
12072
|
+
str = `${str.substring(0, oQuote)}\\${str.substring(oQuote)}`;
|
|
12073
|
+
} else if (stopAtDelimiter && isUnquotedStringDelimiter(text[i])) {
|
|
12074
|
+
if (text[i - 1] === ":" && regexUrlStart.test(text.substring(iBefore + 1, i + 2))) {
|
|
12075
|
+
while (i < text.length && regexUrlChar.test(text[i])) {
|
|
12076
|
+
str += text[i];
|
|
12077
|
+
i++;
|
|
12078
|
+
}
|
|
12079
|
+
}
|
|
12080
|
+
str = insertBeforeLastWhitespace(str, '"');
|
|
12081
|
+
output += str;
|
|
12082
|
+
parseConcatenatedString();
|
|
12083
|
+
return true;
|
|
12084
|
+
} else if (text[i] === "\\") {
|
|
12085
|
+
const char = text.charAt(i + 1);
|
|
12086
|
+
const escapeChar = escapeCharacters[char];
|
|
12087
|
+
if (escapeChar !== void 0) {
|
|
12088
|
+
str += text.slice(i, i + 2);
|
|
12089
|
+
i += 2;
|
|
12090
|
+
} else if (char === "u") {
|
|
12091
|
+
let j = 2;
|
|
12092
|
+
while (j < 6 && isHex(text[i + j])) {
|
|
12093
|
+
j++;
|
|
12094
|
+
}
|
|
12095
|
+
if (j === 6) {
|
|
12096
|
+
str += text.slice(i, i + 6);
|
|
12097
|
+
i += 6;
|
|
12098
|
+
} else if (i + j >= text.length) {
|
|
12099
|
+
i = text.length;
|
|
12100
|
+
} else {
|
|
12101
|
+
throwInvalidUnicodeCharacter();
|
|
12102
|
+
}
|
|
12103
|
+
} else {
|
|
12104
|
+
str += char;
|
|
12105
|
+
i += 2;
|
|
12106
|
+
}
|
|
12107
|
+
} else {
|
|
12108
|
+
const char = text.charAt(i);
|
|
12109
|
+
if (char === '"' && text[i - 1] !== "\\") {
|
|
12110
|
+
str += `\\${char}`;
|
|
12111
|
+
i++;
|
|
12112
|
+
} else if (isControlCharacter(char)) {
|
|
12113
|
+
str += controlCharacters[char];
|
|
12114
|
+
i++;
|
|
12115
|
+
} else {
|
|
12116
|
+
if (!isValidStringCharacter(char)) {
|
|
12117
|
+
throwInvalidCharacter(char);
|
|
12118
|
+
}
|
|
12119
|
+
str += char;
|
|
12120
|
+
i++;
|
|
12121
|
+
}
|
|
12122
|
+
}
|
|
12123
|
+
if (skipEscapeChars) {
|
|
12124
|
+
skipEscapeCharacter();
|
|
12125
|
+
}
|
|
12126
|
+
}
|
|
12127
|
+
}
|
|
12128
|
+
return false;
|
|
12129
|
+
}
|
|
12130
|
+
function parseConcatenatedString() {
|
|
12131
|
+
let processed2 = false;
|
|
12132
|
+
parseWhitespaceAndSkipComments();
|
|
12133
|
+
while (text[i] === "+") {
|
|
12134
|
+
processed2 = true;
|
|
12135
|
+
i++;
|
|
12136
|
+
parseWhitespaceAndSkipComments();
|
|
12137
|
+
output = stripLastOccurrence(output, '"', true);
|
|
12138
|
+
const start = output.length;
|
|
12139
|
+
const parsedStr = parseString();
|
|
12140
|
+
if (parsedStr) {
|
|
12141
|
+
output = removeAtIndex(output, start, 1);
|
|
12142
|
+
} else {
|
|
12143
|
+
output = insertBeforeLastWhitespace(output, '"');
|
|
12144
|
+
}
|
|
12145
|
+
}
|
|
12146
|
+
return processed2;
|
|
12147
|
+
}
|
|
12148
|
+
function parseNumber() {
|
|
12149
|
+
const start = i;
|
|
12150
|
+
if (text[i] === "-") {
|
|
12151
|
+
i++;
|
|
12152
|
+
if (atEndOfNumber()) {
|
|
12153
|
+
repairNumberEndingWithNumericSymbol(start);
|
|
12154
|
+
return true;
|
|
12155
|
+
}
|
|
12156
|
+
if (!isDigit(text[i])) {
|
|
12157
|
+
i = start;
|
|
12158
|
+
return false;
|
|
12159
|
+
}
|
|
12160
|
+
}
|
|
12161
|
+
while (isDigit(text[i])) {
|
|
12162
|
+
i++;
|
|
12163
|
+
}
|
|
12164
|
+
if (text[i] === ".") {
|
|
12165
|
+
i++;
|
|
12166
|
+
if (atEndOfNumber()) {
|
|
12167
|
+
repairNumberEndingWithNumericSymbol(start);
|
|
12168
|
+
return true;
|
|
12169
|
+
}
|
|
12170
|
+
if (!isDigit(text[i])) {
|
|
12171
|
+
i = start;
|
|
12172
|
+
return false;
|
|
12173
|
+
}
|
|
12174
|
+
while (isDigit(text[i])) {
|
|
12175
|
+
i++;
|
|
12176
|
+
}
|
|
12177
|
+
}
|
|
12178
|
+
if (text[i] === "e" || text[i] === "E") {
|
|
12179
|
+
i++;
|
|
12180
|
+
if (text[i] === "-" || text[i] === "+") {
|
|
12181
|
+
i++;
|
|
12182
|
+
}
|
|
12183
|
+
if (atEndOfNumber()) {
|
|
12184
|
+
repairNumberEndingWithNumericSymbol(start);
|
|
12185
|
+
return true;
|
|
12186
|
+
}
|
|
12187
|
+
if (!isDigit(text[i])) {
|
|
12188
|
+
i = start;
|
|
12189
|
+
return false;
|
|
12190
|
+
}
|
|
12191
|
+
while (isDigit(text[i])) {
|
|
12192
|
+
i++;
|
|
12193
|
+
}
|
|
12194
|
+
}
|
|
12195
|
+
if (!atEndOfNumber()) {
|
|
12196
|
+
i = start;
|
|
12197
|
+
return false;
|
|
12198
|
+
}
|
|
12199
|
+
if (i > start) {
|
|
12200
|
+
const num = text.slice(start, i);
|
|
12201
|
+
const hasInvalidLeadingZero = /^0\d/.test(num);
|
|
12202
|
+
output += hasInvalidLeadingZero ? `"${num}"` : num;
|
|
12203
|
+
return true;
|
|
12204
|
+
}
|
|
12205
|
+
return false;
|
|
12206
|
+
}
|
|
12207
|
+
function parseKeywords() {
|
|
12208
|
+
return parseKeyword("true", "true") || parseKeyword("false", "false") || parseKeyword("null", "null") || // repair Python keywords True, False, None
|
|
12209
|
+
parseKeyword("True", "true") || parseKeyword("False", "false") || parseKeyword("None", "null");
|
|
12210
|
+
}
|
|
12211
|
+
function parseKeyword(name, value) {
|
|
12212
|
+
if (text.slice(i, i + name.length) === name) {
|
|
12213
|
+
output += value;
|
|
12214
|
+
i += name.length;
|
|
12215
|
+
return true;
|
|
12216
|
+
}
|
|
12217
|
+
return false;
|
|
12218
|
+
}
|
|
12219
|
+
function parseUnquotedString(isKey2) {
|
|
12220
|
+
const start = i;
|
|
12221
|
+
if (isFunctionNameCharStart(text[i])) {
|
|
12222
|
+
while (i < text.length && isFunctionNameChar(text[i])) {
|
|
12223
|
+
i++;
|
|
12224
|
+
}
|
|
12225
|
+
let j = i;
|
|
12226
|
+
while (isWhitespace(text, j)) {
|
|
12227
|
+
j++;
|
|
12228
|
+
}
|
|
12229
|
+
if (text[j] === "(") {
|
|
12230
|
+
i = j + 1;
|
|
12231
|
+
parseValue();
|
|
12232
|
+
if (text[i] === ")") {
|
|
12233
|
+
i++;
|
|
12234
|
+
if (text[i] === ";") {
|
|
12235
|
+
i++;
|
|
12236
|
+
}
|
|
12237
|
+
}
|
|
12238
|
+
return true;
|
|
12239
|
+
}
|
|
12240
|
+
}
|
|
12241
|
+
while (i < text.length && !isUnquotedStringDelimiter(text[i]) && !isQuote(text[i]) && (!isKey2 || text[i] !== ":")) {
|
|
12242
|
+
i++;
|
|
12243
|
+
}
|
|
12244
|
+
if (text[i - 1] === ":" && regexUrlStart.test(text.substring(start, i + 2))) {
|
|
12245
|
+
while (i < text.length && regexUrlChar.test(text[i])) {
|
|
12246
|
+
i++;
|
|
12247
|
+
}
|
|
12248
|
+
}
|
|
12249
|
+
if (i > start) {
|
|
12250
|
+
while (isWhitespace(text, i - 1) && i > 0) {
|
|
12251
|
+
i--;
|
|
12252
|
+
}
|
|
12253
|
+
const symbol = text.slice(start, i);
|
|
12254
|
+
output += symbol === "undefined" ? "null" : JSON.stringify(symbol);
|
|
12255
|
+
if (text[i] === '"') {
|
|
12256
|
+
i++;
|
|
12257
|
+
}
|
|
12258
|
+
return true;
|
|
12259
|
+
}
|
|
12260
|
+
}
|
|
12261
|
+
function parseRegex() {
|
|
12262
|
+
if (text[i] === "/") {
|
|
12263
|
+
const start = i;
|
|
12264
|
+
i++;
|
|
12265
|
+
while (i < text.length && (text[i] !== "/" || text[i - 1] === "\\")) {
|
|
12266
|
+
i++;
|
|
12267
|
+
}
|
|
12268
|
+
i++;
|
|
12269
|
+
output += `"${text.substring(start, i)}"`;
|
|
12270
|
+
return true;
|
|
12271
|
+
}
|
|
12272
|
+
}
|
|
12273
|
+
function prevNonWhitespaceIndex(start) {
|
|
12274
|
+
let prev = start;
|
|
12275
|
+
while (prev > 0 && isWhitespace(text, prev)) {
|
|
12276
|
+
prev--;
|
|
12277
|
+
}
|
|
12278
|
+
return prev;
|
|
12279
|
+
}
|
|
12280
|
+
function atEndOfNumber() {
|
|
12281
|
+
return i >= text.length || isDelimiter(text[i]) || isWhitespace(text, i);
|
|
12282
|
+
}
|
|
12283
|
+
function repairNumberEndingWithNumericSymbol(start) {
|
|
12284
|
+
output += `${text.slice(start, i)}0`;
|
|
12285
|
+
}
|
|
12286
|
+
function throwInvalidCharacter(char) {
|
|
12287
|
+
throw new JSONRepairError(`Invalid character ${JSON.stringify(char)}`, i);
|
|
12288
|
+
}
|
|
12289
|
+
function throwUnexpectedCharacter() {
|
|
12290
|
+
throw new JSONRepairError(`Unexpected character ${JSON.stringify(text[i])}`, i);
|
|
12291
|
+
}
|
|
12292
|
+
function throwUnexpectedEnd() {
|
|
12293
|
+
throw new JSONRepairError("Unexpected end of json string", text.length);
|
|
12294
|
+
}
|
|
12295
|
+
function throwObjectKeyExpected() {
|
|
12296
|
+
throw new JSONRepairError("Object key expected", i);
|
|
12297
|
+
}
|
|
12298
|
+
function throwColonExpected() {
|
|
12299
|
+
throw new JSONRepairError("Colon expected", i);
|
|
12300
|
+
}
|
|
12301
|
+
function throwInvalidUnicodeCharacter() {
|
|
12302
|
+
const chars = text.slice(i, i + 6);
|
|
12303
|
+
throw new JSONRepairError(`Invalid unicode character "${chars}"`, i);
|
|
12304
|
+
}
|
|
12305
|
+
}
|
|
12306
|
+
function atEndOfBlockComment(text, i) {
|
|
12307
|
+
return text[i] === "*" && text[i + 1] === "/";
|
|
12308
|
+
}
|
|
12309
|
+
function parseRelaxedJSON(str, options) {
|
|
12310
|
+
const startObj = str.indexOf("{");
|
|
12311
|
+
const endObj = str.lastIndexOf("}");
|
|
12312
|
+
const startArr = str.indexOf("[");
|
|
12313
|
+
const endArr = str.lastIndexOf("]");
|
|
12314
|
+
if (startObj > -1 && endObj > -1 && endObj > startObj) {
|
|
12315
|
+
str = str.slice(startObj, endObj + 1);
|
|
12316
|
+
} else if (startArr > -1 && endArr > -1 && endArr > startArr) {
|
|
12317
|
+
str = str.slice(startArr, endArr + 1);
|
|
12318
|
+
}
|
|
12319
|
+
return JSON.parse(jsonrepair(str));
|
|
12320
|
+
}
|
|
11652
12321
|
function to(promise, errorExt) {
|
|
11653
12322
|
return promise.then((data) => [null, data]).catch((err) => {
|
|
11654
12323
|
return [err ?? true, void 0];
|
|
@@ -11938,7 +12607,42 @@ function useServicePagination({
|
|
|
11938
12607
|
};
|
|
11939
12608
|
}
|
|
11940
12609
|
const __vite_import_meta_env__ = {};
|
|
11941
|
-
|
|
12610
|
+
const cslType = ["log", "warn", "error"];
|
|
12611
|
+
const isDev = __vite_import_meta_env__1?.NODE_ENV !== "production" || __vite_import_meta_env__ && false;
|
|
12612
|
+
function useCsl(module2) {
|
|
12613
|
+
const toStr = (data) => {
|
|
12614
|
+
if (typeof data === "object") return data.join(".");
|
|
12615
|
+
if (typeof data === "number") return data.toString();
|
|
12616
|
+
return data;
|
|
12617
|
+
};
|
|
12618
|
+
module2 = toStr(module2);
|
|
12619
|
+
const getModule = (childModule) => {
|
|
12620
|
+
if (isEmpty(childModule)) return `[${module2}]`;
|
|
12621
|
+
childModule = toStr(childModule);
|
|
12622
|
+
if (childModule) childModule = "." + childModule;
|
|
12623
|
+
return `[${module2}${childModule}]`;
|
|
12624
|
+
};
|
|
12625
|
+
const core2 = (type = "log", childModule, ...rest) => {
|
|
12626
|
+
if (isEmpty(rest)) {
|
|
12627
|
+
console[type](getModule(), childModule);
|
|
12628
|
+
return;
|
|
12629
|
+
}
|
|
12630
|
+
console[type](getModule(childModule), ...rest);
|
|
12631
|
+
};
|
|
12632
|
+
const csl2 = {
|
|
12633
|
+
useNext(childModule) {
|
|
12634
|
+
return useCsl(getModule(childModule).replace(/\[|\]/g, ""));
|
|
12635
|
+
}
|
|
12636
|
+
};
|
|
12637
|
+
cslType.forEach((item) => {
|
|
12638
|
+
const temp = (childModule, ...rest) => {
|
|
12639
|
+
core2(item, childModule, ...rest);
|
|
12640
|
+
};
|
|
12641
|
+
temp.dev = isDev ? temp : noop;
|
|
12642
|
+
csl2[item] = temp;
|
|
12643
|
+
});
|
|
12644
|
+
return csl2;
|
|
12645
|
+
}
|
|
11942
12646
|
function useTimer(type = "timeout") {
|
|
11943
12647
|
const timer = ref(null);
|
|
11944
12648
|
const clearTimer = () => {
|
|
@@ -11988,6 +12692,10 @@ const QdConfigProvider = defineComponent({
|
|
|
11988
12692
|
type: Object,
|
|
11989
12693
|
default: void 0
|
|
11990
12694
|
},
|
|
12695
|
+
agentChat: {
|
|
12696
|
+
type: Object,
|
|
12697
|
+
default: void 0
|
|
12698
|
+
},
|
|
11991
12699
|
globalConfig: {
|
|
11992
12700
|
type: Object,
|
|
11993
12701
|
default: void 0
|
|
@@ -12005,24 +12713,22 @@ const QdConfigProvider = defineComponent({
|
|
|
12005
12713
|
provide(PROVIDE_DICT, props.dict);
|
|
12006
12714
|
provide(PROVIDE_UPLOAD, props.upload);
|
|
12007
12715
|
provide(PROVIDE_GLOBAL_CONFIG, mergedGlobalConfig);
|
|
12008
|
-
if (typeof window !== "undefined") {
|
|
12009
|
-
window.__QIDIAN_USER__ = props.user;
|
|
12010
|
-
window.__QIDIAN_DICT__ = props.dict;
|
|
12011
|
-
}
|
|
12012
12716
|
watch(
|
|
12013
|
-
() => [props.user, props.dict],
|
|
12014
|
-
([newUser, newDict]) => {
|
|
12717
|
+
() => [props.user, props.dict, props.agentChat],
|
|
12718
|
+
([newUser, newDict, newAgentChat]) => {
|
|
12015
12719
|
if (typeof window !== "undefined") {
|
|
12016
12720
|
window.__QIDIAN_USER__ = newUser;
|
|
12017
12721
|
window.__QIDIAN_DICT__ = newDict;
|
|
12722
|
+
window.__QIDIAN_AGENT_CHAT__ = newAgentChat;
|
|
12018
12723
|
}
|
|
12019
|
-
}
|
|
12724
|
+
},
|
|
12725
|
+
{ immediate: true }
|
|
12020
12726
|
);
|
|
12021
12727
|
watchEffect(async () => {
|
|
12022
12728
|
const localeMap = {
|
|
12023
12729
|
"zh-CN": () => Promise.resolve().then(() => zhCN$1),
|
|
12024
|
-
"zh-TW": () => import("./zh-TW-
|
|
12025
|
-
"en-US": () => import("./en-US-
|
|
12730
|
+
"zh-TW": () => import("./zh-TW-BAgPvkPl.mjs"),
|
|
12731
|
+
"en-US": () => import("./en-US-Cz46iefS.mjs")
|
|
12026
12732
|
};
|
|
12027
12733
|
const loadLocale = localeMap[props.locale] || localeMap["zh-CN"];
|
|
12028
12734
|
const [err, res] = await to(
|
|
@@ -16496,6 +17202,330 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
16496
17202
|
}
|
|
16497
17203
|
});
|
|
16498
17204
|
const QdCrudSearch = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-13ddedb2"]]);
|
|
17205
|
+
async function getBytes(stream, onChunk) {
|
|
17206
|
+
const reader = stream.getReader();
|
|
17207
|
+
let result;
|
|
17208
|
+
while (!(result = await reader.read()).done) {
|
|
17209
|
+
onChunk(result.value);
|
|
17210
|
+
}
|
|
17211
|
+
}
|
|
17212
|
+
function getLines(onLine) {
|
|
17213
|
+
let buffer;
|
|
17214
|
+
let position;
|
|
17215
|
+
let fieldLength;
|
|
17216
|
+
let discardTrailingNewline = false;
|
|
17217
|
+
return function onChunk(arr) {
|
|
17218
|
+
if (buffer === void 0) {
|
|
17219
|
+
buffer = arr;
|
|
17220
|
+
position = 0;
|
|
17221
|
+
fieldLength = -1;
|
|
17222
|
+
} else {
|
|
17223
|
+
buffer = concat(buffer, arr);
|
|
17224
|
+
}
|
|
17225
|
+
const bufLength = buffer.length;
|
|
17226
|
+
let lineStart = 0;
|
|
17227
|
+
while (position < bufLength) {
|
|
17228
|
+
if (discardTrailingNewline) {
|
|
17229
|
+
if (buffer[position] === 10) {
|
|
17230
|
+
lineStart = ++position;
|
|
17231
|
+
}
|
|
17232
|
+
discardTrailingNewline = false;
|
|
17233
|
+
}
|
|
17234
|
+
let lineEnd = -1;
|
|
17235
|
+
for (; position < bufLength && lineEnd === -1; ++position) {
|
|
17236
|
+
switch (buffer[position]) {
|
|
17237
|
+
case 58:
|
|
17238
|
+
if (fieldLength === -1) {
|
|
17239
|
+
fieldLength = position - lineStart;
|
|
17240
|
+
}
|
|
17241
|
+
break;
|
|
17242
|
+
case 13:
|
|
17243
|
+
discardTrailingNewline = true;
|
|
17244
|
+
case 10:
|
|
17245
|
+
lineEnd = position;
|
|
17246
|
+
break;
|
|
17247
|
+
}
|
|
17248
|
+
}
|
|
17249
|
+
if (lineEnd === -1) {
|
|
17250
|
+
break;
|
|
17251
|
+
}
|
|
17252
|
+
onLine(buffer.subarray(lineStart, lineEnd), fieldLength);
|
|
17253
|
+
lineStart = position;
|
|
17254
|
+
fieldLength = -1;
|
|
17255
|
+
}
|
|
17256
|
+
if (lineStart === bufLength) {
|
|
17257
|
+
buffer = void 0;
|
|
17258
|
+
} else if (lineStart !== 0) {
|
|
17259
|
+
buffer = buffer.subarray(lineStart);
|
|
17260
|
+
position -= lineStart;
|
|
17261
|
+
}
|
|
17262
|
+
};
|
|
17263
|
+
}
|
|
17264
|
+
function getMessages(onId, onRetry, onMessage) {
|
|
17265
|
+
let message = newMessage();
|
|
17266
|
+
const decoder2 = new TextDecoder();
|
|
17267
|
+
return function onLine(line, fieldLength) {
|
|
17268
|
+
if (line.length === 0) {
|
|
17269
|
+
onMessage === null || onMessage === void 0 ? void 0 : onMessage(message);
|
|
17270
|
+
message = newMessage();
|
|
17271
|
+
} else if (fieldLength > 0) {
|
|
17272
|
+
const field = decoder2.decode(line.subarray(0, fieldLength));
|
|
17273
|
+
const valueOffset = fieldLength + (line[fieldLength + 1] === 32 ? 2 : 1);
|
|
17274
|
+
const value = decoder2.decode(line.subarray(valueOffset));
|
|
17275
|
+
switch (field) {
|
|
17276
|
+
case "data":
|
|
17277
|
+
message.data = message.data ? message.data + "\n" + value : value;
|
|
17278
|
+
break;
|
|
17279
|
+
case "event":
|
|
17280
|
+
message.event = value;
|
|
17281
|
+
break;
|
|
17282
|
+
case "id":
|
|
17283
|
+
onId(message.id = value);
|
|
17284
|
+
break;
|
|
17285
|
+
case "retry":
|
|
17286
|
+
const retry = parseInt(value, 10);
|
|
17287
|
+
if (!isNaN(retry)) {
|
|
17288
|
+
onRetry(message.retry = retry);
|
|
17289
|
+
}
|
|
17290
|
+
break;
|
|
17291
|
+
}
|
|
17292
|
+
}
|
|
17293
|
+
};
|
|
17294
|
+
}
|
|
17295
|
+
function concat(a, b) {
|
|
17296
|
+
const res = new Uint8Array(a.length + b.length);
|
|
17297
|
+
res.set(a);
|
|
17298
|
+
res.set(b, a.length);
|
|
17299
|
+
return res;
|
|
17300
|
+
}
|
|
17301
|
+
function newMessage() {
|
|
17302
|
+
return {
|
|
17303
|
+
data: "",
|
|
17304
|
+
event: "",
|
|
17305
|
+
id: "",
|
|
17306
|
+
retry: void 0
|
|
17307
|
+
};
|
|
17308
|
+
}
|
|
17309
|
+
var __rest = function(s, e) {
|
|
17310
|
+
var t = {};
|
|
17311
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
17312
|
+
t[p] = s[p];
|
|
17313
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17314
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17315
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17316
|
+
t[p[i]] = s[p[i]];
|
|
17317
|
+
}
|
|
17318
|
+
return t;
|
|
17319
|
+
};
|
|
17320
|
+
const EventStreamContentType = "text/event-stream";
|
|
17321
|
+
const DefaultRetryInterval = 1e3;
|
|
17322
|
+
const LastEventId = "last-event-id";
|
|
17323
|
+
function fetchEventSource(input, _a2) {
|
|
17324
|
+
var { signal: inputSignal, headers: inputHeaders, onopen: inputOnOpen, onmessage, onclose, onerror, openWhenHidden, fetch: inputFetch } = _a2, rest = __rest(_a2, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
17325
|
+
return new Promise((resolve, reject) => {
|
|
17326
|
+
const headers = Object.assign({}, inputHeaders);
|
|
17327
|
+
if (!headers.accept) {
|
|
17328
|
+
headers.accept = EventStreamContentType;
|
|
17329
|
+
}
|
|
17330
|
+
let curRequestController;
|
|
17331
|
+
function onVisibilityChange() {
|
|
17332
|
+
curRequestController.abort();
|
|
17333
|
+
if (!document.hidden) {
|
|
17334
|
+
create();
|
|
17335
|
+
}
|
|
17336
|
+
}
|
|
17337
|
+
if (!openWhenHidden) {
|
|
17338
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
17339
|
+
}
|
|
17340
|
+
let retryInterval = DefaultRetryInterval;
|
|
17341
|
+
let retryTimer = 0;
|
|
17342
|
+
function dispose() {
|
|
17343
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
17344
|
+
window.clearTimeout(retryTimer);
|
|
17345
|
+
curRequestController.abort();
|
|
17346
|
+
}
|
|
17347
|
+
inputSignal === null || inputSignal === void 0 ? void 0 : inputSignal.addEventListener("abort", () => {
|
|
17348
|
+
dispose();
|
|
17349
|
+
resolve();
|
|
17350
|
+
});
|
|
17351
|
+
const fetch = inputFetch !== null && inputFetch !== void 0 ? inputFetch : window.fetch;
|
|
17352
|
+
const onopen = inputOnOpen !== null && inputOnOpen !== void 0 ? inputOnOpen : defaultOnOpen;
|
|
17353
|
+
async function create() {
|
|
17354
|
+
var _a3;
|
|
17355
|
+
curRequestController = new AbortController();
|
|
17356
|
+
try {
|
|
17357
|
+
const response = await fetch(input, Object.assign(Object.assign({}, rest), { headers, signal: curRequestController.signal }));
|
|
17358
|
+
await onopen(response);
|
|
17359
|
+
await getBytes(response.body, getLines(getMessages((id) => {
|
|
17360
|
+
if (id) {
|
|
17361
|
+
headers[LastEventId] = id;
|
|
17362
|
+
} else {
|
|
17363
|
+
delete headers[LastEventId];
|
|
17364
|
+
}
|
|
17365
|
+
}, (retry) => {
|
|
17366
|
+
retryInterval = retry;
|
|
17367
|
+
}, onmessage)));
|
|
17368
|
+
onclose === null || onclose === void 0 ? void 0 : onclose();
|
|
17369
|
+
dispose();
|
|
17370
|
+
resolve();
|
|
17371
|
+
} catch (err) {
|
|
17372
|
+
if (!curRequestController.signal.aborted) {
|
|
17373
|
+
try {
|
|
17374
|
+
const interval = (_a3 = onerror === null || onerror === void 0 ? void 0 : onerror(err)) !== null && _a3 !== void 0 ? _a3 : retryInterval;
|
|
17375
|
+
window.clearTimeout(retryTimer);
|
|
17376
|
+
retryTimer = window.setTimeout(create, interval);
|
|
17377
|
+
} catch (innerErr) {
|
|
17378
|
+
dispose();
|
|
17379
|
+
reject(innerErr);
|
|
17380
|
+
}
|
|
17381
|
+
}
|
|
17382
|
+
}
|
|
17383
|
+
}
|
|
17384
|
+
create();
|
|
17385
|
+
});
|
|
17386
|
+
}
|
|
17387
|
+
function defaultOnOpen(response) {
|
|
17388
|
+
const contentType = response.headers.get("content-type");
|
|
17389
|
+
if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith(EventStreamContentType))) {
|
|
17390
|
+
throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
|
|
17391
|
+
}
|
|
17392
|
+
}
|
|
17393
|
+
const csl = useCsl("useAgentChat");
|
|
17394
|
+
function useAgentChat(options) {
|
|
17395
|
+
const globalOpt = window.__QIDIAN_AGENT_CHAT__ || {};
|
|
17396
|
+
const mergeOpt = { ...globalOpt, ...options };
|
|
17397
|
+
const loading = ref(false);
|
|
17398
|
+
const agentId = ref(mergeOpt.agentId);
|
|
17399
|
+
const apiKey = ref(mergeOpt.apiKey);
|
|
17400
|
+
const sessionId = ref("");
|
|
17401
|
+
let abortController;
|
|
17402
|
+
async function send({
|
|
17403
|
+
prompt,
|
|
17404
|
+
files,
|
|
17405
|
+
reSend,
|
|
17406
|
+
extParams,
|
|
17407
|
+
refreshSessionId,
|
|
17408
|
+
onOpen,
|
|
17409
|
+
onMessage,
|
|
17410
|
+
onClose,
|
|
17411
|
+
onError
|
|
17412
|
+
}) {
|
|
17413
|
+
const allData = { content: "", reasoning: "" };
|
|
17414
|
+
if (!prompt && isEmpty(files) && isEmpty(extParams)) return allData;
|
|
17415
|
+
loading.value = true;
|
|
17416
|
+
const agInfo = await getAgentInfo();
|
|
17417
|
+
if (!agInfo) {
|
|
17418
|
+
loading.value = false;
|
|
17419
|
+
return allData;
|
|
17420
|
+
}
|
|
17421
|
+
const sId = await getSessionId({ ...agInfo, refreshSessionId });
|
|
17422
|
+
if (!sId) {
|
|
17423
|
+
loading.value = false;
|
|
17424
|
+
return allData;
|
|
17425
|
+
}
|
|
17426
|
+
const getUrl = mergeOpt.getUrl;
|
|
17427
|
+
if (!getUrl) {
|
|
17428
|
+
loading.value = false;
|
|
17429
|
+
console.error("[useAgentChat.getUrl] 必须配置 getUrl 函数");
|
|
17430
|
+
return allData;
|
|
17431
|
+
}
|
|
17432
|
+
abortController = new AbortController();
|
|
17433
|
+
csl.log.dev("send", { ...agInfo, sessionId: sId });
|
|
17434
|
+
return new Promise((resolve, reject) => {
|
|
17435
|
+
fetchEventSource(getUrl(agInfo.agentId, sId), {
|
|
17436
|
+
method: "POST",
|
|
17437
|
+
headers: {
|
|
17438
|
+
"Content-Type": "application/json;charset=UTF-8",
|
|
17439
|
+
Authorization: `Bearer ${agInfo.apiKey}`
|
|
17440
|
+
},
|
|
17441
|
+
signal: abortController?.signal,
|
|
17442
|
+
openWhenHidden: true,
|
|
17443
|
+
body: JSON.stringify({
|
|
17444
|
+
message: prompt || "",
|
|
17445
|
+
re_chat: reSend ?? false,
|
|
17446
|
+
document_list: files,
|
|
17447
|
+
client_id: agInfo.apiKey,
|
|
17448
|
+
client_type: "API_KEY",
|
|
17449
|
+
...extParams
|
|
17450
|
+
}),
|
|
17451
|
+
onopen: async (res) => {
|
|
17452
|
+
csl.log.dev("onOpen", res);
|
|
17453
|
+
await onOpen?.(res);
|
|
17454
|
+
},
|
|
17455
|
+
onmessage: (res) => {
|
|
17456
|
+
const { data } = res;
|
|
17457
|
+
let reData = { content: "", reasoning: "" };
|
|
17458
|
+
try {
|
|
17459
|
+
reData = parseRelaxedJSON(data);
|
|
17460
|
+
if (reData.content) allData.content += reData.content;
|
|
17461
|
+
if (reData.reasoning) allData.reasoning += reData.reasoning;
|
|
17462
|
+
} catch (err) {
|
|
17463
|
+
console.warn("[useAgentChat.send.onMessage]", err);
|
|
17464
|
+
}
|
|
17465
|
+
csl.log.dev("onMessage", reData);
|
|
17466
|
+
onMessage?.({ data: reData, allData });
|
|
17467
|
+
},
|
|
17468
|
+
onclose: () => {
|
|
17469
|
+
csl.log.dev("onClose", allData);
|
|
17470
|
+
loading.value = false;
|
|
17471
|
+
onClose?.(allData);
|
|
17472
|
+
resolve(allData);
|
|
17473
|
+
},
|
|
17474
|
+
onerror: (err) => {
|
|
17475
|
+
csl.log.dev("onError", err);
|
|
17476
|
+
loading.value = false;
|
|
17477
|
+
onError?.(err);
|
|
17478
|
+
reject(err);
|
|
17479
|
+
throw err;
|
|
17480
|
+
}
|
|
17481
|
+
});
|
|
17482
|
+
});
|
|
17483
|
+
}
|
|
17484
|
+
function stop() {
|
|
17485
|
+
abortController?.abort();
|
|
17486
|
+
}
|
|
17487
|
+
async function getAgentInfo() {
|
|
17488
|
+
if (agentId.value && apiKey.value) {
|
|
17489
|
+
return { agentId: agentId.value, apiKey: apiKey.value };
|
|
17490
|
+
}
|
|
17491
|
+
const getFn = mergeOpt.getAgentInfo;
|
|
17492
|
+
if (!getFn) {
|
|
17493
|
+
console.warn("[useAgentChat.getAgentInfo] 必须配置 agentId、apiKey 或者 getAgentInfo 函数");
|
|
17494
|
+
return;
|
|
17495
|
+
}
|
|
17496
|
+
const [err, res] = await suspectedWrapperPromise(getFn());
|
|
17497
|
+
if (err) return;
|
|
17498
|
+
if (!res?.agentId || !res.apiKey) {
|
|
17499
|
+
console.warn("[useAgentChat.getAgentInfo] 未获取到 agentId、apiKey", res);
|
|
17500
|
+
return;
|
|
17501
|
+
}
|
|
17502
|
+
return res;
|
|
17503
|
+
}
|
|
17504
|
+
async function getSessionId({
|
|
17505
|
+
agentId: agentId2,
|
|
17506
|
+
apiKey: apiKey2,
|
|
17507
|
+
refreshSessionId
|
|
17508
|
+
}) {
|
|
17509
|
+
if (sessionId.value && !refreshSessionId) return sessionId.value;
|
|
17510
|
+
const getFn = mergeOpt.getSessionId;
|
|
17511
|
+
if (!getFn) {
|
|
17512
|
+
console.warn("[useAgentChat.getSessionId] 必须配置 getSessionId 函数");
|
|
17513
|
+
return;
|
|
17514
|
+
}
|
|
17515
|
+
const [err, res] = await suspectedWrapperPromise(getFn(agentId2, apiKey2));
|
|
17516
|
+
if (err) return;
|
|
17517
|
+
sessionId.value = res;
|
|
17518
|
+
return res;
|
|
17519
|
+
}
|
|
17520
|
+
return {
|
|
17521
|
+
loading,
|
|
17522
|
+
agentId,
|
|
17523
|
+
apiKey,
|
|
17524
|
+
sessionId,
|
|
17525
|
+
send,
|
|
17526
|
+
stop
|
|
17527
|
+
};
|
|
17528
|
+
}
|
|
16499
17529
|
const dictCache = /* @__PURE__ */ new Map();
|
|
16500
17530
|
const dictPromiseCache = /* @__PURE__ */ new Map();
|
|
16501
17531
|
function useDict(...args) {
|
|
@@ -18533,7 +19563,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18533
19563
|
onWaitingUploadFilesChange: { type: Function }
|
|
18534
19564
|
}, qdUploadProps),
|
|
18535
19565
|
emits: ["update:modelValue", "update:files"],
|
|
18536
|
-
setup(__props, { emit: __emit }) {
|
|
19566
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18537
19567
|
const props = __props;
|
|
18538
19568
|
const emit = __emit;
|
|
18539
19569
|
const { modelValue, files: fileList } = /* @__PURE__ */ useVModels(props, emit, {
|
|
@@ -18860,6 +19890,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18860
19890
|
onMounted(() => {
|
|
18861
19891
|
Object.assign(expose, uploadRef.value, { uploadFiles });
|
|
18862
19892
|
});
|
|
19893
|
+
__expose(expose);
|
|
18863
19894
|
return (_ctx, _cache) => {
|
|
18864
19895
|
return openBlock(), createBlock(unref(Upload), mergeProps({
|
|
18865
19896
|
ref: "upload",
|
|
@@ -18951,7 +19982,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18951
19982
|
};
|
|
18952
19983
|
}
|
|
18953
19984
|
});
|
|
18954
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
19985
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49e8a4e0"]]);
|
|
18955
19986
|
export {
|
|
18956
19987
|
QdGrid as A,
|
|
18957
19988
|
QdGridItem as B,
|
|
@@ -18965,14 +19996,15 @@ export {
|
|
|
18965
19996
|
hasPermi as J,
|
|
18966
19997
|
hasRoleDirective as K,
|
|
18967
19998
|
hasRole as L,
|
|
18968
|
-
|
|
18969
|
-
|
|
18970
|
-
|
|
19999
|
+
useAgentChat as M,
|
|
20000
|
+
useModal as N,
|
|
20001
|
+
useDict as O,
|
|
18971
20002
|
PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE as P,
|
|
18972
20003
|
QdConfigProvider as Q,
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
20004
|
+
useDictDynamic as R,
|
|
20005
|
+
useReadonly as S,
|
|
20006
|
+
useDisabled as T,
|
|
20007
|
+
auth as U,
|
|
18976
20008
|
_typeof as _,
|
|
18977
20009
|
_sfc_main$i as a,
|
|
18978
20010
|
_sfc_main$h as b,
|
|
@@ -19001,4 +20033,4 @@ export {
|
|
|
19001
20033
|
qdFormGutter as y,
|
|
19002
20034
|
qdFormGrid as z
|
|
19003
20035
|
};
|
|
19004
|
-
//# sourceMappingURL=index-
|
|
20036
|
+
//# sourceMappingURL=index-BII9oZal.mjs.map
|