@xuda.io/ai_module 1.1.5214 → 1.1.5216
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/index.mjs +9 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4708,9 +4708,17 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4708
4708
|
|
|
4709
4709
|
const render_suggestions = async function () {
|
|
4710
4710
|
return new Promise(async (resolve, reject) => {
|
|
4711
|
+
let counter = 0;
|
|
4712
|
+
emitToDashboard('suggestions', JSON.stringify(prompt_suggestions));
|
|
4711
4713
|
let interval = setInterval(async function () {
|
|
4714
|
+
counter++;
|
|
4712
4715
|
const job_info = await jobs_ms.get_job_info({ job_id });
|
|
4713
4716
|
|
|
4717
|
+
if (counter > 10) {
|
|
4718
|
+
resolve(job_info);
|
|
4719
|
+
} else {
|
|
4720
|
+
}
|
|
4721
|
+
|
|
4714
4722
|
if (job_info.code < 0 || job_info.data.stat === 4) {
|
|
4715
4723
|
resolve({ code: -1, data: 'aborted' });
|
|
4716
4724
|
clearInterval(interval);
|
|
@@ -4719,10 +4727,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4719
4727
|
resolve({ code: -1, data: 'skipped' });
|
|
4720
4728
|
clearInterval(interval);
|
|
4721
4729
|
}
|
|
4722
|
-
},
|
|
4723
|
-
emitToDashboard('suggestions', JSON.stringify(prompt_suggestions));
|
|
4724
|
-
clearInterval(interval);
|
|
4725
|
-
resolve(ret);
|
|
4730
|
+
}, 1000);
|
|
4726
4731
|
});
|
|
4727
4732
|
};
|
|
4728
4733
|
|