@xuda.io/ai_module 1.1.4167 → 1.1.4169
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 +25 -24
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2961,7 +2961,7 @@ const upload_agent_files = async function (uid, agent_doc) {
|
|
|
2961
2961
|
case 'audio':
|
|
2962
2962
|
case 'video': {
|
|
2963
2963
|
await save_agent_status(uid, agent_doc._id, 2, agentConfig);
|
|
2964
|
-
const file_stream = await get_drive_file_stream('user', app_id, uid, tool.file.name);
|
|
2964
|
+
const file_stream = await get_drive_file_stream('user', agent_doc.account_profile_info.app_id, uid, tool.file.name);
|
|
2965
2965
|
const transcript = await transcribe(uid, file_stream, { agent_id: agent_doc._id, func: 'upload_agent_files -' + validation_ret.category });
|
|
2966
2966
|
|
|
2967
2967
|
file = new File([Buffer.from(transcript, 'utf8')], tool.file.name, {
|
|
@@ -2980,7 +2980,7 @@ const upload_agent_files = async function (uid, agent_doc) {
|
|
|
2980
2980
|
}
|
|
2981
2981
|
|
|
2982
2982
|
case 'image': {
|
|
2983
|
-
const response = await get_drive_file_response('user', app_id, uid, tool.file.name);
|
|
2983
|
+
const response = await get_drive_file_response('user', agent_doc.account_profile_info.app_id, uid, tool.file.name);
|
|
2984
2984
|
|
|
2985
2985
|
if (!response.ok) throw new Error(`Failed to download file: ${response.statusText}`);
|
|
2986
2986
|
const arrayBuffer = await response.arrayBuffer();
|
|
@@ -3017,7 +3017,7 @@ const upload_agent_files = async function (uid, agent_doc) {
|
|
|
3017
3017
|
|
|
3018
3018
|
case 'document':
|
|
3019
3019
|
case 'text': {
|
|
3020
|
-
file = await get_drive_file_stream('user', app_id, uid, tool.file.name);
|
|
3020
|
+
file = await get_drive_file_stream('user', agent_doc.account_profile_info.app_id, uid, tool.file.name);
|
|
3021
3021
|
// tool.file.file_id = await upload_file_to_openai_storage(tool.file.name);
|
|
3022
3022
|
break;
|
|
3023
3023
|
}
|
|
@@ -3082,34 +3082,35 @@ const upload_agent_files = async function (uid, agent_doc) {
|
|
|
3082
3082
|
}
|
|
3083
3083
|
};
|
|
3084
3084
|
|
|
3085
|
-
const validate_ai_agent = async function (req) {
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
};
|
|
3085
|
+
// const validate_ai_agent = async function (req) {
|
|
3086
|
+
// // "tool_type": {
|
|
3087
|
+
// // "name": "Tool Type",
|
|
3088
|
+
// // "description": "",
|
|
3089
|
+
// // "type": "array",
|
|
3090
|
+
// // "enum": [
|
|
3091
|
+
// // "web_search",
|
|
3092
|
+
// // "file_search",
|
|
3093
|
+
// // "program",
|
|
3094
|
+
// // "mcp",
|
|
3095
|
+
// // "plugin",
|
|
3096
|
+
// // "ai_agent",
|
|
3097
|
+
// // "table",
|
|
3098
|
+
// // "image_generate"
|
|
3099
|
+
// // ],
|
|
3100
|
+
// // "mandatory": true
|
|
3101
|
+
// // }
|
|
3102
|
+
// };
|
|
3103
3103
|
|
|
3104
3104
|
const save_agent_status = async function (uid, agent_id, stat, agentConfig) {
|
|
3105
|
-
const project_db = await get_account_project_db(uid);
|
|
3105
|
+
// const project_db = await get_account_project_db(uid);
|
|
3106
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
3106
3107
|
|
|
3107
3108
|
try {
|
|
3108
|
-
let agent_doc = await
|
|
3109
|
+
let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
|
|
3109
3110
|
agent_doc.ts = Date.now();
|
|
3110
3111
|
agent_doc.stat = stat;
|
|
3111
3112
|
agent_doc.agentConfig = agentConfig;
|
|
3112
|
-
const data = await
|
|
3113
|
+
const data = await db_module.save_app_couch_doc_native(account_profile_info.app_id, agent_doc);
|
|
3113
3114
|
|
|
3114
3115
|
return { code: 12, data };
|
|
3115
3116
|
} catch (err) {
|