@agentscope-ai/chat 1.1.43-beta.1765868055060-beta.1765869194774 → 1.1.43-beta.1765941695971

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.
@@ -188,9 +188,11 @@ class AgentScopeRuntimeResponseBuilder {
188
188
  }
189
189
 
190
190
  handle(data: IAgentScopeRuntimeResponse | IAgentScopeRuntimeMessage | IContent) {
191
+
191
192
  if (data.object === 'response') {
192
193
  this.handleResponse(data);
193
194
  } else if (data.object === 'message') {
195
+ if (data.type === AgentScopeRuntimeMessageType.HEARTBEAT) return this.data;
194
196
  this.handleMessage(data);
195
197
  } else if (data.object === 'content') {
196
198
  this.handleContent(data);
@@ -0,0 +1,215 @@
1
+ import { createStyles } from 'antd-style';
2
+ import { Sun, Cloud, CloudRain } from 'lucide-react';
3
+ import { Card, Typography } from 'antd';
4
+ import dayjs from 'dayjs';
5
+
6
+ interface IWeatherData {
7
+ location: string;
8
+ weather: 'sunny' | 'rainy' | 'cloudy';
9
+ temperature: number;
10
+ date: string;
11
+ }
12
+
13
+ const data: IWeatherData[] = [
14
+ {
15
+ location: "杭州",
16
+ weather: "sunny",
17
+ temperature: 20,
18
+ date: "2025-12-17"
19
+ },
20
+ {
21
+ location: "杭州",
22
+ weather: "rainy",
23
+ temperature: 18,
24
+ date: "2025-12-18"
25
+ },
26
+ {
27
+ location: "杭州",
28
+ weather: "cloudy",
29
+ temperature: 19,
30
+ date: "2025-12-19"
31
+ },
32
+ {
33
+ location: "杭州",
34
+ weather: "sunny",
35
+ temperature: 21,
36
+ date: "2025-12-20"
37
+ },
38
+ {
39
+ location: "杭州",
40
+ weather: "sunny",
41
+ temperature: 21,
42
+ date: "2025-12-21"
43
+ }
44
+ ];
45
+
46
+ const useStyles = createStyles(({ token, css }) => ({
47
+ container: css`
48
+ width: 100%;
49
+ max-width: 320px;
50
+ border-radius: 20px;
51
+ background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
52
+ color: white;
53
+ overflow: hidden;
54
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
55
+ border: none;
56
+
57
+ .ant-card-body {
58
+ padding: 0;
59
+ }
60
+ `,
61
+ header: css`
62
+ display: flex;
63
+ justify-content: space-between;
64
+ align-items: flex-start;
65
+ `,
66
+ location: css`
67
+ font-size: 24px;
68
+ font-weight: 600;
69
+ margin-bottom: 4px;
70
+ color: white !important;
71
+ `,
72
+ date: css`
73
+ font-size: 14px;
74
+ opacity: 0.8;
75
+ color: white !important;
76
+ `,
77
+ mainWeather: css`
78
+ display: flex;
79
+ flex-direction: column;
80
+ align-items: center;
81
+ padding: 24px 0 32px;
82
+ `,
83
+ tempContainer: css`
84
+ display: flex;
85
+ align-items: flex-start;
86
+ line-height: 1;
87
+ `,
88
+ temperature: css`
89
+ font-size: 64px;
90
+ font-weight: 700;
91
+ color: white !important;
92
+ `,
93
+ degree: css`
94
+ font-size: 24px;
95
+ font-weight: 500;
96
+ margin-top: 8px;
97
+ color: white !important;
98
+ `,
99
+ mainIcon: css`
100
+ font-size: 48px;
101
+ margin-bottom: 16px;
102
+ filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2));
103
+ `,
104
+ condition: css`
105
+ font-size: 16px;
106
+ font-weight: 500;
107
+ margin-top: 8px;
108
+ opacity: 0.9;
109
+ color: white !important;
110
+ `,
111
+ forecast: css`
112
+ background: rgba(255, 255, 255, 0.1);
113
+ backdrop-filter: blur(10px);
114
+ padding: 16px 24px;
115
+ `,
116
+ forecastItem: css`
117
+ display: flex;
118
+ justify-content: space-between;
119
+ align-items: center;
120
+ padding: 12px 0;
121
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
122
+
123
+ &:last-child {
124
+ border-bottom: none;
125
+ padding-bottom: 4px;
126
+ }
127
+
128
+ &:first-child {
129
+ padding-top: 4px;
130
+ }
131
+ `,
132
+ forecastDay: css`
133
+ font-size: 14px;
134
+ width: 60px;
135
+ color: white !important;
136
+ `,
137
+ forecastIcon: css`
138
+ font-size: 20px;
139
+ color: white;
140
+ `,
141
+ forecastTemp: css`
142
+ font-size: 14px;
143
+ font-weight: 500;
144
+ width: 40px;
145
+ text-align: right;
146
+ color: white !important;
147
+ `
148
+ }));
149
+
150
+ const WeatherIcon = ({ type, className }: { type: string, className?: string }) => {
151
+ switch (type) {
152
+ case 'sunny':
153
+ return <Sun className={className} />;
154
+ case 'rainy':
155
+ return <CloudRain className={className} />;
156
+ case 'cloudy':
157
+ return <Cloud className={className} />;
158
+ default:
159
+ return <Sun className={className} />;
160
+ }
161
+ };
162
+
163
+ const getWeatherLabel = (type: string) => {
164
+ switch (type) {
165
+ case 'sunny': return '晴朗';
166
+ case 'rainy': return '雨天';
167
+ case 'cloudy': return '多云';
168
+ default: return type;
169
+ }
170
+ };
171
+
172
+ export default function Weather() {
173
+ const { styles } = useStyles();
174
+ const current = data[0];
175
+ const forecast = data.slice(1);
176
+
177
+ return (
178
+ <Card className={styles.container} bordered={false}>
179
+ <div className={styles.header}>
180
+ <div>
181
+ <Typography.Text className={styles.location}>{current.location}</Typography.Text>
182
+ <br />
183
+ <Typography.Text className={styles.date}>
184
+ {dayjs(current.date).format('MM月DD日 dddd')}
185
+ </Typography.Text>
186
+ </div>
187
+ </div>
188
+
189
+ <div className={styles.mainWeather}>
190
+ <WeatherIcon type={current.weather} className={styles.mainIcon} />
191
+ <div className={styles.tempContainer}>
192
+ <Typography.Text className={styles.temperature}>{current.temperature}</Typography.Text>
193
+ <Typography.Text className={styles.degree}>°C</Typography.Text>
194
+ </div>
195
+ <Typography.Text className={styles.condition}>
196
+ {getWeatherLabel(current.weather)}
197
+ </Typography.Text>
198
+ </div>
199
+
200
+ <div className={styles.forecast}>
201
+ {forecast.map((item, index) => (
202
+ <div key={index} className={styles.forecastItem}>
203
+ <Typography.Text className={styles.forecastDay}>
204
+ {dayjs(item.date).format('ddd')}
205
+ </Typography.Text>
206
+ <WeatherIcon type={item.weather} className={styles.forecastIcon} />
207
+ <Typography.Text className={styles.forecastTemp}>
208
+ {item.temperature}°
209
+ </Typography.Text>
210
+ </div>
211
+ ))}
212
+ </div>
213
+ </Card>
214
+ );
215
+ }
@@ -4,6 +4,7 @@ import { useMemo, useRef, useState } from 'react';
4
4
  import sessionApi from './sessionApi';
5
5
  import defaultConfig from './OptionsPanel/defaultConfig';
6
6
  import { useLocalStorageState } from 'ahooks';
7
+ import Weather from './Weather';
7
8
 
8
9
  export default function () {
9
10
 
@@ -26,6 +27,9 @@ export default function () {
26
27
 
27
28
  return {
28
29
  ...optionsConfig,
30
+ customToolRenderConfig: {
31
+ // 'weather search mock': Weather,
32
+ },
29
33
  session: {
30
34
  multiple: true,
31
35
  api: sessionApi,
@@ -2,23 +2,26 @@ import { Rag } from '@agentscope-ai/chat';
2
2
  import { Flex } from 'antd';
3
3
 
4
4
  export default function () {
5
- return <Flex vertical gap={16}><Rag
6
- subTitle="GPT-5技术博客、行业分析、技术特性"
7
- list={[
8
- {
9
- title: '【文档库】GPT-5 技术博客', content: 'Aliyun Bailianis a product offered by Alibaba Cloud, which is the cloud computing arm of Alibaba Group. Bailian is a high-performance AI development platform designed to help users build, deploy, and manage machine learning models and AI applications more efficiently.', footer: '来源文档:(真)拟定稿。GPT 的制度研究',
10
- images: [
11
- 'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
12
- 'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
13
- 'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
14
- ],
15
- },
16
- { title: '【文档库】GPT-5 行业分析', content: 'Aliyun Bailianis a product offered by Alibaba Cloud, which is the cloud computing arm of Alibaba Group. Bailian is a high-performance AI development platform designed to help users build, deploy, and manage machine learning models and AI applications more efficiently.', footer: '来源文档:(真)拟定稿。GPT 的制度研究' },
17
- { title: '【文档库】GPT-5 技术特性', content: 'Aliyun Bailianis a product offered by Alibaba Cloud, which is the cloud computing arm of Alibaba Group. Bailian is a high-performance AI development platform designed to help users build, deploy, and manage machine learning models and AI applications more efficiently.', footer: '来源文档:(真)拟定稿。GPT 的制度研究' },
18
- ]}
19
- />
5
+ return <Flex vertical gap={16}>
6
+ <Rag
7
+ query='GPT-5技术博客、行业分析、技术特性 AI原生 GPT-5技术博客、行业分析、技术特性 AI原生'
8
+ subTitle="GPT-5技术博客、行业分析、技术特性"
9
+ list={[
10
+ {
11
+ title: '【文档库】GPT-5 技术博客', content: 'Aliyun Bailianis a product offered by Alibaba Cloud, which is the cloud computing arm of Alibaba Group. Bailian is a high-performance AI development platform designed to help users build, deploy, and manage machine learning models and AI applications more efficiently.', footer: '来源文档:(真)拟定稿。GPT 的制度研究',
12
+ images: [
13
+ 'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
14
+ 'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
15
+ 'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
16
+ ],
17
+ },
18
+ { title: '【文档库】GPT-5 行业分析', content: 'Aliyun Bailianis a product offered by Alibaba Cloud, which is the cloud computing arm of Alibaba Group. Bailian is a high-performance AI development platform designed to help users build, deploy, and manage machine learning models and AI applications more efficiently.', footer: '来源文档:(真)拟定稿。GPT 的制度研究' },
19
+ { title: '【文档库】GPT-5 技术特性', content: 'Aliyun Bailianis a product offered by Alibaba Cloud, which is the cloud computing arm of Alibaba Group. Bailian is a high-performance AI development platform designed to help users build, deploy, and manage machine learning models and AI applications more efficiently.', footer: '来源文档:(真)拟定稿。GPT 的制度研究' },
20
+ ]}
21
+ />
20
22
 
21
23
  <Rag
24
+ query='GPT-5技术博客、行业分析、技术特性 AI原生 GPT-5技术博客、行业分析、技术特性 AI原生'
22
25
  subTitle="GPT-5技术博客、行业分析、技术特性"
23
26
  list={[]}
24
27
  />
@@ -1,6 +1,6 @@
1
1
  import { OperateCard, useProviderContext, Markdown } from '@agentscope-ai/chat';
2
2
  import { Empty, IconButton, Tag } from '@agentscope-ai/design';
3
- import { SparkBookLine, SparkDownLine, SparkUpLine } from '@agentscope-ai/icons';
3
+ import { SparkBookLine, SparkDownLine, SparkUpLine, SparkWarningCircleFill } from '@agentscope-ai/icons';
4
4
  import { ConfigProvider, Flex, Image } from 'antd';
5
5
  import { Locale } from "antd/es/locale";
6
6
  import { useState } from 'react';
@@ -18,13 +18,25 @@ export interface IRagProps {
18
18
  * @default ''
19
19
  */
20
20
  subTitle?: string;
21
+ /**
22
+ * @description 检索词
23
+ * @descriptionEn Query
24
+ */
25
+ query: string;
26
+
27
+ /**
28
+ * @description 检索词前缀
29
+ * @descriptionEn Query Title
30
+ * @default '检索 Query:'
31
+ */
32
+ queryTitle?: string;
21
33
  /**
22
34
  * @description 召回知识列表
23
35
  * @descriptionEn RAG List
24
36
  * @default []
25
37
  */
26
38
  list: {
27
- score?: number;
39
+ score?: number | string;
28
40
  title: string;
29
41
  content: string;
30
42
  footer: string;
@@ -111,10 +123,28 @@ function Item({ item }) {
111
123
 
112
124
 
113
125
  export default function (props: IRagProps) {
114
- const { title = '知识库检索', subTitle, defaultOpen = true, placeholder = '未查询到与提问相关知识库' } = props;
126
+ const {
127
+ title = '知识库检索',
128
+ subTitle,
129
+ defaultOpen = true,
130
+ placeholder = '未查询到与提问相关知识库',
131
+ query,
132
+ queryTitle = '检索 Query:',
133
+ } = props;
115
134
  const { getPrefixCls } = useProviderContext();
116
135
  const prefixCls = getPrefixCls('operate-card');
117
136
 
137
+
138
+ const children = props.list.length ? <OperateCard.LineBody>
139
+ {
140
+ props.list.map((item, index) => {
141
+ return <Item key={index} item={item} />
142
+ })
143
+ }
144
+ </OperateCard.LineBody> : <Flex align="center" justify="center" gap={8} className={`${prefixCls}-rag-empty-placeholder`}>
145
+ <SparkWarningCircleFill /><span>{placeholder}</span>
146
+ </Flex>
147
+
118
148
  return <OperateCard
119
149
  header={{
120
150
  icon: <SparkBookLine />,
@@ -123,16 +153,13 @@ export default function (props: IRagProps) {
123
153
  }}
124
154
  body={{
125
155
  defaultOpen,
126
- children: <OperateCard.LineBody>
127
- {
128
- props.list.length ? props.list.map((item, index) => {
129
- return <Item key={index} item={item} />
130
- }) : <Flex vertical align="center" justify="center">
131
- <Empty type="noData" size={160} />
132
- {placeholder && <div className={`${prefixCls}-rag-empty-placeholder`}>{placeholder}</div>}
133
- </Flex>
134
- }
135
- </OperateCard.LineBody>
156
+ children: <>
157
+ {query && <div className={`${prefixCls}-rag-query`}>
158
+ <span className={`${prefixCls}-rag-query-title`}>{queryTitle}</span>
159
+
160
+ {query}</div>}
161
+ {children}
162
+ </>
136
163
  }}
137
164
  />
138
165
  }
@@ -217,11 +217,25 @@ export default createGlobalStyle`
217
217
  }
218
218
 
219
219
  &-rag-empty-placeholder {
220
- margin-top: -24px;
220
+ padding: 16px 0;
221
+ border: 1px solid ${(p) => p.theme.colorBorderSecondary};
222
+ border-radius: 6px;
223
+ background-color: ${(p) => p.theme.colorBgBase};
224
+ line-height: 20px;
221
225
  font-size: 12px;
226
+ color: ${(p) => p.theme.colorTextSecondary};
227
+ margin: 0 12px 12px 12px;
228
+ }
229
+
230
+ &-rag-query {
231
+ margin: 0 12px 12px 12px;
222
232
  line-height: 20px;
223
- color: ${(p) => p.theme.colorTextTertiary};
224
- padding-bottom: 16px;
233
+ font-size: 12px;
234
+ color: ${(p) => p.theme.colorTextSecondary};
235
+
236
+ &-title {
237
+ font-weight: 500;
238
+ }
225
239
  }
226
240
 
227
241
  &-rag-item {
@@ -119,6 +119,7 @@ var AgentScopeRuntimeResponseBuilder = /*#__PURE__*/function () {
119
119
  if (data.object === 'response') {
120
120
  this.handleResponse(data);
121
121
  } else if (data.object === 'message') {
122
+ if (data.type === AgentScopeRuntimeMessageType.HEARTBEAT) return this.data;
122
123
  this.handleMessage(data);
123
124
  } else if (data.object === 'content') {
124
125
  this.handleContent(data);
@@ -0,0 +1 @@
1
+ export default function Weather(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,146 @@
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import { createStyles } from 'antd-style';
4
+ import { Sun, Cloud, CloudRain } from 'lucide-react';
5
+ import { Card, Typography } from 'antd';
6
+ import dayjs from 'dayjs';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ var data = [{
10
+ location: "杭州",
11
+ weather: "sunny",
12
+ temperature: 20,
13
+ date: "2025-12-17"
14
+ }, {
15
+ location: "杭州",
16
+ weather: "rainy",
17
+ temperature: 18,
18
+ date: "2025-12-18"
19
+ }, {
20
+ location: "杭州",
21
+ weather: "cloudy",
22
+ temperature: 19,
23
+ date: "2025-12-19"
24
+ }, {
25
+ location: "杭州",
26
+ weather: "sunny",
27
+ temperature: 21,
28
+ date: "2025-12-20"
29
+ }, {
30
+ location: "杭州",
31
+ weather: "sunny",
32
+ temperature: 21,
33
+ date: "2025-12-21"
34
+ }];
35
+ var useStyles = createStyles(function (_ref) {
36
+ var token = _ref.token,
37
+ css = _ref.css;
38
+ return {
39
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n max-width: 320px;\n border-radius: 20px;\n background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);\n color: white;\n overflow: hidden;\n box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);\n border: none;\n\n .ant-card-body {\n padding: 0;\n }\n "]))),
40
+ header: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n "]))),
41
+ location: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 24px;\n font-weight: 600;\n margin-bottom: 4px;\n color: white !important;\n "]))),
42
+ date: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 14px;\n opacity: 0.8;\n color: white !important;\n "]))),
43
+ mainWeather: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 24px 0 32px;\n "]))),
44
+ tempContainer: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n align-items: flex-start;\n line-height: 1;\n "]))),
45
+ temperature: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 64px;\n font-weight: 700;\n color: white !important;\n "]))),
46
+ degree: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: 24px;\n font-weight: 500;\n margin-top: 8px;\n color: white !important;\n "]))),
47
+ mainIcon: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: 48px;\n margin-bottom: 16px;\n filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2));\n "]))),
48
+ condition: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n font-size: 16px;\n font-weight: 500;\n margin-top: 8px;\n opacity: 0.9;\n color: white !important;\n "]))),
49
+ forecast: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n background: rgba(255, 255, 255, 0.1);\n backdrop-filter: blur(10px);\n padding: 16px 24px;\n "]))),
50
+ forecastItem: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 12px 0;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n \n &:last-child {\n border-bottom: none;\n padding-bottom: 4px;\n }\n\n &:first-child {\n padding-top: 4px;\n }\n "]))),
51
+ forecastDay: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n font-size: 14px;\n width: 60px;\n color: white !important;\n "]))),
52
+ forecastIcon: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n font-size: 20px;\n color: white;\n "]))),
53
+ forecastTemp: css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n font-size: 14px;\n font-weight: 500;\n width: 40px;\n text-align: right;\n color: white !important;\n "])))
54
+ };
55
+ });
56
+ var WeatherIcon = function WeatherIcon(_ref2) {
57
+ var type = _ref2.type,
58
+ className = _ref2.className;
59
+ switch (type) {
60
+ case 'sunny':
61
+ return /*#__PURE__*/_jsx(Sun, {
62
+ className: className
63
+ });
64
+ case 'rainy':
65
+ return /*#__PURE__*/_jsx(CloudRain, {
66
+ className: className
67
+ });
68
+ case 'cloudy':
69
+ return /*#__PURE__*/_jsx(Cloud, {
70
+ className: className
71
+ });
72
+ default:
73
+ return /*#__PURE__*/_jsx(Sun, {
74
+ className: className
75
+ });
76
+ }
77
+ };
78
+ var getWeatherLabel = function getWeatherLabel(type) {
79
+ switch (type) {
80
+ case 'sunny':
81
+ return '晴朗';
82
+ case 'rainy':
83
+ return '雨天';
84
+ case 'cloudy':
85
+ return '多云';
86
+ default:
87
+ return type;
88
+ }
89
+ };
90
+ export default function Weather() {
91
+ var _useStyles = useStyles(),
92
+ styles = _useStyles.styles;
93
+ var current = data[0];
94
+ var forecast = data.slice(1);
95
+ return /*#__PURE__*/_jsxs(Card, {
96
+ className: styles.container,
97
+ bordered: false,
98
+ children: [/*#__PURE__*/_jsx("div", {
99
+ className: styles.header,
100
+ children: /*#__PURE__*/_jsxs("div", {
101
+ children: [/*#__PURE__*/_jsx(Typography.Text, {
102
+ className: styles.location,
103
+ children: current.location
104
+ }), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx(Typography.Text, {
105
+ className: styles.date,
106
+ children: dayjs(current.date).format('MM月DD日 dddd')
107
+ })]
108
+ })
109
+ }), /*#__PURE__*/_jsxs("div", {
110
+ className: styles.mainWeather,
111
+ children: [/*#__PURE__*/_jsx(WeatherIcon, {
112
+ type: current.weather,
113
+ className: styles.mainIcon
114
+ }), /*#__PURE__*/_jsxs("div", {
115
+ className: styles.tempContainer,
116
+ children: [/*#__PURE__*/_jsx(Typography.Text, {
117
+ className: styles.temperature,
118
+ children: current.temperature
119
+ }), /*#__PURE__*/_jsx(Typography.Text, {
120
+ className: styles.degree,
121
+ children: "\xB0C"
122
+ })]
123
+ }), /*#__PURE__*/_jsx(Typography.Text, {
124
+ className: styles.condition,
125
+ children: getWeatherLabel(current.weather)
126
+ })]
127
+ }), /*#__PURE__*/_jsx("div", {
128
+ className: styles.forecast,
129
+ children: forecast.map(function (item, index) {
130
+ return /*#__PURE__*/_jsxs("div", {
131
+ className: styles.forecastItem,
132
+ children: [/*#__PURE__*/_jsx(Typography.Text, {
133
+ className: styles.forecastDay,
134
+ children: dayjs(item.date).format('ddd')
135
+ }), /*#__PURE__*/_jsx(WeatherIcon, {
136
+ type: item.weather,
137
+ className: styles.forecastIcon
138
+ }), /*#__PURE__*/_jsxs(Typography.Text, {
139
+ className: styles.forecastTemp,
140
+ children: [item.temperature, "\xB0"]
141
+ })]
142
+ }, index);
143
+ })
144
+ })]
145
+ });
146
+ }
@@ -38,6 +38,9 @@ export default function () {
38
38
  }
39
39
  });
40
40
  return _objectSpread(_objectSpread({}, optionsConfig), {}, {
41
+ customToolRenderConfig: {
42
+ // 'weather search mock': Weather,
43
+ },
41
44
  session: {
42
45
  multiple: true,
43
46
  api: sessionApi
@@ -11,13 +11,24 @@ export interface IRagProps {
11
11
  * @default ''
12
12
  */
13
13
  subTitle?: string;
14
+ /**
15
+ * @description 检索词
16
+ * @descriptionEn Query
17
+ */
18
+ query: string;
19
+ /**
20
+ * @description 检索词前缀
21
+ * @descriptionEn Query Title
22
+ * @default '检索 Query:'
23
+ */
24
+ queryTitle?: string;
14
25
  /**
15
26
  * @description 召回知识列表
16
27
  * @descriptionEn RAG List
17
28
  * @default []
18
29
  */
19
30
  list: {
20
- score?: number;
31
+ score?: number | string;
21
32
  title: string;
22
33
  content: string;
23
34
  footer: string;
@@ -5,12 +5,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  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; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { OperateCard, useProviderContext } from "../..";
8
- import { Empty, IconButton, Tag } from '@agentscope-ai/design';
9
- import { SparkBookLine, SparkDownLine, SparkUpLine } from '@agentscope-ai/icons';
8
+ import { IconButton, Tag } from '@agentscope-ai/design';
9
+ import { SparkBookLine, SparkDownLine, SparkUpLine, SparkWarningCircleFill } from '@agentscope-ai/icons';
10
10
  import { ConfigProvider, Flex, Image } from 'antd';
11
11
  import { useState } from 'react';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Fragment as _Fragment } from "react/jsx-runtime";
14
15
  function Images(_ref) {
15
16
  var images = _ref.images;
16
17
  var _useProviderContext = useProviderContext(),
@@ -94,10 +95,28 @@ export default function (props) {
94
95
  _props$defaultOpen = props.defaultOpen,
95
96
  defaultOpen = _props$defaultOpen === void 0 ? true : _props$defaultOpen,
96
97
  _props$placeholder = props.placeholder,
97
- placeholder = _props$placeholder === void 0 ? '未查询到与提问相关知识库' : _props$placeholder;
98
+ placeholder = _props$placeholder === void 0 ? '未查询到与提问相关知识库' : _props$placeholder,
99
+ query = props.query,
100
+ _props$queryTitle = props.queryTitle,
101
+ queryTitle = _props$queryTitle === void 0 ? '检索 Query:' : _props$queryTitle;
98
102
  var _useProviderContext3 = useProviderContext(),
99
103
  getPrefixCls = _useProviderContext3.getPrefixCls;
100
104
  var prefixCls = getPrefixCls('operate-card');
105
+ var children = props.list.length ? /*#__PURE__*/_jsx(OperateCard.LineBody, {
106
+ children: props.list.map(function (item, index) {
107
+ return /*#__PURE__*/_jsx(Item, {
108
+ item: item
109
+ }, index);
110
+ })
111
+ }) : /*#__PURE__*/_jsxs(Flex, {
112
+ align: "center",
113
+ justify: "center",
114
+ gap: 8,
115
+ className: "".concat(prefixCls, "-rag-empty-placeholder"),
116
+ children: [/*#__PURE__*/_jsx(SparkWarningCircleFill, {}), /*#__PURE__*/_jsx("span", {
117
+ children: placeholder
118
+ })]
119
+ });
101
120
  return /*#__PURE__*/_jsx(OperateCard, {
102
121
  header: {
103
122
  icon: /*#__PURE__*/_jsx(SparkBookLine, {}),
@@ -106,23 +125,14 @@ export default function (props) {
106
125
  },
107
126
  body: {
108
127
  defaultOpen: defaultOpen,
109
- children: /*#__PURE__*/_jsx(OperateCard.LineBody, {
110
- children: props.list.length ? props.list.map(function (item, index) {
111
- return /*#__PURE__*/_jsx(Item, {
112
- item: item
113
- }, index);
114
- }) : /*#__PURE__*/_jsxs(Flex, {
115
- vertical: true,
116
- align: "center",
117
- justify: "center",
118
- children: [/*#__PURE__*/_jsx(Empty, {
119
- type: "noData",
120
- size: 160
121
- }), placeholder && /*#__PURE__*/_jsx("div", {
122
- className: "".concat(prefixCls, "-rag-empty-placeholder"),
123
- children: placeholder
124
- })]
125
- })
128
+ children: /*#__PURE__*/_jsxs(_Fragment, {
129
+ children: [query && /*#__PURE__*/_jsxs("div", {
130
+ className: "".concat(prefixCls, "-rag-query"),
131
+ children: [/*#__PURE__*/_jsx("span", {
132
+ className: "".concat(prefixCls, "-rag-query-title"),
133
+ children: queryTitle
134
+ }), query]
135
+ }), children]
126
136
  })
127
137
  }
128
138
  });
@@ -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.", "-operate-card {\n width: 100%;\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 margin-top: 8px;\n\n \n &-title {\n font-size: 12px;\n color: ", ";\n line-height: 20px;\n margin-bottom: 4px;\n }\n\n }\n\n\n\n &-device-action {\n height: auto;\n align-items: flex-start;\n\n &-icon {\n margin-top: 6px;\n }\n\n &-time {\n margin-bottom: 4px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n }\n\n &-content {\n \n width: 100%;\n display: flex;\n justify-content: space-between;\n }\n\n &-description {\n width: 0;\n flex: 1;\n margin: 8px 0 6px 0;\n }\n\n &-image {\n margin: 4px 0;\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 \n }\n\n &-rag-empty-placeholder {\n margin-top: -24px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n padding-bottom: 16px;\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 display: flex;\n align-items: center;\n cursor: pointer;\n }\n\n &-content {\n padding: 8px;\n border-radius: 6px;\n background-color: ", ";\n }\n\n &-images {\n margin-top: 8px;\n padding: 8px;\n display: flex;\n gap: 8px;\n background-color: ", ";\n \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) {
4
+ export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-operate-card {\n width: 100%;\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 margin-top: 8px;\n\n \n &-title {\n font-size: 12px;\n color: ", ";\n line-height: 20px;\n margin-bottom: 4px;\n }\n\n }\n\n\n\n &-device-action {\n height: auto;\n align-items: flex-start;\n\n &-icon {\n margin-top: 6px;\n }\n\n &-time {\n margin-bottom: 4px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n }\n\n &-content {\n \n width: 100%;\n display: flex;\n justify-content: space-between;\n }\n\n &-description {\n width: 0;\n flex: 1;\n margin: 8px 0 6px 0;\n }\n\n &-image {\n margin: 4px 0;\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 \n }\n\n &-rag-empty-placeholder {\n padding: 16px 0;\n border: 1px solid ", ";\n border-radius: 6px;\n background-color: ", ";\n line-height: 20px;\n font-size: 12px;\n color: ", ";\n margin: 0 12px 12px 12px;\n }\n\n &-rag-query {\n margin: 0 12px 12px 12px;\n line-height: 20px;\n font-size: 12px;\n color: ", ";\n\n &-title {\n font-weight: 500;\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 display: flex;\n align-items: center;\n cursor: pointer;\n }\n\n &-content {\n padding: 8px;\n border-radius: 6px;\n background-color: ", ";\n }\n\n &-images {\n margin-top: 8px;\n padding: 8px;\n display: flex;\n gap: 8px;\n background-color: ", ";\n \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
5
  return p.theme.prefixCls;
6
6
  }, function (p) {
7
7
  return p.theme.borderRadiusLG;
@@ -42,7 +42,13 @@ export default createGlobalStyle(_templateObject || (_templateObject = _taggedTe
42
42
  }, function (p) {
43
43
  return p.theme.colorBorderSecondary;
44
44
  }, function (p) {
45
- return p.theme.colorTextTertiary;
45
+ return p.theme.colorBorderSecondary;
46
+ }, function (p) {
47
+ return p.theme.colorBgBase;
48
+ }, function (p) {
49
+ return p.theme.colorTextSecondary;
50
+ }, function (p) {
51
+ return p.theme.colorTextSecondary;
46
52
  }, function (p) {
47
53
  return p.theme.colorText;
48
54
  }, function (p) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/chat",
3
- "version": "1.1.43-beta.1765868055060-beta.1765869194774",
3
+ "version": "1.1.43-beta.1765941695971",
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": [
@@ -58,6 +58,7 @@
58
58
  ]
59
59
  },
60
60
  "dependencies": {
61
+ "@agentscope-ai/design": "^1.0.0",
61
62
  "@agentscope-ai/icons": "^1.0.32",
62
63
  "@agentscope-ai/icons-override-antd": "^6.0.0",
63
64
  "@agentscope-ai/icons-svg-override-antd": "^4.4.2",
@@ -65,7 +66,6 @@
65
66
  "@ant-design/graphs": "^2.1.1",
66
67
  "@ant-design/icons": "^5.0.1",
67
68
  "@ant-design/x-markdown": "^2.0.0",
68
- "@agentscope-ai/design": "^1.0.17",
69
69
  "ahooks": "^3.8.4",
70
70
  "antd-style": "^3.7.1",
71
71
  "classnames": "^2.5.1",
@@ -75,8 +75,8 @@
75
75
  "immer": "^10.1.1",
76
76
  "lodash": "^4.17.21",
77
77
  "mermaid": "^11.6.0",
78
- "rc-util": "^5.29.1",
79
78
  "rc-motion": "^2.9.5",
79
+ "rc-util": "^5.29.1",
80
80
  "react-error-boundary": "^6.0.0",
81
81
  "react-syntax-highlighter": "^15.6.6",
82
82
  "react-transition-group": "^4.4.5",
@@ -106,6 +106,7 @@
106
106
  "father": "^4.1.0",
107
107
  "husky": "^8.0.1",
108
108
  "lint-staged": "^13.0.3",
109
+ "lucide-react": "^0.561.0",
109
110
  "openai": "^4.98.0",
110
111
  "prettier": "^2.7.1",
111
112
  "prettier-plugin-organize-imports": "^3.0.0",