@pagelines/sdk 1.0.218 → 1.0.219
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/{AgentProvider.vue_vue_type_script_setup_true_lang-J2dPA8gh.js → AgentProvider.vue_vue_type_script_setup_true_lang-CsNF0TwT.js} +2 -2
- package/dist/AgentProvider.vue_vue_type_script_setup_true_lang-CsNF0TwT.js.map +1 -0
- package/dist/AgentWidgetInline-DG-ZuBMI.js +33 -0
- package/dist/AgentWidgetInline-DG-ZuBMI.js.map +1 -0
- package/dist/AgentWidgetModal-D-7lR3Yy.js +65 -0
- package/dist/AgentWidgetModal-D-7lR3Yy.js.map +1 -0
- package/dist/AgentWidgetPopup-C7vent2i.js +119 -0
- package/dist/AgentWidgetPopup-C7vent2i.js.map +1 -0
- package/dist/{AgentWrap.vue_vue_type_script_setup_true_lang-Cc3E_MFR.js → AgentWrap.vue_vue_type_script_setup_true_lang-TeMIjtid.js} +2102 -2664
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-TeMIjtid.js.map +1 -0
- package/dist/agent/AgentController.d.ts +12 -43
- package/dist/agent/index.d.ts +1 -4
- package/dist/agent/schema.d.ts +2 -15
- package/dist/agent/ui/AgentChat.vue.d.ts +2 -2
- package/dist/agent/ui/AgentModal.vue.d.ts +2 -2
- package/dist/agent/ui/AgentProvider.vue.d.ts +3 -3
- package/dist/agent/ui/AgentWrap.vue.d.ts +21 -97
- package/dist/agent/ui/ElAgentAbout.vue.d.ts +1 -1
- package/dist/agent/ui/ElAgentChat.vue.d.ts +3 -3
- package/dist/agent/ui/ElAgentHeader.vue.d.ts +1 -1
- package/dist/agent/ui/ElAgentModeSidebar.vue.d.ts +2 -2
- package/dist/agent/ui/ElModeHeader.vue.d.ts +1 -1
- package/dist/agent/ui/ElSidebar.vue.d.ts +1 -1
- package/dist/agent/utils.d.ts +4 -3
- package/dist/agent.js +46 -57
- package/dist/agent.js.map +1 -1
- package/dist/clients/AuthClient.d.ts +1 -1
- package/dist/clients/UserClient.d.ts +3 -3
- package/dist/clients/types.d.ts +2 -3
- package/dist/constants/socialPlatforms.d.ts +1 -1
- package/dist/demo/index.d.ts +37 -37
- package/dist/demo.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/sdk.css +1 -1
- package/dist/sdk.js +2 -2
- package/dist/sdkClient-IfuVpXGX.js +637 -0
- package/dist/sdkClient-IfuVpXGX.js.map +1 -0
- package/dist/sdkClient.d.ts +24 -25
- package/dist/sdkStorage.d.ts +1 -1
- package/dist/socialPlatforms-Ck-b3SnQ.js.map +1 -1
- package/dist/useWidgetState-BGtx6NKD.js +15 -0
- package/dist/useWidgetState-BGtx6NKD.js.map +1 -0
- package/dist/widget/PLWidget.d.ts +3 -3
- package/dist/widget/composables/usePLWidget.d.ts +2 -2
- package/dist/widget/composables/useWidgetState.d.ts +277 -0
- package/dist/widget/ui/AgentWidgetInline.vue.d.ts +5 -6
- package/dist/widget/ui/AgentWidgetModal.vue.d.ts +4 -5
- package/dist/widget/ui/AgentWidgetPopup.vue.d.ts +4 -5
- package/dist/widget.js +12 -11
- package/dist/widget.js.map +1 -1
- package/package.json +2 -2
- package/dist/AgentProvider.vue_vue_type_script_setup_true_lang-J2dPA8gh.js.map +0 -1
- package/dist/AgentWidgetInline-a7B42aCD.js +0 -37
- package/dist/AgentWidgetInline-a7B42aCD.js.map +0 -1
- package/dist/AgentWidgetModal-DmiBPAeW.js +0 -68
- package/dist/AgentWidgetModal-DmiBPAeW.js.map +0 -1
- package/dist/AgentWidgetPopup-kDs-plgY.js +0 -122
- package/dist/AgentWidgetPopup-kDs-plgY.js.map +0 -1
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-Cc3E_MFR.js.map +0 -1
- package/dist/agent/ClientAudio.d.ts +0 -102
- package/dist/agent/constants.d.ts +0 -16
- package/dist/sdkClient-B3EKDRYb.js +0 -1094
- package/dist/sdkClient-B3EKDRYb.js.map +0 -1
- package/dist/utils/base.d.ts +0 -14
- package/dist/utils/color.d.ts +0 -12
- package/dist/utils/cookies.d.ts +0 -47
- package/dist/utils/id.d.ts +0 -27
- package/dist/utils/logger.d.ts +0 -49
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
+
import { AgentConfig, SettingsObject } from '@pagelines/core';
|
|
2
3
|
import { PageLinesSDK } from '../sdkClient';
|
|
3
|
-
import { AgentMode, ChatAttachment, ChatMessage,
|
|
4
|
-
import { SettingsObject } from '../utils/base';
|
|
5
|
-
import { ClientAudio } from './ClientAudio';
|
|
6
|
-
interface AgentCallbacks {
|
|
7
|
-
onConnect?: () => void;
|
|
8
|
-
onDisconnect?: () => void;
|
|
9
|
-
onError?: (error: Error) => void;
|
|
10
|
-
onModeChange?: (mode: string) => void;
|
|
11
|
-
onMessage?: (message: unknown) => void;
|
|
12
|
-
onAudioLevel?: (levels: {
|
|
13
|
-
inputLevel: number;
|
|
14
|
-
outputLevel: number;
|
|
15
|
-
}) => void;
|
|
16
|
-
}
|
|
4
|
+
import { AgentMode, ChatAttachment, ChatMessage, TextConnectionState, Agent } from './schema';
|
|
17
5
|
export type ChatStreamFn = (args: {
|
|
18
6
|
message: string;
|
|
19
7
|
attachments?: ChatAttachment[];
|
|
@@ -27,40 +15,27 @@ export type ChatStreamFn = (args: {
|
|
|
27
15
|
onError: (error: string) => void;
|
|
28
16
|
onStatus?: (status: string) => void;
|
|
29
17
|
}) => Promise<void>;
|
|
30
|
-
type
|
|
18
|
+
type AgentChatControllerSettings = {
|
|
31
19
|
sdk?: PageLinesSDK;
|
|
32
|
-
agent: Agent;
|
|
20
|
+
agent: Agent | AgentConfig;
|
|
33
21
|
context?: string;
|
|
34
22
|
firstMessage?: string;
|
|
35
23
|
chatStreamFn?: ChatStreamFn;
|
|
36
24
|
};
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
/** @deprecated Use AgentChatControllerSettings */
|
|
26
|
+
export type AgentControllerSettings = AgentChatControllerSettings;
|
|
27
|
+
export declare class AgentChatController extends SettingsObject<AgentChatControllerSettings> {
|
|
39
28
|
private isTextMode;
|
|
40
29
|
private lastMessage;
|
|
41
|
-
private clientAudio;
|
|
42
|
-
private unwatchAudio?;
|
|
43
30
|
private isConnecting;
|
|
44
31
|
private conversationId?;
|
|
45
|
-
private sessionId?;
|
|
46
|
-
private conversationStartTime?;
|
|
47
|
-
voiceState: Ref<VoiceConnectionState>;
|
|
48
32
|
textState: Ref<TextConnectionState>;
|
|
49
33
|
agentMode: Ref<AgentMode>;
|
|
50
34
|
sharedMessages: Ref<ChatMessage[]>;
|
|
51
|
-
|
|
35
|
+
private _agent;
|
|
36
|
+
constructor(settings: AgentChatControllerSettings);
|
|
52
37
|
get chatEnabled(): boolean;
|
|
53
38
|
get chatUnavailableReason(): string | undefined;
|
|
54
|
-
get audioLevels(): Ref<{
|
|
55
|
-
inputLevel: number;
|
|
56
|
-
outputLevel: number;
|
|
57
|
-
}, import('./schema').AudioLevel | {
|
|
58
|
-
inputLevel: number;
|
|
59
|
-
outputLevel: number;
|
|
60
|
-
}>;
|
|
61
|
-
getClientAudio(): ClientAudio;
|
|
62
|
-
getOutputFrequencyData(): Uint8Array | null;
|
|
63
|
-
getInputFrequencyData(): Uint8Array | null;
|
|
64
39
|
private mapChatError;
|
|
65
40
|
private isTransientError;
|
|
66
41
|
private isDuplicateMessage;
|
|
@@ -72,22 +47,16 @@ export declare class AgentController extends SettingsObject<AgentControllerSetti
|
|
|
72
47
|
private updateState;
|
|
73
48
|
private resetState;
|
|
74
49
|
private setupModeWatcher;
|
|
75
|
-
handleMessage(message: {
|
|
76
|
-
message: string;
|
|
77
|
-
source: string;
|
|
78
|
-
}, isVoice: boolean): void;
|
|
79
50
|
private handleError;
|
|
80
51
|
setMode(mode: AgentMode): Promise<void>;
|
|
81
|
-
|
|
82
|
-
|
|
52
|
+
startTextConversation(callbacks?: {
|
|
53
|
+
onConnect?: () => void;
|
|
54
|
+
}): Promise<void>;
|
|
83
55
|
endConversation(): Promise<void>;
|
|
84
56
|
sendChatMessage(message: string, attachments?: ChatAttachment[]): Promise<void>;
|
|
85
57
|
private buildHistory;
|
|
86
58
|
isConnected(): boolean;
|
|
87
|
-
isVoiceConnected(): boolean;
|
|
88
59
|
isTextConnected(): boolean;
|
|
89
60
|
destroy(): Promise<void>;
|
|
90
|
-
private endSession;
|
|
91
|
-
private resetSession;
|
|
92
61
|
}
|
|
93
62
|
export {};
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -4,10 +4,7 @@ import { default as AgentProvider } from './ui/AgentProvider.vue';
|
|
|
4
4
|
import { default as AgentWidget } from './ui/AgentWidget.vue';
|
|
5
5
|
import { default as AgentWrap } from './ui/AgentWrap.vue';
|
|
6
6
|
import { default as ElAgentChat } from './ui/ElAgentChat.vue';
|
|
7
|
-
export { AgentController } from './AgentController';
|
|
7
|
+
export { AgentChatController, AgentChatController as AgentController } from './AgentController';
|
|
8
8
|
export type { ChatStreamFn } from './AgentController';
|
|
9
|
-
export { ClientAudio } from './ClientAudio';
|
|
10
|
-
export * from './constants';
|
|
11
9
|
export * from './schema';
|
|
12
10
|
export { AgentChat, AgentModal, AgentProvider, AgentWidget, AgentWrap, ElAgentChat };
|
|
13
|
-
export * from './utils';
|
package/dist/agent/schema.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Agent } from '@pagelines/core';
|
|
2
|
+
export type { AgentConfig } from '@pagelines/core';
|
|
2
3
|
export interface ChatAttachment {
|
|
3
4
|
type: 'image' | 'audio' | 'video' | 'file';
|
|
4
5
|
url: string;
|
|
@@ -13,16 +14,6 @@ export interface ChatMessage {
|
|
|
13
14
|
timestamp: Date;
|
|
14
15
|
attachments?: ChatAttachment[];
|
|
15
16
|
}
|
|
16
|
-
export interface VoiceConnectionState {
|
|
17
|
-
isActive: boolean;
|
|
18
|
-
isConnected: boolean;
|
|
19
|
-
isSpeaking: boolean;
|
|
20
|
-
isListening: boolean;
|
|
21
|
-
isProcessing: boolean;
|
|
22
|
-
transcript?: string;
|
|
23
|
-
connectionStatus: 'connecting' | 'connected' | 'disconnected' | 'error';
|
|
24
|
-
error?: string;
|
|
25
|
-
}
|
|
26
17
|
export interface TextConnectionState {
|
|
27
18
|
isActive: boolean;
|
|
28
19
|
isConnected: boolean;
|
|
@@ -30,10 +21,6 @@ export interface TextConnectionState {
|
|
|
30
21
|
connectionStatus: 'connecting' | 'connected' | 'disconnected' | 'error';
|
|
31
22
|
error?: string;
|
|
32
23
|
}
|
|
33
|
-
export interface AudioLevel {
|
|
34
|
-
inputLevel: number;
|
|
35
|
-
outputLevel: number;
|
|
36
|
-
}
|
|
37
24
|
export declare const AGENT_MODES: readonly [{
|
|
38
25
|
readonly mode: "self";
|
|
39
26
|
readonly label: "Overview";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Agent } from '@pagelines/types';
|
|
2
1
|
import { PageLinesSDK } from '../../sdkClient';
|
|
3
2
|
import { ButtonIconPreset } from '../../widget/PLWidget';
|
|
4
|
-
import { ColorName } from '
|
|
3
|
+
import { ColorName } from '@pagelines/core';
|
|
4
|
+
import { Agent } from '../schema';
|
|
5
5
|
type __VLS_Props = {
|
|
6
6
|
sdk: PageLinesSDK;
|
|
7
7
|
agent: Agent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PageLinesSDK } from '../../sdkClient';
|
|
2
|
-
import {
|
|
2
|
+
import { AgentConfig } from '../schema';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
vis?: boolean;
|
|
5
5
|
sdk?: PageLinesSDK;
|
|
6
|
-
agent?:
|
|
6
|
+
agent?: AgentConfig;
|
|
7
7
|
handle?: string;
|
|
8
8
|
context?: string;
|
|
9
9
|
firstMessage?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PageLinesSDK } from '../../sdkClient';
|
|
2
2
|
import { ButtonIconPreset } from '../../widget/PLWidget';
|
|
3
|
-
import {
|
|
3
|
+
import { AgentConfig } from '../schema';
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
sdk?: PageLinesSDK;
|
|
6
|
-
agent?:
|
|
6
|
+
agent?: AgentConfig;
|
|
7
7
|
handle?: string;
|
|
8
8
|
context?: string;
|
|
9
9
|
firstMessage?: string;
|
|
@@ -19,5 +19,5 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
19
19
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
20
|
onError?: ((message: string) => any) | undefined;
|
|
21
21
|
onClose?: ((value: string) => any) | undefined;
|
|
22
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
22
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
23
|
export default _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { AgentConfig } from '@pagelines/core';
|
|
1
2
|
import { PageLinesSDK } from '../../sdkClient';
|
|
2
3
|
import { ButtonIconPreset } from '../../widget/PLWidget';
|
|
3
4
|
import { Agent } from '../schema';
|
|
4
5
|
type __VLS_Props = {
|
|
5
6
|
sdk?: PageLinesSDK;
|
|
6
|
-
agent?:
|
|
7
|
+
agent?: AgentConfig;
|
|
7
8
|
handle?: string;
|
|
8
9
|
context?: string;
|
|
9
10
|
firstMessage?: string;
|
|
@@ -14,103 +15,26 @@ type __VLS_Props = {
|
|
|
14
15
|
};
|
|
15
16
|
declare function __VLS_template(): {
|
|
16
17
|
attrs: Partial<{}>;
|
|
17
|
-
slots: {
|
|
18
|
-
default
|
|
18
|
+
slots: Readonly<{
|
|
19
|
+
default: (props: {
|
|
19
20
|
sdk: PageLinesSDK;
|
|
20
|
-
agent:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
model?: string | null | undefined;
|
|
38
|
-
channel?: string | null | undefined;
|
|
39
|
-
lastActivityAt?: string | null | undefined;
|
|
40
|
-
instanceId?: string | null | undefined;
|
|
41
|
-
instanceProvider?: string | null | undefined;
|
|
42
|
-
imageVersion?: string | null | undefined;
|
|
43
|
-
deployEnv?: string | undefined;
|
|
44
|
-
botServerUrl?: string | null | undefined;
|
|
45
|
-
botHeartbeatAt?: string | null | undefined;
|
|
46
|
-
desiredStatus?: "active" | "stopped" | null | undefined;
|
|
47
|
-
onboardedAt?: string | null | undefined;
|
|
48
|
-
enrichment?: Record<string, any> | null | undefined;
|
|
49
|
-
onboarding?: Record<string, any> | null | undefined;
|
|
50
|
-
org?: {
|
|
51
|
-
orgId: string;
|
|
52
|
-
handle: string;
|
|
53
|
-
name: string;
|
|
54
|
-
status: string;
|
|
55
|
-
headline?: string | undefined;
|
|
56
|
-
summary?: string | undefined;
|
|
57
|
-
} | undefined;
|
|
58
|
-
visibility?: "org" | "private" | "public" | undefined;
|
|
59
|
-
status?: string | undefined;
|
|
60
|
-
createdAt?: string | undefined;
|
|
61
|
-
updatedAt?: string | undefined;
|
|
62
|
-
avatar?: {
|
|
63
|
-
mediaId?: string | undefined;
|
|
64
|
-
userId?: string | undefined;
|
|
65
|
-
orgId?: string | undefined;
|
|
66
|
-
agentId?: string | null | undefined;
|
|
67
|
-
filename?: string | undefined;
|
|
68
|
-
mimeType?: string | undefined;
|
|
69
|
-
size?: number | undefined;
|
|
70
|
-
src?: string | undefined;
|
|
71
|
-
alt?: string | undefined;
|
|
72
|
-
context?: "avatar" | "cover" | "general" | undefined;
|
|
73
|
-
status?: "processing" | "active" | "failed" | "deleted" | undefined;
|
|
74
|
-
quality?: "high" | "low" | "standard" | undefined;
|
|
75
|
-
createdAt?: string | undefined;
|
|
76
|
-
updatedAt?: string | undefined;
|
|
77
|
-
mediaType?: "image" | "video" | "audio" | undefined;
|
|
78
|
-
className?: string | undefined;
|
|
79
|
-
width?: number | undefined;
|
|
80
|
-
height?: number | undefined;
|
|
81
|
-
duration?: number | undefined;
|
|
82
|
-
blurhash?: string | undefined;
|
|
83
|
-
} | undefined;
|
|
84
|
-
cover?: {
|
|
85
|
-
mediaId?: string | undefined;
|
|
86
|
-
userId?: string | undefined;
|
|
87
|
-
orgId?: string | undefined;
|
|
88
|
-
agentId?: string | null | undefined;
|
|
89
|
-
filename?: string | undefined;
|
|
90
|
-
mimeType?: string | undefined;
|
|
91
|
-
size?: number | undefined;
|
|
92
|
-
src?: string | undefined;
|
|
93
|
-
alt?: string | undefined;
|
|
94
|
-
context?: "avatar" | "cover" | "general" | undefined;
|
|
95
|
-
status?: "processing" | "active" | "failed" | "deleted" | undefined;
|
|
96
|
-
quality?: "high" | "low" | "standard" | undefined;
|
|
97
|
-
createdAt?: string | undefined;
|
|
98
|
-
updatedAt?: string | undefined;
|
|
99
|
-
mediaType?: "image" | "video" | "audio" | undefined;
|
|
100
|
-
className?: string | undefined;
|
|
101
|
-
width?: number | undefined;
|
|
102
|
-
height?: number | undefined;
|
|
103
|
-
duration?: number | undefined;
|
|
104
|
-
blurhash?: string | undefined;
|
|
105
|
-
} | undefined;
|
|
106
|
-
isPrimary?: boolean | undefined;
|
|
107
|
-
};
|
|
108
|
-
context: string | undefined;
|
|
109
|
-
firstMessage: string | undefined;
|
|
110
|
-
buttonText: string | undefined;
|
|
111
|
-
buttonIcon: ButtonIconPreset | undefined;
|
|
112
|
-
loading: false;
|
|
113
|
-
}): any;
|
|
21
|
+
agent: Agent;
|
|
22
|
+
context?: string;
|
|
23
|
+
firstMessage?: string;
|
|
24
|
+
buttonText?: string;
|
|
25
|
+
buttonIcon?: ButtonIconPreset;
|
|
26
|
+
loading: boolean;
|
|
27
|
+
}) => any;
|
|
28
|
+
}> & {
|
|
29
|
+
default: (props: {
|
|
30
|
+
sdk: PageLinesSDK;
|
|
31
|
+
agent: Agent;
|
|
32
|
+
context?: string;
|
|
33
|
+
firstMessage?: string;
|
|
34
|
+
buttonText?: string;
|
|
35
|
+
buttonIcon?: ButtonIconPreset;
|
|
36
|
+
loading: boolean;
|
|
37
|
+
}) => any;
|
|
114
38
|
};
|
|
115
39
|
refs: {};
|
|
116
40
|
rootEl: HTMLDivElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AgentController } from '../AgentController';
|
|
1
|
+
import { AgentChatController } from '../AgentController';
|
|
3
2
|
import { ChatAttachment } from '../schema';
|
|
3
|
+
import { Agent } from '@pagelines/core';
|
|
4
4
|
type __VLS_Props = {
|
|
5
|
-
|
|
5
|
+
chatController?: AgentChatController;
|
|
6
6
|
agent: Agent;
|
|
7
7
|
variant?: 'dark' | 'light';
|
|
8
8
|
scale?: 'md' | 'lg';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgentChatController } from '../AgentController';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
modelValue: boolean;
|
|
4
|
-
|
|
4
|
+
chatController?: AgentChatController;
|
|
5
5
|
};
|
|
6
6
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
7
|
"update:modelValue": (value: boolean) => any;
|
package/dist/agent/utils.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgentConfig, getDefaultAvatarUrl } from '@pagelines/core';
|
|
2
2
|
export { getDefaultAvatarUrl };
|
|
3
3
|
export declare function getImageSrc(image: string | {
|
|
4
4
|
src?: string;
|
|
5
5
|
} | undefined): string;
|
|
6
|
-
|
|
6
|
+
type AgentLike = Pick<AgentConfig, 'cover' | 'avatar' | 'name'>;
|
|
7
|
+
export declare function getAgentAvatarUrl(agent: AgentLike): string;
|
|
7
8
|
export declare function handleImageError(event: Event): void;
|
|
8
9
|
export declare function parseVoiceMessage(args: {
|
|
9
10
|
message: string;
|
|
@@ -30,5 +31,5 @@ export declare function generateFirstMessage(args: {
|
|
|
30
31
|
*/
|
|
31
32
|
export declare function parseButtonTemplate(args: {
|
|
32
33
|
template: string;
|
|
33
|
-
agent:
|
|
34
|
+
agent: Pick<AgentConfig, 'name' | 'title' | 'handle' | 'org'>;
|
|
34
35
|
}): string;
|
package/dist/agent.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var c = (e, r) =>
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
import { defineComponent as x, createBlock as g, openBlock as l, withCtx as b, createElementVNode as o, createVNode as
|
|
6
|
-
import { _ as
|
|
7
|
-
import { _
|
|
8
|
-
import {
|
|
9
|
-
const
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var c = (e, r) => A(e, "name", { value: r, configurable: !0 });
|
|
3
|
+
import { _ as C, a as M } from "./AgentWrap.vue_vue_type_script_setup_true_lang-TeMIjtid.js";
|
|
4
|
+
import { b as K, A as L, A as Q, E as R } from "./AgentWrap.vue_vue_type_script_setup_true_lang-TeMIjtid.js";
|
|
5
|
+
import { defineComponent as x, createBlock as g, openBlock as l, withCtx as b, createElementVNode as o, createVNode as $, ref as h, watch as z, nextTick as E, createElementBlock as f, createCommentVNode as u, normalizeClass as p, normalizeStyle as N } from "vue";
|
|
6
|
+
import { _ as B } from "./FModal.vue_vue_type_script_setup_true_lang-cL0BFEkZ.js";
|
|
7
|
+
import { _ } from "./AgentProvider.vue_vue_type_script_setup_true_lang-CsNF0TwT.js";
|
|
8
|
+
import { Agent as Y } from "@pagelines/core";
|
|
9
|
+
const T = { class: "relative w-full h-[80vh] md:h-[600px]" }, F = /* @__PURE__ */ x({
|
|
10
10
|
name: "AgentModal",
|
|
11
11
|
__name: "AgentModal",
|
|
12
12
|
props: {
|
|
@@ -20,7 +20,7 @@ const S = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
|
|
|
20
20
|
emits: ["update:vis"],
|
|
21
21
|
setup(e, { emit: r }) {
|
|
22
22
|
const s = r;
|
|
23
|
-
return (t, a) => (l(), g(
|
|
23
|
+
return (t, a) => (l(), g(B, {
|
|
24
24
|
vis: e.vis,
|
|
25
25
|
"modal-class": "max-w-4xl p-0",
|
|
26
26
|
"style-class": "bg-transparent shadow-2xl rounded-2xl",
|
|
@@ -28,8 +28,8 @@ const S = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
|
|
|
28
28
|
"onUpdate:vis": a[1] || (a[1] = (d) => s("update:vis", d))
|
|
29
29
|
}, {
|
|
30
30
|
default: b(() => [
|
|
31
|
-
o("div",
|
|
32
|
-
|
|
31
|
+
o("div", T, [
|
|
32
|
+
$(_, {
|
|
33
33
|
sdk: e.sdk,
|
|
34
34
|
agent: e.agent,
|
|
35
35
|
handle: e.handle,
|
|
@@ -43,13 +43,13 @@ const S = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
|
|
|
43
43
|
_: 1
|
|
44
44
|
}, 8, ["vis"]));
|
|
45
45
|
}
|
|
46
|
-
}),
|
|
46
|
+
}), V = {
|
|
47
47
|
key: 0,
|
|
48
48
|
class: "relative h-full w-full"
|
|
49
|
-
},
|
|
49
|
+
}, W = { class: "group relative h-full w-full rounded-3xl overflow-hidden shadow-lg transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:shadow-2xl hover:translate-y-[-1px] hover:brightness-110 active:scale-[1.06] active:-translate-y-0.5 active:duration-100" }, j = ["src", "alt"], O = {
|
|
50
50
|
key: 0,
|
|
51
51
|
class: "absolute top-0.5 right-0.5"
|
|
52
|
-
},
|
|
52
|
+
}, H = /* @__PURE__ */ x({
|
|
53
53
|
__name: "AgentWidget",
|
|
54
54
|
props: {
|
|
55
55
|
sdk: {},
|
|
@@ -63,33 +63,33 @@ const S = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
|
|
|
63
63
|
function d() {
|
|
64
64
|
t.value = !t.value;
|
|
65
65
|
}
|
|
66
|
-
c(d, "toggle"),
|
|
67
|
-
|
|
66
|
+
c(d, "toggle"), z(t, async (m) => {
|
|
67
|
+
m ? (await E(), setTimeout(() => {
|
|
68
68
|
a.value = !0;
|
|
69
69
|
}, 400)) : a.value = !1;
|
|
70
70
|
});
|
|
71
|
-
function
|
|
71
|
+
function w() {
|
|
72
72
|
t.value = !0;
|
|
73
73
|
}
|
|
74
|
-
c(
|
|
75
|
-
function
|
|
74
|
+
c(w, "open");
|
|
75
|
+
function v() {
|
|
76
76
|
t.value = !1;
|
|
77
77
|
}
|
|
78
|
-
c(
|
|
78
|
+
c(v, "close");
|
|
79
79
|
function k() {
|
|
80
|
-
|
|
80
|
+
v();
|
|
81
81
|
}
|
|
82
82
|
return c(k, "handleClose"), r({
|
|
83
83
|
toggle: d,
|
|
84
|
-
open:
|
|
85
|
-
close:
|
|
86
|
-
}), (
|
|
84
|
+
open: w,
|
|
85
|
+
close: v
|
|
86
|
+
}), (m, n) => (l(), g(C, {
|
|
87
87
|
sdk: e.sdk,
|
|
88
88
|
handle: e.handle,
|
|
89
89
|
context: e.context,
|
|
90
90
|
"first-message": e.firstMessage
|
|
91
91
|
}, {
|
|
92
|
-
default: b(({ agent: i, sdk:
|
|
92
|
+
default: b(({ agent: i, sdk: y }) => [
|
|
93
93
|
i ? (l(), f("div", {
|
|
94
94
|
key: 0,
|
|
95
95
|
class: p(["fixed z-[999999] pointer-events-auto", [
|
|
@@ -100,23 +100,23 @@ const S = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
|
|
|
100
100
|
class: p(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu", [
|
|
101
101
|
t.value ? "widget-expanded w-96 h-[600px] max-w-[calc(100vw-48px)] max-h-[calc(100vh-48px)] rounded-3xl opacity-100 scale-100" : "widget-button w-[80px] h-[80px] opacity-100 scale-100 flex items-center justify-center cursor-pointer"
|
|
102
102
|
]]),
|
|
103
|
-
style:
|
|
103
|
+
style: N({
|
|
104
104
|
"transform-origin": s.position === "bottom-left" ? "bottom left" : s.position === "top-right" ? "top right" : s.position === "top-left" ? "top left" : "bottom right"
|
|
105
105
|
}),
|
|
106
|
-
onClick: n[0] || (n[0] = (
|
|
106
|
+
onClick: n[0] || (n[0] = (S) => t.value ? void 0 : d())
|
|
107
107
|
}, [
|
|
108
|
-
t.value ? u("", !0) : (l(), f("div",
|
|
109
|
-
o("div",
|
|
108
|
+
t.value ? u("", !0) : (l(), f("div", V, [
|
|
109
|
+
o("div", W, [
|
|
110
110
|
o("img", {
|
|
111
|
-
src:
|
|
112
|
-
alt: `${i.
|
|
111
|
+
src: i.avatarUrl.value,
|
|
112
|
+
alt: `${i.displayName.value} digital agent`,
|
|
113
113
|
class: "h-full w-full object-cover pointer-events-none",
|
|
114
114
|
width: "80",
|
|
115
115
|
height: "80"
|
|
116
|
-
}, null, 8,
|
|
116
|
+
}, null, 8, j),
|
|
117
117
|
n[1] || (n[1] = o("div", { class: "absolute inset-0 pointer-events-none bg-gradient-to-br from-transparent via-black/10 to-black/40 opacity-60 transition-opacity duration-300 group-hover:opacity-40" }, null, -1))
|
|
118
118
|
]),
|
|
119
|
-
i.
|
|
119
|
+
i.isActive.value ? (l(), f("div", O, [...n[2] || (n[2] = [
|
|
120
120
|
o("div", {
|
|
121
121
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
122
122
|
style: { "animation-duration": "3s" }
|
|
@@ -124,10 +124,10 @@ const S = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
|
|
|
124
124
|
o("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1)
|
|
125
125
|
])])) : u("", !0)
|
|
126
126
|
])),
|
|
127
|
-
t.value && i ? (l(), g(
|
|
127
|
+
t.value && i ? (l(), g(M, {
|
|
128
128
|
key: 1,
|
|
129
129
|
class: "rounded-3xl shadow-2xl border border-white/10",
|
|
130
|
-
sdk:
|
|
130
|
+
sdk: y,
|
|
131
131
|
agent: i,
|
|
132
132
|
context: e.context,
|
|
133
133
|
"first-message": e.firstMessage,
|
|
@@ -143,26 +143,15 @@ const S = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
|
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
export {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
ee as ClientAudio,
|
|
157
|
-
te as ElAgentChat,
|
|
158
|
-
se as VISUALIZER_CONFIG,
|
|
159
|
-
ae as VOICE_FREQUENCIES,
|
|
160
|
-
oe as generateFirstMessage,
|
|
161
|
-
C as getAgentAvatarUrl,
|
|
162
|
-
ce as getDefaultAvatarUrl,
|
|
163
|
-
ne as getImageSrc,
|
|
164
|
-
ie as handleImageError,
|
|
165
|
-
le as parseButtonTemplate,
|
|
166
|
-
re as parseVoiceMessage
|
|
146
|
+
K as AGENT_MODES,
|
|
147
|
+
Y as Agent,
|
|
148
|
+
M as AgentChat,
|
|
149
|
+
L as AgentChatController,
|
|
150
|
+
Q as AgentController,
|
|
151
|
+
F as AgentModal,
|
|
152
|
+
_ as AgentProvider,
|
|
153
|
+
H as AgentWidget,
|
|
154
|
+
C as AgentWrap,
|
|
155
|
+
R as ElAgentChat
|
|
167
156
|
};
|
|
168
157
|
//# sourceMappingURL=agent.js.map
|
package/dist/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sources":["../agent/ui/AgentModal.vue","../agent/ui/AgentWidget.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PageLinesSDK } from '../../sdkClient'\nimport type {
|
|
1
|
+
{"version":3,"file":"agent.js","sources":["../agent/ui/AgentModal.vue","../agent/ui/AgentWidget.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PageLinesSDK } from '../../sdkClient'\nimport type { AgentConfig } from '../schema'\nimport FModal from '@/ui/common/FModal.vue'\nimport AgentProvider from './AgentProvider.vue'\n\ndefineOptions({ name: 'AgentModal' })\n\nconst {\n vis = false,\n sdk,\n agent,\n handle,\n context,\n firstMessage,\n} = defineProps<{\n vis?: boolean\n sdk?: PageLinesSDK\n agent?: AgentConfig\n handle?: string\n context?: string\n firstMessage?: string\n}>()\n\nconst emit = defineEmits<{\n 'update:vis': [value: boolean]\n}>()\n</script>\n\n<template>\n <FModal\n :vis=\"vis\"\n modal-class=\"max-w-4xl p-0\"\n style-class=\"bg-transparent shadow-2xl rounded-2xl\"\n :has-close=\"false\"\n @update:vis=\"(val) => emit('update:vis', val)\"\n >\n <div class=\"relative w-full h-[80vh] md:h-[600px]\">\n <AgentProvider\n :sdk=\"sdk\"\n :agent=\"agent\"\n :handle=\"handle\"\n :context=\"context\"\n :first-message=\"firstMessage\"\n :has-close=\"true\"\n @close=\"emit('update:vis', false)\"\n />\n </div>\n </FModal>\n</template>\n","<script setup lang=\"ts\">\nimport type { PageLinesSDK } from '../../sdkClient'\nimport { nextTick, ref, watch } from 'vue'\nimport AgentChat from './AgentChat.vue'\nimport AgentWrap from './AgentWrap.vue'\n\ninterface Props {\n sdk?: PageLinesSDK\n handle: string\n context?: string\n firstMessage?: string\n position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'\n}\n\nconst props = defineProps<Props>()\nconst isOpen = ref(false)\nconst isAgentActive = ref(false)\n\nfunction toggle() {\n isOpen.value = !isOpen.value\n}\n\n// Watch isOpen to delay agent activation for smooth transition\nwatch(isOpen, async (newValue) => {\n if (newValue) {\n // When opening, delay agent activation until transition starts\n await nextTick()\n setTimeout(() => {\n isAgentActive.value = true\n }, 400) // Delay to let container expand first\n } else {\n // When closing, immediately deactivate agent\n isAgentActive.value = false\n }\n})\n\nfunction open() {\n isOpen.value = true\n}\n\nfunction close() {\n isOpen.value = false\n}\n\nfunction handleClose() {\n close()\n}\n\ndefineExpose({\n toggle,\n open,\n close,\n})\n</script>\n\n<template>\n <AgentWrap\n v-slot=\"{ agent, sdk: resolvedSdk }\"\n :sdk=\"sdk\"\n :handle=\"handle\"\n :context=\"context\"\n :first-message=\"firstMessage\"\n >\n <!-- Fixed Widget Wrapper -->\n <div\n v-if=\"agent\"\n class=\"fixed z-[999999] pointer-events-auto\"\n :class=\"[\n props.position === 'bottom-left' ? 'bottom-6 left-6'\n : props.position === 'top-right' ? 'top-6 right-6'\n : props.position === 'top-left' ? 'top-6 left-6'\n : 'bottom-6 right-6',\n ]\"\n >\n <!-- Widget Content with Transition -->\n <div\n class=\"transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu\"\n :class=\"[\n isOpen\n ? 'widget-expanded w-96 h-[600px] max-w-[calc(100vw-48px)] max-h-[calc(100vh-48px)] rounded-3xl opacity-100 scale-100'\n : 'widget-button w-[80px] h-[80px] opacity-100 scale-100 flex items-center justify-center cursor-pointer',\n ]\"\n :style=\"{\n 'transform-origin':\n props.position === 'bottom-left' ? 'bottom left'\n : props.position === 'top-right' ? 'top right'\n : props.position === 'top-left' ? 'top left'\n : 'bottom right',\n }\"\n @click=\"!isOpen ? toggle() : undefined\"\n >\n <!-- Button Content (visible when closed) -->\n <div v-if=\"!isOpen\" class=\"relative h-full w-full\">\n <div class=\"group relative h-full w-full rounded-3xl overflow-hidden shadow-lg transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:shadow-2xl hover:translate-y-[-1px] hover:brightness-110 active:scale-[1.06] active:-translate-y-0.5 active:duration-100\">\n <img\n :src=\"agent.avatarUrl.value\"\n :alt=\"`${agent.displayName.value} digital agent`\"\n class=\"h-full w-full object-cover pointer-events-none\"\n width=\"80\"\n height=\"80\"\n />\n <!-- Gradient overlay for contrast -->\n <div class=\"absolute inset-0 pointer-events-none bg-gradient-to-br from-transparent via-black/10 to-black/40 opacity-60 transition-opacity duration-300 group-hover:opacity-40\" />\n </div>\n <!-- Online indicator -->\n <div v-if=\"agent.isActive.value\" class=\"absolute top-0.5 right-0.5\">\n <div class=\"size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping\" style=\"animation-duration: 3s;\" />\n <div class=\"size-3 bg-green-500 rounded-full ring-2 ring-white\" />\n </div>\n </div>\n\n <!-- Chat Content (visible when open) -->\n <AgentChat\n v-if=\"isOpen && agent\"\n class=\"rounded-3xl shadow-2xl border border-white/10\"\n :sdk=\"resolvedSdk\"\n :agent=\"agent\"\n :context=\"context\"\n :first-message=\"firstMessage\"\n :has-close=\"true\"\n :is-active=\"isAgentActive\"\n @close=\"handleClose\"\n />\n </div>\n </div>\n </AgentWrap>\n</template>\n"],"names":["emit","__emit","_createBlock","FModal","__props","_cache","val","_createElementVNode","_hoisted_1","_createVNode","AgentProvider","props","isOpen","ref","isAgentActive","toggle","__name","watch","newValue","nextTick","open","close","handleClose","__expose","AgentWrap","agent","resolvedSdk","_createElementBlock","_normalizeStyle","$event","_openBlock","_hoisted_2","_hoisted_4","AgentChat"],"mappings":"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"}
|