@anker-in/campaign-ui 0.0.33-alpha2 → 0.0.33-alpha4

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.
Files changed (86) hide show
  1. package/dist/cjs/components/chat/Markdown.d.ts +5 -0
  2. package/dist/cjs/components/chat/Messages.d.ts +3 -0
  3. package/dist/cjs/components/chat/Response.d.ts +2 -0
  4. package/dist/cjs/components/chat/action.d.ts +8 -2
  5. package/dist/cjs/components/chat/action.js +1 -1
  6. package/dist/cjs/components/chat/action.js.map +3 -3
  7. package/dist/cjs/components/chat/button.d.ts +3 -0
  8. package/dist/cjs/components/chat/button.js +2 -0
  9. package/dist/cjs/components/chat/button.js.map +7 -0
  10. package/dist/cjs/components/chat/index.d.ts +28 -4
  11. package/dist/cjs/components/chat/index.js +1 -5
  12. package/dist/cjs/components/chat/index.js.map +3 -3
  13. package/dist/cjs/components/chat/markdown.js +2 -0
  14. package/dist/cjs/components/chat/markdown.js.map +7 -0
  15. package/dist/cjs/components/chat/marksdown.d.ts +5 -0
  16. package/dist/cjs/components/chat/message.d.ts +2 -0
  17. package/dist/cjs/components/chat/messages.js +2 -0
  18. package/dist/cjs/components/chat/messages.js.map +7 -0
  19. package/dist/cjs/components/chat/props.d.ts +43 -0
  20. package/dist/cjs/components/chat/props.js +2 -0
  21. package/dist/cjs/components/chat/props.js.map +7 -0
  22. package/dist/cjs/components/chat/response copy.d.ts +2 -0
  23. package/dist/cjs/components/chat/response.js +2 -0
  24. package/dist/cjs/components/chat/response.js.map +7 -0
  25. package/dist/cjs/components/chat/rresponse.d.ts +2 -0
  26. package/dist/cjs/components/chat/suggestions.d.ts +3 -0
  27. package/dist/cjs/components/chat/suggestions.js +2 -0
  28. package/dist/cjs/components/chat/suggestions.js.map +7 -0
  29. package/dist/cjs/stories/chat.stories.d.ts +1 -0
  30. package/dist/cjs/stories/chat.stories.js +1 -1
  31. package/dist/cjs/stories/chat.stories.js.map +3 -3
  32. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  33. package/dist/esm/components/chat/Markdown.d.ts +5 -0
  34. package/dist/esm/components/chat/Messages.d.ts +3 -0
  35. package/dist/esm/components/chat/Response.d.ts +2 -0
  36. package/dist/esm/components/chat/action.d.ts +8 -2
  37. package/dist/esm/components/chat/action.js +1 -1
  38. package/dist/esm/components/chat/action.js.map +3 -3
  39. package/dist/esm/components/chat/button.d.ts +3 -0
  40. package/dist/esm/components/chat/button.js +2 -0
  41. package/dist/esm/components/chat/button.js.map +7 -0
  42. package/dist/esm/components/chat/index.d.ts +28 -4
  43. package/dist/esm/components/chat/index.js +1 -5
  44. package/dist/esm/components/chat/index.js.map +3 -3
  45. package/dist/esm/components/chat/markdown.js +2 -0
  46. package/dist/esm/components/chat/markdown.js.map +7 -0
  47. package/dist/esm/components/chat/marksdown.d.ts +5 -0
  48. package/dist/esm/components/chat/message.d.ts +2 -0
  49. package/dist/esm/components/chat/messages.js +2 -0
  50. package/dist/esm/components/chat/messages.js.map +7 -0
  51. package/dist/esm/components/chat/props.d.ts +43 -0
  52. package/dist/esm/components/chat/props.js +2 -0
  53. package/dist/esm/components/chat/props.js.map +7 -0
  54. package/dist/esm/components/chat/response copy.d.ts +2 -0
  55. package/dist/esm/components/chat/response.js +2 -0
  56. package/dist/esm/components/chat/response.js.map +7 -0
  57. package/dist/esm/components/chat/rresponse.d.ts +2 -0
  58. package/dist/esm/components/chat/suggestions.d.ts +3 -0
  59. package/dist/esm/components/chat/suggestions.js +2 -0
  60. package/dist/esm/components/chat/suggestions.js.map +7 -0
  61. package/dist/esm/stories/chat.stories.d.ts +1 -0
  62. package/dist/esm/stories/chat.stories.js +1 -1
  63. package/dist/esm/stories/chat.stories.js.map +2 -2
  64. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +1 -1
  66. package/src/components/chat/action.tsx +58 -14
  67. package/src/components/chat/button.tsx +23 -0
  68. package/src/components/chat/index.tsx +93 -69
  69. package/src/components/chat/markdown.tsx +36 -0
  70. package/src/components/chat/messages.tsx +208 -0
  71. package/src/components/chat/props.ts +51 -0
  72. package/src/components/chat/response.tsx +19 -0
  73. package/src/components/chat/suggestions.tsx +34 -0
  74. package/src/stories/chat.stories.tsx +5 -6
  75. package/src/styles/css/messages.css +12 -0
  76. package/src/styles/css/response.css +0 -1
  77. package/src/styles/css/suggestions.css +1 -0
  78. package/dist/cjs/components/chat/chatContext.js +0 -2
  79. package/dist/cjs/components/chat/chatContext.js.map +0 -7
  80. package/dist/cjs/components/theme.js +0 -2
  81. package/dist/cjs/components/theme.js.map +0 -7
  82. package/dist/esm/components/chat/chatContext.js +0 -2
  83. package/dist/esm/components/chat/chatContext.js.map +0 -7
  84. package/dist/esm/components/theme.js +0 -2
  85. package/dist/esm/components/theme.js.map +0 -7
  86. package/src/components/chat/chatContext.tsx +0 -161
@@ -0,0 +1,19 @@
1
+ import { useChatContext } from '@copilotkit/react-ui'
2
+ import { useCopilotChat } from '@copilotkit/react-core'
3
+
4
+ const ResponseButton = () => {
5
+ const context = useChatContext()
6
+
7
+ const { isLoading, reloadMessages, stopGeneration } = useCopilotChat()
8
+
9
+ return (
10
+ !isLoading && (
11
+ <button onClick={isLoading ? stopGeneration : reloadMessages} className="copilotKitResponseButton">
12
+ {isLoading ? context.labels.stopGenerating : context.labels.regenerateResponse}
13
+ <span>{isLoading ? context.icons.stopIcon : context.icons.regenerateIcon}</span>
14
+ </button>
15
+ )
16
+ )
17
+ }
18
+
19
+ export default ResponseButton
@@ -0,0 +1,34 @@
1
+ import { useCopilotChat } from '@copilotkit/react-core'
2
+ import { Role, TextMessage } from '@copilotkit/runtime-client-gql'
3
+
4
+ import type { SuggestionsProps, ChatSuggestions } from './props.js'
5
+
6
+ const Suggestions = ({ currentSuggestions }: ChatSuggestions) => {
7
+ const { appendMessage } = useCopilotChat()
8
+
9
+ return (
10
+ currentSuggestions?.length > 0 && (
11
+ <div className="suggestions">
12
+ {currentSuggestions.map(({ title, message, partial, className }: SuggestionsProps, index: number) => (
13
+ <button
14
+ key={message + index}
15
+ disabled={partial}
16
+ onClick={e => {
17
+ e.preventDefault()
18
+ const m = new TextMessage({
19
+ content: message,
20
+ role: Role.User,
21
+ })
22
+ appendMessage(m)
23
+ }}
24
+ className={className || 'suggestion'}
25
+ >
26
+ <span>{title}</span>
27
+ </button>
28
+ ))}
29
+ </div>
30
+ )
31
+ )
32
+ }
33
+
34
+ export default Suggestions
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import type { Meta, StoryObj } from '@storybook/react'
3
-
4
3
  import { Chat } from '../components/index.js'
4
+ import '../styles/chat.css'
5
5
 
6
6
  type Story = StoryObj<typeof meta>
7
7
 
@@ -20,8 +20,7 @@ const meta: Meta<typeof Chat> = {
20
20
  // More on argTypes: https://storybook.js.org/docs/api/argtypes
21
21
  decorators: [
22
22
  Story => (
23
- <div style={{ marginTop: '40em' }}>
24
- {/* 👇 Decorators in Storybook also accept a function. Replace <Story/> with Story() to enable it */}
23
+ <div style={{ height: '700px' }}>
25
24
  <Story />
26
25
  </div>
27
26
  ),
@@ -35,8 +34,8 @@ export const Default: Story = {
35
34
  title: 'DTC Live Chat',
36
35
  runtimeUrl: 'https://beta-dtcapi.anker.com',
37
36
  shopify_domain: 'soundcoreusa.myshopify.com',
38
- user_id: 'ar_411',
39
- query: '',
40
- lang: { popupTip: 'Hi ! Welcome to soundcore Innovations live chat!' },
37
+ user_id: 'arno6',
38
+ showResponseButton: 'follow',
39
+ lang: { popupTip: 'Hi ! Welcome to soundcore Innovations live chat!', popupTipTimeout: [3000, 6000] },
41
40
  },
42
41
  }
@@ -71,3 +71,15 @@
71
71
  flex-direction: column;
72
72
  justify-content: flex-end;
73
73
  }
74
+
75
+ .copilotKitMessage.copilotKitAssistantMessage:has(.copilotKitMarkdown:empty) {
76
+ display: none;
77
+ }
78
+
79
+ .copilotKitMessagesFooter {
80
+ transition: all 300ms ease-out;
81
+ }
82
+
83
+ .copilotKitCustomAssistantMessage .hidden {
84
+ display: none !important;
85
+ }
@@ -14,7 +14,6 @@
14
14
  text-decoration: none;
15
15
  text-transform: none;
16
16
  white-space: nowrap;
17
- margin-top: 15px;
18
17
  }
19
18
 
20
19
  .copilotKitResponseButton:hover {
@@ -2,6 +2,7 @@
2
2
  display: flex;
3
3
  flex-wrap: wrap;
4
4
  gap: 8px;
5
+ margin-top: 12px;
5
6
  }
6
7
 
7
8
  .copilotKitMessages footer h6 {
@@ -1,2 +0,0 @@
1
- "use strict";var p=Object.create;var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},i=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d(t))!R.call(e,n)&&n!==o&&a(e,n,{get:()=>t[n],enumerable:!(r=C(t,n))||r.enumerable});return e};var x=(e,t,o)=>(o=e!=null?p(l(e)):{},i(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),u=e=>i(a({},"__esModule",{value:!0}),e);var I={};h(I,{ChatContext:()=>s,useChatContext:()=>f});module.exports=u(I);var c=x(require("react"));const s=c.default.createContext(void 0);function f(){const e=c.default.useContext(s);if(e===void 0)throw new Error("Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?");return e}
2
- //# sourceMappingURL=chatContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/components/chat/chatContext.tsx"],
4
- "sourcesContent": ["import React from 'react'\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[]\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string\n\n /**\n * The message to display when an error occurs.\n * @default \"\u274C An error occurred. Please try again.\"\n */\n error?: string\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>\n icons: Required<CopilotChatIcons>\n open: boolean\n setOpen: (_open: boolean) => void\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined)\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext)\n if (context === undefined) {\n throw new Error('Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?')\n }\n return context\n}\n\nexport interface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels\n icons?: CopilotChatIcons\n children?: React.ReactNode\n open: boolean\n setOpen: (_open: boolean) => void\n}\n\n// export const ChatContextProvider = ({\n// // temperature,\n// // instructions,\n// // maxFeedback,\n// labels,\n// icons,\n// children,\n// open,\n// setOpen,\n// }: ChatContextProps) => {\n// const context = {\n// labels: {\n// ...{\n// initial: \"\",\n// title: \"CopilotKit\",\n// placeholder: \"Type a message...\",\n// error: \"\u274C An error occurred. Please try again.\",\n// stopGenerating: \"Stop generating\",\n// regenerateResponse: \"Regenerate response\",\n// },\n// ...labels,\n// },\n\n// icons: {\n// ...icons,\n// },\n// open,\n// setOpen,\n// };\n// return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n// };\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,mBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAkB,oBA6GX,MAAMH,EAAc,EAAAI,QAAM,cAAuC,MAAS,EAE1E,SAASH,GAA8B,CAC5C,MAAMI,EAAU,EAAAD,QAAM,WAAWJ,CAAW,EAC5C,GAAIK,IAAY,OACd,MAAM,IAAI,MAAM,0FAA0F,EAE5G,OAAOA,CACT",
6
- "names": ["chatContext_exports", "__export", "ChatContext", "useChatContext", "__toCommonJS", "import_react", "React", "context"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var m=Object.create;var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of h(t))!f.call(e,a)&&a!==r&&o(e,a,{get:()=>t[a],enumerable:!(c=s(t,a))||c.enumerable});return e};var l=(e,t,r)=>(r=e!=null?m(p(e)):{},d(t||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r,e)),i=e=>d(o({},"__esModule",{value:!0}),e);var T={};u(T,{default:()=>R});module.exports=i(T);var n=require("react/jsx-runtime"),b=l(require("react"));const y=({brand:e,children:t})=>(b.useLayoutEffect(()=>{document.querySelector("html")?.setAttribute("data-brand-theme",e)},[]),(0,n.jsx)(n.Fragment,{children:t}));var R=y;
2
- //# sourceMappingURL=theme.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/theme.tsx"],
4
- "sourcesContent": ["import * as React from 'react'\nimport type { Brand } from '../helpers/constants.js'\n\ninterface ThemeProps {\n brand: Brand\n children: React.ReactNode\n}\n/**\n *\n * @param param\n * @returns\n */\nconst Theme = ({ brand, children }: ThemeProps) => {\n React.useLayoutEffect(() => {\n document.querySelector('html')?.setAttribute('data-brand-theme', brand)\n }, [])\n return <>{children}</>\n}\n\nexport default Theme\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgBS,IAAAI,EAAA,6BAhBTC,EAAuB,oBAYvB,MAAMC,EAAQ,CAAC,CAAE,MAAAC,EAAO,SAAAC,CAAS,KAC/BH,EAAM,gBAAgB,IAAM,CAC1B,SAAS,cAAc,MAAM,GAAG,aAAa,mBAAoBE,CAAK,CACxE,EAAG,CAAC,CAAC,KACE,mBAAG,SAAAC,EAAS,GAGrB,IAAON,EAAQI",
6
- "names": ["theme_exports", "__export", "theme_default", "__toCommonJS", "import_jsx_runtime", "React", "Theme", "brand", "children"]
7
- }
@@ -1,2 +0,0 @@
1
- import t from"react";const o=t.createContext(void 0);function a(){const e=t.useContext(o);if(e===void 0)throw new Error("Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?");return e}export{o as ChatContext,a as useChatContext};
2
- //# sourceMappingURL=chatContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/components/chat/chatContext.tsx"],
4
- "sourcesContent": ["import React from 'react'\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[]\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string\n\n /**\n * The message to display when an error occurs.\n * @default \"\u274C An error occurred. Please try again.\"\n */\n error?: string\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>\n icons: Required<CopilotChatIcons>\n open: boolean\n setOpen: (_open: boolean) => void\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined)\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext)\n if (context === undefined) {\n throw new Error('Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?')\n }\n return context\n}\n\nexport interface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels\n icons?: CopilotChatIcons\n children?: React.ReactNode\n open: boolean\n setOpen: (_open: boolean) => void\n}\n\n// export const ChatContextProvider = ({\n// // temperature,\n// // instructions,\n// // maxFeedback,\n// labels,\n// icons,\n// children,\n// open,\n// setOpen,\n// }: ChatContextProps) => {\n// const context = {\n// labels: {\n// ...{\n// initial: \"\",\n// title: \"CopilotKit\",\n// placeholder: \"Type a message...\",\n// error: \"\u274C An error occurred. Please try again.\",\n// stopGenerating: \"Stop generating\",\n// regenerateResponse: \"Regenerate response\",\n// },\n// ...labels,\n// },\n\n// icons: {\n// ...icons,\n// },\n// open,\n// setOpen,\n// };\n// return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n// };\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,QA6GX,MAAMC,EAAcD,EAAM,cAAuC,MAAS,EAE1E,SAASE,GAA8B,CAC5C,MAAMC,EAAUH,EAAM,WAAWC,CAAW,EAC5C,GAAIE,IAAY,OACd,MAAM,IAAI,MAAM,0FAA0F,EAE5G,OAAOA,CACT",
6
- "names": ["React", "ChatContext", "useChatContext", "context"]
7
- }
@@ -1,2 +0,0 @@
1
- import{Fragment as o,jsx as n}from"react/jsx-runtime";import*as r from"react";const a=({brand:e,children:t})=>(r.useLayoutEffect(()=>{document.querySelector("html")?.setAttribute("data-brand-theme",e)},[]),n(o,{children:t}));var c=a;export{c as default};
2
- //# sourceMappingURL=theme.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/theme.tsx"],
4
- "sourcesContent": ["import * as React from 'react'\nimport type { Brand } from '../helpers/constants.js'\n\ninterface ThemeProps {\n brand: Brand\n children: React.ReactNode\n}\n/**\n *\n * @param param\n * @returns\n */\nconst Theme = ({ brand, children }: ThemeProps) => {\n React.useLayoutEffect(() => {\n document.querySelector('html')?.setAttribute('data-brand-theme', brand)\n }, [])\n return <>{children}</>\n}\n\nexport default Theme\n"],
5
- "mappings": "AAgBS,mBAAAA,EAAA,OAAAC,MAAA,oBAhBT,UAAYC,MAAW,QAYvB,MAAMC,EAAQ,CAAC,CAAE,MAAAC,EAAO,SAAAC,CAAS,KAC/BH,EAAM,gBAAgB,IAAM,CAC1B,SAAS,cAAc,MAAM,GAAG,aAAa,mBAAoBE,CAAK,CACxE,EAAG,CAAC,CAAC,EACEH,EAAAD,EAAA,CAAG,SAAAK,EAAS,GAGrB,IAAOC,EAAQH",
6
- "names": ["Fragment", "jsx", "React", "Theme", "brand", "children", "theme_default"]
7
- }
@@ -1,161 +0,0 @@
1
- import React from 'react'
2
-
3
- /**
4
- * Icons for CopilotChat component.
5
- */
6
- export interface CopilotChatIcons {
7
- /**
8
- * The icon to use for the open chat button.
9
- * @default <OpenIcon />
10
- */
11
- openIcon?: React.ReactNode
12
-
13
- /**
14
- * The icon to use for the close chat button.
15
- * @default <CloseIcon />
16
- */
17
- closeIcon?: React.ReactNode
18
-
19
- /**
20
- * The icon to use for the close chat button in the header.
21
- * @default <HeaderCloseIcon />
22
- */
23
- headerCloseIcon?: React.ReactNode
24
-
25
- /**
26
- * The icon to use for the send button.
27
- * @default <SendIcon />
28
- */
29
- sendIcon?: React.ReactNode
30
-
31
- /**
32
- * The icon to use for the activity indicator.
33
- * @default <ActivityIcon />
34
- */
35
- activityIcon?: React.ReactNode
36
-
37
- /**
38
- * The icon to use for the spinner.
39
- * @default <SpinnerIcon />
40
- */
41
- spinnerIcon?: React.ReactNode
42
-
43
- /**
44
- * The icon to use for the stop button.
45
- * @default <StopIcon />
46
- */
47
- stopIcon?: React.ReactNode
48
-
49
- /**
50
- * The icon to use for the regenerate button.
51
- * @default <RegenerateIcon />
52
- */
53
- regenerateIcon?: React.ReactNode
54
-
55
- /**
56
- * The icons to use for push to talk.
57
- * @default <PushToTalkIcon />
58
- */
59
-
60
- pushToTalkIcon?: React.ReactNode
61
- }
62
-
63
- /**
64
- * Labels for CopilotChat component.
65
- */
66
- export interface CopilotChatLabels {
67
- /**
68
- * The initial message(s) to display in the chat window.
69
- */
70
- initial?: string | string[]
71
-
72
- /**
73
- * The title to display in the header.
74
- * @default "CopilotKit"
75
- */
76
- title?: string
77
-
78
- /**
79
- * The placeholder to display in the input.
80
- * @default "Type a message..."
81
- */
82
- placeholder?: string
83
-
84
- /**
85
- * The message to display when an error occurs.
86
- * @default "❌ An error occurred. Please try again."
87
- */
88
- error?: string
89
-
90
- /**
91
- * The label to display on the stop button.
92
- * @default "Stop generating"
93
- */
94
- stopGenerating?: string
95
-
96
- /**
97
- * The label to display on the regenerate button.
98
- * @default "Regenerate response"
99
- */
100
- regenerateResponse?: string
101
- }
102
-
103
- interface ChatContext {
104
- labels: Required<CopilotChatLabels>
105
- icons: Required<CopilotChatIcons>
106
- open: boolean
107
- setOpen: (_open: boolean) => void
108
- }
109
-
110
- export const ChatContext = React.createContext<ChatContext | undefined>(undefined)
111
-
112
- export function useChatContext(): ChatContext {
113
- const context = React.useContext(ChatContext)
114
- if (context === undefined) {
115
- throw new Error('Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?')
116
- }
117
- return context
118
- }
119
-
120
- export interface ChatContextProps {
121
- // temperature?: number;
122
- // instructions?: string;
123
- // maxFeedback?: number;
124
- labels?: CopilotChatLabels
125
- icons?: CopilotChatIcons
126
- children?: React.ReactNode
127
- open: boolean
128
- setOpen: (_open: boolean) => void
129
- }
130
-
131
- // export const ChatContextProvider = ({
132
- // // temperature,
133
- // // instructions,
134
- // // maxFeedback,
135
- // labels,
136
- // icons,
137
- // children,
138
- // open,
139
- // setOpen,
140
- // }: ChatContextProps) => {
141
- // const context = {
142
- // labels: {
143
- // ...{
144
- // initial: "",
145
- // title: "CopilotKit",
146
- // placeholder: "Type a message...",
147
- // error: "❌ An error occurred. Please try again.",
148
- // stopGenerating: "Stop generating",
149
- // regenerateResponse: "Regenerate response",
150
- // },
151
- // ...labels,
152
- // },
153
-
154
- // icons: {
155
- // ...icons,
156
- // },
157
- // open,
158
- // setOpen,
159
- // };
160
- // return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;
161
- // };