@xuda.io/ai_module 1.1.4920 → 1.1.4922
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 +14 -30
- package/index_ms.mjs +6 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3945,23 +3945,15 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
3945
3945
|
// const { account_profile_info } = conversation_doc;
|
|
3946
3946
|
const emitToDashboard = (type, content) => {
|
|
3947
3947
|
// console.log(type, content);
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
conversation_id,
|
|
3958
|
-
job_id,
|
|
3959
|
-
delta: content,
|
|
3960
|
-
},
|
|
3961
|
-
},
|
|
3962
|
-
}),
|
|
3963
|
-
),
|
|
3964
|
-
);
|
|
3948
|
+
ws_dashboard_ms.emit_message_to_dashboard({
|
|
3949
|
+
service: type,
|
|
3950
|
+
to: uid,
|
|
3951
|
+
data: {
|
|
3952
|
+
conversation_id,
|
|
3953
|
+
job_id,
|
|
3954
|
+
delta: content,
|
|
3955
|
+
},
|
|
3956
|
+
});
|
|
3965
3957
|
};
|
|
3966
3958
|
|
|
3967
3959
|
const generate_XU_markdown = async function (type, data) {
|
|
@@ -5978,19 +5970,11 @@ export const pin_ai_agent = async function (req, job_id, headers) {
|
|
|
5978
5970
|
|
|
5979
5971
|
const save_ret = await db_module.save_app_couch_doc(app_id, ai_agent_doc);
|
|
5980
5972
|
|
|
5981
|
-
|
|
5982
|
-
'
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
data: {
|
|
5987
|
-
service: 'ai_agent_pinned',
|
|
5988
|
-
to: [uid],
|
|
5989
|
-
data: await get_ai_agent_info(uid, job_id, headers, ai_agent_doc),
|
|
5990
|
-
},
|
|
5991
|
-
}),
|
|
5992
|
-
),
|
|
5993
|
-
);
|
|
5973
|
+
ws_dashboard_ms.emit_message_to_dashboard({
|
|
5974
|
+
service: 'ai_agent_pinned',
|
|
5975
|
+
to: [uid],
|
|
5976
|
+
data: await get_ai_agent_info(uid, job_id, headers, ai_agent_doc),
|
|
5977
|
+
});
|
|
5994
5978
|
return save_ret;
|
|
5995
5979
|
} catch (err) {
|
|
5996
5980
|
return {
|
package/index_ms.mjs
CHANGED
|
@@ -46,7 +46,7 @@ const send_to_queue =async function(ms_method, ...args) {
|
|
|
46
46
|
const timeout = setTimeout(() => {
|
|
47
47
|
delete queue[queue_id];
|
|
48
48
|
reject(new Error(`Queue timeout for ${ms_method}`));
|
|
49
|
-
},
|
|
49
|
+
}, 300000); // 300 second timeout
|
|
50
50
|
|
|
51
51
|
// Wrap resolve to clean up
|
|
52
52
|
queue[queue_id].resolve = (value) => {
|
|
@@ -61,7 +61,8 @@ const send_to_queue =async function(ms_method, ...args) {
|
|
|
61
61
|
delete queue[queue_id];
|
|
62
62
|
reject(error);
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
try{
|
|
65
66
|
global[`_${global.module_in}_ch`].sendToQueue(
|
|
66
67
|
'ai_module',
|
|
67
68
|
Buffer.from(
|
|
@@ -74,6 +75,9 @@ const send_to_queue =async function(ms_method, ...args) {
|
|
|
74
75
|
)
|
|
75
76
|
);
|
|
76
77
|
|
|
78
|
+
}catch(err){
|
|
79
|
+
debugger
|
|
80
|
+
}
|
|
77
81
|
})
|
|
78
82
|
|
|
79
83
|
};
|