qidian-vue-ui 1.0.80 → 1.0.82
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-CEwsHEtM.mjs → en-US-B0M-dhXb.mjs} +2 -2
- package/dist/{en-US-CEwsHEtM.mjs.map → en-US-B0M-dhXb.mjs.map} +1 -1
- package/dist/{en-US-CRhCG6dB.js → en-US-DPSYm20A.js} +2 -2
- package/dist/{en-US-CRhCG6dB.js.map → en-US-DPSYm20A.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-C_utdxmy.js → index-BdtBNVcI.js} +1002 -14
- package/dist/index-BdtBNVcI.js.map +1 -0
- package/dist/{index-CLWHaMZs.mjs → index-CEqpomWn.mjs} +1008 -20
- package/dist/index-CEqpomWn.mjs.map +1 -0
- package/dist/qidian-vue-ui.css +16 -10
- 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-DkuYymjb.mjs → zh-TW-BVl6IXiW.mjs} +2 -2
- package/dist/{zh-TW-DkuYymjb.mjs.map → zh-TW-BVl6IXiW.mjs.map} +1 -1
- package/dist/{zh-TW-C7okul_R.js → zh-TW-OiGfhtFy.js} +2 -2
- package/dist/{zh-TW-C7okul_R.js.map → zh-TW-OiGfhtFy.js.map} +1 -1
- package/package.json +3 -2
- package/dist/index-CLWHaMZs.mjs.map +0 -1
- package/dist/index-C_utdxmy.js.map +0 -1
|
@@ -11650,6 +11650,673 @@ var __extends = /* @__PURE__ */ (function() {
|
|
|
11650
11650
|
})(RSAKey);
|
|
11651
11651
|
var _a;
|
|
11652
11652
|
typeof process !== "undefined" ? (_a = __vite_import_meta_env__1) === null || _a === void 0 ? void 0 : _a.npm_package_version : void 0;
|
|
11653
|
+
class JSONRepairError extends Error {
|
|
11654
|
+
constructor(message, position) {
|
|
11655
|
+
super(`${message} at position ${position}`);
|
|
11656
|
+
this.position = position;
|
|
11657
|
+
}
|
|
11658
|
+
}
|
|
11659
|
+
const codeSpace = 32;
|
|
11660
|
+
const codeNewline = 10;
|
|
11661
|
+
const codeTab = 9;
|
|
11662
|
+
const codeReturn = 13;
|
|
11663
|
+
const codeNonBreakingSpace = 160;
|
|
11664
|
+
const codeEnQuad = 8192;
|
|
11665
|
+
const codeHairSpace = 8202;
|
|
11666
|
+
const codeNarrowNoBreakSpace = 8239;
|
|
11667
|
+
const codeMediumMathematicalSpace = 8287;
|
|
11668
|
+
const codeIdeographicSpace = 12288;
|
|
11669
|
+
function isHex(char) {
|
|
11670
|
+
return /^[0-9A-Fa-f]$/.test(char);
|
|
11671
|
+
}
|
|
11672
|
+
function isDigit(char) {
|
|
11673
|
+
return char >= "0" && char <= "9";
|
|
11674
|
+
}
|
|
11675
|
+
function isValidStringCharacter(char) {
|
|
11676
|
+
return char >= " ";
|
|
11677
|
+
}
|
|
11678
|
+
function isDelimiter(char) {
|
|
11679
|
+
return ",:[]/{}()\n+".includes(char);
|
|
11680
|
+
}
|
|
11681
|
+
function isFunctionNameCharStart(char) {
|
|
11682
|
+
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
|
11683
|
+
}
|
|
11684
|
+
function isFunctionNameChar(char) {
|
|
11685
|
+
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$" || char >= "0" && char <= "9";
|
|
11686
|
+
}
|
|
11687
|
+
const regexUrlStart = /^(http|https|ftp|mailto|file|data|irc):\/\/$/;
|
|
11688
|
+
const regexUrlChar = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
|
|
11689
|
+
function isUnquotedStringDelimiter(char) {
|
|
11690
|
+
return ",[]/{}\n+".includes(char);
|
|
11691
|
+
}
|
|
11692
|
+
function isStartOfValue(char) {
|
|
11693
|
+
return isQuote(char) || regexStartOfValue.test(char);
|
|
11694
|
+
}
|
|
11695
|
+
const regexStartOfValue = /^[[{\w-]$/;
|
|
11696
|
+
function isControlCharacter(char) {
|
|
11697
|
+
return char === "\n" || char === "\r" || char === " " || char === "\b" || char === "\f";
|
|
11698
|
+
}
|
|
11699
|
+
function isWhitespace(text, index2) {
|
|
11700
|
+
const code = text.charCodeAt(index2);
|
|
11701
|
+
return code === codeSpace || code === codeNewline || code === codeTab || code === codeReturn;
|
|
11702
|
+
}
|
|
11703
|
+
function isWhitespaceExceptNewline(text, index2) {
|
|
11704
|
+
const code = text.charCodeAt(index2);
|
|
11705
|
+
return code === codeSpace || code === codeTab || code === codeReturn;
|
|
11706
|
+
}
|
|
11707
|
+
function isSpecialWhitespace(text, index2) {
|
|
11708
|
+
const code = text.charCodeAt(index2);
|
|
11709
|
+
return code === codeNonBreakingSpace || code >= codeEnQuad && code <= codeHairSpace || code === codeNarrowNoBreakSpace || code === codeMediumMathematicalSpace || code === codeIdeographicSpace;
|
|
11710
|
+
}
|
|
11711
|
+
function isQuote(char) {
|
|
11712
|
+
return isDoubleQuoteLike(char) || isSingleQuoteLike(char);
|
|
11713
|
+
}
|
|
11714
|
+
function isDoubleQuoteLike(char) {
|
|
11715
|
+
return char === '"' || char === "“" || char === "”";
|
|
11716
|
+
}
|
|
11717
|
+
function isDoubleQuote(char) {
|
|
11718
|
+
return char === '"';
|
|
11719
|
+
}
|
|
11720
|
+
function isSingleQuoteLike(char) {
|
|
11721
|
+
return char === "'" || char === "‘" || char === "’" || char === "`" || char === "´";
|
|
11722
|
+
}
|
|
11723
|
+
function isSingleQuote(char) {
|
|
11724
|
+
return char === "'";
|
|
11725
|
+
}
|
|
11726
|
+
function stripLastOccurrence(text, textToStrip) {
|
|
11727
|
+
let stripRemainingText = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
11728
|
+
const index2 = text.lastIndexOf(textToStrip);
|
|
11729
|
+
return index2 !== -1 ? text.substring(0, index2) + (stripRemainingText ? "" : text.substring(index2 + 1)) : text;
|
|
11730
|
+
}
|
|
11731
|
+
function insertBeforeLastWhitespace(text, textToInsert) {
|
|
11732
|
+
let index2 = text.length;
|
|
11733
|
+
if (!isWhitespace(text, index2 - 1)) {
|
|
11734
|
+
return text + textToInsert;
|
|
11735
|
+
}
|
|
11736
|
+
while (isWhitespace(text, index2 - 1)) {
|
|
11737
|
+
index2--;
|
|
11738
|
+
}
|
|
11739
|
+
return text.substring(0, index2) + textToInsert + text.substring(index2);
|
|
11740
|
+
}
|
|
11741
|
+
function removeAtIndex(text, start, count) {
|
|
11742
|
+
return text.substring(0, start) + text.substring(start + count);
|
|
11743
|
+
}
|
|
11744
|
+
function endsWithCommaOrNewline(text) {
|
|
11745
|
+
return /[,\n][ \t\r]*$/.test(text);
|
|
11746
|
+
}
|
|
11747
|
+
const controlCharacters = {
|
|
11748
|
+
"\b": "\\b",
|
|
11749
|
+
"\f": "\\f",
|
|
11750
|
+
"\n": "\\n",
|
|
11751
|
+
"\r": "\\r",
|
|
11752
|
+
" ": "\\t"
|
|
11753
|
+
};
|
|
11754
|
+
const escapeCharacters = {
|
|
11755
|
+
'"': '"',
|
|
11756
|
+
"\\": "\\",
|
|
11757
|
+
"/": "/",
|
|
11758
|
+
b: "\b",
|
|
11759
|
+
f: "\f",
|
|
11760
|
+
n: "\n",
|
|
11761
|
+
r: "\r",
|
|
11762
|
+
t: " "
|
|
11763
|
+
// note that \u is handled separately in parseString()
|
|
11764
|
+
};
|
|
11765
|
+
function jsonrepair(text) {
|
|
11766
|
+
let i = 0;
|
|
11767
|
+
let output = "";
|
|
11768
|
+
parseMarkdownCodeBlock(["```", "[```", "{```"]);
|
|
11769
|
+
const processed = parseValue();
|
|
11770
|
+
if (!processed) {
|
|
11771
|
+
throwUnexpectedEnd();
|
|
11772
|
+
}
|
|
11773
|
+
parseMarkdownCodeBlock(["```", "```]", "```}"]);
|
|
11774
|
+
const processedComma = parseCharacter(",");
|
|
11775
|
+
if (processedComma) {
|
|
11776
|
+
parseWhitespaceAndSkipComments();
|
|
11777
|
+
}
|
|
11778
|
+
if (isStartOfValue(text[i]) && endsWithCommaOrNewline(output)) {
|
|
11779
|
+
if (!processedComma) {
|
|
11780
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
11781
|
+
}
|
|
11782
|
+
parseNewlineDelimitedJSON();
|
|
11783
|
+
} else if (processedComma) {
|
|
11784
|
+
output = stripLastOccurrence(output, ",");
|
|
11785
|
+
}
|
|
11786
|
+
while (text[i] === "}" || text[i] === "]") {
|
|
11787
|
+
i++;
|
|
11788
|
+
parseWhitespaceAndSkipComments();
|
|
11789
|
+
}
|
|
11790
|
+
if (i >= text.length) {
|
|
11791
|
+
return output;
|
|
11792
|
+
}
|
|
11793
|
+
throwUnexpectedCharacter();
|
|
11794
|
+
function parseValue() {
|
|
11795
|
+
parseWhitespaceAndSkipComments();
|
|
11796
|
+
const processed2 = parseObject() || parseArray() || parseString() || parseNumber() || parseKeywords() || parseUnquotedString(false) || parseRegex();
|
|
11797
|
+
parseWhitespaceAndSkipComments();
|
|
11798
|
+
return processed2;
|
|
11799
|
+
}
|
|
11800
|
+
function parseWhitespaceAndSkipComments() {
|
|
11801
|
+
let skipNewline = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
11802
|
+
const start = i;
|
|
11803
|
+
let changed = parseWhitespace(skipNewline);
|
|
11804
|
+
do {
|
|
11805
|
+
changed = parseComment();
|
|
11806
|
+
if (changed) {
|
|
11807
|
+
changed = parseWhitespace(skipNewline);
|
|
11808
|
+
}
|
|
11809
|
+
} while (changed);
|
|
11810
|
+
return i > start;
|
|
11811
|
+
}
|
|
11812
|
+
function parseWhitespace(skipNewline) {
|
|
11813
|
+
const _isWhiteSpace = skipNewline ? isWhitespace : isWhitespaceExceptNewline;
|
|
11814
|
+
let whitespace = "";
|
|
11815
|
+
while (true) {
|
|
11816
|
+
if (_isWhiteSpace(text, i)) {
|
|
11817
|
+
whitespace += text[i];
|
|
11818
|
+
i++;
|
|
11819
|
+
} else if (isSpecialWhitespace(text, i)) {
|
|
11820
|
+
whitespace += " ";
|
|
11821
|
+
i++;
|
|
11822
|
+
} else {
|
|
11823
|
+
break;
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
if (whitespace.length > 0) {
|
|
11827
|
+
output += whitespace;
|
|
11828
|
+
return true;
|
|
11829
|
+
}
|
|
11830
|
+
return false;
|
|
11831
|
+
}
|
|
11832
|
+
function parseComment() {
|
|
11833
|
+
if (text[i] === "/" && text[i + 1] === "*") {
|
|
11834
|
+
while (i < text.length && !atEndOfBlockComment(text, i)) {
|
|
11835
|
+
i++;
|
|
11836
|
+
}
|
|
11837
|
+
i += 2;
|
|
11838
|
+
return true;
|
|
11839
|
+
}
|
|
11840
|
+
if (text[i] === "/" && text[i + 1] === "/") {
|
|
11841
|
+
while (i < text.length && text[i] !== "\n") {
|
|
11842
|
+
i++;
|
|
11843
|
+
}
|
|
11844
|
+
return true;
|
|
11845
|
+
}
|
|
11846
|
+
return false;
|
|
11847
|
+
}
|
|
11848
|
+
function parseMarkdownCodeBlock(blocks) {
|
|
11849
|
+
if (skipMarkdownCodeBlock(blocks)) {
|
|
11850
|
+
if (isFunctionNameCharStart(text[i])) {
|
|
11851
|
+
while (i < text.length && isFunctionNameChar(text[i])) {
|
|
11852
|
+
i++;
|
|
11853
|
+
}
|
|
11854
|
+
}
|
|
11855
|
+
parseWhitespaceAndSkipComments();
|
|
11856
|
+
return true;
|
|
11857
|
+
}
|
|
11858
|
+
return false;
|
|
11859
|
+
}
|
|
11860
|
+
function skipMarkdownCodeBlock(blocks) {
|
|
11861
|
+
parseWhitespace(true);
|
|
11862
|
+
for (const block of blocks) {
|
|
11863
|
+
const end = i + block.length;
|
|
11864
|
+
if (text.slice(i, end) === block) {
|
|
11865
|
+
i = end;
|
|
11866
|
+
return true;
|
|
11867
|
+
}
|
|
11868
|
+
}
|
|
11869
|
+
return false;
|
|
11870
|
+
}
|
|
11871
|
+
function parseCharacter(char) {
|
|
11872
|
+
if (text[i] === char) {
|
|
11873
|
+
output += text[i];
|
|
11874
|
+
i++;
|
|
11875
|
+
return true;
|
|
11876
|
+
}
|
|
11877
|
+
return false;
|
|
11878
|
+
}
|
|
11879
|
+
function skipCharacter(char) {
|
|
11880
|
+
if (text[i] === char) {
|
|
11881
|
+
i++;
|
|
11882
|
+
return true;
|
|
11883
|
+
}
|
|
11884
|
+
return false;
|
|
11885
|
+
}
|
|
11886
|
+
function skipEscapeCharacter() {
|
|
11887
|
+
return skipCharacter("\\");
|
|
11888
|
+
}
|
|
11889
|
+
function skipEllipsis() {
|
|
11890
|
+
parseWhitespaceAndSkipComments();
|
|
11891
|
+
if (text[i] === "." && text[i + 1] === "." && text[i + 2] === ".") {
|
|
11892
|
+
i += 3;
|
|
11893
|
+
parseWhitespaceAndSkipComments();
|
|
11894
|
+
skipCharacter(",");
|
|
11895
|
+
return true;
|
|
11896
|
+
}
|
|
11897
|
+
return false;
|
|
11898
|
+
}
|
|
11899
|
+
function parseObject() {
|
|
11900
|
+
if (text[i] === "{") {
|
|
11901
|
+
output += "{";
|
|
11902
|
+
i++;
|
|
11903
|
+
parseWhitespaceAndSkipComments();
|
|
11904
|
+
if (skipCharacter(",")) {
|
|
11905
|
+
parseWhitespaceAndSkipComments();
|
|
11906
|
+
}
|
|
11907
|
+
let initial = true;
|
|
11908
|
+
while (i < text.length && text[i] !== "}") {
|
|
11909
|
+
let processedComma2;
|
|
11910
|
+
if (!initial) {
|
|
11911
|
+
processedComma2 = parseCharacter(",");
|
|
11912
|
+
if (!processedComma2) {
|
|
11913
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
11914
|
+
}
|
|
11915
|
+
parseWhitespaceAndSkipComments();
|
|
11916
|
+
} else {
|
|
11917
|
+
processedComma2 = true;
|
|
11918
|
+
initial = false;
|
|
11919
|
+
}
|
|
11920
|
+
skipEllipsis();
|
|
11921
|
+
const processedKey = parseString() || parseUnquotedString(true);
|
|
11922
|
+
if (!processedKey) {
|
|
11923
|
+
if (text[i] === "}" || text[i] === "{" || text[i] === "]" || text[i] === "[" || text[i] === void 0) {
|
|
11924
|
+
output = stripLastOccurrence(output, ",");
|
|
11925
|
+
} else {
|
|
11926
|
+
throwObjectKeyExpected();
|
|
11927
|
+
}
|
|
11928
|
+
break;
|
|
11929
|
+
}
|
|
11930
|
+
parseWhitespaceAndSkipComments();
|
|
11931
|
+
const processedColon = parseCharacter(":");
|
|
11932
|
+
const truncatedText = i >= text.length;
|
|
11933
|
+
if (!processedColon) {
|
|
11934
|
+
if (isStartOfValue(text[i]) || truncatedText) {
|
|
11935
|
+
output = insertBeforeLastWhitespace(output, ":");
|
|
11936
|
+
} else {
|
|
11937
|
+
throwColonExpected();
|
|
11938
|
+
}
|
|
11939
|
+
}
|
|
11940
|
+
const processedValue = parseValue();
|
|
11941
|
+
if (!processedValue) {
|
|
11942
|
+
if (processedColon || truncatedText) {
|
|
11943
|
+
output += "null";
|
|
11944
|
+
} else {
|
|
11945
|
+
throwColonExpected();
|
|
11946
|
+
}
|
|
11947
|
+
}
|
|
11948
|
+
}
|
|
11949
|
+
if (text[i] === "}") {
|
|
11950
|
+
output += "}";
|
|
11951
|
+
i++;
|
|
11952
|
+
} else {
|
|
11953
|
+
output = insertBeforeLastWhitespace(output, "}");
|
|
11954
|
+
}
|
|
11955
|
+
return true;
|
|
11956
|
+
}
|
|
11957
|
+
return false;
|
|
11958
|
+
}
|
|
11959
|
+
function parseArray() {
|
|
11960
|
+
if (text[i] === "[") {
|
|
11961
|
+
output += "[";
|
|
11962
|
+
i++;
|
|
11963
|
+
parseWhitespaceAndSkipComments();
|
|
11964
|
+
if (skipCharacter(",")) {
|
|
11965
|
+
parseWhitespaceAndSkipComments();
|
|
11966
|
+
}
|
|
11967
|
+
let initial = true;
|
|
11968
|
+
while (i < text.length && text[i] !== "]") {
|
|
11969
|
+
if (!initial) {
|
|
11970
|
+
const processedComma2 = parseCharacter(",");
|
|
11971
|
+
if (!processedComma2) {
|
|
11972
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
11973
|
+
}
|
|
11974
|
+
} else {
|
|
11975
|
+
initial = false;
|
|
11976
|
+
}
|
|
11977
|
+
skipEllipsis();
|
|
11978
|
+
const processedValue = parseValue();
|
|
11979
|
+
if (!processedValue) {
|
|
11980
|
+
output = stripLastOccurrence(output, ",");
|
|
11981
|
+
break;
|
|
11982
|
+
}
|
|
11983
|
+
}
|
|
11984
|
+
if (text[i] === "]") {
|
|
11985
|
+
output += "]";
|
|
11986
|
+
i++;
|
|
11987
|
+
} else {
|
|
11988
|
+
output = insertBeforeLastWhitespace(output, "]");
|
|
11989
|
+
}
|
|
11990
|
+
return true;
|
|
11991
|
+
}
|
|
11992
|
+
return false;
|
|
11993
|
+
}
|
|
11994
|
+
function parseNewlineDelimitedJSON() {
|
|
11995
|
+
let initial = true;
|
|
11996
|
+
let processedValue = true;
|
|
11997
|
+
while (processedValue) {
|
|
11998
|
+
if (!initial) {
|
|
11999
|
+
const processedComma2 = parseCharacter(",");
|
|
12000
|
+
if (!processedComma2) {
|
|
12001
|
+
output = insertBeforeLastWhitespace(output, ",");
|
|
12002
|
+
}
|
|
12003
|
+
} else {
|
|
12004
|
+
initial = false;
|
|
12005
|
+
}
|
|
12006
|
+
processedValue = parseValue();
|
|
12007
|
+
}
|
|
12008
|
+
if (!processedValue) {
|
|
12009
|
+
output = stripLastOccurrence(output, ",");
|
|
12010
|
+
}
|
|
12011
|
+
output = `[
|
|
12012
|
+
${output}
|
|
12013
|
+
]`;
|
|
12014
|
+
}
|
|
12015
|
+
function parseString() {
|
|
12016
|
+
let stopAtDelimiter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
12017
|
+
let stopAtIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1;
|
|
12018
|
+
let skipEscapeChars = text[i] === "\\";
|
|
12019
|
+
if (skipEscapeChars) {
|
|
12020
|
+
i++;
|
|
12021
|
+
skipEscapeChars = true;
|
|
12022
|
+
}
|
|
12023
|
+
if (isQuote(text[i])) {
|
|
12024
|
+
const isEndQuote = isDoubleQuote(text[i]) ? isDoubleQuote : isSingleQuote(text[i]) ? isSingleQuote : isSingleQuoteLike(text[i]) ? isSingleQuoteLike : isDoubleQuoteLike;
|
|
12025
|
+
const iBefore = i;
|
|
12026
|
+
const oBefore = output.length;
|
|
12027
|
+
let str = '"';
|
|
12028
|
+
i++;
|
|
12029
|
+
while (true) {
|
|
12030
|
+
if (i >= text.length) {
|
|
12031
|
+
const iPrev = prevNonWhitespaceIndex(i - 1);
|
|
12032
|
+
if (!stopAtDelimiter && isDelimiter(text.charAt(iPrev))) {
|
|
12033
|
+
i = iBefore;
|
|
12034
|
+
output = output.substring(0, oBefore);
|
|
12035
|
+
return parseString(true);
|
|
12036
|
+
}
|
|
12037
|
+
str = insertBeforeLastWhitespace(str, '"');
|
|
12038
|
+
output += str;
|
|
12039
|
+
return true;
|
|
12040
|
+
}
|
|
12041
|
+
if (i === stopAtIndex) {
|
|
12042
|
+
str = insertBeforeLastWhitespace(str, '"');
|
|
12043
|
+
output += str;
|
|
12044
|
+
return true;
|
|
12045
|
+
}
|
|
12046
|
+
if (isEndQuote(text[i])) {
|
|
12047
|
+
const iQuote = i;
|
|
12048
|
+
const oQuote = str.length;
|
|
12049
|
+
str += '"';
|
|
12050
|
+
i++;
|
|
12051
|
+
output += str;
|
|
12052
|
+
parseWhitespaceAndSkipComments(false);
|
|
12053
|
+
if (stopAtDelimiter || i >= text.length || isDelimiter(text[i]) || isQuote(text[i]) || isDigit(text[i])) {
|
|
12054
|
+
parseConcatenatedString();
|
|
12055
|
+
return true;
|
|
12056
|
+
}
|
|
12057
|
+
const iPrevChar = prevNonWhitespaceIndex(iQuote - 1);
|
|
12058
|
+
const prevChar = text.charAt(iPrevChar);
|
|
12059
|
+
if (prevChar === ",") {
|
|
12060
|
+
i = iBefore;
|
|
12061
|
+
output = output.substring(0, oBefore);
|
|
12062
|
+
return parseString(false, iPrevChar);
|
|
12063
|
+
}
|
|
12064
|
+
if (isDelimiter(prevChar)) {
|
|
12065
|
+
i = iBefore;
|
|
12066
|
+
output = output.substring(0, oBefore);
|
|
12067
|
+
return parseString(true);
|
|
12068
|
+
}
|
|
12069
|
+
output = output.substring(0, oBefore);
|
|
12070
|
+
i = iQuote + 1;
|
|
12071
|
+
str = `${str.substring(0, oQuote)}\\${str.substring(oQuote)}`;
|
|
12072
|
+
} else if (stopAtDelimiter && isUnquotedStringDelimiter(text[i])) {
|
|
12073
|
+
if (text[i - 1] === ":" && regexUrlStart.test(text.substring(iBefore + 1, i + 2))) {
|
|
12074
|
+
while (i < text.length && regexUrlChar.test(text[i])) {
|
|
12075
|
+
str += text[i];
|
|
12076
|
+
i++;
|
|
12077
|
+
}
|
|
12078
|
+
}
|
|
12079
|
+
str = insertBeforeLastWhitespace(str, '"');
|
|
12080
|
+
output += str;
|
|
12081
|
+
parseConcatenatedString();
|
|
12082
|
+
return true;
|
|
12083
|
+
} else if (text[i] === "\\") {
|
|
12084
|
+
const char = text.charAt(i + 1);
|
|
12085
|
+
const escapeChar = escapeCharacters[char];
|
|
12086
|
+
if (escapeChar !== void 0) {
|
|
12087
|
+
str += text.slice(i, i + 2);
|
|
12088
|
+
i += 2;
|
|
12089
|
+
} else if (char === "u") {
|
|
12090
|
+
let j = 2;
|
|
12091
|
+
while (j < 6 && isHex(text[i + j])) {
|
|
12092
|
+
j++;
|
|
12093
|
+
}
|
|
12094
|
+
if (j === 6) {
|
|
12095
|
+
str += text.slice(i, i + 6);
|
|
12096
|
+
i += 6;
|
|
12097
|
+
} else if (i + j >= text.length) {
|
|
12098
|
+
i = text.length;
|
|
12099
|
+
} else {
|
|
12100
|
+
throwInvalidUnicodeCharacter();
|
|
12101
|
+
}
|
|
12102
|
+
} else {
|
|
12103
|
+
str += char;
|
|
12104
|
+
i += 2;
|
|
12105
|
+
}
|
|
12106
|
+
} else {
|
|
12107
|
+
const char = text.charAt(i);
|
|
12108
|
+
if (char === '"' && text[i - 1] !== "\\") {
|
|
12109
|
+
str += `\\${char}`;
|
|
12110
|
+
i++;
|
|
12111
|
+
} else if (isControlCharacter(char)) {
|
|
12112
|
+
str += controlCharacters[char];
|
|
12113
|
+
i++;
|
|
12114
|
+
} else {
|
|
12115
|
+
if (!isValidStringCharacter(char)) {
|
|
12116
|
+
throwInvalidCharacter(char);
|
|
12117
|
+
}
|
|
12118
|
+
str += char;
|
|
12119
|
+
i++;
|
|
12120
|
+
}
|
|
12121
|
+
}
|
|
12122
|
+
if (skipEscapeChars) {
|
|
12123
|
+
skipEscapeCharacter();
|
|
12124
|
+
}
|
|
12125
|
+
}
|
|
12126
|
+
}
|
|
12127
|
+
return false;
|
|
12128
|
+
}
|
|
12129
|
+
function parseConcatenatedString() {
|
|
12130
|
+
let processed2 = false;
|
|
12131
|
+
parseWhitespaceAndSkipComments();
|
|
12132
|
+
while (text[i] === "+") {
|
|
12133
|
+
processed2 = true;
|
|
12134
|
+
i++;
|
|
12135
|
+
parseWhitespaceAndSkipComments();
|
|
12136
|
+
output = stripLastOccurrence(output, '"', true);
|
|
12137
|
+
const start = output.length;
|
|
12138
|
+
const parsedStr = parseString();
|
|
12139
|
+
if (parsedStr) {
|
|
12140
|
+
output = removeAtIndex(output, start, 1);
|
|
12141
|
+
} else {
|
|
12142
|
+
output = insertBeforeLastWhitespace(output, '"');
|
|
12143
|
+
}
|
|
12144
|
+
}
|
|
12145
|
+
return processed2;
|
|
12146
|
+
}
|
|
12147
|
+
function parseNumber() {
|
|
12148
|
+
const start = i;
|
|
12149
|
+
if (text[i] === "-") {
|
|
12150
|
+
i++;
|
|
12151
|
+
if (atEndOfNumber()) {
|
|
12152
|
+
repairNumberEndingWithNumericSymbol(start);
|
|
12153
|
+
return true;
|
|
12154
|
+
}
|
|
12155
|
+
if (!isDigit(text[i])) {
|
|
12156
|
+
i = start;
|
|
12157
|
+
return false;
|
|
12158
|
+
}
|
|
12159
|
+
}
|
|
12160
|
+
while (isDigit(text[i])) {
|
|
12161
|
+
i++;
|
|
12162
|
+
}
|
|
12163
|
+
if (text[i] === ".") {
|
|
12164
|
+
i++;
|
|
12165
|
+
if (atEndOfNumber()) {
|
|
12166
|
+
repairNumberEndingWithNumericSymbol(start);
|
|
12167
|
+
return true;
|
|
12168
|
+
}
|
|
12169
|
+
if (!isDigit(text[i])) {
|
|
12170
|
+
i = start;
|
|
12171
|
+
return false;
|
|
12172
|
+
}
|
|
12173
|
+
while (isDigit(text[i])) {
|
|
12174
|
+
i++;
|
|
12175
|
+
}
|
|
12176
|
+
}
|
|
12177
|
+
if (text[i] === "e" || text[i] === "E") {
|
|
12178
|
+
i++;
|
|
12179
|
+
if (text[i] === "-" || text[i] === "+") {
|
|
12180
|
+
i++;
|
|
12181
|
+
}
|
|
12182
|
+
if (atEndOfNumber()) {
|
|
12183
|
+
repairNumberEndingWithNumericSymbol(start);
|
|
12184
|
+
return true;
|
|
12185
|
+
}
|
|
12186
|
+
if (!isDigit(text[i])) {
|
|
12187
|
+
i = start;
|
|
12188
|
+
return false;
|
|
12189
|
+
}
|
|
12190
|
+
while (isDigit(text[i])) {
|
|
12191
|
+
i++;
|
|
12192
|
+
}
|
|
12193
|
+
}
|
|
12194
|
+
if (!atEndOfNumber()) {
|
|
12195
|
+
i = start;
|
|
12196
|
+
return false;
|
|
12197
|
+
}
|
|
12198
|
+
if (i > start) {
|
|
12199
|
+
const num = text.slice(start, i);
|
|
12200
|
+
const hasInvalidLeadingZero = /^0\d/.test(num);
|
|
12201
|
+
output += hasInvalidLeadingZero ? `"${num}"` : num;
|
|
12202
|
+
return true;
|
|
12203
|
+
}
|
|
12204
|
+
return false;
|
|
12205
|
+
}
|
|
12206
|
+
function parseKeywords() {
|
|
12207
|
+
return parseKeyword("true", "true") || parseKeyword("false", "false") || parseKeyword("null", "null") || // repair Python keywords True, False, None
|
|
12208
|
+
parseKeyword("True", "true") || parseKeyword("False", "false") || parseKeyword("None", "null");
|
|
12209
|
+
}
|
|
12210
|
+
function parseKeyword(name, value) {
|
|
12211
|
+
if (text.slice(i, i + name.length) === name) {
|
|
12212
|
+
output += value;
|
|
12213
|
+
i += name.length;
|
|
12214
|
+
return true;
|
|
12215
|
+
}
|
|
12216
|
+
return false;
|
|
12217
|
+
}
|
|
12218
|
+
function parseUnquotedString(isKey2) {
|
|
12219
|
+
const start = i;
|
|
12220
|
+
if (isFunctionNameCharStart(text[i])) {
|
|
12221
|
+
while (i < text.length && isFunctionNameChar(text[i])) {
|
|
12222
|
+
i++;
|
|
12223
|
+
}
|
|
12224
|
+
let j = i;
|
|
12225
|
+
while (isWhitespace(text, j)) {
|
|
12226
|
+
j++;
|
|
12227
|
+
}
|
|
12228
|
+
if (text[j] === "(") {
|
|
12229
|
+
i = j + 1;
|
|
12230
|
+
parseValue();
|
|
12231
|
+
if (text[i] === ")") {
|
|
12232
|
+
i++;
|
|
12233
|
+
if (text[i] === ";") {
|
|
12234
|
+
i++;
|
|
12235
|
+
}
|
|
12236
|
+
}
|
|
12237
|
+
return true;
|
|
12238
|
+
}
|
|
12239
|
+
}
|
|
12240
|
+
while (i < text.length && !isUnquotedStringDelimiter(text[i]) && !isQuote(text[i]) && (!isKey2 || text[i] !== ":")) {
|
|
12241
|
+
i++;
|
|
12242
|
+
}
|
|
12243
|
+
if (text[i - 1] === ":" && regexUrlStart.test(text.substring(start, i + 2))) {
|
|
12244
|
+
while (i < text.length && regexUrlChar.test(text[i])) {
|
|
12245
|
+
i++;
|
|
12246
|
+
}
|
|
12247
|
+
}
|
|
12248
|
+
if (i > start) {
|
|
12249
|
+
while (isWhitespace(text, i - 1) && i > 0) {
|
|
12250
|
+
i--;
|
|
12251
|
+
}
|
|
12252
|
+
const symbol = text.slice(start, i);
|
|
12253
|
+
output += symbol === "undefined" ? "null" : JSON.stringify(symbol);
|
|
12254
|
+
if (text[i] === '"') {
|
|
12255
|
+
i++;
|
|
12256
|
+
}
|
|
12257
|
+
return true;
|
|
12258
|
+
}
|
|
12259
|
+
}
|
|
12260
|
+
function parseRegex() {
|
|
12261
|
+
if (text[i] === "/") {
|
|
12262
|
+
const start = i;
|
|
12263
|
+
i++;
|
|
12264
|
+
while (i < text.length && (text[i] !== "/" || text[i - 1] === "\\")) {
|
|
12265
|
+
i++;
|
|
12266
|
+
}
|
|
12267
|
+
i++;
|
|
12268
|
+
output += `"${text.substring(start, i)}"`;
|
|
12269
|
+
return true;
|
|
12270
|
+
}
|
|
12271
|
+
}
|
|
12272
|
+
function prevNonWhitespaceIndex(start) {
|
|
12273
|
+
let prev = start;
|
|
12274
|
+
while (prev > 0 && isWhitespace(text, prev)) {
|
|
12275
|
+
prev--;
|
|
12276
|
+
}
|
|
12277
|
+
return prev;
|
|
12278
|
+
}
|
|
12279
|
+
function atEndOfNumber() {
|
|
12280
|
+
return i >= text.length || isDelimiter(text[i]) || isWhitespace(text, i);
|
|
12281
|
+
}
|
|
12282
|
+
function repairNumberEndingWithNumericSymbol(start) {
|
|
12283
|
+
output += `${text.slice(start, i)}0`;
|
|
12284
|
+
}
|
|
12285
|
+
function throwInvalidCharacter(char) {
|
|
12286
|
+
throw new JSONRepairError(`Invalid character ${JSON.stringify(char)}`, i);
|
|
12287
|
+
}
|
|
12288
|
+
function throwUnexpectedCharacter() {
|
|
12289
|
+
throw new JSONRepairError(`Unexpected character ${JSON.stringify(text[i])}`, i);
|
|
12290
|
+
}
|
|
12291
|
+
function throwUnexpectedEnd() {
|
|
12292
|
+
throw new JSONRepairError("Unexpected end of json string", text.length);
|
|
12293
|
+
}
|
|
12294
|
+
function throwObjectKeyExpected() {
|
|
12295
|
+
throw new JSONRepairError("Object key expected", i);
|
|
12296
|
+
}
|
|
12297
|
+
function throwColonExpected() {
|
|
12298
|
+
throw new JSONRepairError("Colon expected", i);
|
|
12299
|
+
}
|
|
12300
|
+
function throwInvalidUnicodeCharacter() {
|
|
12301
|
+
const chars = text.slice(i, i + 6);
|
|
12302
|
+
throw new JSONRepairError(`Invalid unicode character "${chars}"`, i);
|
|
12303
|
+
}
|
|
12304
|
+
}
|
|
12305
|
+
function atEndOfBlockComment(text, i) {
|
|
12306
|
+
return text[i] === "*" && text[i + 1] === "/";
|
|
12307
|
+
}
|
|
12308
|
+
function parseRelaxedJSON(str, options) {
|
|
12309
|
+
const startObj = str.indexOf("{");
|
|
12310
|
+
const endObj = str.lastIndexOf("}");
|
|
12311
|
+
const startArr = str.indexOf("[");
|
|
12312
|
+
const endArr = str.lastIndexOf("]");
|
|
12313
|
+
if (startObj > -1 && endObj > -1 && endObj > startObj) {
|
|
12314
|
+
str = str.slice(startObj, endObj + 1);
|
|
12315
|
+
} else if (startArr > -1 && endArr > -1 && endArr > startArr) {
|
|
12316
|
+
str = str.slice(startArr, endArr + 1);
|
|
12317
|
+
}
|
|
12318
|
+
return JSON.parse(jsonrepair(str));
|
|
12319
|
+
}
|
|
11653
12320
|
function to(promise, errorExt) {
|
|
11654
12321
|
return promise.then((data) => [null, data]).catch((err) => {
|
|
11655
12322
|
return [err ?? true, void 0];
|
|
@@ -11989,6 +12656,10 @@ const QdConfigProvider = vue.defineComponent({
|
|
|
11989
12656
|
type: Object,
|
|
11990
12657
|
default: void 0
|
|
11991
12658
|
},
|
|
12659
|
+
agentChat: {
|
|
12660
|
+
type: Object,
|
|
12661
|
+
default: void 0
|
|
12662
|
+
},
|
|
11992
12663
|
globalConfig: {
|
|
11993
12664
|
type: Object,
|
|
11994
12665
|
default: void 0
|
|
@@ -12006,24 +12677,22 @@ const QdConfigProvider = vue.defineComponent({
|
|
|
12006
12677
|
vue.provide(PROVIDE_DICT, props.dict);
|
|
12007
12678
|
vue.provide(PROVIDE_UPLOAD, props.upload);
|
|
12008
12679
|
vue.provide(PROVIDE_GLOBAL_CONFIG, mergedGlobalConfig);
|
|
12009
|
-
if (typeof window !== "undefined") {
|
|
12010
|
-
window.__QIDIAN_USER__ = props.user;
|
|
12011
|
-
window.__QIDIAN_DICT__ = props.dict;
|
|
12012
|
-
}
|
|
12013
12680
|
vue.watch(
|
|
12014
|
-
() => [props.user, props.dict],
|
|
12015
|
-
([newUser, newDict]) => {
|
|
12681
|
+
() => [props.user, props.dict, props.agentChat],
|
|
12682
|
+
([newUser, newDict, newAgentChat]) => {
|
|
12016
12683
|
if (typeof window !== "undefined") {
|
|
12017
12684
|
window.__QIDIAN_USER__ = newUser;
|
|
12018
12685
|
window.__QIDIAN_DICT__ = newDict;
|
|
12686
|
+
window.__QIDIAN_AGENT_CHAT__ = newAgentChat;
|
|
12019
12687
|
}
|
|
12020
|
-
}
|
|
12688
|
+
},
|
|
12689
|
+
{ immediate: true }
|
|
12021
12690
|
);
|
|
12022
12691
|
vue.watchEffect(async () => {
|
|
12023
12692
|
const localeMap = {
|
|
12024
12693
|
"zh-CN": () => Promise.resolve().then(() => zhCN$1),
|
|
12025
|
-
"zh-TW": () => Promise.resolve().then(() => require("./zh-TW-
|
|
12026
|
-
"en-US": () => Promise.resolve().then(() => require("./en-US-
|
|
12694
|
+
"zh-TW": () => Promise.resolve().then(() => require("./zh-TW-OiGfhtFy.js")),
|
|
12695
|
+
"en-US": () => Promise.resolve().then(() => require("./en-US-DPSYm20A.js"))
|
|
12027
12696
|
};
|
|
12028
12697
|
const loadLocale = localeMap[props.locale] || localeMap["zh-CN"];
|
|
12029
12698
|
const [err, res] = await to(
|
|
@@ -15152,7 +15821,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
|
15152
15821
|
if (scrollHeight < currentScrollTopRecord) return;
|
|
15153
15822
|
if (scrollTop2 >= currentScrollTopRecord) return;
|
|
15154
15823
|
core2();
|
|
15155
|
-
});
|
|
15824
|
+
}, 50);
|
|
15156
15825
|
};
|
|
15157
15826
|
core2();
|
|
15158
15827
|
}
|
|
@@ -15218,7 +15887,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
|
15218
15887
|
};
|
|
15219
15888
|
}
|
|
15220
15889
|
});
|
|
15221
|
-
const QdServiceList = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-
|
|
15890
|
+
const QdServiceList = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-d790966c"]]);
|
|
15222
15891
|
const qdDictConvStrSeparator = ",";
|
|
15223
15892
|
const qdDictSelectProps = {
|
|
15224
15893
|
showArrow: true,
|
|
@@ -16497,6 +17166,323 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
16497
17166
|
}
|
|
16498
17167
|
});
|
|
16499
17168
|
const QdCrudSearch = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-13ddedb2"]]);
|
|
17169
|
+
async function getBytes(stream, onChunk) {
|
|
17170
|
+
const reader = stream.getReader();
|
|
17171
|
+
let result;
|
|
17172
|
+
while (!(result = await reader.read()).done) {
|
|
17173
|
+
onChunk(result.value);
|
|
17174
|
+
}
|
|
17175
|
+
}
|
|
17176
|
+
function getLines(onLine) {
|
|
17177
|
+
let buffer;
|
|
17178
|
+
let position;
|
|
17179
|
+
let fieldLength;
|
|
17180
|
+
let discardTrailingNewline = false;
|
|
17181
|
+
return function onChunk(arr) {
|
|
17182
|
+
if (buffer === void 0) {
|
|
17183
|
+
buffer = arr;
|
|
17184
|
+
position = 0;
|
|
17185
|
+
fieldLength = -1;
|
|
17186
|
+
} else {
|
|
17187
|
+
buffer = concat(buffer, arr);
|
|
17188
|
+
}
|
|
17189
|
+
const bufLength = buffer.length;
|
|
17190
|
+
let lineStart = 0;
|
|
17191
|
+
while (position < bufLength) {
|
|
17192
|
+
if (discardTrailingNewline) {
|
|
17193
|
+
if (buffer[position] === 10) {
|
|
17194
|
+
lineStart = ++position;
|
|
17195
|
+
}
|
|
17196
|
+
discardTrailingNewline = false;
|
|
17197
|
+
}
|
|
17198
|
+
let lineEnd = -1;
|
|
17199
|
+
for (; position < bufLength && lineEnd === -1; ++position) {
|
|
17200
|
+
switch (buffer[position]) {
|
|
17201
|
+
case 58:
|
|
17202
|
+
if (fieldLength === -1) {
|
|
17203
|
+
fieldLength = position - lineStart;
|
|
17204
|
+
}
|
|
17205
|
+
break;
|
|
17206
|
+
case 13:
|
|
17207
|
+
discardTrailingNewline = true;
|
|
17208
|
+
case 10:
|
|
17209
|
+
lineEnd = position;
|
|
17210
|
+
break;
|
|
17211
|
+
}
|
|
17212
|
+
}
|
|
17213
|
+
if (lineEnd === -1) {
|
|
17214
|
+
break;
|
|
17215
|
+
}
|
|
17216
|
+
onLine(buffer.subarray(lineStart, lineEnd), fieldLength);
|
|
17217
|
+
lineStart = position;
|
|
17218
|
+
fieldLength = -1;
|
|
17219
|
+
}
|
|
17220
|
+
if (lineStart === bufLength) {
|
|
17221
|
+
buffer = void 0;
|
|
17222
|
+
} else if (lineStart !== 0) {
|
|
17223
|
+
buffer = buffer.subarray(lineStart);
|
|
17224
|
+
position -= lineStart;
|
|
17225
|
+
}
|
|
17226
|
+
};
|
|
17227
|
+
}
|
|
17228
|
+
function getMessages(onId, onRetry, onMessage) {
|
|
17229
|
+
let message = newMessage();
|
|
17230
|
+
const decoder2 = new TextDecoder();
|
|
17231
|
+
return function onLine(line, fieldLength) {
|
|
17232
|
+
if (line.length === 0) {
|
|
17233
|
+
onMessage === null || onMessage === void 0 ? void 0 : onMessage(message);
|
|
17234
|
+
message = newMessage();
|
|
17235
|
+
} else if (fieldLength > 0) {
|
|
17236
|
+
const field = decoder2.decode(line.subarray(0, fieldLength));
|
|
17237
|
+
const valueOffset = fieldLength + (line[fieldLength + 1] === 32 ? 2 : 1);
|
|
17238
|
+
const value = decoder2.decode(line.subarray(valueOffset));
|
|
17239
|
+
switch (field) {
|
|
17240
|
+
case "data":
|
|
17241
|
+
message.data = message.data ? message.data + "\n" + value : value;
|
|
17242
|
+
break;
|
|
17243
|
+
case "event":
|
|
17244
|
+
message.event = value;
|
|
17245
|
+
break;
|
|
17246
|
+
case "id":
|
|
17247
|
+
onId(message.id = value);
|
|
17248
|
+
break;
|
|
17249
|
+
case "retry":
|
|
17250
|
+
const retry = parseInt(value, 10);
|
|
17251
|
+
if (!isNaN(retry)) {
|
|
17252
|
+
onRetry(message.retry = retry);
|
|
17253
|
+
}
|
|
17254
|
+
break;
|
|
17255
|
+
}
|
|
17256
|
+
}
|
|
17257
|
+
};
|
|
17258
|
+
}
|
|
17259
|
+
function concat(a, b) {
|
|
17260
|
+
const res = new Uint8Array(a.length + b.length);
|
|
17261
|
+
res.set(a);
|
|
17262
|
+
res.set(b, a.length);
|
|
17263
|
+
return res;
|
|
17264
|
+
}
|
|
17265
|
+
function newMessage() {
|
|
17266
|
+
return {
|
|
17267
|
+
data: "",
|
|
17268
|
+
event: "",
|
|
17269
|
+
id: "",
|
|
17270
|
+
retry: void 0
|
|
17271
|
+
};
|
|
17272
|
+
}
|
|
17273
|
+
var __rest = function(s, e) {
|
|
17274
|
+
var t = {};
|
|
17275
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
17276
|
+
t[p] = s[p];
|
|
17277
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17278
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17279
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17280
|
+
t[p[i]] = s[p[i]];
|
|
17281
|
+
}
|
|
17282
|
+
return t;
|
|
17283
|
+
};
|
|
17284
|
+
const EventStreamContentType = "text/event-stream";
|
|
17285
|
+
const DefaultRetryInterval = 1e3;
|
|
17286
|
+
const LastEventId = "last-event-id";
|
|
17287
|
+
function fetchEventSource(input, _a2) {
|
|
17288
|
+
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"]);
|
|
17289
|
+
return new Promise((resolve, reject) => {
|
|
17290
|
+
const headers = Object.assign({}, inputHeaders);
|
|
17291
|
+
if (!headers.accept) {
|
|
17292
|
+
headers.accept = EventStreamContentType;
|
|
17293
|
+
}
|
|
17294
|
+
let curRequestController;
|
|
17295
|
+
function onVisibilityChange() {
|
|
17296
|
+
curRequestController.abort();
|
|
17297
|
+
if (!document.hidden) {
|
|
17298
|
+
create();
|
|
17299
|
+
}
|
|
17300
|
+
}
|
|
17301
|
+
if (!openWhenHidden) {
|
|
17302
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
17303
|
+
}
|
|
17304
|
+
let retryInterval = DefaultRetryInterval;
|
|
17305
|
+
let retryTimer = 0;
|
|
17306
|
+
function dispose() {
|
|
17307
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
17308
|
+
window.clearTimeout(retryTimer);
|
|
17309
|
+
curRequestController.abort();
|
|
17310
|
+
}
|
|
17311
|
+
inputSignal === null || inputSignal === void 0 ? void 0 : inputSignal.addEventListener("abort", () => {
|
|
17312
|
+
dispose();
|
|
17313
|
+
resolve();
|
|
17314
|
+
});
|
|
17315
|
+
const fetch = inputFetch !== null && inputFetch !== void 0 ? inputFetch : window.fetch;
|
|
17316
|
+
const onopen = inputOnOpen !== null && inputOnOpen !== void 0 ? inputOnOpen : defaultOnOpen;
|
|
17317
|
+
async function create() {
|
|
17318
|
+
var _a3;
|
|
17319
|
+
curRequestController = new AbortController();
|
|
17320
|
+
try {
|
|
17321
|
+
const response = await fetch(input, Object.assign(Object.assign({}, rest), { headers, signal: curRequestController.signal }));
|
|
17322
|
+
await onopen(response);
|
|
17323
|
+
await getBytes(response.body, getLines(getMessages((id) => {
|
|
17324
|
+
if (id) {
|
|
17325
|
+
headers[LastEventId] = id;
|
|
17326
|
+
} else {
|
|
17327
|
+
delete headers[LastEventId];
|
|
17328
|
+
}
|
|
17329
|
+
}, (retry) => {
|
|
17330
|
+
retryInterval = retry;
|
|
17331
|
+
}, onmessage)));
|
|
17332
|
+
onclose === null || onclose === void 0 ? void 0 : onclose();
|
|
17333
|
+
dispose();
|
|
17334
|
+
resolve();
|
|
17335
|
+
} catch (err) {
|
|
17336
|
+
if (!curRequestController.signal.aborted) {
|
|
17337
|
+
try {
|
|
17338
|
+
const interval = (_a3 = onerror === null || onerror === void 0 ? void 0 : onerror(err)) !== null && _a3 !== void 0 ? _a3 : retryInterval;
|
|
17339
|
+
window.clearTimeout(retryTimer);
|
|
17340
|
+
retryTimer = window.setTimeout(create, interval);
|
|
17341
|
+
} catch (innerErr) {
|
|
17342
|
+
dispose();
|
|
17343
|
+
reject(innerErr);
|
|
17344
|
+
}
|
|
17345
|
+
}
|
|
17346
|
+
}
|
|
17347
|
+
}
|
|
17348
|
+
create();
|
|
17349
|
+
});
|
|
17350
|
+
}
|
|
17351
|
+
function defaultOnOpen(response) {
|
|
17352
|
+
const contentType = response.headers.get("content-type");
|
|
17353
|
+
if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith(EventStreamContentType))) {
|
|
17354
|
+
throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
|
|
17355
|
+
}
|
|
17356
|
+
}
|
|
17357
|
+
function useAgentChat(options) {
|
|
17358
|
+
const globalOpt = window.__QIDIAN_AGENT_CHAT__ || {};
|
|
17359
|
+
const mergeOpt = { ...globalOpt, ...options };
|
|
17360
|
+
const loading = vue.ref(false);
|
|
17361
|
+
const agentId = vue.ref(mergeOpt.agentId);
|
|
17362
|
+
const apiKey = vue.ref(mergeOpt.apiKey);
|
|
17363
|
+
const sessionId = vue.ref("");
|
|
17364
|
+
let abortController;
|
|
17365
|
+
async function send({
|
|
17366
|
+
prompt,
|
|
17367
|
+
files,
|
|
17368
|
+
reSend,
|
|
17369
|
+
extParams,
|
|
17370
|
+
refreshSessionId,
|
|
17371
|
+
onOpen,
|
|
17372
|
+
onMessage,
|
|
17373
|
+
onClose,
|
|
17374
|
+
onError
|
|
17375
|
+
}) {
|
|
17376
|
+
const allData = { content: "", reasoning: "" };
|
|
17377
|
+
if (!prompt && isEmpty(files) && isEmpty(extParams)) return allData;
|
|
17378
|
+
loading.value = true;
|
|
17379
|
+
const agInfo = await getAgentInfo();
|
|
17380
|
+
if (!agInfo) {
|
|
17381
|
+
loading.value = false;
|
|
17382
|
+
return allData;
|
|
17383
|
+
}
|
|
17384
|
+
const sId = await getSessionId({ ...agInfo, refreshSessionId });
|
|
17385
|
+
if (!sId) {
|
|
17386
|
+
loading.value = false;
|
|
17387
|
+
return allData;
|
|
17388
|
+
}
|
|
17389
|
+
const getUrl = mergeOpt.getUrl;
|
|
17390
|
+
if (!getUrl) {
|
|
17391
|
+
loading.value = false;
|
|
17392
|
+
console.error("[useAgentChat] 必须配置 getUrl 函数");
|
|
17393
|
+
return allData;
|
|
17394
|
+
}
|
|
17395
|
+
abortController = new AbortController();
|
|
17396
|
+
return new Promise((resolve, reject) => {
|
|
17397
|
+
fetchEventSource(getUrl(agInfo.agentId, sId), {
|
|
17398
|
+
method: "POST",
|
|
17399
|
+
headers: {
|
|
17400
|
+
"Content-Type": "application/json;charset=UTF-8",
|
|
17401
|
+
Authorization: `Bearer ${agInfo.apiKey}`
|
|
17402
|
+
},
|
|
17403
|
+
signal: abortController?.signal,
|
|
17404
|
+
openWhenHidden: true,
|
|
17405
|
+
body: JSON.stringify({
|
|
17406
|
+
message: prompt || "",
|
|
17407
|
+
re_chat: reSend ?? false,
|
|
17408
|
+
document_list: files,
|
|
17409
|
+
client_id: agInfo.apiKey,
|
|
17410
|
+
client_type: "API_KEY",
|
|
17411
|
+
...extParams
|
|
17412
|
+
}),
|
|
17413
|
+
onopen: async (res) => {
|
|
17414
|
+
await onOpen?.(res);
|
|
17415
|
+
},
|
|
17416
|
+
onmessage: (res) => {
|
|
17417
|
+
const { data } = res;
|
|
17418
|
+
let reData = { content: "", reasoning: "" };
|
|
17419
|
+
try {
|
|
17420
|
+
reData = parseRelaxedJSON(data);
|
|
17421
|
+
if (reData.content) allData.content += reData.content;
|
|
17422
|
+
if (reData.reasoning) allData.reasoning += reData.reasoning;
|
|
17423
|
+
} catch (err) {
|
|
17424
|
+
console.warn("[useAgentChat.send.onmessage]", err);
|
|
17425
|
+
}
|
|
17426
|
+
onMessage?.({ data: reData, allData });
|
|
17427
|
+
},
|
|
17428
|
+
onclose: () => {
|
|
17429
|
+
loading.value = false;
|
|
17430
|
+
onClose?.(allData);
|
|
17431
|
+
resolve(allData);
|
|
17432
|
+
},
|
|
17433
|
+
onerror: (err) => {
|
|
17434
|
+
loading.value = false;
|
|
17435
|
+
onError?.(err);
|
|
17436
|
+
reject(err);
|
|
17437
|
+
throw err;
|
|
17438
|
+
}
|
|
17439
|
+
});
|
|
17440
|
+
});
|
|
17441
|
+
}
|
|
17442
|
+
function stop() {
|
|
17443
|
+
abortController?.abort();
|
|
17444
|
+
}
|
|
17445
|
+
async function getAgentInfo() {
|
|
17446
|
+
if (agentId.value && apiKey.value) {
|
|
17447
|
+
return { agentId: agentId.value, apiKey: apiKey.value };
|
|
17448
|
+
}
|
|
17449
|
+
const getFn = mergeOpt.getAgentInfo;
|
|
17450
|
+
if (!getFn) {
|
|
17451
|
+
console.warn("[useAgentChat.getAgentInfo] 必须配置 agentId、apiKey 或者 getAgentInfo 函数");
|
|
17452
|
+
return;
|
|
17453
|
+
}
|
|
17454
|
+
const [err, res] = await suspectedWrapperPromise(getFn());
|
|
17455
|
+
if (err) return;
|
|
17456
|
+
if (!res?.agentId || !res.apiKey) {
|
|
17457
|
+
console.warn("[useAgentChat.getAgentInfo] 未获取到 agentId、apiKey", res);
|
|
17458
|
+
return;
|
|
17459
|
+
}
|
|
17460
|
+
return res;
|
|
17461
|
+
}
|
|
17462
|
+
async function getSessionId({
|
|
17463
|
+
agentId: agentId2,
|
|
17464
|
+
apiKey: apiKey2,
|
|
17465
|
+
refreshSessionId
|
|
17466
|
+
}) {
|
|
17467
|
+
if (sessionId.value && !refreshSessionId) return sessionId.value;
|
|
17468
|
+
const getFn = mergeOpt.getSessionId;
|
|
17469
|
+
if (!getFn) {
|
|
17470
|
+
console.warn("[useAgentChat.getSessionId] 必须配置 getSessionId 函数");
|
|
17471
|
+
return;
|
|
17472
|
+
}
|
|
17473
|
+
const [err, res] = await suspectedWrapperPromise(getFn(agentId2, apiKey2));
|
|
17474
|
+
if (err) return;
|
|
17475
|
+
return res;
|
|
17476
|
+
}
|
|
17477
|
+
return {
|
|
17478
|
+
loading,
|
|
17479
|
+
agentId,
|
|
17480
|
+
apiKey,
|
|
17481
|
+
sessionId,
|
|
17482
|
+
send,
|
|
17483
|
+
stop
|
|
17484
|
+
};
|
|
17485
|
+
}
|
|
16500
17486
|
const dictCache = /* @__PURE__ */ new Map();
|
|
16501
17487
|
const dictPromiseCache = /* @__PURE__ */ new Map();
|
|
16502
17488
|
function useDict(...args) {
|
|
@@ -18534,7 +19520,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
18534
19520
|
onWaitingUploadFilesChange: { type: Function }
|
|
18535
19521
|
}, qdUploadProps),
|
|
18536
19522
|
emits: ["update:modelValue", "update:files"],
|
|
18537
|
-
setup(__props, { emit: __emit }) {
|
|
19523
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18538
19524
|
const props = __props;
|
|
18539
19525
|
const emit = __emit;
|
|
18540
19526
|
const { modelValue, files: fileList } = /* @__PURE__ */ useVModels(props, emit, {
|
|
@@ -18861,6 +19847,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
18861
19847
|
vue.onMounted(() => {
|
|
18862
19848
|
Object.assign(expose, uploadRef.value, { uploadFiles });
|
|
18863
19849
|
});
|
|
19850
|
+
__expose(expose);
|
|
18864
19851
|
return (_ctx, _cache) => {
|
|
18865
19852
|
return vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Upload), vue.mergeProps({
|
|
18866
19853
|
ref: "upload",
|
|
@@ -18952,7 +19939,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
18952
19939
|
};
|
|
18953
19940
|
}
|
|
18954
19941
|
});
|
|
18955
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
19942
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49e8a4e0"]]);
|
|
18956
19943
|
exports.PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE = PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE;
|
|
18957
19944
|
exports.PROVIDE_GRID_ITEM_PROPS_KEY = PROVIDE_GRID_ITEM_PROPS_KEY;
|
|
18958
19945
|
exports.PROVIDE_GRID_WIDTH_KEY = PROVIDE_GRID_WIDTH_KEY;
|
|
@@ -18995,9 +19982,10 @@ exports.select = select;
|
|
|
18995
19982
|
exports.setValueByPath = setValueByPath;
|
|
18996
19983
|
exports.table = table;
|
|
18997
19984
|
exports.tag = tag;
|
|
19985
|
+
exports.useAgentChat = useAgentChat;
|
|
18998
19986
|
exports.useDict = useDict;
|
|
18999
19987
|
exports.useDictDynamic = useDictDynamic;
|
|
19000
19988
|
exports.useDisabled = useDisabled;
|
|
19001
19989
|
exports.useModal = useModal;
|
|
19002
19990
|
exports.useReadonly = useReadonly;
|
|
19003
|
-
//# sourceMappingURL=index-
|
|
19991
|
+
//# sourceMappingURL=index-BdtBNVcI.js.map
|