@sinequa/assistant 3.1.1 → 3.2.0
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/chat-message/chat-message.component.d.ts +2 -0
- package/chat/chat-settings-v3/chat-settings-v3.component.d.ts +8 -3
- package/chat/chat.component.d.ts +164 -145
- package/chat/chat.service.d.ts +21 -914
- package/chat/prompt.component.d.ts +21 -0
- package/chat/public-api.d.ts +1 -0
- package/chat/rest-chat.service.d.ts +4 -2
- package/chat/saved-chats/saved-chats.component.d.ts +5 -3
- package/chat/styles/assistant.scss +21 -1
- package/chat/types.d.ts +284 -866
- package/chat/websocket-chat.service.d.ts +4 -2
- package/esm2020/chat/chat-message/chat-message.component.mjs +5 -3
- package/esm2020/chat/chat-reference/chat-reference.component.mjs +3 -3
- package/esm2020/chat/chat-settings-v3/chat-settings-v3.component.mjs +22 -24
- package/esm2020/chat/chat.component.mjs +88 -33
- package/esm2020/chat/chat.service.mjs +68 -24
- package/esm2020/chat/prompt.component.mjs +88 -0
- package/esm2020/chat/public-api.mjs +2 -1
- package/esm2020/chat/rest-chat.service.mjs +41 -18
- package/esm2020/chat/saved-chats/saved-chats.component.mjs +38 -7
- package/esm2020/chat/types.mjs +50 -54
- package/esm2020/chat/websocket-chat.service.mjs +46 -19
- package/fesm2015/sinequa-assistant-chat.mjs +428 -172
- package/fesm2015/sinequa-assistant-chat.mjs.map +1 -1
- package/fesm2020/sinequa-assistant-chat.mjs +429 -176
- package/fesm2020/sinequa-assistant-chat.mjs.map +1 -1
- package/package.json +4 -2
|
@@ -5,6 +5,8 @@ import { ChatContextAttachment, ChatMessage } from "../types";
|
|
|
5
5
|
import { Processor } from "unified";
|
|
6
6
|
import { Node } from "unist";
|
|
7
7
|
import { UIService } from "@sinequa/components/utils";
|
|
8
|
+
import "prismjs-components-importer/esm";
|
|
9
|
+
import 'prismjs/plugins/autoloader/prism-autoloader';
|
|
8
10
|
import * as i0 from "@angular/core";
|
|
9
11
|
export declare class ChatMessageComponent implements OnChanges, AfterViewInit {
|
|
10
12
|
searchService: SearchService;
|
|
@@ -9,12 +9,16 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
export declare class ChatSettingsV3Component implements OnInit, OnDestroy {
|
|
10
10
|
/** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */
|
|
11
11
|
instanceId: string;
|
|
12
|
-
_update: EventEmitter<
|
|
13
|
-
_cancel: EventEmitter<
|
|
12
|
+
_update: EventEmitter<ChatConfig>;
|
|
13
|
+
_cancel: EventEmitter<ChatConfig>;
|
|
14
14
|
chatService: ChatService;
|
|
15
15
|
config: ChatConfig;
|
|
16
16
|
subscription: Subscription;
|
|
17
17
|
selectedModel: GllmModelDescription | undefined;
|
|
18
|
+
functions: {
|
|
19
|
+
name: string;
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
}[];
|
|
18
22
|
isAdmin: boolean;
|
|
19
23
|
loginService: LoginService;
|
|
20
24
|
instanceManagerService: InstanceManagerService;
|
|
@@ -26,8 +30,9 @@ export declare class ChatSettingsV3Component implements OnInit, OnDestroy {
|
|
|
26
30
|
get hasModel(): boolean;
|
|
27
31
|
instantiateChatService(): void;
|
|
28
32
|
onChatModelChange(selectedModel: GllmModelDescription): void;
|
|
33
|
+
getFunctionDescription(name: string): string;
|
|
29
34
|
toggleFunctionsSelection(name: string): void;
|
|
30
|
-
private
|
|
35
|
+
private initFunctionsList;
|
|
31
36
|
/**
|
|
32
37
|
* Save the new chat config in the chat service and the user preferences
|
|
33
38
|
*/
|
package/chat/chat.component.d.ts
CHANGED
|
@@ -16,150 +16,6 @@ export interface InitChat {
|
|
|
16
16
|
messages: RawMessage[];
|
|
17
17
|
}
|
|
18
18
|
export declare class ChatComponent extends AbstractFacet implements OnInit, OnChanges, OnDestroy {
|
|
19
|
-
/** Define the key based on it, the chat service instance will be stored */
|
|
20
|
-
instanceId: string;
|
|
21
|
-
/** Define the query to use to fetch answers */
|
|
22
|
-
query?: Query;
|
|
23
|
-
/** Define the protocol to be used for this chat instance*/
|
|
24
|
-
protocol: 'REST' | 'WEBSOCKET';
|
|
25
|
-
/** Map of listeners overriding default registered ones*/
|
|
26
|
-
messageHandlers: Map<string, MessageHandler<any>>;
|
|
27
|
-
/** When the assistant answer a user question, automatically scroll down to the bottom of the discussion */
|
|
28
|
-
automaticScrollToLastResponse: boolean;
|
|
29
|
-
chat?: InitChat;
|
|
30
|
-
enableChat: boolean;
|
|
31
|
-
showCredits: boolean;
|
|
32
|
-
customAssistantIcon: string;
|
|
33
|
-
data: EventEmitter<ChatMessage[]>;
|
|
34
|
-
referenceClicked: EventEmitter<{
|
|
35
|
-
filename: string;
|
|
36
|
-
id: string;
|
|
37
|
-
title: string;
|
|
38
|
-
text: string;
|
|
39
|
-
size: number;
|
|
40
|
-
$selected: boolean;
|
|
41
|
-
matchlocations: string[];
|
|
42
|
-
rank: number;
|
|
43
|
-
databasealias: string;
|
|
44
|
-
matchingpartnames: string[];
|
|
45
|
-
matchlocationsperpartname: {
|
|
46
|
-
matchlocations: {
|
|
47
|
-
data: string;
|
|
48
|
-
partname: string;
|
|
49
|
-
}[];
|
|
50
|
-
}[];
|
|
51
|
-
documentlanguages: string[];
|
|
52
|
-
documentweight: string;
|
|
53
|
-
modified: string;
|
|
54
|
-
indexationtime: string;
|
|
55
|
-
version: string;
|
|
56
|
-
treepath: string[];
|
|
57
|
-
fileext: string;
|
|
58
|
-
flags: string[];
|
|
59
|
-
collection: string[];
|
|
60
|
-
docformat: string;
|
|
61
|
-
url1: string;
|
|
62
|
-
authors: string[];
|
|
63
|
-
rfmEnabled: boolean;
|
|
64
|
-
termspresence: {
|
|
65
|
-
term: string;
|
|
66
|
-
presence: "found" | "missing";
|
|
67
|
-
}[];
|
|
68
|
-
$isDuplicate: boolean;
|
|
69
|
-
$duplicateCount: number;
|
|
70
|
-
globalrelevance?: number | undefined;
|
|
71
|
-
displayTitle?: string | undefined;
|
|
72
|
-
doctype?: string | undefined;
|
|
73
|
-
url2?: string | undefined;
|
|
74
|
-
relevantExtracts?: string | undefined;
|
|
75
|
-
extracts?: {
|
|
76
|
-
score: number;
|
|
77
|
-
highlighted: string;
|
|
78
|
-
locations: string;
|
|
79
|
-
originalLocations: string;
|
|
80
|
-
partname?: string | undefined;
|
|
81
|
-
}[] | undefined;
|
|
82
|
-
accesslists?: {
|
|
83
|
-
accessListIndices: number[];
|
|
84
|
-
authorizedLists: {
|
|
85
|
-
id: string;
|
|
86
|
-
domain: string;
|
|
87
|
-
}[];
|
|
88
|
-
deniedLists: {
|
|
89
|
-
id: string;
|
|
90
|
-
domain: string;
|
|
91
|
-
}[];
|
|
92
|
-
} | undefined;
|
|
93
|
-
thumbnailUrl?: string | undefined;
|
|
94
|
-
originalUrl?: string | undefined;
|
|
95
|
-
pdfUrl?: string | undefined;
|
|
96
|
-
rfm?: {
|
|
97
|
-
click?: {
|
|
98
|
-
image: import("@sinequa/core/web-services").RFMDisplay;
|
|
99
|
-
status: import("@sinequa/core/web-services").RFMDisplay;
|
|
100
|
-
eventCount: number;
|
|
101
|
-
average: number;
|
|
102
|
-
imageAction: import("@sinequa/core/web-services").RFMDisplay;
|
|
103
|
-
availableActions: import("@sinequa/core/web-services").RFMDisplay;
|
|
104
|
-
} | undefined;
|
|
105
|
-
like?: {
|
|
106
|
-
image: import("@sinequa/core/web-services").RFMDisplay;
|
|
107
|
-
status: import("@sinequa/core/web-services").RFMDisplay;
|
|
108
|
-
eventCount: number;
|
|
109
|
-
average: number;
|
|
110
|
-
imageAction: import("@sinequa/core/web-services").RFMDisplay;
|
|
111
|
-
availableActions: import("@sinequa/core/web-services").RFMDisplay;
|
|
112
|
-
} | undefined;
|
|
113
|
-
important?: {
|
|
114
|
-
image: import("@sinequa/core/web-services").RFMDisplay;
|
|
115
|
-
status: import("@sinequa/core/web-services").RFMDisplay;
|
|
116
|
-
eventCount: number;
|
|
117
|
-
average: number;
|
|
118
|
-
imageAction: import("@sinequa/core/web-services").RFMDisplay;
|
|
119
|
-
availableActions: import("@sinequa/core/web-services").RFMDisplay;
|
|
120
|
-
} | undefined;
|
|
121
|
-
} | undefined;
|
|
122
|
-
groupcount?: number | undefined;
|
|
123
|
-
nearhash?: string | undefined;
|
|
124
|
-
exacthash?: string | undefined;
|
|
125
|
-
containerid?: string | undefined;
|
|
126
|
-
$page?: number | undefined;
|
|
127
|
-
matchingpassages?: {
|
|
128
|
-
passages: {
|
|
129
|
-
location: number[];
|
|
130
|
-
id: number;
|
|
131
|
-
score: number;
|
|
132
|
-
rlocation: number[];
|
|
133
|
-
highlightedText: string;
|
|
134
|
-
$expanded?: boolean | undefined;
|
|
135
|
-
}[];
|
|
136
|
-
} | undefined;
|
|
137
|
-
$hasPassages?: boolean | undefined;
|
|
138
|
-
}>;
|
|
139
|
-
openPreview: EventEmitter<ChatContextAttachment>;
|
|
140
|
-
loading$: EventEmitter<boolean>;
|
|
141
|
-
error: EventEmitter<any>;
|
|
142
|
-
_config: EventEmitter<ChatConfig>;
|
|
143
|
-
messageList?: ElementRef<HTMLUListElement>;
|
|
144
|
-
questionInput?: ElementRef<HTMLInputElement>;
|
|
145
|
-
loadingTpl?: TemplateRef<any>;
|
|
146
|
-
chatService: ChatService;
|
|
147
|
-
config: ChatConfig;
|
|
148
|
-
messages$: BehaviorSubject<ChatMessage[] | undefined>;
|
|
149
|
-
question: string;
|
|
150
|
-
_actions: Action[];
|
|
151
|
-
sub: Subscription;
|
|
152
|
-
dataSubscription: Subscription | undefined;
|
|
153
|
-
/** Variables that depend on the type of model in use */
|
|
154
|
-
modelDescription?: GllmModelDescription;
|
|
155
|
-
assistantIcon: string;
|
|
156
|
-
privacyUrl: string;
|
|
157
|
-
messageToEdit?: number;
|
|
158
|
-
changes$: BehaviorSubject<SimpleChanges | undefined>;
|
|
159
|
-
currentMessageIndex: number | undefined;
|
|
160
|
-
handleFirstChanges: boolean;
|
|
161
|
-
isAtBottom: boolean;
|
|
162
|
-
initializationError: boolean;
|
|
163
19
|
loginService: LoginService;
|
|
164
20
|
websocketService: WebSocketChatService;
|
|
165
21
|
restService: RestChatService;
|
|
@@ -1073,6 +929,149 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1073
929
|
}>;
|
|
1074
930
|
principalService: PrincipalWebService;
|
|
1075
931
|
cdr: ChangeDetectorRef;
|
|
932
|
+
/** Define the key based on it, the chat service instance will be stored */
|
|
933
|
+
instanceId: string;
|
|
934
|
+
/** Define the query to use to fetch answers */
|
|
935
|
+
query: Query;
|
|
936
|
+
/** Define the protocol to be used for this chat instance*/
|
|
937
|
+
protocol: 'REST' | 'WEBSOCKET';
|
|
938
|
+
/** Map of listeners overriding default registered ones*/
|
|
939
|
+
messageHandlers: Map<string, MessageHandler<any>>;
|
|
940
|
+
/** When the assistant answer a user question, automatically scroll down to the bottom of the discussion */
|
|
941
|
+
automaticScrollToLastResponse: boolean;
|
|
942
|
+
chat?: InitChat;
|
|
943
|
+
customAssistantIcon: string;
|
|
944
|
+
data: EventEmitter<ChatMessage[]>;
|
|
945
|
+
referenceClicked: EventEmitter<{
|
|
946
|
+
filename: string;
|
|
947
|
+
id: string;
|
|
948
|
+
title: string;
|
|
949
|
+
text: string;
|
|
950
|
+
size: number;
|
|
951
|
+
$selected: boolean;
|
|
952
|
+
matchlocations: string[];
|
|
953
|
+
rank: number;
|
|
954
|
+
databasealias: string;
|
|
955
|
+
matchingpartnames: string[];
|
|
956
|
+
matchlocationsperpartname: {
|
|
957
|
+
matchlocations: {
|
|
958
|
+
data: string;
|
|
959
|
+
partname: string;
|
|
960
|
+
}[];
|
|
961
|
+
}[];
|
|
962
|
+
documentlanguages: string[];
|
|
963
|
+
documentweight: string;
|
|
964
|
+
modified: string;
|
|
965
|
+
indexationtime: string;
|
|
966
|
+
version: string;
|
|
967
|
+
treepath: string[];
|
|
968
|
+
fileext: string;
|
|
969
|
+
flags: string[];
|
|
970
|
+
collection: string[];
|
|
971
|
+
docformat: string;
|
|
972
|
+
url1: string;
|
|
973
|
+
authors: string[];
|
|
974
|
+
rfmEnabled: boolean;
|
|
975
|
+
termspresence: {
|
|
976
|
+
term: string;
|
|
977
|
+
presence: "found" | "missing";
|
|
978
|
+
}[];
|
|
979
|
+
$isDuplicate: boolean;
|
|
980
|
+
$duplicateCount: number;
|
|
981
|
+
globalrelevance?: number | undefined;
|
|
982
|
+
displayTitle?: string | undefined;
|
|
983
|
+
doctype?: string | undefined;
|
|
984
|
+
url2?: string | undefined;
|
|
985
|
+
relevantExtracts?: string | undefined;
|
|
986
|
+
extracts?: {
|
|
987
|
+
score: number;
|
|
988
|
+
highlighted: string;
|
|
989
|
+
locations: string;
|
|
990
|
+
originalLocations: string;
|
|
991
|
+
partname?: string | undefined;
|
|
992
|
+
}[] | undefined;
|
|
993
|
+
accesslists?: {
|
|
994
|
+
accessListIndices: number[];
|
|
995
|
+
authorizedLists: {
|
|
996
|
+
id: string;
|
|
997
|
+
domain: string;
|
|
998
|
+
}[];
|
|
999
|
+
deniedLists: {
|
|
1000
|
+
id: string;
|
|
1001
|
+
domain: string;
|
|
1002
|
+
}[];
|
|
1003
|
+
} | undefined;
|
|
1004
|
+
thumbnailUrl?: string | undefined;
|
|
1005
|
+
originalUrl?: string | undefined;
|
|
1006
|
+
pdfUrl?: string | undefined;
|
|
1007
|
+
rfm?: {
|
|
1008
|
+
click?: {
|
|
1009
|
+
image: import("@sinequa/core/web-services").RFMDisplay;
|
|
1010
|
+
status: import("@sinequa/core/web-services").RFMDisplay;
|
|
1011
|
+
eventCount: number;
|
|
1012
|
+
average: number;
|
|
1013
|
+
imageAction: import("@sinequa/core/web-services").RFMDisplay;
|
|
1014
|
+
availableActions: import("@sinequa/core/web-services").RFMDisplay;
|
|
1015
|
+
} | undefined;
|
|
1016
|
+
like?: {
|
|
1017
|
+
image: import("@sinequa/core/web-services").RFMDisplay;
|
|
1018
|
+
status: import("@sinequa/core/web-services").RFMDisplay;
|
|
1019
|
+
eventCount: number;
|
|
1020
|
+
average: number;
|
|
1021
|
+
imageAction: import("@sinequa/core/web-services").RFMDisplay;
|
|
1022
|
+
availableActions: import("@sinequa/core/web-services").RFMDisplay;
|
|
1023
|
+
} | undefined;
|
|
1024
|
+
important?: {
|
|
1025
|
+
image: import("@sinequa/core/web-services").RFMDisplay;
|
|
1026
|
+
status: import("@sinequa/core/web-services").RFMDisplay;
|
|
1027
|
+
eventCount: number;
|
|
1028
|
+
average: number;
|
|
1029
|
+
imageAction: import("@sinequa/core/web-services").RFMDisplay;
|
|
1030
|
+
availableActions: import("@sinequa/core/web-services").RFMDisplay;
|
|
1031
|
+
} | undefined;
|
|
1032
|
+
} | undefined;
|
|
1033
|
+
groupcount?: number | undefined;
|
|
1034
|
+
nearhash?: string | undefined;
|
|
1035
|
+
exacthash?: string | undefined;
|
|
1036
|
+
containerid?: string | undefined;
|
|
1037
|
+
$page?: number | undefined;
|
|
1038
|
+
matchingpassages?: {
|
|
1039
|
+
passages: {
|
|
1040
|
+
location: number[];
|
|
1041
|
+
id: number;
|
|
1042
|
+
score: number;
|
|
1043
|
+
rlocation: number[];
|
|
1044
|
+
highlightedText: string;
|
|
1045
|
+
$expanded?: boolean | undefined;
|
|
1046
|
+
}[];
|
|
1047
|
+
} | undefined;
|
|
1048
|
+
$hasPassages?: boolean | undefined;
|
|
1049
|
+
}>;
|
|
1050
|
+
openPreview: EventEmitter<ChatContextAttachment>;
|
|
1051
|
+
loading$: EventEmitter<boolean>;
|
|
1052
|
+
error: EventEmitter<any>;
|
|
1053
|
+
_config: EventEmitter<ChatConfig>;
|
|
1054
|
+
messageList?: ElementRef<HTMLUListElement>;
|
|
1055
|
+
questionInput?: ElementRef<HTMLInputElement>;
|
|
1056
|
+
loadingTpl?: TemplateRef<any>;
|
|
1057
|
+
chatService: ChatService;
|
|
1058
|
+
config: ChatConfig;
|
|
1059
|
+
messages$: BehaviorSubject<ChatMessage[] | undefined>;
|
|
1060
|
+
question: string;
|
|
1061
|
+
_actions: Action[];
|
|
1062
|
+
sub: Subscription;
|
|
1063
|
+
dataSubscription: Subscription | undefined;
|
|
1064
|
+
/** Variables that depend on the type of model in use */
|
|
1065
|
+
modelDescription?: GllmModelDescription;
|
|
1066
|
+
assistantIcon: string;
|
|
1067
|
+
privacyUrl: string;
|
|
1068
|
+
messageToEdit?: number;
|
|
1069
|
+
changes$: BehaviorSubject<SimpleChanges | undefined>;
|
|
1070
|
+
currentMessageIndex: number | undefined;
|
|
1071
|
+
firstChangesHandled: boolean;
|
|
1072
|
+
isAtBottom: boolean;
|
|
1073
|
+
initializationError: boolean;
|
|
1074
|
+
enabledUserInput: boolean;
|
|
1076
1075
|
constructor();
|
|
1077
1076
|
ngOnInit(): void;
|
|
1078
1077
|
ngOnChanges(changes: SimpleChanges): void;
|
|
@@ -1097,9 +1096,29 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1097
1096
|
updateData(messages: ChatMessage[]): void;
|
|
1098
1097
|
private toggleScrollButtonVisibility;
|
|
1099
1098
|
scrollDown(): void;
|
|
1099
|
+
/**
|
|
1100
|
+
* Start a new chat with the defaultValues settings
|
|
1101
|
+
* If the savedChat feature is enabled, the list of saved chats will be refreshed
|
|
1102
|
+
*/
|
|
1100
1103
|
newChat(): void;
|
|
1104
|
+
/**
|
|
1105
|
+
* Start the default chat with the defaultValues settings
|
|
1106
|
+
* If the chat is meant to be initialized with event === "Query", the corresponding user query message will be added to the chat history
|
|
1107
|
+
*/
|
|
1101
1108
|
loadDefaultChat(): void;
|
|
1109
|
+
/**
|
|
1110
|
+
* Start/open a new chat with the provided messages and chatId
|
|
1111
|
+
* If the last message is from the user, a request to the assistant is made to get an answer
|
|
1112
|
+
* If the last message is from the assistant, the conversation is loaded right away
|
|
1113
|
+
* @param messages The list of messages of the chat
|
|
1114
|
+
* @param chatId The id of the chat. If not provided, a new id will be generated
|
|
1115
|
+
*/
|
|
1102
1116
|
openChat(messages: RawMessage[], chatId?: string): void;
|
|
1117
|
+
/**
|
|
1118
|
+
* Reset the chat by clearing the messages and the chat history
|
|
1119
|
+
* The question input will be focused after the chat is reset
|
|
1120
|
+
* The fetch subscription will be terminated
|
|
1121
|
+
*/
|
|
1103
1122
|
resetChat(): void;
|
|
1104
1123
|
onLoadChat(): void;
|
|
1105
1124
|
terminateFetch(): void;
|
|
@@ -1108,5 +1127,5 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1108
1127
|
onKeyUp(event: KeyboardEvent): void;
|
|
1109
1128
|
private navigateMessage;
|
|
1110
1129
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChatComponent, never>;
|
|
1111
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ChatComponent, "sq-chat-v3", never, { "instanceId": "instanceId"; "query": "query"; "protocol": "protocol"; "messageHandlers": "messageHandlers"; "automaticScrollToLastResponse": "automaticScrollToLastResponse"; "chat": "chat"; "
|
|
1130
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatComponent, "sq-chat-v3", never, { "instanceId": "instanceId"; "query": "query"; "protocol": "protocol"; "messageHandlers": "messageHandlers"; "automaticScrollToLastResponse": "automaticScrollToLastResponse"; "chat": "chat"; "customAssistantIcon": "customAssistantIcon"; }, { "data": "data"; "referenceClicked": "referenceClicked"; "openPreview": "openPreview"; "loading$": "loading"; "error": "error"; "_config": "config"; }, ["loadingTpl"], never, true>;
|
|
1112
1131
|
}
|