@xuda.io/ai_module 1.1.5213 → 1.1.5215
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 +22 -8
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4195,7 +4195,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4195
4195
|
resolve({ code: -1, data: 'skipped' });
|
|
4196
4196
|
clearInterval(interval);
|
|
4197
4197
|
}
|
|
4198
|
-
},
|
|
4198
|
+
}, 500);
|
|
4199
4199
|
const ret = await get_chat_suggestions({ uid, ai_agents, conversation_item_id: out_conversation_item_save_ret.data.id, context: prompt });
|
|
4200
4200
|
clearInterval(interval);
|
|
4201
4201
|
resolve(ret);
|
|
@@ -4707,12 +4707,26 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4707
4707
|
};
|
|
4708
4708
|
|
|
4709
4709
|
const render_suggestions = async function () {
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4710
|
+
return new Promise(async (resolve, reject) => {
|
|
4711
|
+
let counter = 0;
|
|
4712
|
+
emitToDashboard('suggestions', JSON.stringify(prompt_suggestions));
|
|
4713
|
+
let interval = setInterval(async function () {
|
|
4714
|
+
counter++;
|
|
4715
|
+
const job_info = await jobs_ms.get_job_info({ job_id });
|
|
4716
|
+
|
|
4717
|
+
if (job_info.code < 0 || job_info.data.stat === 4) {
|
|
4718
|
+
resolve({ code: -1, data: 'aborted' });
|
|
4719
|
+
clearInterval(interval);
|
|
4720
|
+
}
|
|
4721
|
+
if (job_info?.data?.payload?.skip_suggestions) {
|
|
4722
|
+
resolve({ code: -1, data: 'skipped' });
|
|
4723
|
+
clearInterval(interval);
|
|
4724
|
+
}
|
|
4725
|
+
}, 1000);
|
|
4726
|
+
|
|
4727
|
+
clearInterval(interval);
|
|
4728
|
+
resolve(ret);
|
|
4729
|
+
});
|
|
4716
4730
|
};
|
|
4717
4731
|
|
|
4718
4732
|
const run_agent = function (_agent, prompt, opt) {
|
|
@@ -4724,7 +4738,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4724
4738
|
reject(new Error('aborted'));
|
|
4725
4739
|
clearInterval(interval);
|
|
4726
4740
|
}
|
|
4727
|
-
},
|
|
4741
|
+
}, 500);
|
|
4728
4742
|
const ret = await runner.run(_agent, prompt, opt);
|
|
4729
4743
|
clearInterval(interval);
|
|
4730
4744
|
resolve(ret);
|