@xuda.io/ai_module 1.1.5132 → 1.1.5133
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 +9 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4046,7 +4046,7 @@ const chat_email = async function (req, job_id, headers) {
|
|
|
4046
4046
|
};
|
|
4047
4047
|
|
|
4048
4048
|
const ai_chat_conversation = async function (req, job_id, headers) {
|
|
4049
|
-
const { uid, gtp_token, profile_id } = req;
|
|
4049
|
+
const { uid, gtp_token, profile_id, conversation_item_id } = req;
|
|
4050
4050
|
const account_profile_info = await get_active_account_profile_info(uid, profile_id);
|
|
4051
4051
|
let { prompt, conversation_doc, attachments = [], ai_agents, output_format = 'md', stream = true, with_context = true, ai_model = _conf.default_ai_model } = req;
|
|
4052
4052
|
|
|
@@ -4113,6 +4113,11 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4113
4113
|
};
|
|
4114
4114
|
|
|
4115
4115
|
try {
|
|
4116
|
+
if (conversation_item_id) {
|
|
4117
|
+
const conversation_item_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_item_id);
|
|
4118
|
+
prompt = conversation_item_doc.text;
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4116
4121
|
const app_id = await get_account_default_project_id(uid);
|
|
4117
4122
|
const app_obj = await get_app_obj(account_profile_info.app_id);
|
|
4118
4123
|
const userName = await account_ms.get_user_name(uid);
|
|
@@ -10834,7 +10839,7 @@ export const open_ai_alive_check = async function () {};
|
|
|
10834
10839
|
// return account_profile_info;
|
|
10835
10840
|
// };
|
|
10836
10841
|
|
|
10837
|
-
export const get_chat_suggestions = async function (uid, ai_agents, conversation_item_id,
|
|
10842
|
+
export const get_chat_suggestions = async function (uid, ai_agents, conversation_item_id, no_of_suggestions = 3, ai_model = _conf.default_ai_model) {
|
|
10838
10843
|
try {
|
|
10839
10844
|
const account_profile_info = await get_active_account_profile_info(uid);
|
|
10840
10845
|
const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
|
|
@@ -10893,7 +10898,7 @@ export const get_chat_suggestions = async function (uid, ai_agents, conversation
|
|
|
10893
10898
|
|
|
10894
10899
|
// Define the response format as a fixed-length array of 5
|
|
10895
10900
|
const AgentResponseSchema = z.object({
|
|
10896
|
-
agents: z.array(AgentItemSchema).length(
|
|
10901
|
+
agents: z.array(AgentItemSchema).length(no_of_suggestions),
|
|
10897
10902
|
});
|
|
10898
10903
|
|
|
10899
10904
|
const chat_ret = await submit_chat_gpt_prompt({
|
|
@@ -10902,7 +10907,7 @@ export const get_chat_suggestions = async function (uid, ai_agents, conversation
|
|
|
10902
10907
|
|
|
10903
10908
|
Role: You are an expert Routing Assistant specialized in connecting users with the most relevant specialized AI agents.
|
|
10904
10909
|
|
|
10905
|
-
Task: Select exactly ${
|
|
10910
|
+
Task: Select exactly ${no_of_suggestions} agents from the ## Agent List that are best suited to act upon or refine the current conversation state.
|
|
10906
10911
|
|
|
10907
10912
|
Selection Strategy:
|
|
10908
10913
|
|