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