st-comp 0.0.263 → 0.0.266
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/es/CustomFunction.cjs +1 -1
- package/es/CustomFunction.js +22 -22
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +26 -26
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +11 -11
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +19 -19
- package/es/KlineConfig.cjs +1 -1
- package/es/KlineConfig.js +16 -16
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +10 -10
- package/es/KlinePlus.cjs +1 -1
- package/es/KlinePlus.js +12 -12
- package/es/MonacoEditor.cjs +1 -1
- package/es/MonacoEditor.js +18 -18
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +14 -14
- package/es/PasswordPrompt.cjs +1 -1
- package/es/PasswordPrompt.js +2 -2
- package/es/Table.cjs +1 -1
- package/es/Table.js +18 -18
- package/es/User.cjs +1 -1
- package/es/User.js +19 -19
- package/es/VarSelectDialog.cjs +1 -1
- package/es/VarSelectDialog.js +19 -19
- package/es/VarietyAiHelper.cjs +3 -3
- package/es/VarietyAiHelper.js +320 -279
- package/es/VarietyAutoComplete.cjs +1 -1
- package/es/VarietyAutoComplete.js +8 -8
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +31 -31
- package/es/{VarietySelect-9f267958.js → VarietySelect-1ac10ec2.js} +3 -3
- package/es/{VarietySelect-5c845562.cjs → VarietySelect-639a8d9a.cjs} +1 -1
- package/es/VarietyTextCopy.cjs +1 -1
- package/es/VarietyTextCopy.js +10 -10
- package/es/VirtualTable.cjs +1 -1
- package/es/VirtualTable.js +66 -66
- package/es/{_initCloneObject-69c8ae23.js → _initCloneObject-6b8c230e.js} +2 -2
- package/es/{_initCloneObject-2b82e9f7.cjs → _initCloneObject-9eddcb0c.cjs} +1 -1
- package/es/aiTools-6c9c58bd.cjs +4 -0
- package/es/aiTools-ab67ffa0.js +149 -0
- package/es/aiTools.js +92 -1
- package/es/{config-provider-7860903c.js → config-provider-56193d47.js} +3 -3
- package/es/{config-provider-2ae47cc8.cjs → config-provider-ea286661.cjs} +1 -1
- package/es/{dropdown-497442b7.js → dropdown-4e541d60.js} +3 -3
- package/es/{dropdown-eba9eaf5.cjs → dropdown-f30148cc.cjs} +1 -1
- package/es/{el-autocomplete-b59eb529.cjs → el-autocomplete-3949e68c.cjs} +1 -1
- package/es/{el-autocomplete-27c60cc8.js → el-autocomplete-4b521c83.js} +6 -6
- package/es/{el-button-e2c63c08.js → el-button-4f201000.js} +3 -3
- package/es/{el-button-974ff9e9.cjs → el-button-dd065de0.cjs} +1 -1
- package/es/{el-checkbox-08185353.cjs → el-checkbox-02ce40f0.cjs} +1 -1
- package/es/{el-checkbox-71ebd862.js → el-checkbox-33cb73db.js} +3 -3
- package/es/{el-dialog-eedcfd3e.js → el-dialog-1939f7c5.js} +4 -4
- package/es/{el-dialog-1b185570.cjs → el-dialog-6501a151.cjs} +1 -1
- package/es/{el-form-item-c997b4fa.cjs → el-form-item-316b35d8.cjs} +1 -1
- package/es/{el-form-item-bdcfd297.js → el-form-item-ea11211d.js} +5 -5
- package/es/{el-input-fa18ef84.cjs → el-input-094afbe2.cjs} +1 -1
- package/es/{el-input-d47281da.js → el-input-58786d42.js} +32 -32
- package/es/{el-input-number-3d94fa58.cjs → el-input-number-a609a5e3.cjs} +1 -1
- package/es/{el-input-number-c8018cb1.js → el-input-number-a7971697.js} +14 -14
- package/es/{el-loading-969a79ca.cjs → el-loading-d171ce64.cjs} +1 -1
- package/es/{el-loading-0cd81d05.js → el-loading-f3815921.js} +1 -1
- package/es/{el-menu-item-26071fd6.cjs → el-menu-item-3d1e0aff.cjs} +1 -1
- package/es/{el-menu-item-dac65bb3.js → el-menu-item-a166b997.js} +5 -5
- package/es/{el-message-box-31e0aa98.cjs → el-message-box-b8ffcf34.cjs} +1 -1
- package/es/{el-message-box-fea4fca8.js → el-message-box-f2b667e9.js} +9 -9
- package/es/{el-overlay-1ee0338d.js → el-overlay-1dfe3675.js} +3 -3
- package/es/{el-overlay-ea65cb05.cjs → el-overlay-a94f8a98.cjs} +1 -1
- package/es/{el-popconfirm-9e232436.cjs → el-popconfirm-70e2849c.cjs} +1 -1
- package/es/{el-popconfirm-089b8bec.js → el-popconfirm-ca31ceea.js} +5 -5
- package/es/{el-popper-2d3914e4.cjs → el-popper-ce575c12.cjs} +1 -1
- package/es/{el-popper-c9b3d3cf.js → el-popper-db6c599f.js} +2 -2
- package/es/{el-segmented-140ac042.cjs → el-segmented-4d50b63f.cjs} +1 -1
- package/es/{el-segmented-9d3a9e11.js → el-segmented-741f2252.js} +2 -2
- package/es/{el-select-e51e11c1.js → el-select-086bcb6c.js} +9 -9
- package/es/{el-select-a11f33e8.cjs → el-select-2ebc8380.cjs} +1 -1
- package/es/{el-table-column-98570a4d.cjs → el-table-column-2f07fbdb.cjs} +1 -1
- package/es/{el-table-column-05d292a8.js → el-table-column-8a15378a.js} +10 -10
- package/es/{el-tag-17cd04a1.js → el-tag-65a99986.js} +2 -2
- package/es/{el-tag-6d8e653e.cjs → el-tag-f48b1190.cjs} +1 -1
- package/es/{el-text-a18106cb.cjs → el-text-33359f44.cjs} +1 -1
- package/es/{el-text-2710fff3.js → el-text-cbb693f2.js} +1 -1
- package/es/{index-f30561d3.js → index-072c4a65.js} +5 -5
- package/es/{index-299ee017.cjs → index-0f767104.cjs} +1 -1
- package/es/{index-eb99b188.cjs → index-18565979.cjs} +1 -1
- package/es/{index-0f79095c.js → index-1955f23d.js} +1 -1
- package/es/{index-0ee486ad.js → index-1e91e986.js} +1 -1
- package/es/{index-6ca95c8a.cjs → index-21e8d2bc.cjs} +1 -1
- package/es/{index-33f80550.cjs → index-3792552a.cjs} +1 -1
- package/es/{index-7dce9f59.cjs → index-4f900527.cjs} +1 -1
- package/es/{index-1d9b50de.js → index-57d82da0.js} +2 -2
- package/es/{index-e8eeea22.cjs → index-5b546f7d.cjs} +1 -1
- package/es/{index-c71e37dc.js → index-7db02db7.js} +2 -2
- package/es/{index-37b8d3c6.cjs → index-7eb88616.cjs} +1 -1
- package/es/{index-6b99def3.cjs → index-8439d2f9.cjs} +1 -1
- package/es/{index-40f05e2c.cjs → index-8b055879.cjs} +2 -2
- package/es/{index-b0117ba2.js → index-a4e252a0.js} +1 -1
- package/es/{index-95e5d454.js → index-b51915a2.js} +2 -2
- package/es/{index-28e03bad.cjs → index-bf98dd03.cjs} +1 -1
- package/es/{index-c2b9bbfd.js → index-ca91ac68.js} +82 -67
- package/es/{index-8a54ceeb.js → index-d857270a.js} +9 -9
- package/es/{index-bcd895a0.js → index-ff26b1a6.js} +2 -2
- package/es/{python-02c3937a.cjs → python-5b5c9c58.cjs} +1 -1
- package/es/{python-99011a53.js → python-ad9239f9.js} +18 -18
- package/es/style.css +1 -1
- package/es/{use-form-common-props-d3ed62c6.cjs → use-form-common-props-00ec25ac.cjs} +1 -1
- package/es/{use-form-common-props-cb0ca65c.js → use-form-common-props-c14990b9.js} +29 -29
- package/es/{use-global-config-c80f33a4.cjs → use-global-config-28efb416.cjs} +1 -1
- package/es/{use-global-config-cdaeca54.js → use-global-config-a01b5ce1.js} +2 -2
- package/es/{validator-07160325.cjs → validator-119fdaf4.cjs} +1 -1
- package/es/{validator-4ab9774f.js → validator-65de1caf.js} +1 -1
- package/es/{zh-cn-6a0f844c.cjs → zh-cn-9fb29a39.cjs} +1 -1
- package/es/{zh-cn-8a6390a4.js → zh-cn-c1c28e70.js} +1 -1
- package/lib/aiTools.js +92 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +182 -181
- package/lib/{index-0969ca9d.js → index-53b3465c.js} +19675 -19562
- package/lib/{python-506107bf.js → python-4a270481.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietyAiHelper/index.vue +271 -290
- package/public/aiTools.js +92 -1
- package/es/aiTools-2e1f92d2.cjs +0 -3
- package/es/aiTools-faa0a14d.js +0 -90
package/public/aiTools.js
CHANGED
|
@@ -27,7 +27,7 @@ export const sendToBaiLianAppNonStreaming = async ({ appId, apiKey, value }) =>
|
|
|
27
27
|
throw error;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
// 流式返回
|
|
30
|
+
// 单智能体应用: 流式返回
|
|
31
31
|
export const sendToBaiLianAppStreaming = async ({ appId, apiKey, value, callback }) => {
|
|
32
32
|
try {
|
|
33
33
|
const response = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${appId}/completion`, {
|
|
@@ -114,7 +114,98 @@ export const sendToBaiLianAppStreaming = async ({ appId, apiKey, value, callback
|
|
|
114
114
|
callback("error", error.message);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
+
// 工作流: 流式返回
|
|
118
|
+
export const sendToBaiLianWorkflowStreaming = async ({ appId, apiKey, value, callback }) => {
|
|
119
|
+
try {
|
|
120
|
+
const response = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${appId}/completion`, {
|
|
121
|
+
method: "POST",
|
|
122
|
+
body: JSON.stringify({
|
|
123
|
+
input: { prompt: value },
|
|
124
|
+
parameters: { incremental_output: "true", flow_stream_mode: "message_format_plus" },
|
|
125
|
+
debug: {},
|
|
126
|
+
}),
|
|
127
|
+
headers: {
|
|
128
|
+
Authorization: `Bearer ${apiKey}`,
|
|
129
|
+
"Content-Type": "application/json",
|
|
130
|
+
"X-DashScope-SSE": "enable",
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (!response.ok) {
|
|
135
|
+
callback("error", `HTTP ${response.status}: ${response.statusText}`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const reader = response.body.getReader();
|
|
140
|
+
const decoder = new TextDecoder();
|
|
141
|
+
let buffer = "";
|
|
142
|
+
let finalResult = "";
|
|
143
|
+
// 记录已出现的节点(去重用)
|
|
144
|
+
const nodeMap = {};
|
|
145
|
+
|
|
146
|
+
while (true) {
|
|
147
|
+
const { done, value } = await reader.read();
|
|
148
|
+
if (done) {
|
|
149
|
+
if (finalResult) {
|
|
150
|
+
callback("message", finalResult);
|
|
151
|
+
}
|
|
152
|
+
callback("finish", "");
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
buffer += decoder.decode(value, { stream: true });
|
|
157
|
+
let newlineIndex;
|
|
158
|
+
while ((newlineIndex = buffer.indexOf("\n")) !== -1) {
|
|
159
|
+
const line = buffer.substring(0, newlineIndex).trim();
|
|
160
|
+
buffer = buffer.substring(newlineIndex + 1);
|
|
161
|
+
|
|
162
|
+
if (line.startsWith("data:")) {
|
|
163
|
+
const dataStr = line.substring(5).trim();
|
|
164
|
+
if (!dataStr || dataStr === "[DONE]") continue;
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
const parsed = JSON.parse(dataStr);
|
|
168
|
+
const output = parsed?.output;
|
|
169
|
+
const wfMsg = output?.workflow_message;
|
|
170
|
+
|
|
171
|
+
// 提取节点信息
|
|
172
|
+
if (wfMsg?.node_name && wfMsg?.node_type) {
|
|
173
|
+
const nodeName = wfMsg.node_name;
|
|
174
|
+
const nodeStatus = wfMsg.node_status; // "executing" | "success"
|
|
175
|
+
const isCompleted = wfMsg.node_is_completed;
|
|
176
|
+
|
|
177
|
+
// 去重:同一节点只推送状态变化
|
|
178
|
+
const prevStatus = nodeMap[nodeName];
|
|
179
|
+
if (prevStatus !== nodeStatus || (isCompleted && prevStatus !== "success")) {
|
|
180
|
+
nodeMap[nodeName] = isCompleted ? "success" : nodeStatus;
|
|
181
|
+
callback("node", {
|
|
182
|
+
name: nodeName,
|
|
183
|
+
status: isCompleted ? "success" : "executing",
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// 最终结果
|
|
189
|
+
if (output?.finish_reason === "stop" && output?.text) {
|
|
190
|
+
finalResult = output.text;
|
|
191
|
+
}
|
|
117
192
|
|
|
193
|
+
// 错误
|
|
194
|
+
if (output?.code || output?.message) {
|
|
195
|
+
callback("error", output.message || output.code || "未知错误");
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
} catch (e) {
|
|
199
|
+
// 忽略非 JSON 行
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error("工作流请求失败:", error);
|
|
206
|
+
callback("error", error.message);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
118
209
|
// 辅助函数:处理缓冲区剩余数据
|
|
119
210
|
const tryProcessBuffer = (buffer, callback) => {
|
|
120
211
|
const lines = buffer.split("\n");
|
package/es/aiTools-2e1f92d2.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";const y=async({appId:f,apiKey:i,value:p,callback:e})=>{var a;try{const t=await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${f}/completion`,{method:"POST",body:JSON.stringify({input:{prompt:p},parameters:{incremental_output:"true"},debug:{}}),headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-DashScope-SSE":"enable"}});if(!t.ok){e("error",`HTTP ${t.status}: ${t.statusText}`);return}const u=t.body.getReader(),r=new TextDecoder;let s="",o=null;for(;;){const{done:h,value:S}=await u.read();if(h){s.trim()&&x(s,e),e("finish","");break}s+=r.decode(S,{stream:!0});let m;for(;(m=s.indexOf(`
|
|
2
|
-
`))!==-1;){const c=s.substring(0,m).trim();if(s=s.substring(m+1),c.startsWith("event:")){o=c.substring(6).trim();continue}if(c.startsWith("data:")){const d=c.substring(5).trim();if(o==="error"||d&&d.startsWith("{"))try{const n=JSON.parse(d);if(n.code||n.message||o==="error"){const l=n.message||n.code||"未知错误";e("error",`百炼服务端错误: ${l}`);return}const g=(a=n==null?void 0:n.output)==null?void 0:a.text;g&&e&&e("message",g)}catch{console.debug("JSON 解析失败:",d)}o=null}}}}catch(t){console.error("流式请求失败:",t),e("error",t.message)}},x=(f,i)=>{var a;const p=f.split(`
|
|
3
|
-
`);let e=null;for(const t of p){if(t.startsWith("event:")){e=t.substring(6).trim();continue}if(t.startsWith("data:")){const u=t.substring(5).trim();if(u&&u!=="[DONE]")try{const r=JSON.parse(u);if(e==="error"||r.code||r.message){const o=r.message||r.code||"未知错误";i("error",`百炼服务端错误: ${o}`);return}const s=(a=r==null?void 0:r.output)==null?void 0:a.text;s&&i&&i("message",s)}catch{}e=null}}};exports.sendToBaiLianAppStreaming=y;
|
package/es/aiTools-faa0a14d.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
const x = async ({ appId: f, apiKey: i, value: p, callback: e }) => {
|
|
2
|
-
var a;
|
|
3
|
-
try {
|
|
4
|
-
const t = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${f}/completion`, {
|
|
5
|
-
method: "POST",
|
|
6
|
-
body: JSON.stringify({
|
|
7
|
-
input: { prompt: p },
|
|
8
|
-
parameters: { incremental_output: "true" },
|
|
9
|
-
debug: {}
|
|
10
|
-
}),
|
|
11
|
-
headers: {
|
|
12
|
-
Authorization: `Bearer ${i}`,
|
|
13
|
-
"Content-Type": "application/json",
|
|
14
|
-
"X-DashScope-SSE": "enable"
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
if (!t.ok) {
|
|
18
|
-
e("error", `HTTP ${t.status}: ${t.statusText}`);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const u = t.body.getReader(), r = new TextDecoder();
|
|
22
|
-
let s = "", o = null;
|
|
23
|
-
for (; ; ) {
|
|
24
|
-
const { done: h, value: l } = await u.read();
|
|
25
|
-
if (h) {
|
|
26
|
-
s.trim() && y(s, e), e("finish", "");
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
s += r.decode(l, { stream: !0 });
|
|
30
|
-
let m;
|
|
31
|
-
for (; (m = s.indexOf(`
|
|
32
|
-
`)) !== -1; ) {
|
|
33
|
-
const c = s.substring(0, m).trim();
|
|
34
|
-
if (s = s.substring(m + 1), c.startsWith("event:")) {
|
|
35
|
-
o = c.substring(6).trim();
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
if (c.startsWith("data:")) {
|
|
39
|
-
const d = c.substring(5).trim();
|
|
40
|
-
if (o === "error" || d && d.startsWith("{"))
|
|
41
|
-
try {
|
|
42
|
-
const n = JSON.parse(d);
|
|
43
|
-
if (n.code || n.message || o === "error") {
|
|
44
|
-
const S = n.message || n.code || "未知错误";
|
|
45
|
-
e("error", `百炼服务端错误: ${S}`);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const g = (a = n == null ? void 0 : n.output) == null ? void 0 : a.text;
|
|
49
|
-
g && e && e("message", g);
|
|
50
|
-
} catch {
|
|
51
|
-
console.debug("JSON 解析失败:", d);
|
|
52
|
-
}
|
|
53
|
-
o = null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
} catch (t) {
|
|
58
|
-
console.error("流式请求失败:", t), e("error", t.message);
|
|
59
|
-
}
|
|
60
|
-
}, y = (f, i) => {
|
|
61
|
-
var a;
|
|
62
|
-
const p = f.split(`
|
|
63
|
-
`);
|
|
64
|
-
let e = null;
|
|
65
|
-
for (const t of p) {
|
|
66
|
-
if (t.startsWith("event:")) {
|
|
67
|
-
e = t.substring(6).trim();
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (t.startsWith("data:")) {
|
|
71
|
-
const u = t.substring(5).trim();
|
|
72
|
-
if (u && u !== "[DONE]")
|
|
73
|
-
try {
|
|
74
|
-
const r = JSON.parse(u);
|
|
75
|
-
if (e === "error" || r.code || r.message) {
|
|
76
|
-
const o = r.message || r.code || "未知错误";
|
|
77
|
-
i("error", `百炼服务端错误: ${o}`);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const s = (a = r == null ? void 0 : r.output) == null ? void 0 : a.text;
|
|
81
|
-
s && i && i("message", s);
|
|
82
|
-
} catch {
|
|
83
|
-
}
|
|
84
|
-
e = null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
export {
|
|
89
|
-
x as s
|
|
90
|
-
};
|