@wix/legends-platform-sdk 1.35.0 → 1.37.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/README.md +18 -1
- package/dist/cjs/components/LegendsPlatform/LegendsPlatform.js +10 -7
- package/dist/cjs/components/LegendsPlatform/LegendsPlatform.js.map +1 -1
- package/dist/cjs/components/LegendsPlatformCore/LegendsPlatformCore.js +73 -0
- package/dist/cjs/components/LegendsPlatformCore/LegendsPlatformCore.js.map +1 -0
- package/dist/cjs/components/LegendsPlatformCore/index.js +10 -0
- package/dist/cjs/components/LegendsPlatformCore/index.js.map +1 -0
- package/dist/cjs/hooks/useTextChat/streamChatMessage.js +3 -1
- package/dist/cjs/hooks/useTextChat/streamChatMessage.js.map +1 -1
- package/dist/cjs/hooks/useTextChat/useTextChat.js +3 -2
- package/dist/cjs/hooks/useTextChat/useTextChat.js.map +1 -1
- package/dist/cjs/hooks/useTextChat/useTextChatStream.js +3 -1
- package/dist/cjs/hooks/useTextChat/useTextChatStream.js.map +1 -1
- package/dist/cjs/hooks/useTextChat/useToolAwareSend.js +5 -3
- package/dist/cjs/hooks/useTextChat/useToolAwareSend.js.map +1 -1
- package/dist/cjs/sdk.js +7 -1
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/cjs/services/BearerPersonaChatService.js +191 -0
- package/dist/cjs/services/BearerPersonaChatService.js.map +1 -0
- package/dist/cjs/services/FetchPersonaChatService.js +15 -5
- package/dist/cjs/services/FetchPersonaChatService.js.map +1 -1
- package/dist/cjs/types/service.js.map +1 -1
- package/dist/esm/components/LegendsPlatform/LegendsPlatform.js +5 -2
- package/dist/esm/components/LegendsPlatform/LegendsPlatform.js.map +1 -1
- package/dist/esm/components/LegendsPlatformCore/LegendsPlatformCore.js +40 -0
- package/dist/esm/components/LegendsPlatformCore/LegendsPlatformCore.js.map +1 -0
- package/dist/esm/components/LegendsPlatformCore/index.js +2 -0
- package/dist/esm/components/LegendsPlatformCore/index.js.map +1 -0
- package/dist/esm/hooks/useTextChat/streamChatMessage.js +3 -1
- package/dist/esm/hooks/useTextChat/streamChatMessage.js.map +1 -1
- package/dist/esm/hooks/useTextChat/useTextChat.js +3 -2
- package/dist/esm/hooks/useTextChat/useTextChat.js.map +1 -1
- package/dist/esm/hooks/useTextChat/useTextChatStream.js +3 -1
- package/dist/esm/hooks/useTextChat/useTextChatStream.js.map +1 -1
- package/dist/esm/hooks/useTextChat/useToolAwareSend.js +5 -3
- package/dist/esm/hooks/useTextChat/useToolAwareSend.js.map +1 -1
- package/dist/esm/sdk.js +2 -0
- package/dist/esm/sdk.js.map +1 -1
- package/dist/esm/services/BearerPersonaChatService.js +181 -0
- package/dist/esm/services/BearerPersonaChatService.js.map +1 -0
- package/dist/esm/services/FetchPersonaChatService.js +17 -4
- package/dist/esm/services/FetchPersonaChatService.js.map +1 -1
- package/dist/esm/types/service.js.map +1 -1
- package/dist/types/components/LegendsPlatform/LegendsPlatform.d.ts +3 -0
- package/dist/types/components/LegendsPlatform/LegendsPlatform.d.ts.map +1 -1
- package/dist/types/components/LegendsPlatformCore/LegendsPlatformCore.d.ts +23 -0
- package/dist/types/components/LegendsPlatformCore/LegendsPlatformCore.d.ts.map +1 -0
- package/dist/types/components/LegendsPlatformCore/index.d.ts +2 -0
- package/dist/types/components/LegendsPlatformCore/index.d.ts.map +1 -0
- package/dist/types/hooks/useTextChat/streamChatMessage.d.ts +1 -0
- package/dist/types/hooks/useTextChat/streamChatMessage.d.ts.map +1 -1
- package/dist/types/hooks/useTextChat/useTextChat.d.ts +2 -0
- package/dist/types/hooks/useTextChat/useTextChat.d.ts.map +1 -1
- package/dist/types/hooks/useTextChat/useTextChatStream.d.ts +1 -0
- package/dist/types/hooks/useTextChat/useTextChatStream.d.ts.map +1 -1
- package/dist/types/hooks/useTextChat/useToolAwareSend.d.ts +1 -1
- package/dist/types/hooks/useTextChat/useToolAwareSend.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +4 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/services/BearerPersonaChatService.d.ts +37 -0
- package/dist/types/services/BearerPersonaChatService.d.ts.map +1 -0
- package/dist/types/services/FetchPersonaChatService.d.ts +11 -1
- package/dist/types/services/FetchPersonaChatService.d.ts.map +1 -1
- package/dist/types/types/service.d.ts +2 -0
- package/dist/types/types/service.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Store } from 'jotai/vanilla/store';
|
|
3
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
+
import type { ToolsRegistry } from '../../hooks/useTools/model/types';
|
|
5
|
+
import type { IPersonaChatService } from '../../types/service';
|
|
6
|
+
export type LegendsPlatformCoreProps = {
|
|
7
|
+
chatId: string;
|
|
8
|
+
namespace: string;
|
|
9
|
+
/** Required: in a browser, a BearerPersonaChatService with the caller's own token. */
|
|
10
|
+
personaChatService: IPersonaChatService;
|
|
11
|
+
tools?: ToolsRegistry;
|
|
12
|
+
/** Pass the same store and query client to LegendsPlatform when a call starts, to keep the chat state. */
|
|
13
|
+
store?: Store;
|
|
14
|
+
queryClient?: QueryClient;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The text-chat providers without LiveKit, from the main entry: for a page that
|
|
19
|
+
* loads LiveKit only when a call starts (`@wix/legends-platform-sdk/livekit/sdk`'s
|
|
20
|
+
* LegendsPlatform then wraps the call, with the same store and query client).
|
|
21
|
+
*/
|
|
22
|
+
export declare function LegendsPlatformCore(props: LegendsPlatformCoreProps): React.JSX.Element;
|
|
23
|
+
//# sourceMappingURL=LegendsPlatformCore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendsPlatformCore.d.ts","sourceRoot":"","sources":["../../../../src/components/LegendsPlatformCore/LegendsPlatformCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAuB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,kBAAkB,EAAE,mBAAmB,CAAC;IACxC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,0GAA0G;IAC1G,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,qBA6BlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/LegendsPlatformCore/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -12,6 +12,7 @@ export type StreamChatMessageParams = {
|
|
|
12
12
|
attachments?: object[];
|
|
13
13
|
metadata?: object;
|
|
14
14
|
conversationLanguage?: string;
|
|
15
|
+
includeCitations?: boolean;
|
|
15
16
|
headers?: Record<string, string>;
|
|
16
17
|
};
|
|
17
18
|
export declare function extractContent(frame: string): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamChatMessage.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/streamChatMessage.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,MAA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AK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiB3D;AAGD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAkBvE;AAID,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,UAQxC,MAAM,UA8BlC;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,uBAAuB,EAC/B,SAAS,EAAE,eAAe,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAuEf"}
|
|
@@ -3,6 +3,8 @@ interface UseTextChatOptions {
|
|
|
3
3
|
limit?: number;
|
|
4
4
|
/** Language or locale for the persona's text reply, e.g. es or en-GB. Omit to keep the default behavior. */
|
|
5
5
|
conversationLanguage?: string;
|
|
6
|
+
/** Asks the backend for the Knowledge sources behind each answer. Honoured only in PREVIEW chats. */
|
|
7
|
+
includeCitations?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export declare function useTextChat(options?: UseTextChatOptions): {
|
|
8
10
|
status: "pending" | "error" | "success";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextChat.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAKrB,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4GAA4G;IAC5G,oBAAoB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useTextChat.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAKrB,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4GAA4G;IAC5G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB;;;;;;;;;;;oBA8C5B;QAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAC;QACtC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;KAChC;EAOF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextChatStream.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useTextChatStream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAItE,YAAY,EACV,eAAe,EACf,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useTextChatStream.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useTextChatStream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAItE,YAAY,EACV,eAAe,EACf,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAG9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAG/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAKF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B;;aA4OrD,KAAK,EAAE;;;;4DAhJnB,uBAAuB,KAAG,OAAO,CAAC,gBAAgB,CAAC;EA0JzD"}
|
|
@@ -2,7 +2,7 @@ import type { FunctionCall, ChatMessageAttachment, SendMessageMetadata } from '.
|
|
|
2
2
|
export interface SendChatMessageResponse {
|
|
3
3
|
functionCalls?: FunctionCall[];
|
|
4
4
|
}
|
|
5
|
-
export declare function useToolAwareSend(chatId: string, namespace: string, conversationLanguage?: string): (message: {
|
|
5
|
+
export declare function useToolAwareSend(chatId: string, namespace: string, conversationLanguage?: string, includeCitations?: boolean): (message: {
|
|
6
6
|
message?: string;
|
|
7
7
|
chatConfig?: object;
|
|
8
8
|
attachments?: ChatMessageAttachment[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToolAwareSend.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAUrB,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,oBAAoB,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useToolAwareSend.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAUrB,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,gBAAgB,CAAC,EAAE,OAAO,aAmCU;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACtC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,sCA6CF"}
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export * from './hooks/usePictureInPicture';
|
|
|
16
16
|
export * from './hooks/useMediaPermissions';
|
|
17
17
|
export * from './hooks/useTools';
|
|
18
18
|
export * from './conversation/types';
|
|
19
|
+
export { BearerPersonaChatService } from './services/BearerPersonaChatService';
|
|
20
|
+
export type { BearerPersonaChatServiceOptions } from './services/BearerPersonaChatService';
|
|
21
|
+
export { LegendsPlatformCore } from './components/LegendsPlatformCore';
|
|
22
|
+
export type { LegendsPlatformCoreProps } from './components/LegendsPlatformCore';
|
|
19
23
|
export { createStartupIntent, StartupAttempt, } from './startup-telemetry/attempt';
|
|
20
24
|
export type { StartupIntent, StartupReport, StartupTelemetryOptions, } from './startup-telemetry/attempt';
|
|
21
25
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAExB,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AAEjC,cAAc,sBAAsB,CAAC;AAErC,OAAO,EACL,mBAAmB,EACnB,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,aAAa,EACb,aAAa,EACb,uBAAuB,GACxB,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAExB,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AAEjC,cAAc,sBAAsB,CAAC;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,YAAY,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EACL,mBAAmB,EACnB,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,aAAa,EACb,aAAa,EACb,uBAAuB,GACxB,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IPersonaChatService, CreateConversationParams, ConversationResult, EndConversationParams, SendMessageParams, QueryMessagesParams, QueryMessagesResult, ChatFunctionCall, ChatMessage } from '../types';
|
|
2
|
+
export interface BearerPersonaChatServiceOptions {
|
|
3
|
+
/** API host. Defaults to https://www.wixapis.com. */
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
/**
|
|
6
|
+
* The caller's own access token, e.g. a visitor token minted by the Legend's
|
|
7
|
+
* sign-in app. Sent as the Authorization header, the way Wix's headless
|
|
8
|
+
* clients send it. Called for every request, so a refreshed token is used.
|
|
9
|
+
*/
|
|
10
|
+
getAccessToken: () => string | Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Called once when a request answers 401. Refresh the token and resolve true
|
|
13
|
+
* to retry the request with the new token; resolve false to fail it.
|
|
14
|
+
*/
|
|
15
|
+
onUnauthorized?: () => Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The persona-chat service for a browser: authenticated with the caller's own
|
|
19
|
+
* bearer token (never a namespace API key), on the same REST paths the
|
|
20
|
+
* Legend's own page uses for a visitor.
|
|
21
|
+
*/
|
|
22
|
+
export declare class BearerPersonaChatService implements IPersonaChatService {
|
|
23
|
+
private readonly options;
|
|
24
|
+
private readonly baseUrl;
|
|
25
|
+
constructor(options: BearerPersonaChatServiceOptions);
|
|
26
|
+
private request;
|
|
27
|
+
private createConversation;
|
|
28
|
+
createVoiceConversation(params: CreateConversationParams): Promise<ConversationResult>;
|
|
29
|
+
createInteractiveConversation(params: CreateConversationParams): Promise<ConversationResult>;
|
|
30
|
+
endInteractiveConversation(params: EndConversationParams): Promise<void>;
|
|
31
|
+
sendChatMessage(params: SendMessageParams): Promise<{
|
|
32
|
+
functionCalls?: ChatFunctionCall[];
|
|
33
|
+
messages?: ChatMessage[];
|
|
34
|
+
}>;
|
|
35
|
+
queryChatMessages(params: QueryMessagesParams): Promise<QueryMessagesResult>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=BearerPersonaChatService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BearerPersonaChatService.d.ts","sourceRoot":"","sources":["../../../src/services/BearerPersonaChatService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EAEZ,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,+BAA+B;IAC9C,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,cAAc,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AA8CD;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,mBAAmB;IAGtD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAEJ,OAAO,EAAE,+BAA+B;YAIvD,OAAO;YAqCP,kBAAkB;IA8BhC,uBAAuB,CACrB,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IAI9B,6BAA6B,CAC3B,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IAIxB,0BAA0B,CAC9B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAaV,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;QACxD,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;QACnC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;KAC1B,CAAC;IAgCI,iBAAiB,CACrB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;CAmBhC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import type { IPersonaChatService, CreateConversationParams, ConversationResult, EndConversationParams, SendMessageParams, QueryMessagesParams, QueryMessagesResult, FunctionCall, ChatFunctionCall, ChatMessage } from '../types';
|
|
2
|
+
export declare const DEFAULT_BASE_URL = "https://www.wixapis.com";
|
|
3
|
+
export interface FetchPersonaChatServiceOptions {
|
|
4
|
+
/** API host, e.g. a local or test gateway. Defaults to https://www.wixapis.com. */
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
}
|
|
2
7
|
export declare class FetchPersonaChatService implements IPersonaChatService {
|
|
3
8
|
private readonly apiKey;
|
|
4
|
-
|
|
9
|
+
private readonly baseUrl;
|
|
10
|
+
/**
|
|
11
|
+
* Server side only: a namespace API key skips owner checks and must never
|
|
12
|
+
* reach a browser. A browser uses BearerPersonaChatService with a visitor token.
|
|
13
|
+
*/
|
|
14
|
+
constructor(apiKey: string, options?: FetchPersonaChatServiceOptions);
|
|
5
15
|
private headers;
|
|
6
16
|
private post;
|
|
7
17
|
createVoiceConversation(params: CreateConversationParams): Promise<ConversationResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchPersonaChatService.d.ts","sourceRoot":"","sources":["../../../src/services/FetchPersonaChatService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EAEZ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"FetchPersonaChatService.d.ts","sourceRoot":"","sources":["../../../src/services/FetchPersonaChatService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EAEZ,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAE1D,MAAM,WAAW,8BAA8B;IAC7C,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAiBD,qBAAa,uBAAwB,YAAW,mBAAmB;IACjE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,8BAAmC;IAKxE,OAAO,CAAC,OAAO;YAOD,IAAI;IAmBZ,uBAAuB,CAC3B,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IAuBxB,6BAA6B,CACjC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IAuBxB,0BAA0B,CAC9B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAWV,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;QACxD,aAAa,CAAC,EAAE,CAAC,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAC;QACpD,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;KAC1B,CAAC;IA0BI,iBAAiB,CACrB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;CA0BhC"}
|
|
@@ -71,6 +71,8 @@ export interface SendMessageParams {
|
|
|
71
71
|
metadata?: SendMessageMetadata;
|
|
72
72
|
/** Language or locale for the persona's text reply, e.g. es or en-GB. Omit to keep the default behavior. */
|
|
73
73
|
conversationLanguage?: string;
|
|
74
|
+
/** Asks the backend for the Knowledge sources behind the answer. Honoured only in PREVIEW chats. */
|
|
75
|
+
includeCitations?: boolean;
|
|
74
76
|
}
|
|
75
77
|
export interface ChatMessage {
|
|
76
78
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/types/service.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAC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Aa,CAAC,EAAE,CAAC,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAC;QACpD,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;KAC1B,CAAC,CAAC;IACH,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.37.0",
|
|
3
3
|
"name": "@wix/legends-platform-sdk",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"wallaby": {
|
|
104
104
|
"autoDetect": true
|
|
105
105
|
},
|
|
106
|
-
"falconPackageHash": "
|
|
106
|
+
"falconPackageHash": "81fcef3915fc5a3d20f4cd1af56e79a1c265b29802ee73ea628c7bde"
|
|
107
107
|
}
|