genassist-chat-react 1.0.26 → 1.0.28
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/README.md +2 -0
- package/dist/components/GenAgentChat.js +40 -31
- package/dist/components/GenAgentConfigPanel.d.ts +1 -0
- package/dist/components/GenAgentConfigPanel.js +2 -1
- package/dist/components/InteractiveContent.js +3 -2
- package/dist/components/MarkdownMessage.d.ts +11 -0
- package/dist/components/MarkdownMessage.js +56 -0
- package/dist/components/WelcomeCard.js +3 -3
- package/dist/hooks/useChat.d.ts +6 -2
- package/dist/hooks/useChat.js +314 -67
- package/dist/services/chatService.d.ts +24 -2
- package/dist/services/chatService.js +146 -48
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.js +1 -1
- package/package.json +5 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatMessage, Attachment, AgentThinkingConfig, AgentWelcomeData, FileUploadResponse } from "../types";
|
|
1
|
+
import { ChatMessage, Attachment, AgentThinkingConfig, AgentWelcomeData, FileUploadResponse, InProgressPollMessage } from "../types";
|
|
2
2
|
export declare const GENASSIST_AGENT_METADATA_UPDATED = "genassist_agent_metadata_updated";
|
|
3
3
|
export declare class ChatService {
|
|
4
4
|
private baseUrl;
|
|
@@ -27,8 +27,13 @@ export declare class ChatService {
|
|
|
27
27
|
private serverUnavailableMessage;
|
|
28
28
|
private serverUnavailableContactUrl;
|
|
29
29
|
private serverUnavailableContactLabel;
|
|
30
|
-
|
|
30
|
+
private usePoll;
|
|
31
|
+
constructor(baseUrl: string, apiKey: string, metadata?: Record<string, any>, tenant?: string, language?: string, useWs?: boolean, usePoll?: boolean);
|
|
31
32
|
private getStorageKey;
|
|
33
|
+
/**
|
|
34
|
+
* Handle conversation finalized: emit special message, call finalized handler, persist state.
|
|
35
|
+
*/
|
|
36
|
+
handleConversationFinalized(): void;
|
|
32
37
|
/**
|
|
33
38
|
* Persist agent_chat_input_metadata to localStorage and dispatch a global event.
|
|
34
39
|
* Any consumer (e.g. config panel) can listen for GENASSIST_AGENT_METADATA_UPDATED
|
|
@@ -76,6 +81,11 @@ export declare class ChatService {
|
|
|
76
81
|
*/
|
|
77
82
|
private saveConversation;
|
|
78
83
|
private isTokenExpiredError;
|
|
84
|
+
/**
|
|
85
|
+
* Internal handler for takeover events: emits a special message and invokes takeoverHandler.
|
|
86
|
+
* Runs only once per conversation (idempotent).
|
|
87
|
+
*/
|
|
88
|
+
private handleTakeover;
|
|
79
89
|
/**
|
|
80
90
|
* Reset the current conversation by clearing the ID and websocket
|
|
81
91
|
*/
|
|
@@ -98,4 +108,16 @@ export declare class ChatService {
|
|
|
98
108
|
private fetchWelcomeImage;
|
|
99
109
|
addFeedback(messageId: string, feedback: "good" | "bad", feedback_message?: string): Promise<void>;
|
|
100
110
|
private adjustMessageTimestamps;
|
|
111
|
+
/************ Heartbeat polling ************/
|
|
112
|
+
/**
|
|
113
|
+
* Poll in-progress conversation (heartbeat when WebSocket is disabled).
|
|
114
|
+
* Returns status and messages normalized to ChatMessage[].
|
|
115
|
+
*/
|
|
116
|
+
pollInProgressConversation(): Promise<{
|
|
117
|
+
status: string;
|
|
118
|
+
pollMessages: InProgressPollMessage[];
|
|
119
|
+
}>;
|
|
120
|
+
private normalizePollMessageToChatMessage;
|
|
121
|
+
notifyTakeoverFromPoll(): Promise<void>;
|
|
122
|
+
notifyFinalizedFromPoll(): Promise<void>;
|
|
101
123
|
}
|