@smarter.sh/ui-chat 0.8.0 → 0.9.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/README.md +328 -107
- package/dist/embed/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/embed/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/embed/mermaid/abnfDiagram-VCTEODGH-CGtrctwA.js +89 -0
- package/dist/embed/mermaid/arc-DlzgcAgU.js +82 -0
- package/dist/embed/mermaid/architecture-7GRP2DOG-D66ObL4C.js +3 -0
- package/dist/embed/mermaid/architectureDiagram-5GKGNRK7-CgMNWdVn.js +4148 -0
- package/dist/embed/mermaid/array-CApNbSU9.js +6 -0
- package/dist/embed/mermaid/blockDiagram-I7D4REHJ-Q2YOF2Nl.js +1922 -0
- package/dist/embed/mermaid/c4Diagram-7LVT6UL2-DI7_cX7n.js +3010 -0
- package/dist/embed/mermaid/channel-CxRe6Ync.js +5 -0
- package/dist/embed/mermaid/chunk-2E4U76K2-DPc-jkQd.js +348 -0
- package/dist/embed/mermaid/chunk-2Q5K7J3B-C1pX24ft.js +15 -0
- package/dist/embed/mermaid/chunk-4HAMMTFA-DY_JmJA2.js +4188 -0
- package/dist/embed/mermaid/chunk-5VM5RSS4-BFskf6Qk.js +5 -0
- package/dist/embed/mermaid/chunk-75Z2AOVW-BugNeXEB.js +1330 -0
- package/dist/embed/mermaid/chunk-CLGD4ZFX-BOKCMNQY.js +14 -0
- package/dist/embed/mermaid/chunk-DU6HZSFF-C09wkxIu.js +3897 -0
- package/dist/embed/mermaid/chunk-F27PBJKO-C69L38at.js +61 -0
- package/dist/embed/mermaid/chunk-FOHPRMQF-CLLDWcGe.js +21458 -0
- package/dist/embed/mermaid/chunk-GMAD6QVW-NxqJJwNT.js +1863 -0
- package/dist/embed/mermaid/chunk-GVQU2GXP-D4WoQcNg.js +37 -0
- package/dist/embed/mermaid/chunk-IMKFNOWR-DE94S7XC.js +2042 -0
- package/dist/embed/mermaid/chunk-JWPE2WC7-BGVSGRTC.js +8 -0
- package/dist/embed/mermaid/chunk-L3NEJ4N5-CqdtyK-9.js +245 -0
- package/dist/embed/mermaid/chunk-LNGE3PJU-DqC_0r8u.js +1521 -0
- package/dist/embed/mermaid/chunk-OSK3NFVY-B1KjtHOy.js +672 -0
- package/dist/embed/mermaid/chunk-P2QGCYS3-CP_jp-eQ.js +67 -0
- package/dist/embed/mermaid/chunk-POPQ4Y6H-CSwFrYKY.js +26 -0
- package/dist/embed/mermaid/chunk-PWAF6VOD-qhXJD1mO.js +275 -0
- package/dist/embed/mermaid/chunk-SHT3W25Y-a5ik03bR.js +4183 -0
- package/dist/embed/mermaid/chunk-SVP7TREG-67QXjHHx.js +490 -0
- package/dist/embed/mermaid/chunk-TICWLB2K-DHg0COuy.js +3357 -0
- package/dist/embed/mermaid/chunk-TLUHSLCS-BwEhuf5d.js +59 -0
- package/dist/embed/mermaid/chunk-XXDRQBXY-BJjzBm4h.js +9 -0
- package/dist/embed/mermaid/chunk-Y2CYZVJY-BAad7w_K.js +12 -0
- package/dist/embed/mermaid/classDiagram-ZZMXUADV-BlIPVBOk.js +30 -0
- package/dist/embed/mermaid/classDiagram-v2-VYDZK3BY-BavoJkSK.js +30 -0
- package/dist/embed/mermaid/cose-bilkent-JH36ORCC-Cx3-7Rca.js +2248 -0
- package/dist/embed/mermaid/cynefin-OW5HDTMX-Cfa1-YuM.js +3 -0
- package/dist/embed/mermaid/cynefinDiagram-5FMLGOSQ-CsV1I6A_.js +355 -0
- package/dist/embed/mermaid/cytoscape.esm-CLcfvFJ6.js +18145 -0
- package/dist/embed/mermaid/dagre-COnXXJRS.js +1934 -0
- package/dist/embed/mermaid/dagre-GXQ25YYZ-BzZWpDkI.js +425 -0
- package/dist/embed/mermaid/defaultLocale-CQ4Nl88y.js +198 -0
- package/dist/embed/mermaid/diagram-S7CK7UJ4-CShsH_ul.js +301 -0
- package/dist/embed/mermaid/diagram-UQ7AKVKN-Bb0mFpt2.js +214 -0
- package/dist/embed/mermaid/diagram-VSXAHHWV-DUq5PKM1.js +432 -0
- package/dist/embed/mermaid/diagram-VX7I27RA-Co2uyrw2.js +527 -0
- package/dist/embed/mermaid/diagram-Z3DM3KII-CTdPPkZs.js +134 -0
- package/dist/embed/mermaid/dist-CjR2JtV-.js +59 -0
- package/dist/embed/mermaid/ebnfDiagram-PWID7BFC-CAQNT7Vt.js +100 -0
- package/dist/embed/mermaid/erDiagram-RLTQ6QDP-DluYOFtk.js +1966 -0
- package/dist/embed/mermaid/eventmodeling-NTZA5JFV-DFSPvGS4.js +3 -0
- package/dist/embed/mermaid/flowDiagram-HODETNUW-BKXSV8xL.js +17 -0
- package/dist/embed/mermaid/ganttDiagram-EL5Y4UJY-D2BBzcpY.js +3072 -0
- package/dist/embed/mermaid/gitGraph-4MIJSDKK-BTHPY7Tg.js +3 -0
- package/dist/embed/mermaid/gitGraphDiagram-WWUBYQGX-BzZ3sE3s.js +733 -0
- package/dist/embed/mermaid/graphlib-D8JS7ydf.js +1267 -0
- package/dist/embed/mermaid/info-A6RAGUB7-4Mm0OyB8.js +3 -0
- package/dist/embed/mermaid/infoDiagram-27XIBGKW-DcbKIVvy.js +20 -0
- package/dist/embed/mermaid/init-CFNf60QB.js +13 -0
- package/dist/embed/mermaid/ishikawaDiagram-5VMMS53U-B6q3rvke.js +719 -0
- package/dist/embed/mermaid/journeyDiagram-3NMN7TZE-CDDY2Xma.js +884 -0
- package/dist/embed/mermaid/kanban-definition-UXKFOSKX-w7v22sq3.js +976 -0
- package/dist/embed/mermaid/katex-BqirFtOb.js +21977 -0
- package/dist/embed/mermaid/line-DoUHpRzu.js +34 -0
- package/dist/embed/mermaid/linear-CLS335Sc.js +287 -0
- package/dist/embed/mermaid/mermaid-parser.core-BoI6HFCg.js +638 -0
- package/dist/embed/mermaid/mermaid.js +1092 -0
- package/dist/embed/mermaid/mindmap-definition-YA3MSWOX-1bs_tKMD.js +1006 -0
- package/dist/embed/mermaid/ordinal-Da0rnhxr.js +65 -0
- package/dist/embed/mermaid/packet-AYTQ26CC-BAodtDR3.js +3 -0
- package/dist/embed/mermaid/path-hN9ktzbr.js +84 -0
- package/dist/embed/mermaid/pegDiagram-XKGWAZYB-DsrQs7Qo.js +94 -0
- package/dist/embed/mermaid/pie-WAS4IAKB-Yw-9-2EN.js +3 -0
- package/dist/embed/mermaid/pieDiagram-E7YTZNPT-BvkRs6Xl.js +203 -0
- package/dist/embed/mermaid/quadrantDiagram-AXDQQJYC-DDSDkbcq.js +2001 -0
- package/dist/embed/mermaid/radar-RG4KPBEZ-BtjjaEPe.js +3 -0
- package/dist/embed/mermaid/railroad-74A4TZTK-Du7TjeaO.js +3 -0
- package/dist/embed/mermaid/railroad-abnf-HS5TGJTU-D3flpty6.js +3 -0
- package/dist/embed/mermaid/railroad-ebnf-LZEXJU2U-DWpeYHWC.js +3 -0
- package/dist/embed/mermaid/railroad-peg-WCYAUIDC-DKiyz9fh.js +3 -0
- package/dist/embed/mermaid/railroadDiagram-O6MQD6OU-T__Cw3ez.js +76 -0
- package/dist/embed/mermaid/requirementDiagram-BXWQKSXE-ADir8pgL.js +2224 -0
- package/dist/embed/mermaid/rough.esm-XhrPyaQA.js +1361 -0
- package/dist/embed/mermaid/sankeyDiagram-P5KCCOFB-YTgoqhmd.js +972 -0
- package/dist/embed/mermaid/sequenceDiagram-WJ2MYXX4-Dpn6ph0n.js +4156 -0
- package/dist/embed/mermaid/sizeCapture-INFHLROL-C2wlw8KF.js +46 -0
- package/dist/embed/mermaid/src-CH4XuqUv.js +2147 -0
- package/dist/embed/mermaid/stateDiagram-D77RDMKH-V_8TbftV.js +220 -0
- package/dist/embed/mermaid/stateDiagram-v2-MP3YSRHH-us7SNDcU.js +30 -0
- package/dist/embed/mermaid/swimlanes-42K2YHIH-wzihXC1V.js +4979 -0
- package/dist/embed/mermaid/swimlanesDiagram-VR7AAH4N-BML-4Vp0.js +31 -0
- package/dist/embed/mermaid/timeline-definition-24CTP7MA-C3BzP6RA.js +1069 -0
- package/dist/embed/mermaid/treeView-Q6P3EWNA-Ba1dLcIR.js +3 -0
- package/dist/embed/mermaid/treemap-WGGIJYW6-D9G3ZsOW.js +3 -0
- package/dist/embed/mermaid/vennDiagram-4TSXK5OY-Cq1JumSe.js +1880 -0
- package/dist/embed/mermaid/wardley-WFR3VGLG-gAtip5-G.js +3 -0
- package/dist/embed/mermaid/wardleyDiagram-VM6X3IG4-HtzestuU.js +645 -0
- package/dist/embed/mermaid/xychartDiagram-S5SC5T6Z-BE-W0B_D.js +2210 -0
- package/dist/embed.js +903 -0
- package/dist/embed.js.map +1 -0
- package/dist/smarter-chat-library.es.js +1592 -1583
- package/dist/smarter-chat-library.es.js.map +1 -1
- package/dist/smarter-chat-library.umd.js +43 -43
- package/dist/smarter-chat-library.umd.js.map +1 -1
- package/dist/types/src/components/SmarterChat/Component.d.ts +1 -1
- package/dist/types/src/contract.gen.d.ts +41 -26
- package/dist/types/src/embed/EmbedApp.d.ts +10 -0
- package/dist/types/src/embed/assets.d.ts +7 -0
- package/dist/types/src/embed/autoMount.d.ts +18 -0
- package/dist/types/src/embed/css.d.ts +15 -0
- package/dist/types/src/embed/element.d.ts +19 -0
- package/dist/types/src/embed/index.d.ts +17 -0
- package/dist/types/src/embed/mermaid.d.ts +2 -0
- package/dist/types/src/embed/mermaidImport.d.ts +1 -0
- package/dist/types/src/embed/options.d.ts +69 -0
- package/dist/types/src/lib/cookie.d.ts +4 -3
- package/dist/types/src/lib/mermaidImport.d.ts +8 -0
- package/dist/types/src/types.d.ts +7 -0
- package/dist/ui-chat.css +1 -1
- package/package.json +10 -4
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
import "@chatscope/chat-ui-kit-styles/dist/default/styles.min.css";
|
|
27
27
|
import type { SmarterChatProps } from "@/types";
|
|
28
28
|
import "@/components/SmarterChat/styles.css";
|
|
29
|
-
declare function SmarterChat({ apiUrl, apiKey, toggleMetadata, csrfCookieName, csrftoken, debugCookieName, debugCookieExpiration, debugMode, sessionCookieName, sessionCookieExpiration, showConsole, cookieDomain, smarterRequestId, logStreamUrl, streamProgress, }: SmarterChatProps): import("react").JSX.Element;
|
|
29
|
+
declare function SmarterChat({ apiUrl, apiKey, toggleMetadata, csrfCookieName, csrftoken, debugCookieName, debugCookieExpiration, debugMode, sessionCookieName, sessionCookieExpiration, cookiePath, showConsole, cookieDomain, smarterRequestId, logStreamUrl, streamProgress, }: SmarterChatProps): import("react").JSX.Element;
|
|
30
30
|
export default SmarterChat;
|
|
@@ -344,7 +344,7 @@ export interface PromptChatApiConfig {
|
|
|
344
344
|
* The ENABLE_REACTAPP_DEBUG_MODE waffle switch.
|
|
345
345
|
*/
|
|
346
346
|
debug_mode: boolean;
|
|
347
|
-
|
|
347
|
+
extensions?: PromptChatApiExtensionList | null;
|
|
348
348
|
history: PromptChatApiHistory;
|
|
349
349
|
llmclient: PromptChatApiLLMClient;
|
|
350
350
|
meta_data: PromptChatApiMetaData;
|
|
@@ -360,56 +360,68 @@ export interface PromptChatApiConfig {
|
|
|
360
360
|
[k: string]: unknown;
|
|
361
361
|
}
|
|
362
362
|
/**
|
|
363
|
-
* The LLMClient's
|
|
363
|
+
* The LLMClient's extensions.
|
|
364
364
|
*
|
|
365
365
|
* The list itself is returned only in the complete configuration.
|
|
366
366
|
*
|
|
367
367
|
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
368
|
-
* via the `definition` "
|
|
368
|
+
* via the `definition` "PromptChatApiExtensionList".
|
|
369
369
|
*/
|
|
370
|
-
export interface
|
|
371
|
-
|
|
370
|
+
export interface PromptChatApiExtensionList {
|
|
371
|
+
extensions?: PromptChatApiLLMClientExtension[];
|
|
372
372
|
meta_data: PromptChatApiListMetaData;
|
|
373
373
|
[k: string]: unknown;
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
|
-
*
|
|
376
|
+
* An extension of the LLMClient: a :class:`smarter.apps.llmclient.models.LLMClientExtensions`.
|
|
377
377
|
*
|
|
378
378
|
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
379
|
-
* via the `definition` "
|
|
379
|
+
* via the `definition` "PromptChatApiLLMClientExtension".
|
|
380
380
|
*/
|
|
381
|
-
export interface
|
|
381
|
+
export interface PromptChatApiLLMClientExtension {
|
|
382
382
|
/**
|
|
383
383
|
* TimestampedModel.created_at.
|
|
384
384
|
*/
|
|
385
385
|
created_at?: string | null;
|
|
386
|
+
/**
|
|
387
|
+
* Whether the Extension is enabled, so that its tools are offered.
|
|
388
|
+
*/
|
|
389
|
+
enabled: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* LLMClientExtensions.extension: the Extension's id.
|
|
392
|
+
*/
|
|
393
|
+
extension: number;
|
|
386
394
|
/**
|
|
387
395
|
* The row's primary key.
|
|
388
396
|
*/
|
|
389
397
|
id: number;
|
|
390
398
|
/**
|
|
391
|
-
*
|
|
399
|
+
* LLMClientExtensions.llmclient: the LLMClient's id.
|
|
392
400
|
*/
|
|
393
401
|
llmclient: number;
|
|
394
402
|
/**
|
|
395
|
-
*
|
|
403
|
+
* The Extension's slug, e.g. weather.
|
|
396
404
|
*/
|
|
397
|
-
name
|
|
405
|
+
name: string;
|
|
398
406
|
/**
|
|
399
407
|
* TimestampedModel.updated_at.
|
|
400
408
|
*/
|
|
401
409
|
updated_at?: string | null;
|
|
410
|
+
/**
|
|
411
|
+
* The Extension's installed version, e.g. 1.0.0.
|
|
412
|
+
*/
|
|
413
|
+
version?: string | null;
|
|
402
414
|
}
|
|
403
415
|
/**
|
|
404
|
-
* The counts of a list of the LLMClient's plugins or
|
|
416
|
+
* The counts of a list of the LLMClient's plugins or extensions.
|
|
405
417
|
*
|
|
406
418
|
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
407
419
|
* via the `definition` "PromptChatApiListMetaData".
|
|
408
420
|
*/
|
|
409
421
|
export interface PromptChatApiListMetaData {
|
|
410
|
-
|
|
422
|
+
extensions_returned?: number | null;
|
|
411
423
|
plugins_returned?: number | null;
|
|
412
|
-
|
|
424
|
+
total_extensions?: number | null;
|
|
413
425
|
total_plugins?: number | null;
|
|
414
426
|
[k: string]: unknown;
|
|
415
427
|
}
|
|
@@ -479,7 +491,7 @@ export interface PromptChatApiPromptRequest {
|
|
|
479
491
|
[k: string]: unknown;
|
|
480
492
|
}
|
|
481
493
|
/**
|
|
482
|
-
* A plugin selector's activation: a :class:`smarter.apps.
|
|
494
|
+
* A plugin selector's activation: a :class:`smarter.apps.llmtool.models.PluginSelectorHistory`.
|
|
483
495
|
*
|
|
484
496
|
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
485
497
|
* via the `definition` "PromptChatApiPluginSelection".
|
|
@@ -784,7 +796,7 @@ export interface PromptChatApiConfigV1 {
|
|
|
784
796
|
* The ENABLE_REACTAPP_DEBUG_MODE waffle switch.
|
|
785
797
|
*/
|
|
786
798
|
debug_mode: boolean;
|
|
787
|
-
|
|
799
|
+
extensions?: PromptChatApiExtensionListV1 | null;
|
|
788
800
|
history: PromptChatApiHistoryV1;
|
|
789
801
|
meta_data: PromptChatApiMetaData;
|
|
790
802
|
plugins: PromptChatApiPluginListV1;
|
|
@@ -800,41 +812,44 @@ export interface PromptChatApiConfigV1 {
|
|
|
800
812
|
}
|
|
801
813
|
/**
|
|
802
814
|
* @deprecated
|
|
803
|
-
* The LLMClient's
|
|
815
|
+
* The LLMClient's extensions, in version 1.
|
|
804
816
|
*
|
|
805
817
|
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
806
|
-
* via the `definition` "
|
|
818
|
+
* via the `definition` "PromptChatApiExtensionListV1".
|
|
807
819
|
*/
|
|
808
|
-
export interface
|
|
809
|
-
|
|
820
|
+
export interface PromptChatApiExtensionListV1 {
|
|
821
|
+
extensions?: PromptChatApiLLMClientExtensionV1[];
|
|
810
822
|
meta_data: PromptChatApiListMetaData;
|
|
811
823
|
[k: string]: unknown;
|
|
812
824
|
}
|
|
813
825
|
/**
|
|
814
826
|
* @deprecated
|
|
815
|
-
*
|
|
827
|
+
* An extension of the LLMClient, in version 1, whose ``llmclient`` is renamed ``chatbot``.
|
|
816
828
|
*
|
|
817
829
|
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
818
|
-
* via the `definition` "
|
|
830
|
+
* via the `definition` "PromptChatApiLLMClientExtensionV1".
|
|
819
831
|
*/
|
|
820
|
-
export interface
|
|
832
|
+
export interface PromptChatApiLLMClientExtensionV1 {
|
|
821
833
|
/**
|
|
822
|
-
*
|
|
834
|
+
* LLMClientExtensions.llmclient: the LLMClient's id.
|
|
823
835
|
*/
|
|
824
836
|
chatbot: number;
|
|
825
837
|
/**
|
|
826
838
|
* TimestampedModel.created_at.
|
|
827
839
|
*/
|
|
828
840
|
created_at?: string | null;
|
|
841
|
+
enabled: boolean;
|
|
842
|
+
extension: number;
|
|
829
843
|
/**
|
|
830
844
|
* The row's primary key.
|
|
831
845
|
*/
|
|
832
846
|
id: number;
|
|
833
|
-
name
|
|
847
|
+
name: string;
|
|
834
848
|
/**
|
|
835
849
|
* TimestampedModel.updated_at.
|
|
836
850
|
*/
|
|
837
851
|
updated_at?: string | null;
|
|
852
|
+
version?: string | null;
|
|
838
853
|
}
|
|
839
854
|
/**
|
|
840
855
|
* @deprecated
|
|
@@ -920,7 +935,7 @@ export interface PromptChatApiLLMClientPluginV1 {
|
|
|
920
935
|
updated_at?: string | null;
|
|
921
936
|
}
|
|
922
937
|
/**
|
|
923
|
-
* A plugin's metadata: a :class:`smarter.apps.
|
|
938
|
+
* A plugin's metadata: a :class:`smarter.apps.llmtool.models.PluginMeta`.
|
|
924
939
|
*
|
|
925
940
|
* Its owner is left out: the configuration never includes a user's profile.
|
|
926
941
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EmbedOptions } from "./options";
|
|
2
|
+
export declare const PANEL_ID = "smarter-chat-embed-panel";
|
|
3
|
+
export interface EmbedAppProps {
|
|
4
|
+
options: EmbedOptions;
|
|
5
|
+
/** Whether the launcher is open. The element owns this state, so that page scripts can open and close it. */
|
|
6
|
+
open: boolean;
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
declare function EmbedApp(props: EmbedAppProps): import("react").JSX.Element;
|
|
10
|
+
export default EmbedApp;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CDN_BASE_URL: string;
|
|
2
|
+
/** The url of the directory of a script, or of jsDelivr's copy of the package, if it has no url. */
|
|
3
|
+
export declare function scriptBaseUrl(script: Element | null | undefined): string;
|
|
4
|
+
/** Remembers the directory of the running script. Called once, by index.ts, when the script first runs. */
|
|
5
|
+
export declare function captureBaseUrl(script?: Element | null | undefined): string;
|
|
6
|
+
/** The url of one of the embed script's files, e.g. assetUrl("mermaid/mermaid.js"). */
|
|
7
|
+
export declare function assetUrl(path: string): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The attribute that marks the elements that the script added, with their chatbot's url. */
|
|
2
|
+
export declare const AUTO_ATTRIBUTE = "data-smarter-chat-auto";
|
|
3
|
+
export type EmbedConfig = Record<string, unknown>;
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
SmarterChatConfig?: EmbedConfig | EmbedConfig[];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** The configurations of the script tag's data- attributes and of window.SmarterChatConfig, as attributes. */
|
|
10
|
+
export declare function configurations(script: Element | null | undefined, globalConfig: EmbedConfig | EmbedConfig[] | null | undefined): Record<string, string>[];
|
|
11
|
+
/**
|
|
12
|
+
* Adds a <smarter-chat> element for a configuration, unless the page has one for its chatbot already.
|
|
13
|
+
*
|
|
14
|
+
* @returns The new element, or null if none was added.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mountChat(attributes: Record<string, string>, doc?: Document): HTMLElement | null;
|
|
17
|
+
/** Adds the configurations' elements once the page's body exists. */
|
|
18
|
+
export declare function autoMount(script: Element | null | undefined, globalConfig: EmbedConfig | EmbedConfig[] | null | undefined, doc?: Document): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const ASSETS_PLACEHOLDER = "__SMARTER_CHAT_ASSETS__/";
|
|
2
|
+
export declare const FONT_STYLE_ID = "smarter-chat-embed-fonts";
|
|
3
|
+
/** Adds css to the embed's stylesheet. Called by the modules that the embed build generates for css imports. */
|
|
4
|
+
export declare function addCss(css: string): void;
|
|
5
|
+
/** The embed's css, with the urls of its own files. */
|
|
6
|
+
export declare function embedCss(): string;
|
|
7
|
+
/** The @font-face rules of a stylesheet. */
|
|
8
|
+
export declare function fontFaceRules(css: string): string[];
|
|
9
|
+
/** Adds the @font-face rules of the css to the document's head, once. */
|
|
10
|
+
export declare function hoistFontFaces(css: string, doc?: Document): void;
|
|
11
|
+
/**
|
|
12
|
+
* Applies the css to a shadow root: as a constructable stylesheet, shared by every chat on the page, where the
|
|
13
|
+
* browser supports them, or else as a style element.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyCss(root: ShadowRoot, css: string): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type EmbedOptionsResult } from "./options";
|
|
2
|
+
export declare const ELEMENT_NAME = "smarter-chat";
|
|
3
|
+
export declare const TOGGLE_EVENT = "smarter-chat-toggle";
|
|
4
|
+
export declare class SmarterChatElement extends HTMLElement {
|
|
5
|
+
#private;
|
|
6
|
+
static observedAttributes: ("chatbot" | "color" | "label" | "open" | "debug" | "width" | "height" | "position" | "api-key" | "mode" | "z-index" | "session-cookie-name" | "cookie-path" | "stream-progress")[];
|
|
7
|
+
/** The element's options, from its attributes. */
|
|
8
|
+
get options(): EmbedOptionsResult;
|
|
9
|
+
/** Whether the launcher is open. */
|
|
10
|
+
get isOpen(): boolean;
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
disconnectedCallback(): void;
|
|
13
|
+
attributeChangedCallback(): void;
|
|
14
|
+
open(): void;
|
|
15
|
+
close(): void;
|
|
16
|
+
toggle(): void;
|
|
17
|
+
}
|
|
18
|
+
/** Defines <smarter-chat>, unless the page already has, e.g. with another copy of the embed script. */
|
|
19
|
+
export declare function defineElement(registry?: CustomElementRegistry): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type EmbedConfig } from "./autoMount";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
/** The api of window.SmarterChat. */
|
|
4
|
+
export interface SmarterChatEmbedApi {
|
|
5
|
+
version: string;
|
|
6
|
+
/** Opens the launchers, or the launcher of one chatbot, by its url. */
|
|
7
|
+
open: (chatbot?: string) => void;
|
|
8
|
+
close: (chatbot?: string) => void;
|
|
9
|
+
toggle: (chatbot?: string) => void;
|
|
10
|
+
/** Adds a chat to the page, as window.SmarterChatConfig does. */
|
|
11
|
+
mount: (config: EmbedConfig) => HTMLElement | null;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
SmarterChat?: SmarterChatEmbedApi;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const importMermaid: () => Promise<typeof import("mermaid")>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type EmbedMode = "launcher" | "inline";
|
|
2
|
+
export type EmbedPosition = "bottom-right" | "bottom-left";
|
|
3
|
+
export interface EmbedOptions {
|
|
4
|
+
/** The url of the deployed LLMClient, e.g. https://support.3141-5926-5359.api.example.com/ */
|
|
5
|
+
chatbot: string;
|
|
6
|
+
/** A Smarter api key, for LLMClients that require one. It is public, as is everything in a web page. */
|
|
7
|
+
apiKey: string | null;
|
|
8
|
+
/** "launcher": a button in a corner of the page that opens the chat. "inline": the chat, in the page. */
|
|
9
|
+
mode: EmbedMode;
|
|
10
|
+
/** The launcher's corner. */
|
|
11
|
+
position: EmbedPosition;
|
|
12
|
+
/** Whether the launcher starts open. */
|
|
13
|
+
open: boolean;
|
|
14
|
+
/** The launcher's accessible name, and the chat panel's. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** The launcher button's background color. */
|
|
17
|
+
color: string;
|
|
18
|
+
/** The width of the inline chat, or of the launcher's panel. */
|
|
19
|
+
width: string;
|
|
20
|
+
/** The height of the inline chat, or of the launcher's panel. */
|
|
21
|
+
height: string;
|
|
22
|
+
/** The launcher's z-index. */
|
|
23
|
+
zIndex: number;
|
|
24
|
+
/** The cookie in which the chat saves its session's key. */
|
|
25
|
+
sessionCookieName: string;
|
|
26
|
+
/** The path of the chat's cookies. "/" keeps one chat session across the website. */
|
|
27
|
+
cookiePath: string;
|
|
28
|
+
/** Display a running prompt's progress. */
|
|
29
|
+
streamProgress: boolean;
|
|
30
|
+
/** Log to the browser console. */
|
|
31
|
+
debug: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** The result of reading the options: the options, or why they can't be used. */
|
|
34
|
+
export type EmbedOptionsResult = {
|
|
35
|
+
options: EmbedOptions;
|
|
36
|
+
error: null;
|
|
37
|
+
} | {
|
|
38
|
+
options: null;
|
|
39
|
+
error: string;
|
|
40
|
+
};
|
|
41
|
+
/** The attributes that a <smarter-chat> element reads, in kebab-case. */
|
|
42
|
+
export declare const OPTION_ATTRIBUTES: readonly ["chatbot", "api-key", "mode", "position", "open", "label", "color", "width", "height", "z-index", "session-cookie-name", "cookie-path", "stream-progress", "debug"];
|
|
43
|
+
export declare const DEFAULT_LABEL = "Chat";
|
|
44
|
+
export declare const DEFAULT_COLOR = "#ff5733";
|
|
45
|
+
export declare const DEFAULT_Z_INDEX = 2147483000;
|
|
46
|
+
/** A boolean attribute: present and empty, or "true", is true. "false" is false. Missing is the default. */
|
|
47
|
+
export declare function booleanOption(value: string | null | undefined, defaultValue: boolean): boolean;
|
|
48
|
+
/** The url, if it is an http(s) url, normalized to end with a slash, else null. */
|
|
49
|
+
export declare function chatbotUrl(value: string | null | undefined): string | null;
|
|
50
|
+
/**
|
|
51
|
+
* The default session cookie of a chatbot: one per chatbot host, so that two chatbots on one website keep separate
|
|
52
|
+
* chat sessions, e.g. smarter_chat_support_3141_5926_5359_api_example_com.
|
|
53
|
+
*/
|
|
54
|
+
export declare function defaultSessionCookieName(chatbot: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* The options of a <smarter-chat> element.
|
|
57
|
+
*
|
|
58
|
+
* @param get Returns the value of an attribute, by its kebab-case name, or null if it is missing.
|
|
59
|
+
* @param defaultMode The mode, if the attributes don't say: "inline" for an element in the page, and "launcher"
|
|
60
|
+
* for the element that the script tag adds.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseOptions(get: (name: (typeof OPTION_ATTRIBUTES)[number]) => string | null, defaultMode?: EmbedMode): EmbedOptionsResult;
|
|
63
|
+
/** A camelCase name in kebab-case, e.g. apiKey to api-key. */
|
|
64
|
+
export declare function kebabCase(name: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* The attributes of a configuration object, e.g. window.SmarterChatConfig's, or a script tag's dataset: kebab-case
|
|
67
|
+
* names, and string values. Values that are null, undefined, objects or functions are left out.
|
|
68
|
+
*/
|
|
69
|
+
export declare function configAttributes(config: Record<string, unknown>): Record<string, string>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cookie management for Smarter Chat: the Django CSRF cookie, which it reads, and the chat
|
|
3
3
|
* session and debug cookies, which it sets for the page's path, so that each LLMClient's
|
|
4
|
-
* workbench has its own chat session.
|
|
4
|
+
* workbench has its own chat session, or for the path that the cookie names, e.g. "/" for a chat
|
|
5
|
+
* that follows the visitor across a website.
|
|
5
6
|
*/
|
|
6
7
|
import type { CookieMeta } from "../types";
|
|
7
8
|
/**
|
|
@@ -12,6 +13,6 @@ import type { CookieMeta } from "../types";
|
|
|
12
13
|
export declare function inCookieDomain(hostname: string, domain: string | null | undefined): boolean;
|
|
13
14
|
/** The cookie's value: its preset value, else the browser's cookie, else defaultValue. */
|
|
14
15
|
export declare function getCookie(cookie: CookieMeta, defaultValue?: string | null): string | null;
|
|
15
|
-
/** Sets the cookie for the page's
|
|
16
|
+
/** Sets the cookie for its path (by default, the page's), or deletes it when value is empty. */
|
|
16
17
|
export declare function setCookie(cookie: CookieMeta, value: string | boolean | null | undefined): void;
|
|
17
|
-
export declare function cookieMetaFactory(name: string, expiration: number | null, domain: string | undefined, value?: string | null): CookieMeta;
|
|
18
|
+
export declare function cookieMetaFactory(name: string, expiration: number | null, domain: string | undefined, value?: string | null, path?: string | null): CookieMeta;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imports mermaid, which lib/mermaid.ts does the first time that a message has a diagram.
|
|
3
|
+
*
|
|
4
|
+
* In the npm package and the web console, the page's bundler splits mermaid into chunks, which are downloaded only
|
|
5
|
+
* then. The embed script, a single classic script, can't be split that way, so its build replaces this module with
|
|
6
|
+
* src/embed/mermaidImport.ts, which imports a separate build of mermaid from beside the script. See vite.config.ts.
|
|
7
|
+
*/
|
|
8
|
+
export declare const importMermaid: () => Promise<typeof import("mermaid")>;
|
|
@@ -54,6 +54,8 @@ export interface CookieMeta {
|
|
|
54
54
|
domain: string;
|
|
55
55
|
/** A value to use instead of the cookie's. */
|
|
56
56
|
value: string | null;
|
|
57
|
+
/** The path that Smarter Chat sets the cookie for. Empty or missing means the page's path. */
|
|
58
|
+
path?: string | null;
|
|
57
59
|
}
|
|
58
60
|
export interface ChatCookies {
|
|
59
61
|
csrfCookie: CookieMeta;
|
|
@@ -87,6 +89,11 @@ export interface SmarterChatProps {
|
|
|
87
89
|
/** The name of the cookie in which Smarter Chat saves the chat session's key. */
|
|
88
90
|
sessionCookieName?: string;
|
|
89
91
|
sessionCookieExpiration?: number;
|
|
92
|
+
/**
|
|
93
|
+
* The path of the session and debug cookies. By default, the page's path, so that each page has its own chat
|
|
94
|
+
* session. "/" keeps one chat session as the visitor moves from page to page of a website.
|
|
95
|
+
*/
|
|
96
|
+
cookiePath?: string | null;
|
|
90
97
|
/** @deprecated Not used. Django's session cookie is sent with each request, as is. */
|
|
91
98
|
authSessionCookieName?: string;
|
|
92
99
|
/** Show the Console, which displays the chat's configuration and history. */
|