koishi-plugin-aka-sa-caller 0.0.4 → 0.0.5
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/lib/index.js +12 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -71,14 +71,19 @@ function apply(ctx, config) {
|
|
|
71
71
|
if (response.success) {
|
|
72
72
|
const task = response.task;
|
|
73
73
|
if (task.status === "completed" && task.result) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
if (Array.isArray(task.result.analyses)) {
|
|
75
|
+
const analyses = task.result.analyses;
|
|
76
|
+
if (analyses.length > 0) {
|
|
77
|
+
const analysis = analyses.find((a) => a.symbol === symbol);
|
|
78
|
+
if (analysis) {
|
|
79
|
+
return analysis;
|
|
80
|
+
}
|
|
81
|
+
ctx.logger.warn(`未找到 ${symbol} 的分析结果,返回第一个结果`);
|
|
82
|
+
return analyses[0];
|
|
79
83
|
}
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
} else if (task.result.symbol) {
|
|
85
|
+
ctx.logger.info(`获取到 ${task.result.symbol} 的分析结果`);
|
|
86
|
+
return task.result;
|
|
82
87
|
}
|
|
83
88
|
} else if (task.status === "failed") {
|
|
84
89
|
ctx.logger.error(`任务失败: ${task.error}`);
|