@agentscope-ai/chat 1.1.46-beta.1768114534636 → 1.1.46-beta.1768184877196

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.
@@ -78,8 +78,8 @@ export default function Audio(props: IAudio) {
78
78
  <>
79
79
  <audio ref={audioRef} src={props.src} muted={isMuted} />
80
80
  <div className={prefixCls}>
81
- <IconButton shape="circle" size="small" type="text" onClick={togglePlay} icon={isPlaying ? <SparkPauseFill /> : <SparkPlayFill />} />
82
- <IconButton shape="circle" size="small" type="text" onClick={toggleMuted} icon={isMuted ? <SparkMuteLine /> : <SparkVolumeLine />} />
81
+ <IconButton size="small" type="text" onClick={togglePlay} icon={isPlaying ? <SparkPauseFill /> : <SparkPlayFill />} />
82
+ <IconButton size="small" type="text" onClick={toggleMuted} icon={isMuted ? <SparkMuteLine /> : <SparkVolumeLine />} />
83
83
  <div className={`${prefixCls}-time`}>{formatTime(currentTime)}</div>
84
84
  <div
85
85
  className={`${prefixCls}-progress`}
@@ -16,4 +16,9 @@ export default function (props: IImage) {
16
16
  } as Locale}
17
17
  ><Image src={props.src} width={"100%"} height={"100%"} /></ConfigProvider>
18
18
  </div>;
19
+ }
20
+
21
+
22
+ export function ImagesContainer(props: { children: React.ReactNode }) {
23
+ return <Image.PreviewGroup>{props.children}</Image.PreviewGroup>
19
24
  }
@@ -0,0 +1,13 @@
1
+
2
+ import { AssetsPreview } from '@agentscope-ai/chat';
3
+ import { Flex, Space } from 'antd';
4
+ import React from 'react';
5
+
6
+ export default function () {
7
+ return <AssetsPreview type="audio" data={[
8
+ { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', },
9
+ { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', },
10
+ { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', },
11
+
12
+ ]} />
13
+ }
@@ -0,0 +1,9 @@
1
+ import { AssetsPreview } from '@agentscope-ai/chat';
2
+ import { Flex, Space } from 'antd';
3
+ import React from 'react';
4
+
5
+ export default function () {
6
+ return <AssetsPreview type="image" data={[
7
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 1, height: 1 },
8
+ ]} />
9
+ }
@@ -0,0 +1,21 @@
1
+ import { AssetsPreview } from '@agentscope-ai/chat';
2
+ import { Flex, Space } from 'antd';
3
+ import React from 'react';
4
+
5
+ export default function () {
6
+ return <AssetsPreview type="image" data={[
7
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
8
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
9
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
10
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
11
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
12
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
13
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
14
+ { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
15
+ ]} />
16
+
17
+
18
+
19
+
20
+
21
+ }
@@ -0,0 +1,10 @@
1
+
2
+ import { AssetsPreview } from '@agentscope-ai/chat';
3
+ import { Flex, Space } from 'antd';
4
+ import React from 'react';
5
+
6
+ export default function () {
7
+ return <AssetsPreview type="video" data={[
8
+ { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
9
+ ]} />
10
+ }
@@ -2,11 +2,35 @@
2
2
  group:
3
3
  title: Output
4
4
  order: 3
5
- title: ???
6
- description: ???
5
+ title: AssetsPreview
6
+ description: Preview assets in conversations
7
7
  ---
8
8
 
9
- <DemoTitle title="???" desc="???"></DemoTitle>
9
+ <DemoTitle title="AssetsPreview" desc="Preview assets in conversations"></DemoTitle>
10
10
 
11
+ <Install>import { AssetsPreview } from '@agentscope-ai/chat'</Install>
11
12
 
12
- <code src="./demo/index.tsx"></code>
13
+ #### AssetsPreview Examples
14
+
15
+ <code src="./demo/left.tsx" height="auto">Multiple images left-aligned</code>
16
+ <code src="./demo/center.tsx" height="auto">Single image centered</code>
17
+ <code src="./demo/video.tsx" height="auto">Video preview</code>
18
+ <code src="./demo/audio.tsx" height="auto">Audio preview</code>
19
+
20
+ #### API
21
+
22
+ ##### IAssetsPreviewProps
23
+
24
+ <ApiParser source="./index.tsx" id="IAssetsPreviewProps"></ApiParser>
25
+
26
+ ##### IImage
27
+
28
+ <ApiParser source="./types.tsx" id="IImage"></ApiParser>
29
+
30
+ ##### IVideo
31
+
32
+ <ApiParser source="./types.tsx" id="IVideo"></ApiParser>
33
+
34
+ ##### IAudio
35
+
36
+ <ApiParser source="./types.tsx" id="IAudio"></ApiParser>
@@ -2,20 +2,44 @@ import { useProviderContext } from '../Provider';
2
2
  import Style from './style';
3
3
  import cls from 'classnames';
4
4
  import { IImage, IVideo, IAudio } from './types';
5
- import Image from './Image';
5
+ import Image, { ImagesContainer } from './Image';
6
6
  import Video from './Video';
7
7
  import Audio from './Audio';
8
8
  import { useCallback, useDeferredValue, useEffect, useRef, useState } from 'react';
9
9
  import { SparkLeftLine, SparkRightLine } from '@agentscope-ai/icons';
10
10
  import { IconButton } from '@agentscope-ai/design';
11
-
12
11
  export interface IAssetsPreviewProps {
12
+ /**
13
+ * @description 类名
14
+ * @descriptionEn Class Name
15
+ * @default ''
16
+ */
13
17
  className?: string;
18
+ /**
19
+ * @description 语义化类名
20
+ * @descriptionEn Semantic Class Name
21
+ * @default {}
22
+ */
14
23
  classNames?: {
15
24
  container?: string;
16
25
  };
26
+ /**
27
+ * @description 高度
28
+ * @descriptionEn Height
29
+ * @default 144
30
+ */
17
31
  height?: number;
32
+ /**
33
+ * @description 类型
34
+ * @descriptionEn Type
35
+ * @default 'image'
36
+ */
18
37
  type: 'image' | 'video' | 'audio';
38
+ /**
39
+ * @description 数据
40
+ * @descriptionEn Data
41
+ * @default []
42
+ */
19
43
  data: (IImage | IVideo | IAudio)[];
20
44
  }
21
45
 
@@ -44,7 +68,7 @@ function AssetsPreview(props: IAssetsPreviewProps) {
44
68
 
45
69
 
46
70
  const toArrow = useCallback((direct: 'left' | 'right') => {
47
- const width = 100;
71
+ const width = 200;
48
72
  ref.current.scrollLeft = ref.current.scrollLeft + width * (direct === 'left' ? -1 : 1)
49
73
  }, [])
50
74
 
@@ -54,16 +78,19 @@ function AssetsPreview(props: IAssetsPreviewProps) {
54
78
  audio: Audio,
55
79
  }[props.type];
56
80
 
81
+
82
+ const list = props.data.map((item, index) => {
83
+ return <Component key={index} {...item as any} />;
84
+ })
85
+
57
86
  return <>
58
87
  <Style />
59
88
  <div className={cls(`${prefixCls}`, props.className)}>
60
- <div className={cls(`${prefixCls}-container`, props.className)} style={props.type !== 'audio' ? { height } : {
89
+ <div className={cls(`${prefixCls}-container`, props.classNames?.container)} style={props.type !== 'audio' ? { height } : {
61
90
  flexDirection: 'column'
62
91
  }} onScroll={onScroll} ref={ref}>
63
92
  {
64
- props.data.map((item, index) => {
65
- return <Component key={index} {...item as any} />;
66
- })
93
+ props.type === 'image' ? <ImagesContainer>{list}</ImagesContainer> : list
67
94
  }
68
95
  </div>
69
96
 
@@ -85,7 +112,6 @@ function AssetsPreview(props: IAssetsPreviewProps) {
85
112
 
86
113
  </> : null
87
114
  }
88
-
89
115
  </div>
90
116
  </>
91
117
  }
@@ -1,11 +1,36 @@
1
1
  ---
2
-
3
2
  group:
4
- title: 输出
3
+ title: Output
5
4
  order: 3
6
- title: ???
7
- description: ???
5
+ title: AssetsPreview
6
+ description: 可以在对话中预览资源
8
7
  ---
9
8
 
9
+ <DemoTitle title="AssetsPreview" desc="可以在对话中预览资源"></DemoTitle>
10
+
11
+ <Install>import { AssetsPreview } from '@agentscope-ai/chat'</Install>
12
+
13
+ #### AssetsPreview 示例
14
+
15
+ <code src="./demo/left.tsx" height="auto">多张左对齐平铺</code>
16
+ <code src="./demo/center.tsx" height="auto">单张居中显示</code>
17
+ <code src="./demo/video.tsx" height="auto">视频生成</code>
18
+ <code src="./demo/audio.tsx" height="auto">音频生成</code>
19
+
20
+ #### API
21
+
22
+ ##### IAssetsPreviewProps
23
+
24
+ <ApiParser source="./index.tsx" id="IAssetsPreviewProps"></ApiParser>
25
+
26
+ ##### IImage
27
+
28
+ <ApiParser source="./types.tsx" id="IImage"></ApiParser>
29
+
30
+ ##### IVideo
31
+
32
+ <ApiParser source="./types.tsx" id="IVideo"></ApiParser>
33
+
34
+ ##### IAudio
10
35
 
11
- <DemoTitle title="???" desc="???"></DemoTitle>
36
+ <ApiParser source="./types.tsx" id="IAudio"></ApiParser>
@@ -65,6 +65,7 @@ export default createGlobalStyle`
65
65
 
66
66
  .anticon-eye {
67
67
  font-size: 20px;
68
+ margin: 0 !important;
68
69
  }
69
70
  }
70
71
 
@@ -1,14 +1,54 @@
1
1
  export interface IImage {
2
+ /**
3
+ * @description 图片地址
4
+ * @descriptionEn Image URL
5
+ * @default ''
6
+ */
2
7
  src: string;
8
+ /**
9
+ * @description 图片宽度(比例值)
10
+ * @descriptionEn Image Width (Ratio Value)
11
+ * @default 0
12
+ */
3
13
  width: number;
14
+ /**
15
+ * @description 图片高度(比例值)
16
+ * @descriptionEn Image Height (Ratio Value)
17
+ * @default 0
18
+ */
4
19
  height: number;
5
20
  }
6
21
  export interface IVideo {
22
+ /**
23
+ * @description 封面图片地址
24
+ * @descriptionEn Poster Image URL
25
+ * @default ''
26
+ */
7
27
  poster?: string;
28
+ /**
29
+ * @description 视频地址
30
+ * @descriptionEn Video URL
31
+ * @default ''
32
+ */
8
33
  src: string;
34
+ /**
35
+ * @description 视频宽度(比例值)
36
+ * @descriptionEn Video Width (Ratio Value)
37
+ * @default 0
38
+ */
9
39
  width: number;
40
+ /**
41
+ * @description 视频高度(比例值)
42
+ * @descriptionEn Video Height (Ratio Value)
43
+ * @default 0
44
+ */
10
45
  height: number;
11
46
  }
12
47
  export interface IAudio {
48
+ /**
49
+ * @description 音频地址
50
+ * @descriptionEn Audio URL
51
+ * @default ''
52
+ */
13
53
  src: string;
14
54
  }
@@ -92,13 +92,11 @@ export default function Audio(props) {
92
92
  }), /*#__PURE__*/_jsxs("div", {
93
93
  className: prefixCls,
94
94
  children: [/*#__PURE__*/_jsx(IconButton, {
95
- shape: "circle",
96
95
  size: "small",
97
96
  type: "text",
98
97
  onClick: togglePlay,
99
98
  icon: isPlaying ? /*#__PURE__*/_jsx(SparkPauseFill, {}) : /*#__PURE__*/_jsx(SparkPlayFill, {})
100
99
  }), /*#__PURE__*/_jsx(IconButton, {
101
- shape: "circle",
102
100
  size: "small",
103
101
  type: "text",
104
102
  onClick: toggleMuted,
@@ -1,2 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { IImage } from "./types";
2
3
  export default function (props: IImage): import("react/jsx-runtime").JSX.Element;
4
+ export declare function ImagesContainer(props: {
5
+ children: React.ReactNode;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -21,4 +21,9 @@ export default function (props) {
21
21
  })
22
22
  })
23
23
  });
24
+ }
25
+ export function ImagesContainer(props) {
26
+ return /*#__PURE__*/_jsx(Image.PreviewGroup, {
27
+ children: props.children
28
+ });
24
29
  }
@@ -1,11 +1,36 @@
1
1
  import { IImage, IVideo, IAudio } from './types';
2
2
  export interface IAssetsPreviewProps {
3
+ /**
4
+ * @description 类名
5
+ * @descriptionEn Class Name
6
+ * @default ''
7
+ */
3
8
  className?: string;
9
+ /**
10
+ * @description 语义化类名
11
+ * @descriptionEn Semantic Class Name
12
+ * @default {}
13
+ */
4
14
  classNames?: {
5
15
  container?: string;
6
16
  };
17
+ /**
18
+ * @description 高度
19
+ * @descriptionEn Height
20
+ * @default 144
21
+ */
7
22
  height?: number;
23
+ /**
24
+ * @description 类型
25
+ * @descriptionEn Type
26
+ * @default 'image'
27
+ */
8
28
  type: 'image' | 'video' | 'audio';
29
+ /**
30
+ * @description 数据
31
+ * @descriptionEn Data
32
+ * @default []
33
+ */
9
34
  data: (IImage | IVideo | IAudio)[];
10
35
  }
11
36
  declare function AssetsPreview(props: IAssetsPreviewProps): import("react/jsx-runtime").JSX.Element;
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { useProviderContext } from "../Provider";
14
14
  import Style from "./style";
15
15
  import cls from 'classnames';
16
- import Image from "./Image";
16
+ import Image, { ImagesContainer } from "./Image";
17
17
  import Video from "./Video";
18
18
  import Audio from "./Audio";
19
19
  import { useCallback, useDeferredValue, useEffect, useRef, useState } from 'react';
@@ -23,6 +23,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
23
23
  import { Fragment as _Fragment } from "react/jsx-runtime";
24
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
25
25
  function AssetsPreview(props) {
26
+ var _props$classNames;
26
27
  var prefixCls = useProviderContext().getPrefixCls('assets-preview');
27
28
  var ref = useRef(null);
28
29
  var _props$height = props.height,
@@ -49,7 +50,7 @@ function AssetsPreview(props) {
49
50
  }
50
51
  }, []);
51
52
  var toArrow = useCallback(function (direct) {
52
- var width = 100;
53
+ var width = 200;
53
54
  ref.current.scrollLeft = ref.current.scrollLeft + width * (direct === 'left' ? -1 : 1);
54
55
  }, []);
55
56
  var Component = {
@@ -57,11 +58,14 @@ function AssetsPreview(props) {
57
58
  video: Video,
58
59
  audio: Audio
59
60
  }[props.type];
61
+ var list = props.data.map(function (item, index) {
62
+ return /*#__PURE__*/_jsx(Component, _objectSpread({}, item), index);
63
+ });
60
64
  return /*#__PURE__*/_jsxs(_Fragment, {
61
65
  children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsxs("div", {
62
66
  className: cls("".concat(prefixCls), props.className),
63
67
  children: [/*#__PURE__*/_jsx("div", {
64
- className: cls("".concat(prefixCls, "-container"), props.className),
68
+ className: cls("".concat(prefixCls, "-container"), (_props$classNames = props.classNames) === null || _props$classNames === void 0 ? void 0 : _props$classNames.container),
65
69
  style: props.type !== 'audio' ? {
66
70
  height: height
67
71
  } : {
@@ -69,9 +73,9 @@ function AssetsPreview(props) {
69
73
  },
70
74
  onScroll: onScroll,
71
75
  ref: ref,
72
- children: props.data.map(function (item, index) {
73
- return /*#__PURE__*/_jsx(Component, _objectSpread({}, item), index);
74
- })
76
+ children: props.type === 'image' ? /*#__PURE__*/_jsx(ImagesContainer, {
77
+ children: list
78
+ }) : list
75
79
  }), arrowTop && props.type !== 'audio' ? /*#__PURE__*/_jsxs(_Fragment, {
76
80
  children: [deferScrollLeft > 50 && /*#__PURE__*/_jsxs(_Fragment, {
77
81
  children: [/*#__PURE__*/_jsx("div", {
@@ -1,7 +1,7 @@
1
1
  var _templateObject;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import { createGlobalStyle } from 'antd-style';
4
- export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-assets-preview {\n position: relative;\n\n &-left-edge,\n &-right-edge {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 128px;\n pointer-events: none;\n }\n\n &-left-edge {\n left: 0;\n background: linear-gradient(to right, ", ", rgba(0, 0, 0, 0));\n }\n\n &-right-edge {\n right: 0;\n background: linear-gradient(to left, ", ", rgba(0, 0, 0, 0));\n }\n\n &-arrow {\n position: absolute;\n bottom: 0;\n }\n\n &-left-arrow {\n left: 10px;\n }\n\n &-right-arrow {\n right: 10px;\n }\n\n &-container {\n display: flex;\n padding: 8px;\n gap: 8px;\n overflow-x: auto;\n justify-content: safe center;\n background-color: ", ";\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE/Edge */\n &::-webkit-scrollbar {\n display: none; /* Chrome/Safari/Opera */\n }\n }\n\n\n &-image {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n\n .anticon-eye {\n font-size: 20px;\n }\n }\n\n &-video {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n\n video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n\n &-playing {\n opacity: 0;\n &:hover {\n opacity: 1;\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-paused {\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-play-btn {\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n transition: transform 0.2s ease;\n font-size: 40px;\n \n\n &:hover {\n transform: scale(1.1);\n }\n }\n\n &-duration {\n position: absolute;\n bottom: 8px;\n left: 50%;\n transform: translateX(-50%);\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);\n }\n\n &-playing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n \n }\n \n &-audio {\n display: flex;\n align-items: center;\n gap: 8px;\n background-color: ", ";\n border-radius: 8px;\n border: 1px solid ", ";\n height: 40px;\n padding: 0 8px;\n\n &-time {\n font-size: 12px;\n color: ", ";\n line-height: 1;\n }\n\n &-progress {\n flex: 1;\n height: 8px;\n background-color: ", ";\n border-radius: 4px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n\n &-bar {\n height: 100%;\n background-color: ", ";\n border-radius: 4px;\n transition: width 0.1s linear;\n }\n }\n }\n}\n"])), function (p) {
4
+ export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-assets-preview {\n position: relative;\n\n &-left-edge,\n &-right-edge {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 128px;\n pointer-events: none;\n }\n\n &-left-edge {\n left: 0;\n background: linear-gradient(to right, ", ", rgba(0, 0, 0, 0));\n }\n\n &-right-edge {\n right: 0;\n background: linear-gradient(to left, ", ", rgba(0, 0, 0, 0));\n }\n\n &-arrow {\n position: absolute;\n bottom: 0;\n }\n\n &-left-arrow {\n left: 10px;\n }\n\n &-right-arrow {\n right: 10px;\n }\n\n &-container {\n display: flex;\n padding: 8px;\n gap: 8px;\n overflow-x: auto;\n justify-content: safe center;\n background-color: ", ";\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE/Edge */\n &::-webkit-scrollbar {\n display: none; /* Chrome/Safari/Opera */\n }\n }\n\n\n &-image {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n\n .anticon-eye {\n font-size: 20px;\n margin: 0 !important;\n }\n }\n\n &-video {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n\n video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n\n &-playing {\n opacity: 0;\n &:hover {\n opacity: 1;\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-paused {\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-play-btn {\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n transition: transform 0.2s ease;\n font-size: 40px;\n \n\n &:hover {\n transform: scale(1.1);\n }\n }\n\n &-duration {\n position: absolute;\n bottom: 8px;\n left: 50%;\n transform: translateX(-50%);\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);\n }\n\n &-playing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n \n }\n \n &-audio {\n display: flex;\n align-items: center;\n gap: 8px;\n background-color: ", ";\n border-radius: 8px;\n border: 1px solid ", ";\n height: 40px;\n padding: 0 8px;\n\n &-time {\n font-size: 12px;\n color: ", ";\n line-height: 1;\n }\n\n &-progress {\n flex: 1;\n height: 8px;\n background-color: ", ";\n border-radius: 4px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n\n &-bar {\n height: 100%;\n background-color: ", ";\n border-radius: 4px;\n transition: width 0.1s linear;\n }\n }\n }\n}\n"])), function (p) {
5
5
  return p.theme.prefixCls;
6
6
  }, function (p) {
7
7
  return p.theme.colorBgLayout;
@@ -1,14 +1,54 @@
1
1
  export interface IImage {
2
+ /**
3
+ * @description 图片地址
4
+ * @descriptionEn Image URL
5
+ * @default ''
6
+ */
2
7
  src: string;
8
+ /**
9
+ * @description 图片宽度(比例值)
10
+ * @descriptionEn Image Width (Ratio Value)
11
+ * @default 0
12
+ */
3
13
  width: number;
14
+ /**
15
+ * @description 图片高度(比例值)
16
+ * @descriptionEn Image Height (Ratio Value)
17
+ * @default 0
18
+ */
4
19
  height: number;
5
20
  }
6
21
  export interface IVideo {
22
+ /**
23
+ * @description 封面图片地址
24
+ * @descriptionEn Poster Image URL
25
+ * @default ''
26
+ */
7
27
  poster?: string;
28
+ /**
29
+ * @description 视频地址
30
+ * @descriptionEn Video URL
31
+ * @default ''
32
+ */
8
33
  src: string;
34
+ /**
35
+ * @description 视频宽度(比例值)
36
+ * @descriptionEn Video Width (Ratio Value)
37
+ * @default 0
38
+ */
9
39
  width: number;
40
+ /**
41
+ * @description 视频高度(比例值)
42
+ * @descriptionEn Video Height (Ratio Value)
43
+ * @default 0
44
+ */
10
45
  height: number;
11
46
  }
12
47
  export interface IAudio {
48
+ /**
49
+ * @description 音频地址
50
+ * @descriptionEn Audio URL
51
+ * @default ''
52
+ */
13
53
  src: string;
14
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/chat",
3
- "version": "1.1.46-beta.1768114534636",
3
+ "version": "1.1.46-beta.1768184877196",
4
4
  "description": "a free and open-source chat framework for building excellent LLM-powered chat experiences",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": [
@@ -1,63 +0,0 @@
1
- import { AssetsPreview } from '@agentscope-ai/chat';
2
- import { Flex, Space } from 'antd';
3
- import React from 'react';
4
-
5
- export default function () {
6
- return <Flex vertical gap={32}>
7
- <AssetsPreview type="audio" data={[
8
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', },
9
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', },
10
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', },
11
-
12
- ]} />
13
-
14
-
15
- <AssetsPreview type="image" data={[
16
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
17
- ]} />
18
-
19
-
20
- <AssetsPreview type="image" data={[
21
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
22
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
23
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
24
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
25
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
26
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
27
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
28
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 16, height: 9 },
29
- ]} />
30
-
31
- <AssetsPreview type="image" data={[
32
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 1, height: 1 },
33
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 1, height: 1 },
34
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 1, height: 1 },
35
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 1, height: 1 },
36
- ]} />
37
-
38
- <AssetsPreview type="image" data={[
39
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 9, height: 16 },
40
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 9, height: 16 },
41
- { src: 'https://img.alicdn.com/imgextra/i3/O1CN01dKprif1ar0awCMDwK_!!6000000003382-0-tps-2640-1100.jpg', width: 9, height: 16 },
42
- ]} />
43
-
44
- <AssetsPreview type="video" data={[
45
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
46
- ]} />
47
-
48
- <AssetsPreview type="video" data={[
49
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
50
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
51
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
52
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
53
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
54
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', width: 16, height: 9 },
55
- ]} />
56
-
57
- <AssetsPreview type="audio" data={[
58
- { src: 'https://cloud.video.taobao.com/vod/m9amjbqLTGUvaGo3o61u-Ch2hycUCa3RA3pAw1-Zv_0.mp4', },
59
- ]} />
60
-
61
-
62
- </Flex>
63
- }