@xuda.io/ai_module 1.1.5424 → 1.1.5426
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 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -11191,7 +11191,7 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11191
11191
|
const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_item_doc.conversation_id);
|
|
11192
11192
|
|
|
11193
11193
|
if (conversation_item_doc.prompt_suggestions) {
|
|
11194
|
-
exclude_agents = conversation_item_doc.prompt_suggestions.map((agent) => agent.agent_id);
|
|
11194
|
+
exclude_agents = [...new Set([...exclude_agents, ...conversation_item_doc.prompt_suggestions.map((agent) => agent.agent_id)])];
|
|
11195
11195
|
}
|
|
11196
11196
|
|
|
11197
11197
|
const get_agents = async function () {
|
|
@@ -11260,6 +11260,7 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11260
11260
|
|
|
11261
11261
|
const get_suggestions = async function () {
|
|
11262
11262
|
const availableAgentIds = new Set(agents_docs.map((agent) => agent.agent_id));
|
|
11263
|
+
const contentToAnalyze = context || conversation_item_doc?.text || conversation_item_doc?.prompt || conversation_doc?.prompt || '';
|
|
11263
11264
|
const AgentItemSchema = z.object({
|
|
11264
11265
|
type: z.literal('agent').describe('Constant identifier, always "agent"'),
|
|
11265
11266
|
agent_id: z.string().describe('The unique identifier for the agent'),
|
|
@@ -11281,22 +11282,27 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11281
11282
|
1. Return fewer than ${no_of_suggestions} agents when only a few are relevant.
|
|
11282
11283
|
2. Return an empty array when none of the agents are a strong match.
|
|
11283
11284
|
3. Do not fill the list just to reach ${no_of_suggestions}.
|
|
11284
|
-
4. Only include an agent when its relevance_score is
|
|
11285
|
+
4. Only include an agent when its relevance_score is 85 or higher.
|
|
11285
11286
|
5. Never invent agent ids. Use only ids from the ## Agent Source.
|
|
11287
|
+
6. Never return any agent whose id appears in ## Excluded Agent IDs.
|
|
11288
|
+
7. Base every suggestion on explicit evidence in ## Content To Analyze, not on assumptions about what might be useful later.
|
|
11289
|
+
8. If ## Content To Analyze is only a greeting, acknowledgement, chit-chat, or other generic text with no concrete task, return [].
|
|
11290
|
+
9. Do not use the user profile by itself as a reason to recommend technical, coding, HTML, or app-building agents.
|
|
11286
11291
|
|
|
11287
11292
|
Selection Strategy:
|
|
11288
|
-
1.
|
|
11289
|
-
2.
|
|
11290
|
-
3.
|
|
11293
|
+
1. Evidence First: Recommend an agent only when the content clearly mentions a task, artifact, or format that the agent directly handles.
|
|
11294
|
+
2. Format Compatibility: If the content explicitly contains structured JSON, component definitions, code, markup, or a direct request for those formats, prioritize agents specialized for that exact format.
|
|
11295
|
+
3. Workflow Continuity: Use next-step reasoning only when the current content already demonstrates a concrete project step.
|
|
11291
11296
|
4. Reject generic or weakly related agents. If the match is ambiguous, leave the agent out.
|
|
11292
11297
|
|
|
11293
11298
|
|
|
11294
|
-
## ${type}: ${
|
|
11299
|
+
## Content To Analyze (${type}): ${contentToAnalyze || 'No usable content.'}
|
|
11295
11300
|
|
|
11296
11301
|
Input Context:
|
|
11297
11302
|
|
|
11298
11303
|
User Profile: ${JSON.stringify(account_doc.account_info)}
|
|
11299
11304
|
Prompt Category: ${conversation_doc?.category_info?.category}
|
|
11305
|
+
Excluded Agent IDs: ${JSON.stringify(exclude_agents)}
|
|
11300
11306
|
|
|
11301
11307
|
Agent Source: ${JSON.stringify(agents_docs)}
|
|
11302
11308
|
|
|
@@ -11341,7 +11347,7 @@ export const get_chat_suggestions = async function (req) {
|
|
|
11341
11347
|
if (seen.has(agent.agent_id)) {
|
|
11342
11348
|
return false;
|
|
11343
11349
|
}
|
|
11344
|
-
if (typeof agent.relevance_score !== 'number' || agent.relevance_score <
|
|
11350
|
+
if (typeof agent.relevance_score !== 'number' || agent.relevance_score < 85) {
|
|
11345
11351
|
return false;
|
|
11346
11352
|
}
|
|
11347
11353
|
const short_action = agent.short_action?.trim();
|