@xuda.io/ai_module 1.1.4875 → 1.1.4877
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 +20 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -6078,7 +6078,7 @@ export const unpin_ai_agent = async function (req, job_id, headers) {
|
|
|
6078
6078
|
}
|
|
6079
6079
|
};
|
|
6080
6080
|
|
|
6081
|
-
const get_transcript = async function (uid, app_id, conversation_id, account_profile_info, filename) {
|
|
6081
|
+
export const get_transcript = async function (uid, app_id, conversation_id, account_profile_info, filename) {
|
|
6082
6082
|
async function streamToBuffer(fileStream) {
|
|
6083
6083
|
const chunks = [];
|
|
6084
6084
|
for await (const chunk of fileStream) {
|
|
@@ -6183,6 +6183,25 @@ const get_transcript = async function (uid, app_id, conversation_id, account_pro
|
|
|
6183
6183
|
return transcript;
|
|
6184
6184
|
};
|
|
6185
6185
|
|
|
6186
|
+
export const add_conversation_item = async function () {
|
|
6187
|
+
try {
|
|
6188
|
+
const items = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
6189
|
+
items: [
|
|
6190
|
+
{
|
|
6191
|
+
type: 'message',
|
|
6192
|
+
role: 'system',
|
|
6193
|
+
content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript?.data || transcript || ''}` }],
|
|
6194
|
+
},
|
|
6195
|
+
],
|
|
6196
|
+
});
|
|
6197
|
+
report_ai_status('conversations');
|
|
6198
|
+
return items;
|
|
6199
|
+
} catch (err) {
|
|
6200
|
+
report_ai_status('conversations', err);
|
|
6201
|
+
throw err;
|
|
6202
|
+
}
|
|
6203
|
+
};
|
|
6204
|
+
|
|
6186
6205
|
const attachment_handler = async function (uid, app_id, conversation_id, attachments, account_profile_info, date_created_ts) {
|
|
6187
6206
|
if (!attachments?.length) return;
|
|
6188
6207
|
let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|