@aigentyc/chat-sdk 0.5.4 → 0.5.5

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/context7.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "url": "https://context7.com/llmstxt/cdn_jsdelivr_net_npm_aigentyc_chat-sdk_0_5_0_llms_txt",
2
+ "url": "https://context7.com/llmstxt/cdn_jsdelivr_net_npm_aigentyc_chat-sdk_0_5_5_llms_txt",
3
3
  "public_key": "pk_dHiyF4hGXkgbb1jdrT7TU"
4
4
  }
@@ -85,6 +85,14 @@ interface ChatContextValue {
85
85
  * {@link ChatContextValue.newConversation}.
86
86
  */
87
87
  retryLastTurn: () => void;
88
+ /**
89
+ * Replace a sent user message with new text and answer it again.
90
+ *
91
+ * Everything after that message is dropped, as in ChatGPT's edit: the
92
+ * conversation continues from the corrected question, not alongside the old
93
+ * one. A turn still streaming is stopped first.
94
+ */
95
+ editMessage: (messageId: string, content: string) => void;
88
96
  newConversation: () => void;
89
97
  clearMessages: () => void;
90
98
  callbacks?: ChatEventCallbacks;
@@ -85,6 +85,14 @@ interface ChatContextValue {
85
85
  * {@link ChatContextValue.newConversation}.
86
86
  */
87
87
  retryLastTurn: () => void;
88
+ /**
89
+ * Replace a sent user message with new text and answer it again.
90
+ *
91
+ * Everything after that message is dropped, as in ChatGPT's edit: the
92
+ * conversation continues from the corrected question, not alongside the old
93
+ * one. A turn still streaming is stopped first.
94
+ */
95
+ editMessage: (messageId: string, content: string) => void;
88
96
  newConversation: () => void;
89
97
  clearMessages: () => void;
90
98
  callbacks?: ChatEventCallbacks;
@@ -5,8 +5,8 @@ var chunkDVWX2UGY_cjs = require('./chunk-DVWX2UGY.cjs');
5
5
  var chunkBYX6IOGX_cjs = require('./chunk-BYX6IOGX.cjs');
6
6
  var chunk7LJMBYHC_cjs = require('./chunk-7LJMBYHC.cjs');
7
7
  var chunk72QJ2ORD_cjs = require('./chunk-72QJ2ORD.cjs');
8
- var chunkJEK2V5I3_cjs = require('./chunk-JEK2V5I3.cjs');
9
- var chunkUXVOUC2A_cjs = require('./chunk-UXVOUC2A.cjs');
8
+ var chunkAQTN4QLR_cjs = require('./chunk-AQTN4QLR.cjs');
9
+ var chunkJJRLHXHZ_cjs = require('./chunk-JJRLHXHZ.cjs');
10
10
  var chunk525KS5HM_cjs = require('./chunk-525KS5HM.cjs');
11
11
  var react = require('react');
12
12
  var lucideReact = require('lucide-react');
@@ -31,7 +31,7 @@ var ChatHeader = react.memo(function ChatHeader2({
31
31
  onCartClick
32
32
  }) {
33
33
  const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
34
- const ctx = chunkUXVOUC2A_cjs.useChatContext();
34
+ const ctx = chunkJJRLHXHZ_cjs.useChatContext();
35
35
  const displayName = clientName || ctx.config.clientName || "AI Assistant";
36
36
  const LogoOrIcon = () => {
37
37
  if (logoUrl) {
@@ -970,10 +970,10 @@ function DefaultUserMessage({ text }) {
970
970
  }
971
971
  function ChatInterface(props) {
972
972
  const { showSources = false } = props;
973
- const { messages, status, error, sendMessage, sessionId, config, retryLastTurn, newConversation: ctxNewConversation } = chunkUXVOUC2A_cjs.useChatContext();
973
+ const { messages, status, error, sendMessage, sessionId, config, retryLastTurn, newConversation: ctxNewConversation } = chunkJJRLHXHZ_cjs.useChatContext();
974
974
  const { t, direction } = chunk72QJ2ORD_cjs.useI18n();
975
975
  chunkBYX6IOGX_cjs.useTheme();
976
- const slots = chunkUXVOUC2A_cjs.useSlots();
976
+ const slots = chunkJJRLHXHZ_cjs.useSlots();
977
977
  let liveChat = null;
978
978
  try {
979
979
  liveChat = chunkDVWX2UGY_cjs.useLiveChat();
@@ -1057,8 +1057,8 @@ function ChatInterface(props) {
1057
1057
  );
1058
1058
  if (showWelcome && messages.length === 0) {
1059
1059
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", dir: direction, style: { backgroundColor: "var(--ac-background)" }, children: [
1060
- !props.hideHeader && chunkUXVOUC2A_cjs.renderSlot("header", headerProps, ChatHeader, slots),
1061
- chunkUXVOUC2A_cjs.renderSlot(
1060
+ !props.hideHeader && chunkJJRLHXHZ_cjs.renderSlot("header", headerProps, ChatHeader, slots),
1061
+ chunkJJRLHXHZ_cjs.renderSlot(
1062
1062
  "welcomePage",
1063
1063
  {
1064
1064
  onSelectCategory: handleSelectCategory,
@@ -1077,18 +1077,18 @@ function ChatInterface(props) {
1077
1077
  slots
1078
1078
  ),
1079
1079
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 px-[15px] md:px-[40px]", style: { backgroundColor: "var(--ac-background)" }, children: [
1080
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto z-40 w-full", children: chunkUXVOUC2A_cjs.renderSlot(
1080
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto z-40 w-full", children: chunkJJRLHXHZ_cjs.renderSlot(
1081
1081
  "input",
1082
1082
  { value: input, onChange: setInput, onSubmit: handleSubmit, isProcessing },
1083
1083
  ChatInput,
1084
1084
  slots
1085
1085
  ) }),
1086
- chunkUXVOUC2A_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1086
+ chunkJJRLHXHZ_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1087
1087
  ] })
1088
1088
  ] });
1089
1089
  }
1090
1090
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", dir: direction, style: { backgroundColor: "var(--ac-background)" }, children: [
1091
- !props.hideHeader && chunkUXVOUC2A_cjs.renderSlot("header", headerProps, ChatHeader, slots),
1091
+ !props.hideHeader && chunkJJRLHXHZ_cjs.renderSlot("header", headerProps, ChatHeader, slots),
1092
1092
  storeOrigin && /* @__PURE__ */ jsxRuntime.jsx(
1093
1093
  CartDrawer,
1094
1094
  {
@@ -1107,11 +1107,11 @@ function ChatInterface(props) {
1107
1107
  children: [
1108
1108
  anchorLatestTurn && /* @__PURE__ */ jsxRuntime.jsx(chunk7LJMBYHC_cjs.FollowLatestTurn, { turnKey: latestUserId }),
1109
1109
  /* @__PURE__ */ jsxRuntime.jsxs(chunk7LJMBYHC_cjs.ConversationContent, { className: "px-[15px] md:px-[40px] py-6 sm:py-8 w-full space-y-6", children: [
1110
- messages.length === 0 && chunkUXVOUC2A_cjs.renderSlot("emptyState", {}, chunk7LJMBYHC_cjs.ConversationEmptyState, slots),
1110
+ messages.length === 0 && chunkJJRLHXHZ_cjs.renderSlot("emptyState", {}, chunk7LJMBYHC_cjs.ConversationEmptyState, slots),
1111
1111
  messages.map((message, messageIndex) => {
1112
1112
  if (hideFirstUserMessage && messageIndex === 0 && message.role === "user") return null;
1113
1113
  if (message.role === "system") {
1114
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkUXVOUC2A_cjs.renderSlot("systemMessage", { message: message.content }, SystemMessage, slots) }, message.id);
1114
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkJJRLHXHZ_cjs.renderSlot("systemMessage", { message: message.content }, SystemMessage, slots) }, message.id);
1115
1115
  }
1116
1116
  return /* @__PURE__ */ jsxRuntime.jsxs(
1117
1117
  "div",
@@ -1151,9 +1151,9 @@ function ChatInterface(props) {
1151
1151
  })().map((part, i) => {
1152
1152
  if (part.type === "text") {
1153
1153
  if (message.role === "assistant") {
1154
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkUXVOUC2A_cjs.renderSlot("assistantMessage", { message, partIndex: i, text: part.text || "" }, DefaultAssistantMessage, slots) }, `${message.id}-${i}`);
1154
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkJJRLHXHZ_cjs.renderSlot("assistantMessage", { message, partIndex: i, text: part.text || "" }, DefaultAssistantMessage, slots) }, `${message.id}-${i}`);
1155
1155
  }
1156
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkUXVOUC2A_cjs.renderSlot("userMessage", { message, partIndex: i, text: part.text || "" }, DefaultUserMessage, slots) }, `${message.id}-${i}`);
1156
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: chunkJJRLHXHZ_cjs.renderSlot("userMessage", { message, partIndex: i, text: part.text || "" }, DefaultUserMessage, slots) }, `${message.id}-${i}`);
1157
1157
  }
1158
1158
  if (part.type.startsWith("tool-")) {
1159
1159
  const toolName = part.type.replace("tool-", "");
@@ -1171,7 +1171,7 @@ function ChatInterface(props) {
1171
1171
  {
1172
1172
  label: `tool "${toolName}"`,
1173
1173
  children: /* @__PURE__ */ jsxRuntime.jsx(
1174
- chunkJEK2V5I3_cjs.ToolRenderer,
1174
+ chunkAQTN4QLR_cjs.ToolRenderer,
1175
1175
  {
1176
1176
  toolName,
1177
1177
  state: part.state ?? "output-available",
@@ -1202,7 +1202,7 @@ function ChatInterface(props) {
1202
1202
  )) })
1203
1203
  ] });
1204
1204
  })(),
1205
- message.role === "assistant" && chunkUXVOUC2A_cjs.renderSlot("feedback", {
1205
+ message.role === "assistant" && chunkJJRLHXHZ_cjs.renderSlot("feedback", {
1206
1206
  messageId: message.id,
1207
1207
  projectId: config.projectId,
1208
1208
  sessionId,
@@ -1224,7 +1224,7 @@ function ChatInterface(props) {
1224
1224
  const allToolsComplete = (lastMessage.parts || []).filter((p) => p.type.startsWith("tool-")).every((p) => p.state === "output-available");
1225
1225
  return allToolsComplete && !hasText;
1226
1226
  })() && /* @__PURE__ */ jsxRuntime.jsx(chunk7LJMBYHC_cjs.Loader, { text: t("thinking") }),
1227
- status === "error" && chunkUXVOUC2A_cjs.renderSlot(
1227
+ status === "error" && chunkJJRLHXHZ_cjs.renderSlot(
1228
1228
  "error",
1229
1229
  {
1230
1230
  error,
@@ -1249,7 +1249,7 @@ function ChatInterface(props) {
1249
1249
  }
1250
1250
  ),
1251
1251
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto z-40 w-full flex items-end gap-2", children: [
1252
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: chunkUXVOUC2A_cjs.renderSlot(
1252
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: chunkJJRLHXHZ_cjs.renderSlot(
1253
1253
  "input",
1254
1254
  { value: input, onChange: setInput, onSubmit: handleSubmit, isProcessing },
1255
1255
  ChatInput,
@@ -1266,7 +1266,7 @@ function ChatInterface(props) {
1266
1266
  }
1267
1267
  )
1268
1268
  ] }),
1269
- chunkUXVOUC2A_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1269
+ chunkJJRLHXHZ_cjs.renderSlot("footer", { footerText: props.footerText }, ChatFooter, slots)
1270
1270
  ] }),
1271
1271
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-session-id": sessionId, className: "hidden" })
1272
1272
  ] });
@@ -1949,5 +1949,5 @@ exports.QuickQuestions = QuickQuestions;
1949
1949
  exports.SystemMessage = SystemMessage;
1950
1950
  exports.WelcomePage = WelcomePage;
1951
1951
  exports.panelMaxWidth = panelMaxWidth;
1952
- //# sourceMappingURL=chunk-CPWM6NNE.cjs.map
1953
- //# sourceMappingURL=chunk-CPWM6NNE.cjs.map
1952
+ //# sourceMappingURL=chunk-7MHR4BSJ.cjs.map
1953
+ //# sourceMappingURL=chunk-7MHR4BSJ.cjs.map