@informedai/react 0.4.10 → 0.4.11
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/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +33 -0
- package/dist/index.mjs +33 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,10 @@ interface Session {
|
|
|
13
13
|
aiConversations: Record<string, ChatMessage[]>;
|
|
14
14
|
status: 'active' | 'ended' | 'abandoned';
|
|
15
15
|
}
|
|
16
|
+
interface KbSearchInfo {
|
|
17
|
+
query: string;
|
|
18
|
+
documentNames: string[];
|
|
19
|
+
}
|
|
16
20
|
interface WidgetMessage {
|
|
17
21
|
id: string;
|
|
18
22
|
role: 'user' | 'assistant' | 'agent' | 'system';
|
|
@@ -21,6 +25,7 @@ interface WidgetMessage {
|
|
|
21
25
|
quickActions?: QuickAction[];
|
|
22
26
|
timestamp: string;
|
|
23
27
|
taskContext?: string;
|
|
28
|
+
kbSearch?: KbSearchInfo;
|
|
24
29
|
}
|
|
25
30
|
interface QuickAction {
|
|
26
31
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ interface Session {
|
|
|
13
13
|
aiConversations: Record<string, ChatMessage[]>;
|
|
14
14
|
status: 'active' | 'ended' | 'abandoned';
|
|
15
15
|
}
|
|
16
|
+
interface KbSearchInfo {
|
|
17
|
+
query: string;
|
|
18
|
+
documentNames: string[];
|
|
19
|
+
}
|
|
16
20
|
interface WidgetMessage {
|
|
17
21
|
id: string;
|
|
18
22
|
role: 'user' | 'assistant' | 'agent' | 'system';
|
|
@@ -21,6 +25,7 @@ interface WidgetMessage {
|
|
|
21
25
|
quickActions?: QuickAction[];
|
|
22
26
|
timestamp: string;
|
|
23
27
|
taskContext?: string;
|
|
28
|
+
kbSearch?: KbSearchInfo;
|
|
24
29
|
}
|
|
25
30
|
interface QuickAction {
|
|
26
31
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -1121,6 +1121,7 @@ function QuickActionButton({
|
|
|
1121
1121
|
function MessageBubble({ message, theme, onQuickAction, isLatest = false }) {
|
|
1122
1122
|
const isUser = message.role === "user";
|
|
1123
1123
|
const hasQuickActions = isLatest && message.quickActions && message.quickActions.length > 0;
|
|
1124
|
+
const hasKbSearch = message.kbSearch !== void 0;
|
|
1124
1125
|
if ((message.type === "quick_actions" || !message.content) && hasQuickActions) {
|
|
1125
1126
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: {
|
|
1126
1127
|
display: "flex",
|
|
@@ -1151,6 +1152,32 @@ function MessageBubble({ message, theme, onQuickAction, isLatest = false }) {
|
|
|
1151
1152
|
] });
|
|
1152
1153
|
}
|
|
1153
1154
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1155
|
+
hasKbSearch && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1156
|
+
"div",
|
|
1157
|
+
{
|
|
1158
|
+
style: {
|
|
1159
|
+
display: "flex",
|
|
1160
|
+
alignItems: "center",
|
|
1161
|
+
gap: "6px",
|
|
1162
|
+
padding: "4px 10px",
|
|
1163
|
+
backgroundColor: message.kbSearch.documentNames.length > 0 ? "#dbeafe" : "#f3f4f6",
|
|
1164
|
+
borderRadius: "12px",
|
|
1165
|
+
fontSize: "11px",
|
|
1166
|
+
color: message.kbSearch.documentNames.length > 0 ? "#1e40af" : "#6b7280",
|
|
1167
|
+
marginBottom: "4px",
|
|
1168
|
+
width: "fit-content"
|
|
1169
|
+
},
|
|
1170
|
+
title: message.kbSearch.documentNames.length > 0 ? `Found: ${message.kbSearch.documentNames.join(", ")}` : `Searched for: ${message.kbSearch.query}`,
|
|
1171
|
+
children: [
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BookIcon, { size: 12 }),
|
|
1173
|
+
message.kbSearch.documentNames.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
1174
|
+
"Referenced: ",
|
|
1175
|
+
message.kbSearch.documentNames.slice(0, 2).join(", "),
|
|
1176
|
+
message.kbSearch.documentNames.length > 2 && ` +${message.kbSearch.documentNames.length - 2} more`
|
|
1177
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "No matching documents found" })
|
|
1178
|
+
]
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1154
1181
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1155
1182
|
"div",
|
|
1156
1183
|
{
|
|
@@ -1223,6 +1250,12 @@ function MinimizeIcon() {
|
|
|
1223
1250
|
function ChevronRightIcon({ size = 16, color = "currentColor" }) {
|
|
1224
1251
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9 18l6-6-6-6" }) });
|
|
1225
1252
|
}
|
|
1253
|
+
function BookIcon({ size = 16, color = "currentColor" }) {
|
|
1254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1255
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 19.5A2.5 2.5 0 016.5 17H20" }),
|
|
1256
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z" })
|
|
1257
|
+
] });
|
|
1258
|
+
}
|
|
1226
1259
|
function LoadingSpinner({ size = 20 }) {
|
|
1227
1260
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1228
1261
|
"svg",
|
package/dist/index.mjs
CHANGED
|
@@ -1091,6 +1091,7 @@ function QuickActionButton({
|
|
|
1091
1091
|
function MessageBubble({ message, theme, onQuickAction, isLatest = false }) {
|
|
1092
1092
|
const isUser = message.role === "user";
|
|
1093
1093
|
const hasQuickActions = isLatest && message.quickActions && message.quickActions.length > 0;
|
|
1094
|
+
const hasKbSearch = message.kbSearch !== void 0;
|
|
1094
1095
|
if ((message.type === "quick_actions" || !message.content) && hasQuickActions) {
|
|
1095
1096
|
return /* @__PURE__ */ jsxs("div", { style: {
|
|
1096
1097
|
display: "flex",
|
|
@@ -1121,6 +1122,32 @@ function MessageBubble({ message, theme, onQuickAction, isLatest = false }) {
|
|
|
1121
1122
|
] });
|
|
1122
1123
|
}
|
|
1123
1124
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1125
|
+
hasKbSearch && /* @__PURE__ */ jsxs(
|
|
1126
|
+
"div",
|
|
1127
|
+
{
|
|
1128
|
+
style: {
|
|
1129
|
+
display: "flex",
|
|
1130
|
+
alignItems: "center",
|
|
1131
|
+
gap: "6px",
|
|
1132
|
+
padding: "4px 10px",
|
|
1133
|
+
backgroundColor: message.kbSearch.documentNames.length > 0 ? "#dbeafe" : "#f3f4f6",
|
|
1134
|
+
borderRadius: "12px",
|
|
1135
|
+
fontSize: "11px",
|
|
1136
|
+
color: message.kbSearch.documentNames.length > 0 ? "#1e40af" : "#6b7280",
|
|
1137
|
+
marginBottom: "4px",
|
|
1138
|
+
width: "fit-content"
|
|
1139
|
+
},
|
|
1140
|
+
title: message.kbSearch.documentNames.length > 0 ? `Found: ${message.kbSearch.documentNames.join(", ")}` : `Searched for: ${message.kbSearch.query}`,
|
|
1141
|
+
children: [
|
|
1142
|
+
/* @__PURE__ */ jsx2(BookIcon, { size: 12 }),
|
|
1143
|
+
message.kbSearch.documentNames.length > 0 ? /* @__PURE__ */ jsxs("span", { children: [
|
|
1144
|
+
"Referenced: ",
|
|
1145
|
+
message.kbSearch.documentNames.slice(0, 2).join(", "),
|
|
1146
|
+
message.kbSearch.documentNames.length > 2 && ` +${message.kbSearch.documentNames.length - 2} more`
|
|
1147
|
+
] }) : /* @__PURE__ */ jsx2("span", { children: "No matching documents found" })
|
|
1148
|
+
]
|
|
1149
|
+
}
|
|
1150
|
+
),
|
|
1124
1151
|
/* @__PURE__ */ jsx2(
|
|
1125
1152
|
"div",
|
|
1126
1153
|
{
|
|
@@ -1193,6 +1220,12 @@ function MinimizeIcon() {
|
|
|
1193
1220
|
function ChevronRightIcon({ size = 16, color = "currentColor" }) {
|
|
1194
1221
|
return /* @__PURE__ */ jsx2("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx2("path", { d: "M9 18l6-6-6-6" }) });
|
|
1195
1222
|
}
|
|
1223
|
+
function BookIcon({ size = 16, color = "currentColor" }) {
|
|
1224
|
+
return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1225
|
+
/* @__PURE__ */ jsx2("path", { d: "M4 19.5A2.5 2.5 0 016.5 17H20" }),
|
|
1226
|
+
/* @__PURE__ */ jsx2("path", { d: "M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z" })
|
|
1227
|
+
] });
|
|
1228
|
+
}
|
|
1196
1229
|
function LoadingSpinner({ size = 20 }) {
|
|
1197
1230
|
return /* @__PURE__ */ jsxs(
|
|
1198
1231
|
"svg",
|