@nexface/chat 0.1.18 → 0.1.19

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.
@@ -29515,7 +29515,7 @@ function EditComposer({
29515
29515
  className: cn(
29516
29516
  "bg-primary text-primary-foreground rounded-control h-8 px-3 text-[13px] font-medium transition-opacity disabled:opacity-40"
29517
29517
  ),
29518
- children: "\u4FDD\u5B58\u5E76\u91CD\u65B0\u53D1\u9001"
29518
+ children: "\u53D1\u9001"
29519
29519
  }
29520
29520
  ) })
29521
29521
  ] })
@@ -46887,7 +46887,6 @@ function Chat({
46887
46887
  onRunResult?.(chat.completed.result);
46888
46888
  }, [chat.completed, chat.consumeCompletion, onRunResult]);
46889
46889
  useLayoutEffect14(() => {
46890
- dialog?.cancel?.();
46891
46890
  setNotice("");
46892
46891
  setDialog(void 0);
46893
46892
  setEditing(void 0);
@@ -46915,34 +46914,17 @@ function Chat({
46915
46914
  if (submitting.current === submission) submitting.current = void 0;
46916
46915
  }
46917
46916
  };
46918
- const editThroughRuntime = (sourceId, text7) => new Promise((resolve, reject) => {
46917
+ const editThroughRuntime = async (sourceId, text7) => {
46919
46918
  const files = editing?.id === sourceId ? editing.files : messages.find((message) => message.id === sourceId)?.attachments ?? [];
46920
- const perform = () => {
46921
- setNotice("");
46922
- void chat.sendMessage(text7, files, sourceId).then(
46923
- () => {
46924
- setEditing(void 0);
46925
- resolve();
46926
- },
46927
- (error) => {
46928
- setNotice(sendErrorNotice(error));
46929
- reject(error);
46930
- }
46931
- );
46932
- };
46933
- const index5 = messages.findIndex((message) => message.id === sourceId);
46934
- const hasOperations = messages.slice(index5 + 1).some(
46935
- (message) => message.parts.some((part) => part.type === "tool" && part.result !== void 0)
46936
- );
46937
- if (hasOperations)
46938
- setDialog({
46939
- title: "\u4FDD\u5B58\u5E76\u91CD\u65B0\u53D1\u9001\uFF1F",
46940
- description: "\u4FEE\u6539\u540E\u5C06\u91CD\u65B0\u751F\u6210\u56DE\u7B54\u3002\u6B64\u524D\u5DF2\u6267\u884C\u7684\u4E1A\u52A1\u64CD\u4F5C\u4E0D\u4F1A\u64A4\u9500\uFF0C\u91CD\u65B0\u53D1\u9001\u53EF\u80FD\u91CD\u590D\u6267\u884C\u3002",
46941
- action: perform,
46942
- cancel: () => reject(new Error("Resending was cancelled."))
46943
- });
46944
- else perform();
46945
- });
46919
+ setNotice("");
46920
+ try {
46921
+ await chat.sendMessage(text7, files, sourceId);
46922
+ setEditing(void 0);
46923
+ } catch (error) {
46924
+ setNotice(sendErrorNotice(error));
46925
+ throw error;
46926
+ }
46927
+ };
46946
46928
  return /* @__PURE__ */ jsx98(Fragment16, { children: chat.sessions.filter((session) => visited.current.has(session.id)).map((session) => /* @__PURE__ */ jsx98(
46947
46929
  SessionRuntime,
46948
46930
  {
@@ -47410,7 +47392,6 @@ function Chat({
47410
47392
  open: Boolean(dialog),
47411
47393
  onOpenChange: (next) => {
47412
47394
  if (!next) {
47413
- dialog?.cancel?.();
47414
47395
  setDialog(void 0);
47415
47396
  }
47416
47397
  },
@@ -47437,7 +47418,6 @@ function Chat({
47437
47418
  variant: "outline",
47438
47419
  autoFocus: true,
47439
47420
  onClick: () => {
47440
- dialog?.cancel?.();
47441
47421
  setDialog(void 0);
47442
47422
  },
47443
47423
  children: "\u53D6\u6D88"
@@ -11,5 +11,5 @@ export function Composer({ children, inputProps, actions, ...props }) {
11
11
  }, children: _jsxs("div", { "data-slot": "aui_composer-shell", className: cn("border-foreground/10 bg-muted/30 focus-within:border-foreground/25 data-[dragging=true]:border-foreground/40 rounded-thread flex flex-col border transition-colors data-[dragging=true]:border-dashed"), children: [_jsx("div", { className: cn("has-[.aui-attachment-root]:px-3 has-[.aui-attachment-root]:pt-3"), children: children }), _jsx(ComposerPrimitive.Input, { asChild: true, ...inputProps, children: _jsx("textarea", { "data-composer-input": true, rows: 1, className: cn("placeholder:text-muted-foreground field-sizing-content block max-h-48 w-full resize-none bg-transparent px-4 pt-3 pb-2 text-base leading-6 focus:outline-none") }) }), _jsx("div", { className: cn("flex items-center justify-between gap-2 px-2 pb-2"), children: actions })] }) }) }));
12
12
  }
13
13
  export function EditComposer({ children, inputProps, cancelProps, sendProps, ...props }) {
14
- return (_jsx(MessagePrimitive.Root, { "data-role": "user", "data-slot": "aui_edit-composer-wrapper", className: cn("mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end"), children: _jsxs(ComposerPrimitive.Root, { className: cn("border-foreground/10 bg-muted/30 focus-within:border-foreground/25 rounded-thread flex w-full max-w-[85%] flex-col border transition-colors"), ...props, children: [_jsx(ComposerPrimitive.Input, { asChild: true, ...inputProps, children: _jsx("textarea", { autoFocus: true, rows: 1, className: cn("field-sizing-content max-h-48 min-h-12 w-full resize-none bg-transparent px-4 pt-3.5 pb-1 text-[15px] leading-6 focus:outline-none") }) }), children, _jsxs("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [_jsx(ComposerPrimitive.Cancel, { asChild: true, children: _jsx("button", { type: "button", ...cancelProps, className: cn("text-muted-foreground hover:text-foreground rounded-control h-8 px-3 text-[13px] transition-colors"), children: "\u53D6\u6D88" }) }), _jsx(ComposerPrimitive.Send, { asChild: true, children: _jsx("button", { type: "button", ...sendProps, className: cn("bg-primary text-primary-foreground rounded-control h-8 px-3 text-[13px] font-medium transition-opacity disabled:opacity-40"), children: "\u4FDD\u5B58\u5E76\u91CD\u65B0\u53D1\u9001" }) })] })] }) }));
14
+ return (_jsx(MessagePrimitive.Root, { "data-role": "user", "data-slot": "aui_edit-composer-wrapper", className: cn("mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end"), children: _jsxs(ComposerPrimitive.Root, { className: cn("border-foreground/10 bg-muted/30 focus-within:border-foreground/25 rounded-thread flex w-full max-w-[85%] flex-col border transition-colors"), ...props, children: [_jsx(ComposerPrimitive.Input, { asChild: true, ...inputProps, children: _jsx("textarea", { autoFocus: true, rows: 1, className: cn("field-sizing-content max-h-48 min-h-12 w-full resize-none bg-transparent px-4 pt-3.5 pb-1 text-[15px] leading-6 focus:outline-none") }) }), children, _jsxs("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [_jsx(ComposerPrimitive.Cancel, { asChild: true, children: _jsx("button", { type: "button", ...cancelProps, className: cn("text-muted-foreground hover:text-foreground rounded-control h-8 px-3 text-[13px] transition-colors"), children: "\u53D6\u6D88" }) }), _jsx(ComposerPrimitive.Send, { asChild: true, children: _jsx("button", { type: "button", ...sendProps, className: cn("bg-primary text-primary-foreground rounded-control h-8 px-3 text-[13px] font-medium transition-opacity disabled:opacity-40"), children: "\u53D1\u9001" }) })] })] }) }));
15
15
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@nexface/chat",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
+ "types": "./dist/index.d.ts",
5
6
  "sideEffects": [
6
7
  "./dist/index.js",
7
8
  "**/*.css"
@@ -18,7 +19,7 @@
18
19
  },
19
20
  "dependencies": {
20
21
  "@ag-ui/core": "0.0.59",
21
- "@nexface/agent": "0.1.18",
22
+ "@nexface/agent": "0.1.19",
22
23
  "class-variance-authority": "0.7.1",
23
24
  "clsx": "2.1.1",
24
25
  "fast-json-patch": "3.1.1",
@@ -27,7 +28,7 @@
27
28
  "use-sync-external-store": "1.7.0"
28
29
  },
29
30
  "peerDependencies": {
30
- "@nexface/tools": "0.1.18",
31
+ "@nexface/tools": "0.1.19",
31
32
  "react": ">=17",
32
33
  "react-dom": ">=17"
33
34
  },