@sinequa/assistant 3.8.4 → 3.8.6
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/chat/websocket-chat.service.d.ts +4 -2
- package/esm2020/chat/websocket-chat.service.mjs +41 -70
- package/fesm2015/sinequa-assistant-chat.mjs +39 -68
- package/fesm2015/sinequa-assistant-chat.mjs.map +1 -1
- package/fesm2020/sinequa-assistant-chat.mjs +39 -68
- package/fesm2020/sinequa-assistant-chat.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1476,6 +1476,8 @@ class WebSocketChatService extends ChatService {
|
|
|
1476
1476
|
this._debugMessages = [];
|
|
1477
1477
|
this.signalRService = inject(SignalRWebService);
|
|
1478
1478
|
this.authenticationService = inject(AuthenticationService);
|
|
1479
|
+
this.jsonMethodWebService = inject(JsonMethodPluginService);
|
|
1480
|
+
this.restUrl = "SinequaAssistantREST";
|
|
1479
1481
|
}
|
|
1480
1482
|
/**
|
|
1481
1483
|
* Initialize the assistant process.
|
|
@@ -1742,65 +1744,48 @@ class WebSocketChatService extends ChatService {
|
|
|
1742
1744
|
return;
|
|
1743
1745
|
}
|
|
1744
1746
|
const data = {
|
|
1747
|
+
action: "SavedChatList",
|
|
1745
1748
|
instanceId: this.chatInstanceId,
|
|
1746
1749
|
debug: this.assistantConfig$.value.defaultValues.debug
|
|
1747
1750
|
};
|
|
1748
|
-
this.
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
// Invoke the method SavedChatList
|
|
1752
|
-
this.connection.invoke('SavedChatList', data)
|
|
1753
|
-
.catch(error => {
|
|
1754
|
-
console.error('Error invoking SavedChatList:', error);
|
|
1755
|
-
return Promise.resolve();
|
|
1751
|
+
this.jsonMethodWebService.get(this.restUrl, data).subscribe(res => this.savedChats$.next(res.savedChats), error => {
|
|
1752
|
+
console.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);
|
|
1753
|
+
this.notificationsService.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);
|
|
1756
1754
|
});
|
|
1757
1755
|
}
|
|
1758
|
-
|
|
1759
|
-
const savedChatSubject$ = new Subject();
|
|
1756
|
+
addSavedChat(messages) {
|
|
1760
1757
|
const data = {
|
|
1758
|
+
action: "SavedChatAdd",
|
|
1761
1759
|
instanceId: this.chatInstanceId,
|
|
1762
|
-
savedChatId:
|
|
1760
|
+
savedChatId: this.chatId,
|
|
1761
|
+
history: messages,
|
|
1763
1762
|
debug: this.assistantConfig$.value.defaultValues.debug
|
|
1764
1763
|
};
|
|
1765
|
-
this.
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
})
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
savedChatSubject$.error(new Error(error));
|
|
1774
|
-
return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream
|
|
1775
|
-
});
|
|
1776
|
-
return savedChatSubject$.asObservable();
|
|
1764
|
+
return this.jsonMethodWebService.post(this.restUrl, data).pipe(map(res => res.savedChat), tap((savedChat) => {
|
|
1765
|
+
this.setSavedChatId(savedChat.id); // Persist the savedChatId
|
|
1766
|
+
this.generateAuditEvent('saved-chat.add', {}, savedChat.id); // Generate audit event
|
|
1767
|
+
}), catchError((error) => {
|
|
1768
|
+
console.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);
|
|
1769
|
+
this.notificationsService.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);
|
|
1770
|
+
return throwError(() => error);
|
|
1771
|
+
}));
|
|
1777
1772
|
}
|
|
1778
|
-
|
|
1779
|
-
const addSavedChatSubject$ = new Subject();
|
|
1773
|
+
getSavedChat(id) {
|
|
1780
1774
|
const data = {
|
|
1775
|
+
action: "SavedChatGet",
|
|
1781
1776
|
instanceId: this.chatInstanceId,
|
|
1782
|
-
savedChatId:
|
|
1783
|
-
history: messages,
|
|
1777
|
+
savedChatId: id,
|
|
1784
1778
|
debug: this.assistantConfig$.value.defaultValues.debug
|
|
1785
1779
|
};
|
|
1786
|
-
this.
|
|
1787
|
-
|
|
1788
|
-
this.
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
});
|
|
1792
|
-
// Invoke the method SavedChatAdd
|
|
1793
|
-
this.connection.invoke('SavedChatAdd', data)
|
|
1794
|
-
.catch(error => {
|
|
1795
|
-
console.error('Error invoking SavedChatAdd:', error);
|
|
1796
|
-
addSavedChatSubject$.error(new Error(error));
|
|
1797
|
-
return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream
|
|
1798
|
-
});
|
|
1799
|
-
return addSavedChatSubject$.asObservable();
|
|
1780
|
+
return this.jsonMethodWebService.get(this.restUrl, data).pipe(map(res => res.savedChat), catchError((error) => {
|
|
1781
|
+
console.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);
|
|
1782
|
+
this.notificationsService.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);
|
|
1783
|
+
return throwError(() => error);
|
|
1784
|
+
}));
|
|
1800
1785
|
}
|
|
1801
1786
|
updateSavedChat(id, name, messages) {
|
|
1802
|
-
const updateSavedChatSubject$ = new Subject();
|
|
1803
1787
|
const data = {
|
|
1788
|
+
action: "SavedChatUpdate",
|
|
1804
1789
|
instanceId: this.chatInstanceId,
|
|
1805
1790
|
savedChatId: id,
|
|
1806
1791
|
debug: this.assistantConfig$.value.defaultValues.debug
|
|
@@ -1809,38 +1794,24 @@ class WebSocketChatService extends ChatService {
|
|
|
1809
1794
|
data["title"] = name;
|
|
1810
1795
|
if (messages)
|
|
1811
1796
|
data["history"] = messages;
|
|
1812
|
-
this.
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
this.connection.invoke('SavedChatUpdate', data)
|
|
1818
|
-
.catch(error => {
|
|
1819
|
-
console.error('Error invoking SavedChatUpdate:', error);
|
|
1820
|
-
updateSavedChatSubject$.error(new Error(error));
|
|
1821
|
-
return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream
|
|
1822
|
-
});
|
|
1823
|
-
return updateSavedChatSubject$.asObservable();
|
|
1797
|
+
return this.jsonMethodWebService.post(this.restUrl, data).pipe(map(res => res.savedChat), catchError((error) => {
|
|
1798
|
+
console.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);
|
|
1799
|
+
this.notificationsService.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);
|
|
1800
|
+
return throwError(() => error);
|
|
1801
|
+
}));
|
|
1824
1802
|
}
|
|
1825
1803
|
deleteSavedChat(ids) {
|
|
1826
|
-
const deleteSavedChatSubject$ = new Subject();
|
|
1827
1804
|
const data = {
|
|
1805
|
+
action: "SavedChatDelete",
|
|
1828
1806
|
instanceId: this.chatInstanceId,
|
|
1829
|
-
|
|
1807
|
+
savedChatIds: ids,
|
|
1830
1808
|
debug: this.assistantConfig$.value.defaultValues.debug
|
|
1831
1809
|
};
|
|
1832
|
-
this.
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
this.connection.invoke('SavedChatDelete', data)
|
|
1838
|
-
.catch(error => {
|
|
1839
|
-
console.error('Error invoking SavedChatDelete:', error);
|
|
1840
|
-
deleteSavedChatSubject$.error(new Error(error));
|
|
1841
|
-
return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream
|
|
1842
|
-
});
|
|
1843
|
-
return deleteSavedChatSubject$.asObservable();
|
|
1810
|
+
return this.jsonMethodWebService.post(this.restUrl, data).pipe(map(res => res.deletedCount), catchError((error) => {
|
|
1811
|
+
console.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);
|
|
1812
|
+
this.notificationsService.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);
|
|
1813
|
+
return throwError(() => error);
|
|
1814
|
+
}));
|
|
1844
1815
|
}
|
|
1845
1816
|
/**
|
|
1846
1817
|
* Initialize out-of-the-box handlers
|