@xuda.io/ai_module 1.1.5254 → 1.1.5256
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 -14
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -11032,7 +11032,8 @@ export const open_ai_alive_check = async function () {};
|
|
|
11032
11032
|
// };
|
|
11033
11033
|
|
|
11034
11034
|
export const get_chat_suggestions = async function (req) {
|
|
11035
|
-
|
|
11035
|
+
//type = 'chat prompt'
|
|
11036
|
+
const { type = 'chat response', uid, conversation_item_id, no_of_suggestions = 3, ai_model = _conf.default_ai_model, context, exclude_agents = [] } = req;
|
|
11036
11037
|
let { ai_agents = [] } = req;
|
|
11037
11038
|
|
|
11038
11039
|
try {
|
|
@@ -11086,7 +11087,14 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11086
11087
|
}
|
|
11087
11088
|
if (skip) continue;
|
|
11088
11089
|
|
|
11089
|
-
list.push({
|
|
11090
|
+
list.push({
|
|
11091
|
+
agent_id,
|
|
11092
|
+
agent_name: ai_agent_doc.properties.menuName,
|
|
11093
|
+
agent_category: ai_agent_doc.studio_meta.agent_category,
|
|
11094
|
+
agent_industry: ai_agent_doc.studio_meta.agent_industry,
|
|
11095
|
+
agent_instructions: ai_agent_doc?.agentConfig?.agent_instructions,
|
|
11096
|
+
agent_user_guide: ai_agent_doc?.agentConfig?.agent_user_guide,
|
|
11097
|
+
});
|
|
11090
11098
|
} catch (err) {
|
|
11091
11099
|
throw new Error(err.message);
|
|
11092
11100
|
}
|
|
@@ -11113,33 +11121,33 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11113
11121
|
//${conversation_item_doc.text}
|
|
11114
11122
|
// Prompt Category: ${conversation_doc?.category_info?.category}
|
|
11115
11123
|
// Input: ${conversation_item_doc.prompt || conversation_doc.prompt}
|
|
11124
|
+
// 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.
|
|
11125
|
+
|
|
11126
|
+
// 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).
|
|
11127
|
+
|
|
11128
|
+
// Contextual Relevance: Balance the selection with the ## User Info and ## Prompt Category to ensure the agents match the user's industry and intent.
|
|
11116
11129
|
|
|
11117
11130
|
const prompt = `
|
|
11118
11131
|
|
|
11119
11132
|
Role: You are an expert Routing Assistant specialized in connecting users with the most relevant specialized AI agents.
|
|
11120
|
-
|
|
11121
11133
|
Task: Select maximum ${no_of_suggestions} agents from the ## Agent List that are best suited to act upon or refine the current conversation state.
|
|
11122
11134
|
|
|
11123
11135
|
Selection Strategy:
|
|
11136
|
+
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).
|
|
11137
|
+
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.
|
|
11138
|
+
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.
|
|
11139
|
+
4. Contextual Relevance: Match the user's business profile (Digital Marketing & Web Development) with technical agents that automate development tasks.
|
|
11124
11140
|
|
|
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.
|
|
11130
11141
|
|
|
11142
|
+
## ${type}: ${context ? context : 'Use the previous response output as the content to analyze for next agents.'}
|
|
11143
|
+
|
|
11131
11144
|
Input Context:
|
|
11132
11145
|
|
|
11133
11146
|
User Profile: ${JSON.stringify(account_doc.account_info)}
|
|
11134
11147
|
Prompt Category: ${conversation_doc?.category_info?.category}
|
|
11135
11148
|
Input: ${conversation_item_doc.prompt || conversation_doc.prompt}
|
|
11136
11149
|
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
Output to Process: ${context ? context : 'Use the previous response output as the content to analyze for next agents.'}
|
|
11142
|
-
|
|
11150
|
+
|
|
11143
11151
|
Agent Source: ${JSON.stringify(agents_docs)}
|
|
11144
11152
|
|
|
11145
11153
|
Output: > Return a JSON array of maximum ${no_of_suggestions} objects following this schema:
|