@agentscope-ai/chat 1.1.8 → 1.1.10

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 (53) hide show
  1. package/lib/Accordion/Accordion.js +5 -3
  2. package/lib/Accordion/DeepThinking.js +1 -1
  3. package/lib/Accordion/SoftLightTitle.js +1 -1
  4. package/lib/Accordion/style.js +1 -3
  5. package/lib/ChatAnywhere/Input/index.js +3 -0
  6. package/lib/ChatAnywhere/hooks/types.d.ts +10 -0
  7. package/lib/DefaultCards/DeepThinking/index.d.ts +2 -0
  8. package/lib/DefaultCards/Images/index.js +3 -1
  9. package/lib/DefaultCards/Text/index.js +10 -9
  10. package/lib/DeviceAction/index.d.ts +33 -0
  11. package/lib/DeviceAction/index.js +77 -0
  12. package/lib/ImageGenerator/index.d.ts +12 -0
  13. package/lib/ImageGenerator/index.js +23 -12
  14. package/lib/ImageGenerator/style.js +3 -1
  15. package/lib/Markdown/CodeBlock.js +1 -1
  16. package/lib/Markdown/ImageOrMedia.js +5 -2
  17. package/lib/Markdown/Link.js +3 -3
  18. package/lib/Markdown/Markdown.js +5 -7
  19. package/lib/Markdown/index.js +6 -3
  20. package/lib/Markdown/style.js +1 -1
  21. package/lib/Markdown/useTyping.d.ts +4 -0
  22. package/lib/Markdown/useTyping.js +32 -0
  23. package/lib/Mermaid/index.js +29 -25
  24. package/lib/OperateCard/OperateCard.d.ts +31 -0
  25. package/lib/OperateCard/OperateCard.js +74 -0
  26. package/lib/OperateCard/index.d.ts +1 -0
  27. package/lib/OperateCard/index.js +1 -0
  28. package/lib/OperateCard/preset/Rag.d.ts +26 -0
  29. package/lib/OperateCard/preset/Rag.js +47 -0
  30. package/lib/OperateCard/preset/Thinking.d.ts +21 -0
  31. package/lib/OperateCard/preset/Thinking.js +24 -0
  32. package/lib/OperateCard/preset/TodoList.d.ts +24 -0
  33. package/lib/OperateCard/preset/TodoList.js +53 -0
  34. package/lib/OperateCard/preset/ToolCall.d.ts +27 -0
  35. package/lib/OperateCard/preset/ToolCall.js +44 -0
  36. package/lib/OperateCard/preset/WebSearch.d.ts +26 -0
  37. package/lib/OperateCard/preset/WebSearch.js +48 -0
  38. package/lib/OperateCard/preset/index.d.ts +5 -0
  39. package/lib/OperateCard/preset/index.js +5 -0
  40. package/lib/OperateCard/style.d.ts +2 -0
  41. package/lib/OperateCard/style.js +54 -0
  42. package/lib/Sender/ModeSelect/index.d.ts +1 -0
  43. package/lib/Sender/ModeSelect/index.js +4 -3
  44. package/lib/Sender/index.js +0 -1
  45. package/lib/index.d.ts +3 -1
  46. package/lib/index.js +4 -2
  47. package/package.json +3 -4
  48. package/lib/DefaultCards/count/index.d.ts +0 -1
  49. package/lib/DefaultCards/count/index.js +0 -36
  50. package/lib/Markdown/hooks/index.d.ts +0 -0
  51. package/lib/Markdown/hooks/index.js +0 -0
  52. package/lib/Markdown/hooks/useTypedEffect.d.ts +0 -6
  53. package/lib/Markdown/hooks/useTypedEffect.js +0 -56
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ export interface IOperateCardProps {
3
+ /**
4
+ * @description 头部配置
5
+ * @descriptionEn Header Config
6
+ * @default {}
7
+ */
8
+ header: {
9
+ className?: string;
10
+ style?: React.CSSProperties;
11
+ icon: React.ReactNode;
12
+ title: React.ReactNode | string;
13
+ description?: React.ReactNode | string;
14
+ };
15
+ /**
16
+ * @description 内容配置
17
+ * @descriptionEn Body Config
18
+ * @default {}
19
+ */
20
+ body?: {
21
+ children?: React.ReactNode;
22
+ defaultOpen?: boolean;
23
+ };
24
+ }
25
+ declare function OperateCard(props: IOperateCardProps): import("react/jsx-runtime").JSX.Element;
26
+ declare namespace OperateCard {
27
+ var LineBody: (props: {
28
+ children?: import("react").ReactNode;
29
+ }) => import("react/jsx-runtime").JSX.Element;
30
+ }
31
+ export default OperateCard;
@@ -0,0 +1,74 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { useState } from 'react';
12
+ import { useProviderContext } from "../Provider";
13
+ import useStyle from "./style";
14
+ import classNames from 'classnames';
15
+ import { SparkDownLine, SparkUpLine } from '@agentscope-ai/icons';
16
+ import { IconButton } from '@ali/agentscope-ai-design';
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { Fragment as _Fragment } from "react/jsx-runtime";
19
+ import { jsxs as _jsxs } from "react/jsx-runtime";
20
+ function LineBody(props) {
21
+ var _useProviderContext = useProviderContext(),
22
+ getPrefixCls = _useProviderContext.getPrefixCls;
23
+ var prefixCls = getPrefixCls('operate-card');
24
+ return /*#__PURE__*/_jsx(_Fragment, {
25
+ children: /*#__PURE__*/_jsx("div", {
26
+ className: "".concat(prefixCls, "-line-body"),
27
+ children: props.children
28
+ })
29
+ });
30
+ }
31
+ function OperateCard(props) {
32
+ var _props$body;
33
+ var _useProviderContext2 = useProviderContext(),
34
+ getPrefixCls = _useProviderContext2.getPrefixCls;
35
+ var prefixCls = getPrefixCls('operate-card');
36
+ var Style = useStyle();
37
+ var _useState = useState(((_props$body = props.body) === null || _props$body === void 0 ? void 0 : _props$body.defaultOpen) || false),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ open = _useState2[0],
40
+ setOpen = _useState2[1];
41
+ return /*#__PURE__*/_jsxs(_Fragment, {
42
+ children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsxs("div", {
43
+ className: prefixCls,
44
+ children: [/*#__PURE__*/_jsxs("div", {
45
+ className: classNames("".concat(prefixCls, "-header"), props.header.className, _defineProperty({}, "".concat(prefixCls, "-header-has-body"), props.body)),
46
+ onClick: function onClick() {
47
+ if (props.body) {
48
+ setOpen(!open);
49
+ }
50
+ },
51
+ children: [/*#__PURE__*/_jsx("div", {
52
+ className: "".concat(prefixCls, "-header-icon"),
53
+ children: props.header.icon
54
+ }), typeof props.header.title === 'string' ? /*#__PURE__*/_jsx("div", {
55
+ className: "".concat(prefixCls, "-header-title"),
56
+ children: props.header.title
57
+ }) : props.header.title, props.header.description && /*#__PURE__*/_jsx("div", {
58
+ className: "".concat(prefixCls, "-header-description"),
59
+ children: props.header.description
60
+ }), props.body && /*#__PURE__*/_jsx(IconButton, {
61
+ size: "small",
62
+ bordered: false,
63
+ className: "".concat(prefixCls, "-header-arrow"),
64
+ icon: open ? /*#__PURE__*/_jsx(SparkUpLine, {}) : /*#__PURE__*/_jsx(SparkDownLine, {})
65
+ })]
66
+ }), props.body && open && /*#__PURE__*/_jsx("div", {
67
+ className: "".concat(prefixCls, "-body"),
68
+ children: props.body.children
69
+ })]
70
+ })]
71
+ });
72
+ }
73
+ OperateCard.LineBody = LineBody;
74
+ export default OperateCard;
@@ -0,0 +1 @@
1
+ export { default, type IOperateCardProps } from './OperateCard';
@@ -0,0 +1 @@
1
+ export { default } from "./OperateCard";
@@ -0,0 +1,26 @@
1
+ export interface IRagProps {
2
+ /**
3
+ * @description 标题
4
+ * @descriptionEn Title
5
+ * @default '知识库检索'
6
+ */
7
+ title?: string;
8
+ /**
9
+ * @description 副标题
10
+ * @descriptionEn Subtitle
11
+ * @default ''
12
+ */
13
+ subTitle?: string;
14
+ /**
15
+ * @description 召回知识列表
16
+ * @descriptionEn RAG List
17
+ * @default []
18
+ */
19
+ list: {
20
+ title: string;
21
+ content: string;
22
+ footer: string;
23
+ link?: string;
24
+ }[];
25
+ }
26
+ export default function (props: IRagProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { OperateCard, useProviderContext } from "../..";
2
+ import { SparkBookLine } from '@agentscope-ai/icons';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ export default function (props) {
6
+ var _useProviderContext = useProviderContext(),
7
+ getPrefixCls = _useProviderContext.getPrefixCls;
8
+ var prefixCls = getPrefixCls('operate-card');
9
+ var _props$title = props.title,
10
+ title = _props$title === void 0 ? '知识库检索' : _props$title,
11
+ subTitle = props.subTitle;
12
+ return /*#__PURE__*/_jsx(OperateCard, {
13
+ header: {
14
+ icon: /*#__PURE__*/_jsx(SparkBookLine, {}),
15
+ title: title,
16
+ description: subTitle
17
+ },
18
+ body: {
19
+ defaultOpen: true,
20
+ children: /*#__PURE__*/_jsx(OperateCard.LineBody, {
21
+ children: props.list.map(function (item, index) {
22
+ return /*#__PURE__*/_jsxs("div", {
23
+ className: "".concat(prefixCls, "-rag-item"),
24
+ children: [/*#__PURE__*/_jsx("div", {
25
+ className: "".concat(prefixCls, "-rag-item-title"),
26
+ children: item.title
27
+ }), /*#__PURE__*/_jsxs("div", {
28
+ className: "".concat(prefixCls, "-rag-item-content"),
29
+ children: [item.content, item.link ? /*#__PURE__*/_jsx("a", {
30
+ onClick: function onClick() {
31
+ window.open(item.link, '_blank');
32
+ },
33
+ className: "".concat(prefixCls, "-rag-item-footer"),
34
+ href: item.link,
35
+ target: "_blank",
36
+ children: item.footer
37
+ }) : /*#__PURE__*/_jsx("div", {
38
+ className: "".concat(prefixCls, "-rag-item-footer"),
39
+ children: item.footer
40
+ })]
41
+ })]
42
+ }, index);
43
+ })
44
+ })
45
+ }
46
+ });
47
+ }
@@ -0,0 +1,21 @@
1
+ export interface IThinkingProps {
2
+ /**
3
+ * @description 标题
4
+ * @descriptionEn Title
5
+ * @default ''
6
+ */
7
+ title: string;
8
+ /**
9
+ * @description 副标题
10
+ * @descriptionEn Subtitle
11
+ * @default ''
12
+ */
13
+ subTitle?: string;
14
+ /**
15
+ * @description 思考内容
16
+ * @descriptionEn Thinking Content
17
+ * @default ''
18
+ */
19
+ content: string;
20
+ }
21
+ export default function (props: IThinkingProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { OperateCard, useProviderContext } from "../..";
2
+ import { SparkMemoryLine } from '@agentscope-ai/icons';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function (props) {
5
+ var _useProviderContext = useProviderContext(),
6
+ getPrefixCls = _useProviderContext.getPrefixCls;
7
+ var prefixCls = getPrefixCls('operate-card');
8
+ return /*#__PURE__*/_jsx(OperateCard, {
9
+ header: {
10
+ icon: /*#__PURE__*/_jsx(SparkMemoryLine, {}),
11
+ title: props.title,
12
+ description: props.subTitle
13
+ },
14
+ body: {
15
+ defaultOpen: true,
16
+ children: /*#__PURE__*/_jsx(OperateCard.LineBody, {
17
+ children: /*#__PURE__*/_jsx("div", {
18
+ className: "".concat(prefixCls, "-thinking"),
19
+ children: props.content
20
+ })
21
+ })
22
+ }
23
+ });
24
+ }
@@ -0,0 +1,24 @@
1
+ export interface ITodoListProps {
2
+ /**
3
+ * @description 标题
4
+ * @descriptionEn Title
5
+ * @default 'Task List'
6
+ */
7
+ title?: string;
8
+ /**
9
+ * @description 默认展开
10
+ * @descriptionEn Default Open
11
+ * @default false
12
+ */
13
+ defaultOpen?: boolean;
14
+ /**
15
+ * @description Todo 列表
16
+ * @descriptionEn Todo List
17
+ * @default []
18
+ */
19
+ list: {
20
+ title: string;
21
+ status: 'done' | 'todo' | 'running';
22
+ }[];
23
+ }
24
+ export default function (props: ITodoListProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,53 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { OperateCard, useProviderContext } from "../..";
6
+ import { SparkCheckCircleLine, SparkLoadingLine, SparkProjectNoLine } from '@agentscope-ai/icons';
7
+ import classNames from 'classnames';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ export default function (props) {
11
+ var _useProviderContext = useProviderContext(),
12
+ getPrefixCls = _useProviderContext.getPrefixCls;
13
+ var prefixCls = getPrefixCls('operate-card');
14
+ var _props$title = props.title,
15
+ title = _props$title === void 0 ? 'Task List' : _props$title;
16
+ var doneCount = props.list.filter(function (item) {
17
+ return item.status === 'done';
18
+ }).length;
19
+ return /*#__PURE__*/_jsx(OperateCard, {
20
+ header: {
21
+ icon: /*#__PURE__*/_jsx(SparkProjectNoLine, {}),
22
+ title: title,
23
+ description: "\xB7 ".concat(doneCount ? doneCount + ' of ' : '', " ").concat(props.list.length)
24
+ },
25
+ body: {
26
+ defaultOpen: props.defaultOpen,
27
+ children: /*#__PURE__*/_jsx("div", {
28
+ className: "".concat(prefixCls, "-todo-list"),
29
+ children: props.list.map(function (item) {
30
+ return /*#__PURE__*/_jsxs("div", {
31
+ className: classNames(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-todo-list-item"), true), "".concat(prefixCls, "-todo-list-item-").concat(item.status), true)),
32
+ children: [/*#__PURE__*/_jsx("div", {
33
+ className: "".concat(prefixCls, "-todo-list-item-icon"),
34
+ children: {
35
+ 'done': /*#__PURE__*/_jsx(SparkCheckCircleLine, {}),
36
+ 'todo': /*#__PURE__*/_jsx(SparkCheckCircleLine, {}),
37
+ 'running': /*#__PURE__*/_jsx(SparkLoadingLine, {
38
+ spin: true
39
+ })
40
+ }[item.status]
41
+ }), /*#__PURE__*/_jsx("div", {
42
+ className: "".concat(prefixCls, "-todo-list-item-title"),
43
+ style: {
44
+ textDecoration: item.status === 'done' ? 'line-through' : 'none'
45
+ },
46
+ children: item.title
47
+ })]
48
+ }, item.title);
49
+ })
50
+ })
51
+ }
52
+ });
53
+ }
@@ -0,0 +1,27 @@
1
+ export interface IToolCallProps {
2
+ /**
3
+ * @description 标题
4
+ * @descriptionEn Title
5
+ * @default 'Call Tool'
6
+ */
7
+ title?: string;
8
+ /**
9
+ * @description 副标题
10
+ * @descriptionEn Subtitle
11
+ * @default ''
12
+ */
13
+ subTitle?: string;
14
+ /**
15
+ * @description 工具调用入参
16
+ * @descriptionEn Tool Call Input
17
+ * @default ''
18
+ */
19
+ input: string | Record<string, any>;
20
+ /**
21
+ * @description 工具调用输出
22
+ * @descriptionEn Tool Call Output
23
+ * @default ''
24
+ */
25
+ output: string | Record<string, any>;
26
+ }
27
+ export default function (props: IToolCallProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { OperateCard, useProviderContext } from "../..";
2
+ import { SparkToolLine } from '@agentscope-ai/icons';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ function Block(props) {
6
+ var _useProviderContext = useProviderContext(),
7
+ getPrefixCls = _useProviderContext.getPrefixCls;
8
+ var prefixCls = getPrefixCls('operate-card');
9
+ var contentString = typeof props.content === 'string' ? props.content : JSON.stringify(props.content, null, 2);
10
+ return /*#__PURE__*/_jsxs("div", {
11
+ className: "".concat(prefixCls, "-tool-call-block"),
12
+ children: [/*#__PURE__*/_jsx("div", {
13
+ className: "".concat(prefixCls, "-tool-call-block-title"),
14
+ children: props.title
15
+ }), /*#__PURE__*/_jsx("div", {
16
+ className: "".concat(prefixCls, "-tool-call-block-content"),
17
+ children: contentString
18
+ })]
19
+ });
20
+ }
21
+ export default function (props) {
22
+ var _props$title = props.title,
23
+ title = _props$title === void 0 ? 'Call Tool' : _props$title,
24
+ subTitle = props.subTitle;
25
+ return /*#__PURE__*/_jsx(OperateCard, {
26
+ header: {
27
+ icon: /*#__PURE__*/_jsx(SparkToolLine, {}),
28
+ title: title,
29
+ description: subTitle
30
+ },
31
+ body: {
32
+ defaultOpen: true,
33
+ children: /*#__PURE__*/_jsxs(OperateCard.LineBody, {
34
+ children: [/*#__PURE__*/_jsx(Block, {
35
+ title: "Parameters",
36
+ content: props.input
37
+ }), /*#__PURE__*/_jsx(Block, {
38
+ title: "Result",
39
+ content: props.output
40
+ })]
41
+ })
42
+ }
43
+ });
44
+ }
@@ -0,0 +1,26 @@
1
+ export interface IWebSearchProps {
2
+ /**
3
+ * @description 标题
4
+ * @descriptionEn Title
5
+ * @default '联网搜索'
6
+ */
7
+ title?: string;
8
+ /**
9
+ * @description 副标题
10
+ * @descriptionEn Subtitle
11
+ * @default ''
12
+ */
13
+ subTitle?: string;
14
+ /**
15
+ * @description 列表
16
+ * @descriptionEn List
17
+ * @default []
18
+ */
19
+ list: {
20
+ title: string;
21
+ subTitle?: string;
22
+ link: string;
23
+ icon: string;
24
+ }[];
25
+ }
26
+ export default function (props: IWebSearchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { OperateCard, useProviderContext } from "../..";
6
+ import { SparkSearchLine } from '@agentscope-ai/icons';
7
+ import classNames from 'classnames';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ export default function (props) {
11
+ var _useProviderContext = useProviderContext(),
12
+ getPrefixCls = _useProviderContext.getPrefixCls;
13
+ var prefixCls = getPrefixCls('operate-card');
14
+ var _props$title = props.title,
15
+ title = _props$title === void 0 ? '联网搜索' : _props$title,
16
+ subTitle = props.subTitle;
17
+ return /*#__PURE__*/_jsx(OperateCard, {
18
+ header: {
19
+ icon: /*#__PURE__*/_jsx(SparkSearchLine, {}),
20
+ title: title,
21
+ description: subTitle
22
+ },
23
+ body: {
24
+ defaultOpen: true,
25
+ children: /*#__PURE__*/_jsx(OperateCard.LineBody, {
26
+ children: props.list.map(function (item) {
27
+ return /*#__PURE__*/_jsxs("div", {
28
+ className: classNames(_defineProperty({}, "".concat(prefixCls, "-web-search-item"), true)),
29
+ onClick: function onClick() {
30
+ window.open(item.link, '_blank');
31
+ },
32
+ children: [/*#__PURE__*/_jsx("img", {
33
+ className: "".concat(prefixCls, "-web-search-item-icon"),
34
+ src: item.icon,
35
+ alt: item.title
36
+ }), /*#__PURE__*/_jsx("div", {
37
+ className: "".concat(prefixCls, "-web-search-item-title"),
38
+ children: item.title
39
+ }), item.subTitle && /*#__PURE__*/_jsx("div", {
40
+ className: "".concat(prefixCls, "-web-search-item-subTitle"),
41
+ children: item.subTitle
42
+ })]
43
+ }, item.title);
44
+ })
45
+ })
46
+ }
47
+ });
48
+ }
@@ -0,0 +1,5 @@
1
+ export { default as Thinking, type IThinkingProps } from './Thinking';
2
+ export { default as TodoList, type ITodoListProps } from './TodoList';
3
+ export { default as ToolCall, type IToolCallProps } from './ToolCall';
4
+ export { default as WebSearch, type IWebSearchProps } from './WebSearch';
5
+ export { default as Rag, type IRagProps } from './Rag';
@@ -0,0 +1,5 @@
1
+ export { default as Thinking } from "./Thinking";
2
+ export { default as TodoList } from "./TodoList";
3
+ export { default as ToolCall } from "./ToolCall";
4
+ export { default as WebSearch } from "./WebSearch";
5
+ export { default as Rag } from "./Rag";
@@ -0,0 +1,2 @@
1
+ declare const _default: () => () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,54 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import { createGlobalStyle } from "./..";
4
+ export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-operate-card {\n border-radius: ", "px;\n overflow: hidden;\n background-color: ", ";\n\n &-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 0 12px;\n height: 32px;\n\n &-icon {\n font-size: 16px;\n }\n\n &-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 13px;\n font-weight: 500;\n color: ", ";\n }\n\n &-description {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 12px;\n color: ", ";\n }\n\n &-arrow {\n margin: 0 0 0 auto;\n }\n\n &-has-body {\n cursor: pointer;\n }\n }\n\n &-body {\n opacity: 0;\n animation: ", "-operate-card-body-open 0.2s ease-in-out forwards;\n \n @keyframes ", "-operate-card-body-open {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n \n }\n\n\n &-line-body {\n margin: 0 12px 12px 20px;\n border-left: 1px solid ", ";\n }\n\n &-thinking {\n padding-left: 16px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n opacity: 0.85;\n white-space: pre-wrap;\n }\n\n\n &-todo-list {\n\n &-item {\n height: 32px;\n display: flex;\n align-items: center;\n padding: 0 12px;\n gap: 8px;\n \n color: ", ";\n\n\n &-done {\n color: ", ";\n }\n\n &-icon {\n font-size: 16px;\n }\n\n &-title {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-size: 12px;\n }\n\n &-done {\n \n }\n\n }\n \n }\n\n\n &-web-search-item {\n display: flex;\n height: 32px;\n align-items: center;\n padding: 0 12px;\n gap: 8px;\n color: ", ";\n cursor: pointer;\n\n &-icon {\n display: block;\n width: 16px;\n height: 16px;\n border: 1px solid ", ";\n border-radius: 99px;\n }\n\n &-title {\n font-size: 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n\n &:hover {\n color: ", ";\n \n }\n\n }\n\n &-subTitle {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-left: 1px solid ", ";\n font-size: 12px;\n line-height: 1;\n color: ", ";\n padding-left: 8px;\n margin-left: 4px;\n }\n\n }\n\n\n &-tool-call-block {\n margin-left: 16px;\n \n &-title {\n font-size: 12px;\n color: ", ";\n line-height: 20px;\n margin-bottom: 4px;\n }\n\n &-content {\n font-size: 12px;\n line-height: 20px;\n font-family: ", ";\n border-radius: 6px;\n padding: 8px;\n background-color: ", ";\n white-space: pre-wrap;\n }\n }\n\n &-tool-call-block ~ &-tool-call-block {\n margin-top: 8px;\n }\n\n\n &-device-action {\n height: 44px;\n\n &-time {\n margin-bottom: 4px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n }\n\n &-content {\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n &-image {\n height: 32px;\n margin-left: 8px;\n display: block;\n border-radius: 6px;\n overflow: hidden;\n border: 1px solid ", ";\n }\n\n\n &-description {\n display: flex;\n gap: 4px;\n flex: 1;\n width: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n }\n\n &-rag-item {\n margin-left: 16px;\n\n &-title {\n font-size: 12px;\n color: ", ";\n line-height: 20px;\n margin-bottom: 4px;\n }\n\n &-content {\n padding: 8px;\n border-radius: 6px;\n background-color: ", ";\n font-size: 12px;\n line-height: 20px;\n }\n\n &-footer {\n display: block;\n margin-top: 8px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n }\n\n }\n\n &-rag-item ~ &-rag-item {\n margin-top: 8px;\n }\n}\n"])), function (p) {
5
+ return p.prefix;
6
+ }, function (p) {
7
+ return p.theme.borderRadiusLG;
8
+ }, function (p) {
9
+ return p.theme.colorFillTertiary;
10
+ }, function (p) {
11
+ return p.theme.colorText;
12
+ }, function (p) {
13
+ return p.theme.colorTextTertiary;
14
+ }, function (p) {
15
+ return p.prefix;
16
+ }, function (p) {
17
+ return p.prefix;
18
+ }, function (p) {
19
+ return p.theme.colorBorderSecondary;
20
+ }, function (p) {
21
+ return p.theme.colorTextTertiary;
22
+ }, function (p) {
23
+ return p.theme.colorText;
24
+ }, function (p) {
25
+ return p.theme.colorTextTertiary;
26
+ }, function (p) {
27
+ return p.theme.colorText;
28
+ }, function (p) {
29
+ return p.theme.colorBorderSecondary;
30
+ }, function (p) {
31
+ return p.theme.colorTextSecondary;
32
+ }, function (p) {
33
+ return p.theme.colorText;
34
+ }, function (p) {
35
+ return p.theme.colorBorderSecondary;
36
+ }, function (p) {
37
+ return p.theme.colorTextTertiary;
38
+ }, function (p) {
39
+ return p.theme.colorText;
40
+ }, function (p) {
41
+ return p.theme.fontFamilyCode;
42
+ }, function (p) {
43
+ return p.theme.colorFillTertiary;
44
+ }, function (p) {
45
+ return p.theme.colorTextSecondary;
46
+ }, function (p) {
47
+ return p.theme.colorBorderSecondary;
48
+ }, function (p) {
49
+ return p.theme.colorText;
50
+ }, function (p) {
51
+ return p.theme.colorFillTertiary;
52
+ }, function (p) {
53
+ return p.theme.colorTextTertiary;
54
+ });
@@ -2,6 +2,7 @@ import React from "react";
2
2
  interface IItem {
3
3
  icon: string | React.ReactNode;
4
4
  label: string | React.ReactNode;
5
+ selectedLabel?: string | React.ReactNode;
5
6
  tooltip?: string | React.ReactNode;
6
7
  value: string;
7
8
  }
@@ -13,7 +13,7 @@ import { Tooltip } from "@agentscope-ai/design";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
16
- var useStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-sender-mode-select {\n position: relative;\n height: 40px;\n\n &-options {\n position: absolute;\n top: 4px;\n left: 0;\n right: 0;\n display: flex;\n gap: 8px;\n transition: all 0.3s;\n }\n\n &-option {\n height: 28px;\n display: flex;\n align-items: center;\n fonts: 14px;\n padding: 0 8px;\n border-radius: ", "px;\n gap: 4px;\n border: 1px solid ", ";\n cursor: pointer;\n color: ", ";\n transition: all 0.3s;\n\n &:hover {\n border-color: ", ";\n color: ", ";\n }\n }\n\n &-display {\n position: absolute;\n top: 8px;\n left: 0;\n right: 0;\n height: 40px;\n border: 1px solid ", ";\n border-radius: ", "px ", "px 0 0;\n background: ", ";\n transition: all 0.3s;\n\n &-flex {\n display: flex;\n justify-content: space-between; \n align-items: center;\n height: 32px;\n padding: 0 12px;\n }\n\n &-label {\n display: flex;\n align-items: center;\n gap: 4px;\n fontsize: 14px;\n color: ", ";\n }\n\n &-desc {\n display: flex;\n align-items: center;\n margin: 0 12px 0 auto;\n }\n }\n\n &-hide {\n top: 45px;\n }\n}\n\n"])), function (p) {
16
+ var useStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-sender-mode-select {\n position: relative;\n height: 40px;\n\n &-options {\n position: absolute;\n top: 4px;\n left: 0;\n right: 0;\n display: flex;\n gap: 8px;\n transition: all 0.3s;\n }\n\n &-option {\n height: 28px;\n display: flex;\n align-items: center;\n fonts: 14px;\n padding: 0 8px;\n border-radius: ", "px;\n gap: 4px;\n border: 1px solid ", ";\n cursor: pointer;\n color: ", ";\n transition: all 0.3s;\n\n &:hover {\n border-color: ", ";\n color: ", ";\n }\n }\n\n &-display {\n position: absolute;\n top: 8px;\n left: 0;\n right: 0;\n height: 40px;\n border: 1px solid ", ";\n border-radius: ", "px ", "px 0 0;\n background: ", ";\n transition: all 0.3s;\n\n &-flex {\n display: flex;\n justify-content: space-between; \n align-items: center;\n height: 32px;\n padding: 0 12px;\n }\n\n &-label {\n width: 0;\n flex: 1;\n display: flex;\n align-items: center;\n gap: 4px;\n fontsize: 14px;\n color: ", ";\n }\n\n &-desc {\n display: flex;\n align-items: center;\n margin: 0 12px 0 auto;\n }\n }\n\n &-hide {\n top: 45px;\n }\n}\n\n"])), function (p) {
17
17
  return p.prefix;
18
18
  }, function (p) {
19
19
  return p.theme.borderRadius;
@@ -46,7 +46,7 @@ export default function (props) {
46
46
  var valueObject = useMemo(function () {
47
47
  var item = props.options.find(function (item) {
48
48
  return item.value === value;
49
- });
49
+ }) || {};
50
50
  return item;
51
51
  }, [props.value]);
52
52
  var close = /*#__PURE__*/_jsx(SparkFalseLine, {
@@ -58,7 +58,6 @@ export default function (props) {
58
58
  fontSize: 20
59
59
  }
60
60
  });
61
- console.log(props.options);
62
61
  return /*#__PURE__*/_jsxs(_Fragment, {
63
62
  children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsxs("div", {
64
63
  className: prefixCls,
@@ -79,6 +78,7 @@ export default function (props) {
79
78
  children: /*#__PURE__*/_jsxs("div", {
80
79
  className: "".concat(prefixCls, "-display-flex"),
81
80
  children: [/*#__PURE__*/_jsx(Display, _objectSpread(_objectSpread({}, valueObject), {}, {
81
+ label: (valueObject === null || valueObject === void 0 ? void 0 : valueObject.selectedLabel) || (valueObject === null || valueObject === void 0 ? void 0 : valueObject.label),
82
82
  className: "".concat(prefixCls, "-display-label")
83
83
  })), props.desc && /*#__PURE__*/_jsx("div", {
84
84
  className: "".concat(prefixCls, "-display-desc"),
@@ -101,6 +101,7 @@ function Display(props) {
101
101
  if (props.tooltip) {
102
102
  return /*#__PURE__*/_jsx(Tooltip, {
103
103
  title: props.tooltip,
104
+ placement: "topLeft",
104
105
  children: node
105
106
  });
106
107
  } else {
@@ -234,7 +234,6 @@ var ForwardSender = /*#__PURE__*/React.forwardRef(function (props, ref) {
234
234
  children: header
235
235
  }), /*#__PURE__*/_jsxs("div", {
236
236
  className: "".concat(prefixCls, "-content"),
237
- onMouseDown: onContentMouseDown,
238
237
  children: [/*#__PURE__*/_jsx(InputTextArea, _objectSpread(_objectSpread({}, inputProps), {}, {
239
238
  disabled: disabled,
240
239
  style: styles.input,
package/lib/index.d.ts CHANGED
@@ -17,9 +17,11 @@ export { default as Conversations, default as HistoryPanel, type ConversationsPr
17
17
  export { default as Disclaimer, type IDisclaimerProps } from './Disclaimer';
18
18
  export { default as ImageGenerator, type IImageGeneratorProps, } from './ImageGenerator';
19
19
  export { default as Markdown, type MarkdownProps as IMarkdownProps, type MarkdownProps, } from './Markdown';
20
- export { default as useTypedEffect } from './Markdown/hooks/useTypedEffect';
21
20
  export { default as Mermaid, type IMermaidProps } from './Mermaid';
21
+ export { default as OperateCard, type IOperateCardProps } from './OperateCard';
22
22
  export { default as ChatInput, default as Sender, type SenderProps as IChatInputProps, type SenderProps, } from './Sender';
23
23
  export { default as createGlobalStyle } from './Util/createStyle';
24
24
  export { default as sleep } from './Util/sleep';
25
25
  export { default as Welcome, type IWelcomeProps } from './Welcome';
26
+ export * from './OperateCard/preset';
27
+ export { default as DeviceAction, type IDeviceActionProps } from './DeviceAction';
package/lib/index.js CHANGED
@@ -16,9 +16,11 @@ export { default as Conversations, default as HistoryPanel } from "./Conversatio
16
16
  export { default as Disclaimer } from "./Disclaimer";
17
17
  export { default as ImageGenerator } from "./ImageGenerator";
18
18
  export { default as Markdown } from "./Markdown";
19
- export { default as useTypedEffect } from "./Markdown/hooks/useTypedEffect";
20
19
  export { default as Mermaid } from "./Mermaid";
20
+ export { default as OperateCard } from "./OperateCard";
21
21
  export { default as ChatInput, default as Sender } from "./Sender";
22
22
  export { default as createGlobalStyle } from "./Util/createStyle";
23
23
  export { default as sleep } from "./Util/sleep";
24
- export { default as Welcome } from "./Welcome";
24
+ export { default as Welcome } from "./Welcome";
25
+ export * from "./OperateCard/preset";
26
+ export { default as DeviceAction } from "./DeviceAction";