@agentscope-ai/chat 1.1.43-beta.1765881837025 → 1.1.43

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.
Binary file
@@ -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,
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/chat",
3
- "version": "1.1.43-beta.1765881837025",
3
+ "version": "1.1.43",
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",