@sinequa/assistant 3.6.2 → 3.7.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/chat/chat-message/chat-message.component.d.ts +4 -2
- package/chat/chat.component.d.ts +137 -18
- package/chat/chat.service.d.ts +23 -1
- package/chat/rest-chat.service.d.ts +1 -0
- package/chat/saved-chats/saved-chats.component.d.ts +2 -2
- package/chat/styles/assistant.scss +5 -0
- package/chat/types.d.ts +189 -3
- package/chat/websocket-chat.service.d.ts +6 -6
- package/esm2020/chat/chat-message/chat-message.component.mjs +9 -4
- package/esm2020/chat/chat-reference/chat-reference.component.mjs +3 -3
- package/esm2020/chat/chat.component.mjs +361 -62
- package/esm2020/chat/chat.service.mjs +49 -3
- package/esm2020/chat/debug-message/debug-message.component.mjs +3 -3
- package/esm2020/chat/instance-manager.service.mjs +2 -2
- package/esm2020/chat/rest-chat.service.mjs +8 -3
- package/esm2020/chat/saved-chats/saved-chats.component.mjs +16 -5
- package/esm2020/chat/token-progress-bar/token-progress-bar.component.mjs +3 -3
- package/esm2020/chat/types.mjs +18 -4
- package/esm2020/chat/websocket-chat.service.mjs +191 -99
- package/fesm2015/sinequa-assistant-chat.mjs +660 -182
- package/fesm2015/sinequa-assistant-chat.mjs.map +1 -1
- package/fesm2020/sinequa-assistant-chat.mjs +649 -179
- package/fesm2020/sinequa-assistant-chat.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter, OnChanges, SimpleChanges, ChangeDetectorRef, AfterViewInit, ElementRef } from "@angular/core";
|
|
2
2
|
import { PrincipalWebService } from "@sinequa/core/web-services";
|
|
3
3
|
import { SearchService } from "@sinequa/components/search";
|
|
4
|
-
import { ChatContextAttachment, ChatMessage, SuggestedAction } from "../types";
|
|
4
|
+
import { ChatContextAttachment, ChatMessage, ChatStarter, SuggestedAction } from "../types";
|
|
5
5
|
import { Processor } from "unified";
|
|
6
6
|
import { Node } from "unist";
|
|
7
7
|
import { UIService } from "@sinequa/components/utils";
|
|
@@ -17,6 +17,7 @@ export declare class ChatMessageComponent implements OnChanges, AfterViewInit {
|
|
|
17
17
|
message: ChatMessage;
|
|
18
18
|
conversation: ChatMessage[];
|
|
19
19
|
suggestedActions: SuggestedAction[] | undefined;
|
|
20
|
+
chatStarters: ChatStarter[] | undefined;
|
|
20
21
|
assistantMessageIcon: string;
|
|
21
22
|
userMessageIcon: string;
|
|
22
23
|
connectionErrorMessageIcon: string;
|
|
@@ -37,6 +38,7 @@ export declare class ChatMessageComponent implements OnChanges, AfterViewInit {
|
|
|
37
38
|
partId?: number | undefined;
|
|
38
39
|
}>;
|
|
39
40
|
suggestAction: EventEmitter<SuggestedAction>;
|
|
41
|
+
chatStarterClicked: EventEmitter<ChatStarter>;
|
|
40
42
|
edit: EventEmitter<ChatMessage>;
|
|
41
43
|
copy: EventEmitter<ChatMessage>;
|
|
42
44
|
regenerate: EventEmitter<ChatMessage>;
|
|
@@ -79,5 +81,5 @@ export declare class ChatMessageComponent implements OnChanges, AfterViewInit {
|
|
|
79
81
|
openOriginalAttachment(attachment: ChatContextAttachment, partId?: number): void;
|
|
80
82
|
hideTooltip(): void;
|
|
81
83
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChatMessageComponent, never>;
|
|
82
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ChatMessageComponent, "sq-chat-message", never, { "message": "message"; "conversation": "conversation"; "suggestedActions": "suggestedActions"; "assistantMessageIcon": "assistantMessageIcon"; "userMessageIcon": "userMessageIcon"; "connectionErrorMessageIcon": "connectionErrorMessageIcon"; "searchWarningMessageIcon": "searchWarningMessageIcon"; "streaming": "streaming"; "canEdit": "canEdit"; "canRegenerate": "canRegenerate"; "canCopy": "canCopy"; "canDebug": "canDebug"; "canLike": "canLike"; "canDislike": "canDislike"; }, { "openDocument": "openDocument"; "openPreview": "openPreview"; "suggestAction": "suggestAction"; "edit": "edit"; "copy": "copy"; "regenerate": "regenerate"; "like": "like"; "dislike": "dislike"; "debug": "debug"; }, never, never, true>;
|
|
84
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatMessageComponent, "sq-chat-message", never, { "message": "message"; "conversation": "conversation"; "suggestedActions": "suggestedActions"; "chatStarters": "chatStarters"; "assistantMessageIcon": "assistantMessageIcon"; "userMessageIcon": "userMessageIcon"; "connectionErrorMessageIcon": "connectionErrorMessageIcon"; "searchWarningMessageIcon": "searchWarningMessageIcon"; "streaming": "streaming"; "canEdit": "canEdit"; "canRegenerate": "canRegenerate"; "canCopy": "canCopy"; "canDebug": "canDebug"; "canLike": "canLike"; "canDislike": "canDislike"; }, { "openDocument": "openDocument"; "openPreview": "openPreview"; "suggestAction": "suggestAction"; "chatStarterClicked": "chatStarterClicked"; "edit": "edit"; "copy": "copy"; "regenerate": "regenerate"; "like": "like"; "dislike": "dislike"; "debug": "debug"; }, never, never, true>;
|
|
83
85
|
}
|
package/chat/chat.component.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { AbstractFacet } from "@sinequa/components/facet";
|
|
|
4
4
|
import { SearchService } from "@sinequa/components/search";
|
|
5
5
|
import { AppService, Query } from "@sinequa/core/app-utils";
|
|
6
6
|
import { PrincipalWebService } from "@sinequa/core/web-services";
|
|
7
|
-
import { BehaviorSubject
|
|
7
|
+
import { BehaviorSubject } from "rxjs";
|
|
8
8
|
import { ChatService } from "./chat.service";
|
|
9
|
-
import { ChatContextAttachment, ChatConfig, ChatMessage, GllmModelDescription, MessageHandler, RawMessage, SuggestedAction, InitChat, DebugMessage } from "./types";
|
|
9
|
+
import { ChatContextAttachment, ChatConfig, ChatMessage, GllmModelDescription, MessageHandler, RawMessage, SuggestedAction, InitChat, DebugMessage, ChatStarter } from "./types";
|
|
10
10
|
import { InstanceManagerService } from "./instance-manager.service";
|
|
11
11
|
import { WebSocketChatService } from "./websocket-chat.service";
|
|
12
12
|
import { LoginService } from "@sinequa/core/login";
|
|
@@ -945,6 +945,8 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
945
945
|
messageHandlers: Map<string, MessageHandler<any>>;
|
|
946
946
|
/** When the assistant answer a user question, automatically scroll down to the bottom of the discussion */
|
|
947
947
|
automaticScrollToLastResponse: boolean;
|
|
948
|
+
/** When the assistant answer a user question, automatically focus to the chat input */
|
|
949
|
+
focusAfterResponse: boolean;
|
|
948
950
|
/** A chat discussion that the component should get initialized with it */
|
|
949
951
|
chat?: InitChat;
|
|
950
952
|
/** Icon to use for the assistant messages */
|
|
@@ -1073,10 +1075,14 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1073
1075
|
openPreview: EventEmitter<ChatContextAttachment>;
|
|
1074
1076
|
/** Event emitter triggered when the user clicks on a suggested action */
|
|
1075
1077
|
suggestAction: EventEmitter<SuggestedAction>;
|
|
1078
|
+
/** Event emitter triggered when the user clicks on a chat starter */
|
|
1079
|
+
chatStarter: EventEmitter<ChatStarter>;
|
|
1080
|
+
/** ViewChild decorators to access the template elements */
|
|
1076
1081
|
messageList?: ElementRef<HTMLUListElement>;
|
|
1077
1082
|
questionInput?: ElementRef<HTMLTextAreaElement>;
|
|
1083
|
+
/** ContentChild decorators allowing the override of the default templates from the parent component */
|
|
1078
1084
|
loadingTpl?: TemplateRef<any>;
|
|
1079
|
-
|
|
1085
|
+
reportTpl?: TemplateRef<any>;
|
|
1080
1086
|
tokenConsumptionTpl?: TemplateRef<any>;
|
|
1081
1087
|
debugMessagesTpl?: TemplateRef<any>;
|
|
1082
1088
|
chatService: ChatService;
|
|
@@ -1084,11 +1090,13 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1084
1090
|
messages$: BehaviorSubject<ChatMessage[] | undefined>;
|
|
1085
1091
|
question: string;
|
|
1086
1092
|
_actions: Action[];
|
|
1087
|
-
|
|
1088
|
-
|
|
1093
|
+
private _resetChatAction;
|
|
1094
|
+
private _sub;
|
|
1095
|
+
private _dataSubscription;
|
|
1089
1096
|
/** Variables that depend on the type of model in use */
|
|
1090
1097
|
modelDescription?: GllmModelDescription;
|
|
1091
1098
|
messageToEdit?: number;
|
|
1099
|
+
remappedMessageToEdit?: number;
|
|
1092
1100
|
changes$: BehaviorSubject<SimpleChanges | undefined>;
|
|
1093
1101
|
currentMessageIndex: number | undefined;
|
|
1094
1102
|
firstChangesHandled: boolean;
|
|
@@ -1101,35 +1109,81 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1101
1109
|
issueTypes?: string[];
|
|
1102
1110
|
defaultIssueTypes: string[];
|
|
1103
1111
|
issueType: string;
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1112
|
+
reportComment?: string;
|
|
1113
|
+
messageToReport?: ChatMessage;
|
|
1114
|
+
reportRank?: number;
|
|
1115
|
+
reportType: 'like' | 'dislike';
|
|
1116
|
+
showReport: boolean;
|
|
1108
1117
|
debugMessages: DebugMessage[] | undefined;
|
|
1109
1118
|
showDebugMessages: boolean;
|
|
1110
1119
|
private _previousQuery;
|
|
1120
|
+
private _reloadSubscription;
|
|
1111
1121
|
constructor();
|
|
1112
1122
|
ngOnInit(): void;
|
|
1113
1123
|
ngOnChanges(changes: SimpleChanges): void;
|
|
1114
1124
|
ngOnDestroy(): void;
|
|
1115
1125
|
get isAdmin(): boolean;
|
|
1126
|
+
get visibleMessagesCount(): number;
|
|
1116
1127
|
/**
|
|
1117
1128
|
* Instantiate the chat service based on the provided @input protocol
|
|
1118
1129
|
* This chat service instance will then be stored in the instanceManagerService with provided @input instanceId as a key
|
|
1119
1130
|
*/
|
|
1120
1131
|
instantiateChatService(): void;
|
|
1121
1132
|
get actions(): Action[];
|
|
1133
|
+
/**
|
|
1134
|
+
* Handles the changes in the chat component.
|
|
1135
|
+
* If the chat service is a WebSocketChatService, it handles the override of the message handlers if they exist.
|
|
1136
|
+
* Initializes the chat with the provided chat messages if they exist, otherwise loads the default chat.
|
|
1137
|
+
* If the chat is initialized, the initialization event is "Query", the query changes, and the queryChangeShouldTriggerReload function is provided,
|
|
1138
|
+
* then the chat should be reloaded if the function returns true. Otherwise, the chat should be reloaded by default.
|
|
1139
|
+
* It takes into account the ongoing streaming process and the ongoing stopping process to trigger that conditionally define the logic
|
|
1140
|
+
* of the reload :
|
|
1141
|
+
* - If the chat is streaming, then stop the generation and wait for the fetch to complete before reloading the chat.
|
|
1142
|
+
* - If the chat is stopping the generation, then wait for the fetch to complete before reloading the chat.
|
|
1143
|
+
*/
|
|
1122
1144
|
private _handleChanges;
|
|
1145
|
+
/**
|
|
1146
|
+
* Triggers a reload after the query change.
|
|
1147
|
+
* This method performs the necessary operations to reload the chat after a query change.
|
|
1148
|
+
* It sets the system and user messages, resets the savedChatId, generates a new chatId,
|
|
1149
|
+
* generates a new chat audit event, and handles the query mode.
|
|
1150
|
+
*/
|
|
1123
1151
|
private _triggerReloadAfterQueryChange;
|
|
1152
|
+
/**
|
|
1153
|
+
* Adds a scroll listener to the message list element.
|
|
1154
|
+
* The listener is triggered when any of the following events occur:
|
|
1155
|
+
* - Loading state changes
|
|
1156
|
+
* - Messages change
|
|
1157
|
+
* - Streaming state changes
|
|
1158
|
+
* - Scroll event occurs on the message list element
|
|
1159
|
+
*
|
|
1160
|
+
* When the listener is triggered, it updates the `isAtBottom` property.
|
|
1161
|
+
*/
|
|
1124
1162
|
private _addScrollListener;
|
|
1163
|
+
/**
|
|
1164
|
+
* Get the model description based on the defaultValues service_id and model_id
|
|
1165
|
+
*/
|
|
1125
1166
|
updateModelDescription(): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Submits a question from the user.
|
|
1169
|
+
* If the user is editing a previous message, removes all subsequent messages from the chat history.
|
|
1170
|
+
* Triggers the fetch of the answer for the submitted question by calling _fetchAnswer().
|
|
1171
|
+
* Clears the input value in the UI.
|
|
1172
|
+
*/
|
|
1126
1173
|
submitQuestion(): void;
|
|
1174
|
+
/**
|
|
1175
|
+
* Triggers the fetch of the answer for the given question and updates the conversation.
|
|
1176
|
+
* Generates an audit event for the user input.
|
|
1177
|
+
*
|
|
1178
|
+
* @param question - The question asked by the user.
|
|
1179
|
+
* @param conversation - The current conversation messages.
|
|
1180
|
+
*/
|
|
1127
1181
|
private _fetchAnswer;
|
|
1128
1182
|
/**
|
|
1129
1183
|
* Depending on the connection's state :
|
|
1130
1184
|
* - If connected => given a list of messages, the chat endpoint is invoked for a continuation and updates the list of messages accordingly.
|
|
1131
1185
|
* - If any other state => a connection error message is displayed in the chat.
|
|
1132
|
-
* @param messages
|
|
1186
|
+
* @param messages The list of messages to invoke the chat endpoint with
|
|
1133
1187
|
*/
|
|
1134
1188
|
fetch(messages: ChatMessage[]): void;
|
|
1135
1189
|
/**
|
|
@@ -1150,7 +1204,13 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1150
1204
|
* @param messages
|
|
1151
1205
|
*/
|
|
1152
1206
|
updateData(messages: ChatMessage[]): void;
|
|
1207
|
+
/**
|
|
1208
|
+
* @returns true if the chat discussion is scrolled down to the bottom, false otherwise
|
|
1209
|
+
*/
|
|
1153
1210
|
private _toggleScrollButtonVisibility;
|
|
1211
|
+
/**
|
|
1212
|
+
* Scroll down to the bottom of the chat discussion
|
|
1213
|
+
*/
|
|
1154
1214
|
scrollDown(): void;
|
|
1155
1215
|
/**
|
|
1156
1216
|
* Start a new chat with the defaultValues settings
|
|
@@ -1158,6 +1218,14 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1158
1218
|
* If the savedChat feature is enabled, the list of saved chats will be refreshed
|
|
1159
1219
|
*/
|
|
1160
1220
|
newChat(): void;
|
|
1221
|
+
/**
|
|
1222
|
+
* Attaches the specified document IDs to the assistant.
|
|
1223
|
+
* If the chat is streaming or stopping the generation, the operation is not allowed.
|
|
1224
|
+
* If no document IDs are provided, the operation is not allowed.
|
|
1225
|
+
* If the action for attaching a document is not defined at the application customization level, an error is logged.
|
|
1226
|
+
* @param ids - An array of document IDs to attach.
|
|
1227
|
+
*/
|
|
1228
|
+
attachToChat(ids: string[]): void;
|
|
1161
1229
|
/**
|
|
1162
1230
|
* Start the default chat with the defaultValues settings
|
|
1163
1231
|
* If the chat is meant to be initialized with event === "Query", the corresponding user query message will be added to the chat history
|
|
@@ -1183,7 +1251,20 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1183
1251
|
* The fetch subscription will be terminated
|
|
1184
1252
|
*/
|
|
1185
1253
|
resetChat(): void;
|
|
1254
|
+
/**
|
|
1255
|
+
* Fetch and Load the saved chat from the saved chat index.
|
|
1256
|
+
* If the saved chat is found, the chat discussion will be loaded with the provided messages and chatId
|
|
1257
|
+
*/
|
|
1186
1258
|
onLoadChat(): void;
|
|
1259
|
+
/**
|
|
1260
|
+
* Stop the generation of the current assistant's answer.
|
|
1261
|
+
* The fetch subscription will be terminated.
|
|
1262
|
+
*/
|
|
1263
|
+
stopGeneration(): void;
|
|
1264
|
+
/**
|
|
1265
|
+
* Terminate the fetch process by unsubscribing from the data subscription and updating the loading status to false.
|
|
1266
|
+
* Additionally, focus on the chat input if the focusAfterResponse flag is set to true.
|
|
1267
|
+
*/
|
|
1187
1268
|
terminateFetch(): void;
|
|
1188
1269
|
/**
|
|
1189
1270
|
* Copy a previous user message of the chat history to the chat user input.
|
|
@@ -1204,28 +1285,46 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1204
1285
|
* @param index The index of the assistant's message to regenerate
|
|
1205
1286
|
*/
|
|
1206
1287
|
regenerateMessage(index: number): void;
|
|
1288
|
+
/**
|
|
1289
|
+
* Remaps the index in the chat history.
|
|
1290
|
+
* The chat history is a list of messages where some messages can be hidden (display set to false).
|
|
1291
|
+
* The index provided as input is the index of the message in the chat history displayed in the UI.
|
|
1292
|
+
* This function should be removed once the backend is updated to add the ids of the messages in the chat history
|
|
1293
|
+
* @param index - The index to be remapped.
|
|
1294
|
+
*/
|
|
1295
|
+
private _remapIndexInChatHistory;
|
|
1296
|
+
/**
|
|
1297
|
+
* Handles the key up event for 'Backspace' and 'Enter' keys.
|
|
1298
|
+
* @param event - The keyboard event.
|
|
1299
|
+
*/
|
|
1207
1300
|
onKeyUp(event: KeyboardEvent): void;
|
|
1301
|
+
/**
|
|
1302
|
+
* Calculates and adjusts the height of the question input element based on its content.
|
|
1303
|
+
* If the Enter key is pressed without the Shift key, it prevents the default behavior.
|
|
1304
|
+
* @param event The keyboard event
|
|
1305
|
+
*/
|
|
1208
1306
|
calculateHeight(event?: KeyboardEvent): void;
|
|
1209
1307
|
/**
|
|
1210
1308
|
* Send a "like" event on clicking on the thumb-up icon of an assistant's message
|
|
1309
|
+
* @param message The assistant message to like
|
|
1211
1310
|
* @param rank The rank of the message to like
|
|
1212
1311
|
*/
|
|
1213
|
-
onLike(rank: number): void;
|
|
1312
|
+
onLike(message: ChatMessage, rank: number): void;
|
|
1214
1313
|
/**
|
|
1215
1314
|
* Send a "dislike" event on clicking on the thumb-down icon of an assistant's message.
|
|
1216
1315
|
* It also opens the issue reporting dialog.
|
|
1217
1316
|
* @param message The assistant message to dislike
|
|
1218
|
-
* @param
|
|
1317
|
+
* @param index The rank of the message to dislike
|
|
1219
1318
|
*/
|
|
1220
1319
|
onDislike(message: ChatMessage, rank: number): void;
|
|
1221
1320
|
/**
|
|
1222
1321
|
* Report an issue related to the assistant's message.
|
|
1223
1322
|
*/
|
|
1224
|
-
|
|
1323
|
+
sendReport(): void;
|
|
1225
1324
|
/**
|
|
1226
|
-
* Close the
|
|
1325
|
+
* Close the reporting dialog.
|
|
1227
1326
|
*/
|
|
1228
|
-
|
|
1327
|
+
ignoreReport(): void;
|
|
1229
1328
|
/**
|
|
1230
1329
|
* Handle the click on a reference's 'open preview'.
|
|
1231
1330
|
* @param data
|
|
@@ -1248,11 +1347,31 @@ export declare class ChatComponent extends AbstractFacet implements OnInit, OnCh
|
|
|
1248
1347
|
* @param index Rank of the message in the chatHistory related to the suggested action.
|
|
1249
1348
|
*/
|
|
1250
1349
|
suggestActionClick(action: SuggestedAction, index: number): void;
|
|
1350
|
+
/**
|
|
1351
|
+
* Handle the click on a chat starter.
|
|
1352
|
+
* @param starter the chat starter.
|
|
1353
|
+
*/
|
|
1354
|
+
chatStarterClick(starter: ChatStarter): void;
|
|
1355
|
+
/**
|
|
1356
|
+
* It looks for the debug messages available in the current group of "assistant" messages.
|
|
1357
|
+
* By design, the debug messages are only available in the first visible message among the group "assistant" messages.
|
|
1358
|
+
* @param index The rank of the message
|
|
1359
|
+
* @returns The debug messages available in the current group of "assistant" messages
|
|
1360
|
+
*/
|
|
1361
|
+
getDebugMessages(index: number): DebugMessage[];
|
|
1251
1362
|
/**
|
|
1252
1363
|
* Handle the click on the 'show log info' button of a message.
|
|
1253
|
-
* @param
|
|
1364
|
+
* @param index The rank of the message
|
|
1365
|
+
*/
|
|
1366
|
+
showDebug(index: number): void;
|
|
1367
|
+
/**
|
|
1368
|
+
* Verify whether the current message is an assistant message and that all following messages are assistant ones
|
|
1369
|
+
* Used to keep the "View progress" opened even though the assistant is sending additional messages after the current one
|
|
1370
|
+
* @param messages the list of current messages
|
|
1371
|
+
* @param index the index of the current message
|
|
1372
|
+
* @returns if this messages and the following ones (if any) are the last ones
|
|
1254
1373
|
*/
|
|
1255
|
-
|
|
1374
|
+
isAssistantLastMessages(messages: ChatMessage[], index: number): boolean;
|
|
1256
1375
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChatComponent, never>;
|
|
1257
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ChatComponent, "sq-chat-v3", never, { "instanceId": "instanceId"; "query": "query"; "queryChangeShouldTriggerReload": "queryChangeShouldTriggerReload"; "protocol": "protocol"; "messageHandlers": "messageHandlers"; "automaticScrollToLastResponse": "automaticScrollToLastResponse"; "chat": "chat"; "assistantMessageIcon": "assistantMessageIcon"; "userMessageIcon": "userMessageIcon"; "connectionErrorMessageIcon": "connectionErrorMessageIcon"; "searchWarningMessageIcon": "searchWarningMessageIcon"; }, { "connection": "connection"; "loading$": "loading"; "_config": "config"; "data": "data"; "openDocument": "openDocument"; "openPreview": "openPreview"; "suggestAction": "suggestAction"; }, ["loadingTpl", "
|
|
1376
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatComponent, "sq-chat-v3", never, { "instanceId": "instanceId"; "query": "query"; "queryChangeShouldTriggerReload": "queryChangeShouldTriggerReload"; "protocol": "protocol"; "messageHandlers": "messageHandlers"; "automaticScrollToLastResponse": "automaticScrollToLastResponse"; "focusAfterResponse": "focusAfterResponse"; "chat": "chat"; "assistantMessageIcon": "assistantMessageIcon"; "userMessageIcon": "userMessageIcon"; "connectionErrorMessageIcon": "connectionErrorMessageIcon"; "searchWarningMessageIcon": "searchWarningMessageIcon"; }, { "connection": "connection"; "loading$": "loading"; "_config": "config"; "data": "data"; "openDocument": "openDocument"; "openPreview": "openPreview"; "suggestAction": "suggestAction"; "chatStarter": "chatStarter"; }, ["loadingTpl", "reportTpl", "tokenConsumptionTpl", "debugMessagesTpl"], never, true>;
|
|
1258
1377
|
}
|
package/chat/chat.service.d.ts
CHANGED
|
@@ -17,7 +17,11 @@ export declare abstract class ChatService {
|
|
|
17
17
|
initConfig$: BehaviorSubject<boolean>;
|
|
18
18
|
/** Global configuration of the chat. */
|
|
19
19
|
chatConfig$: BehaviorSubject<ChatConfig | undefined>;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Emit true if the fetch of an assistant's response is ongoing (it includes Streaming status of the chat endpoint AND saving the discussion if save Chat is enabled).
|
|
22
|
+
* This is used to prevent multiple fetches at the same time.
|
|
23
|
+
* Typically, there is no problem chaining fetches, but when forcing a reload after query changes cases, it can't be allowed because it breaks the whole business logic.
|
|
24
|
+
*/
|
|
21
25
|
streaming$: BehaviorSubject<boolean>;
|
|
22
26
|
/** Store the messages history of the current chat. */
|
|
23
27
|
chatHistory: ChatMessage[] | undefined;
|
|
@@ -37,6 +41,8 @@ export declare abstract class ChatService {
|
|
|
37
41
|
chatUsageMetrics$: BehaviorSubject<ChatUsageMetrics | undefined>;
|
|
38
42
|
/** Emit the calculated chat's token consumption based on the chat usage metrics. */
|
|
39
43
|
chatTokenConsumption$: BehaviorSubject<TokenConsumption | undefined>;
|
|
44
|
+
/** Emit true if "CancelTasks" is ongoing. */
|
|
45
|
+
stoppingGeneration$: BehaviorSubject<boolean>;
|
|
40
46
|
/** Instance ID of the chat service defining the assistant instance. */
|
|
41
47
|
private _chatInstanceId;
|
|
42
48
|
/** ID of the current **saved chat** discussion which is used to update/get/delete it. */
|
|
@@ -126,6 +132,10 @@ export declare abstract class ChatService {
|
|
|
126
132
|
* Return the list of functions available on the server AND matching enabled functions in the chat config
|
|
127
133
|
*/
|
|
128
134
|
abstract listFunctions(): Observable<GllmFunction[] | undefined>;
|
|
135
|
+
/**
|
|
136
|
+
* Stops the assistant answer generation and cancels all the ongoing and pending related tasks
|
|
137
|
+
*/
|
|
138
|
+
abstract stopGeneration(): Observable<any>;
|
|
129
139
|
/**
|
|
130
140
|
* A handler for quota updates each time the chat is invoked.
|
|
131
141
|
* It emits the updated quota to the quota$ subject, emits accordingly the updated user's tokens consumption and notifies the user if the max quota is reached.
|
|
@@ -183,6 +193,18 @@ export declare abstract class ChatService {
|
|
|
183
193
|
* @param id Actions (savedChat delete/rename/...) may occur on a specific chat different than the current one stored in this service, so the chat id can be provided
|
|
184
194
|
*/
|
|
185
195
|
generateAuditEvent(type: string, details: Record<string, any>, id?: string): void;
|
|
196
|
+
/**
|
|
197
|
+
* Traverse the array from the end and track the first 'assistant' message among the last group of "assistant" messages where display is true
|
|
198
|
+
* @param array The array of ChatMessage to traverse
|
|
199
|
+
* @returns The index of the first visible assistant message among the last group of "assistant" messages in the array
|
|
200
|
+
*/
|
|
201
|
+
firstVisibleAssistantMessageIndex(array: ChatMessage[] | undefined): number;
|
|
202
|
+
/**
|
|
203
|
+
* Traverse the array from the end and pick the last 'assistant' message among the last group of "assistant" messages where display is true
|
|
204
|
+
* @param array The array of ChatMessage to traverse
|
|
205
|
+
* @returns The index of the last visible assistant message among the last group of "assistant" messages in the array
|
|
206
|
+
*/
|
|
207
|
+
lastVisibleAssistantMessageIndex(array: ChatMessage[] | undefined): number;
|
|
186
208
|
/**
|
|
187
209
|
* Format a date string in UTC to a local date string
|
|
188
210
|
* @param value Date string in UTC to format
|
|
@@ -21,6 +21,7 @@ export declare class RestChatService extends ChatService {
|
|
|
21
21
|
listModels(): Observable<GllmModelDescription[] | undefined>;
|
|
22
22
|
listFunctions(): Observable<GllmFunction[] | undefined>;
|
|
23
23
|
fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse>;
|
|
24
|
+
stopGeneration(): Observable<any>;
|
|
24
25
|
listSavedChat(): void;
|
|
25
26
|
addSavedChat(messages: ChatMessage[]): Observable<SavedChat>;
|
|
26
27
|
getSavedChat(id: string): Observable<SavedChatHistory | undefined>;
|
|
@@ -27,8 +27,8 @@ export declare class SavedChatsComponent implements OnInit, OnDestroy {
|
|
|
27
27
|
instantiateChatService(): void;
|
|
28
28
|
onListSavedChat(): void;
|
|
29
29
|
onLoad(savedChat: SavedChat): void;
|
|
30
|
-
onRename(savedChat: SavedChat): void;
|
|
31
|
-
onDelete(savedChat: SavedChat): void;
|
|
30
|
+
onRename(event: Event, savedChat: SavedChat): void;
|
|
31
|
+
onDelete(event: Event, savedChat: SavedChat): void;
|
|
32
32
|
private _groupSavedChatsByDate;
|
|
33
33
|
private _getTimeKey;
|
|
34
34
|
static ɵfac: i0.ɵɵFactoryDeclaration<SavedChatsComponent, never>;
|
|
@@ -33,6 +33,8 @@ $ast-saved-chat-hover-background: var(--ast-saved-chat-hover-background, #FFF8F1
|
|
|
33
33
|
$ast-input-bg: var(--ast-input-bg, #F8F8F8);
|
|
34
34
|
$ast-input-color: var(--ast-input-color, #B0B0B0);
|
|
35
35
|
$ast-muted-color: var(--ast-muted-color, rgba(33, 37, 41, 0.75));
|
|
36
|
+
$ast-action-buttons-color: var(--ast-action-buttons-color, #212529);
|
|
37
|
+
$ast-action-buttons-hover-color: var(--ast-action-buttons-hover-color, var(--ast-primary-color, #005DA7));
|
|
36
38
|
|
|
37
39
|
/****************************************************
|
|
38
40
|
classes
|
|
@@ -58,6 +60,7 @@ $ast-muted-color: var(--ast-muted-color, rgba(33, 37, 41, 0.75));
|
|
|
58
60
|
|
|
59
61
|
.ast-error {
|
|
60
62
|
background-color: $ast-error-bg;
|
|
63
|
+
color: var(--ast-action-buttons-color, inherit);
|
|
61
64
|
|
|
62
65
|
&:hover {
|
|
63
66
|
color: $ast-error-color;
|
|
@@ -90,4 +93,6 @@ $ast-muted-color: var(--ast-muted-color, rgba(33, 37, 41, 0.75));
|
|
|
90
93
|
--ast-reference-passages-color: white;
|
|
91
94
|
--ast-reference-expanded-hover-bg: #262421;
|
|
92
95
|
--ast-message-reference-color: black;
|
|
96
|
+
--ast-action-buttons-color: white;
|
|
97
|
+
--ast-action-buttons-hover-color: #6dbee6;
|
|
93
98
|
}
|