dhi-copilot-ai 3.3.0 → 3.3.1
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/dist/dhi-copilot-ai.js +42 -17
- package/dist/dhi-copilot-ai.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/dhi-copilot-ai.js
CHANGED
|
@@ -24293,6 +24293,28 @@ const apiService = {
|
|
|
24293
24293
|
}
|
|
24294
24294
|
return response.json();
|
|
24295
24295
|
},
|
|
24296
|
+
sendMessageWithAttachments: async (apiUrl, companyId, token, payload) => {
|
|
24297
|
+
const url = `${cleanUrl(apiUrl)}/chat/fluxxon/${companyId}/attachments`;
|
|
24298
|
+
const headers = {};
|
|
24299
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
24300
|
+
const formData = new FormData();
|
|
24301
|
+
formData.append("message", payload.message);
|
|
24302
|
+
formData.append("thread_id", payload.thread_id);
|
|
24303
|
+
if (payload.category) formData.append("category", payload.category);
|
|
24304
|
+
payload.files.forEach((file) => {
|
|
24305
|
+
formData.append("files", file);
|
|
24306
|
+
});
|
|
24307
|
+
const response = await fetch(url, {
|
|
24308
|
+
method: "POST",
|
|
24309
|
+
headers,
|
|
24310
|
+
body: formData
|
|
24311
|
+
});
|
|
24312
|
+
if (!response.ok) {
|
|
24313
|
+
const detail = await response.text();
|
|
24314
|
+
throw new Error(`Chat attachments error ${response.status}: ${detail}`);
|
|
24315
|
+
}
|
|
24316
|
+
return response.json();
|
|
24317
|
+
},
|
|
24296
24318
|
// --- SKILLS / CATEGORIES ---
|
|
24297
24319
|
/**
|
|
24298
24320
|
* Récupère la liste statique des catégories métier.
|
|
@@ -37349,9 +37371,7 @@ const ChatView = () => {
|
|
|
37349
37371
|
threadId,
|
|
37350
37372
|
confirmThreadId,
|
|
37351
37373
|
config: storeConfig,
|
|
37352
|
-
// --- Nouveautés Catégories ---
|
|
37353
37374
|
selectedCategory,
|
|
37354
|
-
categories,
|
|
37355
37375
|
fetchCategories
|
|
37356
37376
|
} = useStore();
|
|
37357
37377
|
const configContext = useConfig();
|
|
@@ -37387,7 +37407,7 @@ const ChatView = () => {
|
|
|
37387
37407
|
addMessage({
|
|
37388
37408
|
id: "err-company-" + Date.now(),
|
|
37389
37409
|
role: "assistant",
|
|
37390
|
-
content: "⚠️ **Identifiant d'entreprise manquant.**\n\nVeuillez configurer l'identifiant de l'entreprise
|
|
37410
|
+
content: "⚠️ **Identifiant d'entreprise manquant.**\n\nVeuillez configurer l'identifiant de l'entreprise dans les propriétés du widget.",
|
|
37391
37411
|
timestamp: /* @__PURE__ */ new Date()
|
|
37392
37412
|
});
|
|
37393
37413
|
setLoading(false);
|
|
@@ -37400,7 +37420,7 @@ const ChatView = () => {
|
|
|
37400
37420
|
const fileList = files.map((f2) => `📄 ${f2.name}`).join("\n");
|
|
37401
37421
|
displayContent += `
|
|
37402
37422
|
|
|
37403
|
-
**Fichiers joints :**
|
|
37423
|
+
**Fichiers joints (analyse éphémère) :**
|
|
37404
37424
|
${fileList}`;
|
|
37405
37425
|
}
|
|
37406
37426
|
addMessage({
|
|
@@ -37410,24 +37430,29 @@ ${fileList}`;
|
|
|
37410
37430
|
timestamp: /* @__PURE__ */ new Date()
|
|
37411
37431
|
});
|
|
37412
37432
|
setLoading(true);
|
|
37413
|
-
const currentThreadId = threadId;
|
|
37414
37433
|
try {
|
|
37415
|
-
if (files.length > 0) {
|
|
37416
|
-
await apiService.uploadFiles(apiUrl, userToken ?? "", files);
|
|
37417
|
-
}
|
|
37418
37434
|
const fileNames = files.map((f2) => f2.name).join(", ");
|
|
37419
37435
|
let finalPrompt = text2.trim();
|
|
37420
37436
|
if (files.length > 0) {
|
|
37421
37437
|
finalPrompt = finalPrompt ? `${finalPrompt}
|
|
37422
37438
|
|
|
37423
|
-
(
|
|
37439
|
+
(Note : L'utilisateur a joint ces fichiers pour analyse immédiate : ${fileNames})` : `Analyse les documents joints suivants : ${fileNames}`;
|
|
37440
|
+
}
|
|
37441
|
+
let data;
|
|
37442
|
+
if (files.length > 0) {
|
|
37443
|
+
data = await apiService.sendMessageWithAttachments(apiUrl, companyId, userToken, {
|
|
37444
|
+
message: finalPrompt,
|
|
37445
|
+
thread_id: threadId,
|
|
37446
|
+
category: selectedCategory,
|
|
37447
|
+
files
|
|
37448
|
+
});
|
|
37449
|
+
} else {
|
|
37450
|
+
data = await apiService.sendMessage(apiUrl, companyId, userToken, {
|
|
37451
|
+
message: finalPrompt,
|
|
37452
|
+
thread_id: threadId,
|
|
37453
|
+
category: selectedCategory
|
|
37454
|
+
});
|
|
37424
37455
|
}
|
|
37425
|
-
const data = await apiService.sendMessage(apiUrl, companyId, userToken, {
|
|
37426
|
-
message: finalPrompt,
|
|
37427
|
-
thread_id: currentThreadId,
|
|
37428
|
-
category: selectedCategory
|
|
37429
|
-
// ← Envoi de l'ID (ex: "remunerations") ou null
|
|
37430
|
-
});
|
|
37431
37456
|
if (data == null ? void 0 : data.thread_id) {
|
|
37432
37457
|
confirmThreadId(data.thread_id);
|
|
37433
37458
|
}
|
|
@@ -37443,7 +37468,7 @@ ${fileList}`;
|
|
|
37443
37468
|
addMessage({
|
|
37444
37469
|
id: "err-" + Date.now(),
|
|
37445
37470
|
role: "assistant",
|
|
37446
|
-
content: "⚠️ **
|
|
37471
|
+
content: "⚠️ **Erreur de communication.**\n\nLe serveur ne répond pas ou a rencontré une erreur lors de l'analyse. Veuillez réessayer.",
|
|
37447
37472
|
timestamp: /* @__PURE__ */ new Date()
|
|
37448
37473
|
});
|
|
37449
37474
|
} finally {
|
|
@@ -37485,7 +37510,7 @@ ${fileList}`;
|
|
|
37485
37510
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ChatInput, { onSend: handleSendMessage, disabled: isLoading }),
|
|
37486
37511
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center gap-4 mt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-[9px] text-slate-400 font-bold uppercase tracking-widest flex items-center gap-1", children: [
|
|
37487
37512
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-1 h-1 rounded-full bg-emerald-500" }),
|
|
37488
|
-
"Fluxoon
|
|
37513
|
+
"Fluxoon Intelligence Active"
|
|
37489
37514
|
] }) })
|
|
37490
37515
|
] }) })
|
|
37491
37516
|
] });
|