@xuda.io/ai_module 1.1.5128 → 1.1.5129
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 +13 -15
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4785,7 +4785,7 @@ setTimeout(async () => {
|
|
|
4785
4785
|
|
|
4786
4786
|
// await init_studio_units();
|
|
4787
4787
|
let ret;
|
|
4788
|
-
ret = await get_chat_suggestions(uid, [], 'coi_7b65b783af38b91c8ec4c499d3694bab');
|
|
4788
|
+
// ret = await get_chat_suggestions(uid, [], 'coi_7b65b783af38b91c8ec4c499d3694bab');
|
|
4789
4789
|
// ret = await get_active_account_profile_info(uid);
|
|
4790
4790
|
// ret = await is_spam_email(uid, 'dsgr8-2994400420@gigs.craigslist.org', 'To: You, From: Us - 70% Off Stickers & Labels Today Only');
|
|
4791
4791
|
// ret = await is_spam_email(uid, 'noreply@tm.openai.com', 'Please update your Plus payment method', account_profile_info);
|
|
@@ -10836,8 +10836,6 @@ export const open_ai_alive_check = async function () {};
|
|
|
10836
10836
|
// };
|
|
10837
10837
|
|
|
10838
10838
|
export const get_chat_suggestions = async function (uid, ai_agents, conversation_item_id, ai_model = _conf.default_ai_model) {
|
|
10839
|
-
let ret = [];
|
|
10840
|
-
|
|
10841
10839
|
try {
|
|
10842
10840
|
const account_profile_info = await get_active_account_profile_info(uid);
|
|
10843
10841
|
const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
|
|
@@ -10903,24 +10901,24 @@ export const get_chat_suggestions = async function (uid, ai_agents, conversation
|
|
|
10903
10901
|
uid,
|
|
10904
10902
|
prompt: `
|
|
10905
10903
|
|
|
10906
|
-
|
|
10904
|
+
Role: You are a routing assistant.
|
|
10907
10905
|
|
|
10908
|
-
|
|
10906
|
+
Task: Analyze the provided user context and select the 5 most relevant agents from the ## Agent List.
|
|
10909
10907
|
|
|
10910
|
-
|
|
10911
|
-
|
|
10908
|
+
Selection Logic:
|
|
10909
|
+
Base your selection on the alignment between the agent's purpose and the following context:
|
|
10912
10910
|
|
|
10913
|
-
|
|
10911
|
+
User Profile: ${JSON.stringify(account_doc.account_info)}
|
|
10914
10912
|
|
|
10915
|
-
|
|
10913
|
+
Recent Interaction: The user asked ${conversation_item_doc.prompt || conversation_doc.prompt}, categorized as ${conversation_doc?.category_info?.category}, which resulted in the response: ${conversation_item_doc.text}.
|
|
10916
10914
|
|
|
10917
|
-
|
|
10915
|
+
Data Source: > ${JSON.stringify(agents_docs)}
|
|
10918
10916
|
|
|
10919
|
-
|
|
10920
|
-
|
|
10917
|
+
Output: > Return a JSON array of exactly 5 objects following this schema:
|
|
10918
|
+
[{ "agent_id": "string", "short_action": "string", "agent_description": "string" }]
|
|
10921
10919
|
|
|
10922
|
-
|
|
10923
|
-
|
|
10920
|
+
## output example:
|
|
10921
|
+
[{agent_id:"392_agn_55cb328d2743",short_action:"Create article","agent_description":"create proffessional article..."}]
|
|
10924
10922
|
|
|
10925
10923
|
`,
|
|
10926
10924
|
model: ai_model,
|
|
@@ -10939,7 +10937,7 @@ export const get_chat_suggestions = async function (uid, ai_agents, conversation
|
|
|
10939
10937
|
const agents_docs = await get_agents();
|
|
10940
10938
|
const suggestions = await get_suggestions();
|
|
10941
10939
|
|
|
10942
|
-
|
|
10940
|
+
return { code: 44, data: suggestions };
|
|
10943
10941
|
} catch (err) {
|
|
10944
10942
|
return { code: -44, data: err.message || String(err) };
|
|
10945
10943
|
}
|