@xuda.io/ai_module 1.1.5255 → 1.1.5257
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 +12 -18
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4891,6 +4891,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4891
4891
|
let out_conversation_item_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, out_conversation_item_obj._id);
|
|
4892
4892
|
// out_conversation_item_doc.stat = 3;
|
|
4893
4893
|
out_conversation_item_doc.conversation_item_reference_id = conversation_items?.data?.[0]?.id;
|
|
4894
|
+
out_conversation_item_doc.prompt_suggestions = prompt_suggestions;
|
|
4894
4895
|
await db_module.save_app_couch_doc_native(account_profile_info.app_id, out_conversation_item_doc);
|
|
4895
4896
|
|
|
4896
4897
|
account_msa.record_ai_usage(uid, inputTokens, outputTokens, 'conversation chat', prompt, model, { conversation_id, ai_agent_id: in_conversation_item_obj.ai_agent_id, item_id: in_conversation_item_obj._id }, account_profile_info);
|
|
@@ -11032,7 +11033,8 @@ export const open_ai_alive_check = async function () {};
|
|
|
11032
11033
|
// };
|
|
11033
11034
|
|
|
11034
11035
|
export const get_chat_suggestions = async function (req) {
|
|
11035
|
-
|
|
11036
|
+
//type = 'chat prompt'
|
|
11037
|
+
const { type = 'chat response', uid, conversation_item_id, no_of_suggestions = 3, ai_model = _conf.default_ai_model, context, exclude_agents = [] } = req;
|
|
11036
11038
|
let { ai_agents = [] } = req;
|
|
11037
11039
|
|
|
11038
11040
|
try {
|
|
@@ -11120,41 +11122,33 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11120
11122
|
//${conversation_item_doc.text}
|
|
11121
11123
|
// Prompt Category: ${conversation_doc?.category_info?.category}
|
|
11122
11124
|
// Input: ${conversation_item_doc.prompt || conversation_doc.prompt}
|
|
11125
|
+
// Format Compatibility: Analyze the ## Prompt Response. If it contains code, data structures, or specific document types (like HTML), prioritize agents whose agent_instructions or agent_name or agent instructions involve processing, transforming, or styling that specific format.
|
|
11126
|
+
|
|
11127
|
+
// Workflow Continuity: Choose agents that represent a logical "next step" in a development or content creation pipeline (e.g., if code was generated, suggest an agent that deploys, converts, or styles it).
|
|
11128
|
+
|
|
11129
|
+
// Contextual Relevance: Balance the selection with the ## User Info and ## Prompt Category to ensure the agents match the user's industry and intent.
|
|
11123
11130
|
|
|
11124
11131
|
const prompt = `
|
|
11125
11132
|
|
|
11126
11133
|
Role: You are an expert Routing Assistant specialized in connecting users with the most relevant specialized AI agents.
|
|
11127
|
-
|
|
11128
11134
|
Task: Select maximum ${no_of_suggestions} agents from the ## Agent List that are best suited to act upon or refine the current conversation state.
|
|
11129
11135
|
|
|
11130
|
-
|
|
11131
11136
|
Selection Strategy:
|
|
11132
|
-
1. Format Compatibility: Analyze the ##
|
|
11137
|
+
1. Format Compatibility: Analyze the ## ${type} to Process. If it contains structured JSON, component definitions, or raw HTML, prioritize agents capable of transforming these formats (e.g., converting HTML/JSON to functional apps).
|
|
11133
11138
|
2. Workflow Continuity: Focus on the "Lifecycle" of the project. If a UI or content has been drafted, the logical next step is conversion to a production-ready format, styling, or deployment.
|
|
11134
11139
|
3. Explicit Intent: If the user’s original input was "make me a website" and the current state is a document definition, prioritize the agent that performs the final "Conversion" or "Building" step.
|
|
11135
11140
|
4. Contextual Relevance: Match the user's business profile (Digital Marketing & Web Development) with technical agents that automate development tasks.
|
|
11136
11141
|
|
|
11137
11142
|
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
Format Compatibility: Analyze the ## Prompt Response. If it contains code, data structures, or specific document types (like HTML), prioritize agents whose agent_instructions or agent_name or agent instructions involve processing, transforming, or styling that specific format.
|
|
11141
|
-
|
|
11142
|
-
Workflow Continuity: Choose agents that represent a logical "next step" in a development or content creation pipeline (e.g., if code was generated, suggest an agent that deploys, converts, or styles it).
|
|
11143
|
-
|
|
11144
|
-
Contextual Relevance: Balance the selection with the ## User Info and ## Prompt Category to ensure the agents match the user's industry and intent.
|
|
11145
|
-
|
|
11143
|
+
## ${type}: ${context ? context : 'Use the previous response output as the content to analyze for next agents.'}
|
|
11144
|
+
|
|
11146
11145
|
Input Context:
|
|
11147
11146
|
|
|
11148
11147
|
User Profile: ${JSON.stringify(account_doc.account_info)}
|
|
11149
11148
|
Prompt Category: ${conversation_doc?.category_info?.category}
|
|
11150
11149
|
Input: ${conversation_item_doc.prompt || conversation_doc.prompt}
|
|
11151
11150
|
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
Output to Process: ${context ? context : 'Use the previous response output as the content to analyze for next agents.'}
|
|
11157
|
-
|
|
11151
|
+
|
|
11158
11152
|
Agent Source: ${JSON.stringify(agents_docs)}
|
|
11159
11153
|
|
|
11160
11154
|
Output: > Return a JSON array of maximum ${no_of_suggestions} objects following this schema:
|