@aws-amplify/ui-react-ai 0.4.0 → 1.1.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/dist/esm/components/AIConversation/AIConversation.mjs +8 -26
- package/dist/esm/components/AIConversation/AIConversationProvider.mjs +20 -17
- package/dist/esm/components/AIConversation/context/AIContextContext.mjs +8 -0
- package/dist/esm/components/AIConversation/context/AttachmentContext.mjs +12 -3
- package/dist/esm/components/AIConversation/context/ConversationInputContext.mjs +2 -1
- package/dist/esm/components/AIConversation/context/FallbackComponentContext.mjs +8 -0
- package/dist/esm/components/AIConversation/context/ResponseComponentsContext.mjs +6 -2
- package/dist/esm/components/AIConversation/context/elements/IconElement.mjs +2 -2
- package/dist/esm/components/AIConversation/context/elements/definitions.mjs +12 -12
- package/dist/esm/components/AIConversation/createAIConversation.mjs +2 -5
- package/dist/esm/components/AIConversation/displayText.mjs +6 -0
- package/dist/esm/components/AIConversation/utils.mjs +42 -13
- package/dist/esm/components/AIConversation/views/Controls/ActionsBarControl.mjs +3 -2
- package/dist/esm/components/AIConversation/views/Controls/AttachFileControl.mjs +2 -0
- package/dist/esm/components/AIConversation/views/Controls/AttachmentListControl.mjs +2 -0
- package/dist/esm/components/AIConversation/views/Controls/AvatarControl.mjs +2 -0
- package/dist/esm/components/AIConversation/views/Controls/DefaultMessageControl.mjs +2 -0
- package/dist/esm/components/AIConversation/views/Controls/FormControl.mjs +44 -8
- package/dist/esm/components/AIConversation/views/Controls/MessagesControl.mjs +24 -31
- package/dist/esm/components/AIConversation/views/Controls/PromptControl.mjs +2 -0
- package/dist/esm/components/AIConversation/views/default/Form.mjs +13 -20
- package/dist/esm/components/AIConversation/views/default/MessageList.mjs +31 -16
- package/dist/esm/hooks/contentFromEvents.mjs +22 -0
- package/dist/esm/hooks/createAIHooks.mjs +0 -3
- package/dist/esm/hooks/exhaustivelyListMessages.mjs +19 -0
- package/dist/esm/hooks/shared.mjs +14 -0
- package/dist/esm/hooks/useAIConversation.mjs +246 -106
- package/dist/esm/hooks/useAIGeneration.mjs +1 -8
- package/dist/esm/index.mjs +0 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +508 -280
- package/dist/types/components/AIConversation/AIConversation.d.ts +0 -3
- package/dist/types/components/AIConversation/AIConversationProvider.d.ts +1 -1
- package/dist/types/components/AIConversation/context/AIContextContext.d.ts +6 -0
- package/dist/types/components/AIConversation/context/AttachmentContext.d.ts +5 -5
- package/dist/types/components/AIConversation/context/ControlsContext.d.ts +5 -3
- package/dist/types/components/AIConversation/context/ConversationInputContext.d.ts +4 -2
- package/dist/types/components/AIConversation/context/DisplayTextContext.d.ts +1 -1
- package/dist/types/components/AIConversation/context/FallbackComponentContext.d.ts +7 -0
- package/dist/types/components/AIConversation/context/MessageRenderContext.d.ts +1 -1
- package/dist/types/components/AIConversation/context/ResponseComponentsContext.d.ts +2 -2
- package/dist/types/components/AIConversation/context/elements/IconElement.d.ts +2 -2
- package/dist/types/components/AIConversation/context/elements/definitions.d.ts +12 -12
- package/dist/types/components/AIConversation/context/index.d.ts +4 -2
- package/dist/types/components/AIConversation/createAIConversation.d.ts +0 -3
- package/dist/types/components/AIConversation/displayText.d.ts +2 -0
- package/dist/types/components/AIConversation/index.d.ts +2 -1
- package/dist/types/components/AIConversation/types.d.ts +6 -24
- package/dist/types/components/AIConversation/utils.d.ts +10 -0
- package/dist/types/components/AIConversation/views/Controls/MessagesControl.d.ts +1 -5
- package/dist/types/components/AIConversation/views/default/Attachments.d.ts +2 -2
- package/dist/types/components/AIConversation/views/default/Form.d.ts +1 -1
- package/dist/types/components/AIConversation/views/default/MessageList.d.ts +1 -1
- package/dist/types/components/AIConversation/views/default/PromptList.d.ts +1 -1
- package/dist/types/hooks/contentFromEvents.d.ts +2 -0
- package/dist/types/hooks/createAIHooks.d.ts +0 -3
- package/dist/types/hooks/exhaustivelyListMessages.d.ts +8 -0
- package/dist/types/hooks/index.d.ts +1 -2
- package/dist/types/hooks/shared.d.ts +23 -0
- package/dist/types/hooks/useAIConversation.d.ts +6 -4
- package/dist/types/hooks/useAIGeneration.d.ts +3 -13
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +32 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -6
- package/dist/ai-conversation-styles.css +0 -195
- package/dist/ai-conversation-styles.js +0 -2
- package/dist/esm/hooks/AIContextProvider.mjs +0 -20
- package/dist/types/ai-conversation-styles.d.ts +0 -1
- package/dist/types/hooks/AIContextProvider.d.ts +0 -17
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
.ai-header__container {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
|
-
flex: 0 0 auto;
|
|
5
|
-
justify-content: space-between;
|
|
6
|
-
border: 1px solid rgb(220, 222, 224);
|
|
7
|
-
border-radius: 16px 16px 0px 0px;
|
|
8
|
-
padding: 0px 16px;
|
|
9
|
-
box-shadow: rgba(0, 0, 0, 0.07) 0px 12px 30px 0px;
|
|
10
|
-
background-color: rgb(250, 250, 250);
|
|
11
|
-
flex-grow: 1;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.ai-header__button {
|
|
15
|
-
border: none;
|
|
16
|
-
background: none;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.ai-prompts__prompt__buttongroup {
|
|
20
|
-
display: flex;
|
|
21
|
-
gap: 8px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.ai-prompts__prompt__card {
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
flex: 1;
|
|
28
|
-
border-radius: 8px;
|
|
29
|
-
border-width: 0px;
|
|
30
|
-
text-align: left;
|
|
31
|
-
white-space: nowrap;
|
|
32
|
-
padding: 12px;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.ai-prompts__prompt__card__header {
|
|
37
|
-
font-weight: bold;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.ai-prompts__prompt__card__text {
|
|
41
|
-
margin: 0px;
|
|
42
|
-
overflow: hidden;
|
|
43
|
-
text-overflow: ellipsis;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ai-messages__container {
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
width: 100%;
|
|
50
|
-
justify-content: flex-end;
|
|
51
|
-
align-items: flex-start;
|
|
52
|
-
gap: 16px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.ai-message {
|
|
56
|
-
display: flex;
|
|
57
|
-
flex-direction: column;
|
|
58
|
-
width: 480px;
|
|
59
|
-
align-items: flex-start;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.ai-message__text {
|
|
63
|
-
white-space: pre-wrap;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.ai-message--bubble-2.ai-message--user {
|
|
67
|
-
justify-content: flex-end;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.ai-message__header__container {
|
|
71
|
-
display: flex;
|
|
72
|
-
flex-direction: row;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 12px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.ai-message__image {
|
|
78
|
-
width: 100%;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.ai-avatar__container {
|
|
82
|
-
display: flex;
|
|
83
|
-
flex-direction: row;
|
|
84
|
-
gap: 12px;
|
|
85
|
-
align-items: center;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.ai-avatar__icon {
|
|
89
|
-
width: 40px;
|
|
90
|
-
height: 40px;
|
|
91
|
-
border-radius: 50%;
|
|
92
|
-
display: flex;
|
|
93
|
-
overflow: hidden;
|
|
94
|
-
justify-content: center;
|
|
95
|
-
align-items: center;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.ai-actions-bar__container {
|
|
99
|
-
display: flex;
|
|
100
|
-
align-items: flex-start;
|
|
101
|
-
gap: 8px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.ai-actions-bar__icon {
|
|
105
|
-
width: 100%;
|
|
106
|
-
height: 100%;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.ai-actions-bar__button {
|
|
110
|
-
display: flex;
|
|
111
|
-
width: 28px;
|
|
112
|
-
height: 28px;
|
|
113
|
-
justify-content: center;
|
|
114
|
-
align-items: center;
|
|
115
|
-
gap: 4px;
|
|
116
|
-
overflow: hidden;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.ai-field__form {
|
|
120
|
-
display: flex;
|
|
121
|
-
flex-direction: row;
|
|
122
|
-
align-items: flex-start;
|
|
123
|
-
gap: 8px;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.ai-field__input-container {
|
|
127
|
-
display: flex;
|
|
128
|
-
flex-direction: column;
|
|
129
|
-
align-items: flex-start;
|
|
130
|
-
gap: 8px;
|
|
131
|
-
flex: 1 0 0;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.ai-attachment-list__unordered-list {
|
|
135
|
-
gap: 8px;
|
|
136
|
-
display: flex;
|
|
137
|
-
flex-direction: column;
|
|
138
|
-
width: 70%;
|
|
139
|
-
padding: 0px;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.ai-attachment__list-item {
|
|
143
|
-
display: flex;
|
|
144
|
-
align-items: center;
|
|
145
|
-
gap: 8px;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.ai-attachment-text__container {
|
|
149
|
-
display: flex;
|
|
150
|
-
align-items: center;
|
|
151
|
-
flex: 1;
|
|
152
|
-
overflow: hidden;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.ai-attachment-text__separator {
|
|
156
|
-
flex-shrink: 0;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.ai-attachment-text__file-name {
|
|
160
|
-
flex: 1;
|
|
161
|
-
overflow: hidden;
|
|
162
|
-
text-overflow: ellipsis;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.ai-attachment-text__file-size {
|
|
166
|
-
flex-shrink: 0;
|
|
167
|
-
margin-left: 8px;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.ai-field__input {
|
|
171
|
-
align-self: stretch;
|
|
172
|
-
overflow: hidden;
|
|
173
|
-
resize: none;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.ai-field__button {
|
|
177
|
-
display: flex;
|
|
178
|
-
width: 40px;
|
|
179
|
-
height: 40px;
|
|
180
|
-
justify-content: center;
|
|
181
|
-
align-items: center;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.ai-field__visually-hidden {
|
|
185
|
-
position: absolute;
|
|
186
|
-
width: 1px;
|
|
187
|
-
height: 1px;
|
|
188
|
-
padding: 0;
|
|
189
|
-
margin: -1px;
|
|
190
|
-
fill: transparent;
|
|
191
|
-
overflow: hidden;
|
|
192
|
-
clip: rect(0, 0, 0, 0);
|
|
193
|
-
white-space: nowrap;
|
|
194
|
-
border-width: 0;
|
|
195
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
const AIContext = React__default.createContext(undefined);
|
|
4
|
-
const useAIContext = () => {
|
|
5
|
-
const context = React__default.useContext(AIContext);
|
|
6
|
-
const [routeToConversationsMap, setRouteToConversationsMap] = React__default.useState({});
|
|
7
|
-
if (context) {
|
|
8
|
-
return context;
|
|
9
|
-
}
|
|
10
|
-
return { routeToConversationsMap, setRouteToConversationsMap };
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* @experimental
|
|
14
|
-
*/
|
|
15
|
-
const AIContextProvider = ({ children, }) => {
|
|
16
|
-
const context = useAIContext();
|
|
17
|
-
return React__default.createElement(AIContext.Provider, { value: context }, children);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { AIContext, AIContextProvider, useAIContext };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './ai-conversation-styles.css';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ConversationMessage } from '../types';
|
|
3
|
-
type ConversationToMessages = Record<string, ConversationMessage[]>;
|
|
4
|
-
export type RouteToConversations = Record<string, ConversationToMessages>;
|
|
5
|
-
interface ContextType {
|
|
6
|
-
routeToConversationsMap: RouteToConversations;
|
|
7
|
-
setRouteToConversationsMap: React.Dispatch<React.SetStateAction<RouteToConversations>>;
|
|
8
|
-
}
|
|
9
|
-
export declare const AIContext: React.Context<ContextType | undefined>;
|
|
10
|
-
export declare const useAIContext: () => ContextType;
|
|
11
|
-
/**
|
|
12
|
-
* @experimental
|
|
13
|
-
*/
|
|
14
|
-
export declare const AIContextProvider: ({ children, }: {
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
}) => React.ReactNode;
|
|
17
|
-
export {};
|