st-comp 0.0.261 → 0.0.263
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/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +143 -142
- package/es/VarietyAiHelper.cjs +3 -5
- package/es/VarietyAiHelper.js +226 -312
- package/es/VarietySearch.cjs +18 -19
- package/es/VarietySearch.js +1130 -1165
- package/es/aiTools-2e1f92d2.cjs +3 -0
- package/es/aiTools-faa0a14d.js +90 -0
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +150 -151
- package/lib/{index-ea159fbc.js → index-0969ca9d.js} +8225 -8260
- package/lib/{python-2aa774a5.js → python-506107bf.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/KlineBasic/index.vue +1 -1
- package/packages/VarietySearch/components/FactorScreen/index.vue +20 -7
- package/packages/VarietySearch/components/FactorScreen/tools.js +0 -41
package/package.json
CHANGED
|
@@ -223,7 +223,7 @@ const drawSub = () => {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
requestAnimationFrame(() => {
|
|
226
|
-
klineSubRef.value
|
|
226
|
+
klineSubRef.value?.draw({ startValue, endValue, maxValueSpan: maxShowCounts }, { gridLeft, gridRight });
|
|
227
227
|
});
|
|
228
228
|
};
|
|
229
229
|
// 图表渲染: 预警线
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
<script setup name="FactorScreen">
|
|
3
3
|
import { nextTick, ref, watch, inject, reactive } from "vue";
|
|
4
4
|
import { Close, Plus, CircleCloseFilled, InfoFilled, Document } from "@element-plus/icons-vue";
|
|
5
|
-
import { handleVerifyScore, extractConditionDetails, extractVariables
|
|
5
|
+
import { handleVerifyScore, extractConditionDetails, extractVariables } from "./tools.js";
|
|
6
|
+
import { sendToBaiLianAppStreaming } from "../../../../public/aiTools";
|
|
6
7
|
import FactorDescription from "./FactorDescription.vue";
|
|
7
8
|
import MonacoEditor from "../../../MonacoEditor/index.vue";
|
|
8
9
|
|
|
@@ -395,12 +396,24 @@ const handleTestAi = () => {
|
|
|
395
396
|
const apiKey = "sk-d995eb26a4334bdeb2ccb4cbfaf51de8";
|
|
396
397
|
scriptAILoading.value = true;
|
|
397
398
|
scriptTestResult.ai = "";
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
399
|
+
let fullResponse = "";
|
|
400
|
+
sendToBaiLianAppStreaming({
|
|
401
|
+
appId,
|
|
402
|
+
apiKey,
|
|
403
|
+
value: scriptTestResult.code,
|
|
404
|
+
callback: (type, data) => {
|
|
405
|
+
// 百炼应用错误
|
|
406
|
+
if (type === "error") return;
|
|
407
|
+
// 流式输出(正常)
|
|
408
|
+
else if (type === "message") {
|
|
409
|
+
fullResponse += data;
|
|
410
|
+
scriptTestResult.ai = fullResponse;
|
|
411
|
+
}
|
|
412
|
+
// 流式输出(完毕)
|
|
413
|
+
else if (type === "finish") {
|
|
414
|
+
scriptAILoading.value = false;
|
|
415
|
+
}
|
|
416
|
+
},
|
|
404
417
|
});
|
|
405
418
|
};
|
|
406
419
|
|
|
@@ -32,44 +32,3 @@ export const extractVariables = (content) => {
|
|
|
32
32
|
|
|
33
33
|
return [...new Set(variables)]; // 去重
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
// 发送AI
|
|
37
|
-
export const sendToAi = async (appId, apiKey, value, callback) => {
|
|
38
|
-
try {
|
|
39
|
-
const res = await fetch(`https://dashscope.aliyuncs.com/api/v1/apps/${appId}/completion`, {
|
|
40
|
-
method: "POST",
|
|
41
|
-
body: JSON.stringify({
|
|
42
|
-
input: { prompt: value },
|
|
43
|
-
parameters: {
|
|
44
|
-
incremental_output: "true", // 流式返回
|
|
45
|
-
},
|
|
46
|
-
debug: {},
|
|
47
|
-
}),
|
|
48
|
-
headers: {
|
|
49
|
-
Authorization: `Bearer ${apiKey}`,
|
|
50
|
-
"Content-Type": "application/json",
|
|
51
|
-
"X-DashScope-SSE": "enable", // 流式输出
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
if (!res.ok || !res.body) throw new Error("请求失败");
|
|
55
|
-
|
|
56
|
-
const reader = res.body.getReader();
|
|
57
|
-
const decoder = new TextDecoder();
|
|
58
|
-
|
|
59
|
-
while (true) {
|
|
60
|
-
const { done, value } = await reader.read();
|
|
61
|
-
if (done && callback) {
|
|
62
|
-
callback("finish", "");
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
const data = decoder.decode(value, { stream: true });
|
|
67
|
-
const resData = JSON.parse(data.split("\n")[3].substr(5));
|
|
68
|
-
const resText = resData?.output?.text;
|
|
69
|
-
if (resText && callback) callback("message", resText);
|
|
70
|
-
} catch (error) {}
|
|
71
|
-
}
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error(error);
|
|
74
|
-
}
|
|
75
|
-
};
|