@xuda.io/ai_module 1.1.4572 → 1.1.4574
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 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5181,9 +5181,9 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
5181
5181
|
// };
|
|
5182
5182
|
// await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_item_obj);
|
|
5183
5183
|
|
|
5184
|
-
let
|
|
5184
|
+
let in_conversation_item_obj = {
|
|
5185
5185
|
_id: await _common.xuda_get_uuid('chat_conversation_item'),
|
|
5186
|
-
stat:
|
|
5186
|
+
stat: 3,
|
|
5187
5187
|
docType: 'chat_conversation_item',
|
|
5188
5188
|
uid,
|
|
5189
5189
|
conversation_type: 'ai_chat',
|
|
@@ -5191,12 +5191,14 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
5191
5191
|
date_created_ts: Date.now(),
|
|
5192
5192
|
ts: Date.now(),
|
|
5193
5193
|
conversation_id,
|
|
5194
|
-
text:
|
|
5195
|
-
reference_id:
|
|
5196
|
-
direction: '
|
|
5197
|
-
role: '
|
|
5194
|
+
text: output.state._currentStep.output,
|
|
5195
|
+
reference_id: output.state._lastTurnResponse.responseId,
|
|
5196
|
+
direction: 'in',
|
|
5197
|
+
role: 'assistant',
|
|
5198
5198
|
};
|
|
5199
|
-
await db_module.save_app_couch_doc_native(account_profile_info.app_id,
|
|
5199
|
+
await db_module.save_app_couch_doc_native(account_profile_info.app_id, in_conversation_item_obj);
|
|
5200
|
+
let out_conversation_item_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, out_conversation_item_obj._id);
|
|
5201
|
+
out_conversation_item_doc.stat = 3;
|
|
5200
5202
|
|
|
5201
5203
|
account_module.record_ai_usage(uid, inputTokens, outputTokens, 'conversation chat', prompt, model, { conversation_id, ai_agent_id: obj.ai_agent_id, item_id: obj.id }, account_profile_info);
|
|
5202
5204
|
// if (!conversation_doc.chat_image && (!conversation_doc.thumbnail_request_ts || Date.now() - conversation_doc.thumbnail_request_ts > 120000)) {
|