@agentscope-ai/chat 1.1.62 → 1.1.63-beta.1778751563321
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.
- package/components/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Request/Actions.tsx +42 -0
- package/components/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Request/Card.tsx +5 -1
- package/components/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Actions.tsx +17 -2
- package/components/AgentScopeRuntimeWebUI/core/types/IChatAnywhere.ts +31 -3
- package/components/Bubble/style/list.ts +5 -0
- package/components/Markdown/core/index.tsx +3 -3
- package/lib/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Request/Actions.d.ts +4 -0
- package/lib/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Request/Actions.js +50 -0
- package/lib/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Request/Card.js +10 -3
- package/lib/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Actions.js +36 -5
- package/lib/AgentScopeRuntimeWebUI/core/types/IChatAnywhere.d.ts +34 -4
- package/lib/Bubble/style/list.js +3 -1
- package/lib/Markdown/core/index.d.ts +3 -1
- package/lib/Markdown/core/index.js +3 -4
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SparkCopyLine } from "@agentscope-ai/icons";
|
|
2
|
+
import { AgentScopeRuntimeContentType, IAgentScopeRuntimeRequest } from "../types";
|
|
3
|
+
import { Bubble } from "@agentscope-ai/chat";
|
|
4
|
+
import { copy } from "../../../../Util/copy";
|
|
5
|
+
import { useChatAnywhereOptions } from "../../Context/ChatAnywhereOptionsContext";
|
|
6
|
+
|
|
7
|
+
function getTextContent(data: IAgentScopeRuntimeRequest): string {
|
|
8
|
+
return data.input
|
|
9
|
+
.flatMap(i => i.content)
|
|
10
|
+
.filter(c => c.type === AgentScopeRuntimeContentType.TEXT)
|
|
11
|
+
.map(c => (c as { text: string }).text)
|
|
12
|
+
.join('\n');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function RequestActions(props: {
|
|
16
|
+
data: IAgentScopeRuntimeRequest;
|
|
17
|
+
}) {
|
|
18
|
+
const requestActionsOptions = useChatAnywhereOptions(v => v.requestActions);
|
|
19
|
+
if (!requestActionsOptions) return null;
|
|
20
|
+
|
|
21
|
+
const text = getTextContent(props.data);
|
|
22
|
+
|
|
23
|
+
const defaultActions = text ? [
|
|
24
|
+
{
|
|
25
|
+
icon: <SparkCopyLine />,
|
|
26
|
+
onClick: () => { copy(text); },
|
|
27
|
+
},
|
|
28
|
+
] : [];
|
|
29
|
+
|
|
30
|
+
const actions = (requestActionsOptions.list || defaultActions).map(i => ({
|
|
31
|
+
...i,
|
|
32
|
+
onClick: () => { i.onClick?.({ data: props.data }); },
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
if (!actions.length) return null;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Bubble.Footer
|
|
39
|
+
right={<Bubble.Footer.Actions data={actions} />}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AgentScopeRuntimeContentType, IAgentScopeRuntimeRequest } from '../types';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { Bubble } from '@agentscope-ai/chat';
|
|
5
|
+
import Actions from './Actions';
|
|
5
6
|
|
|
6
7
|
export default function AgentScopeRuntimeRequestCard(props: {
|
|
7
8
|
data: IAgentScopeRuntimeRequest;
|
|
@@ -73,6 +74,9 @@ export default function AgentScopeRuntimeRequestCard(props: {
|
|
|
73
74
|
|
|
74
75
|
if (!cards?.length) return null;
|
|
75
76
|
|
|
76
|
-
return
|
|
77
|
+
return <>
|
|
78
|
+
<Bubble role="user" cards={cards}></Bubble>
|
|
79
|
+
<Actions data={props.data} />
|
|
80
|
+
</>;
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -10,7 +10,6 @@ import { useChatAnywhereOptions } from "../../Context/ChatAnywhereOptionsContext
|
|
|
10
10
|
import { useTranslation } from "../../Context/ChatAnywhereI18nContext";
|
|
11
11
|
import React from "react";
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
function Usage(props: {
|
|
15
14
|
input_tokens: string;
|
|
16
15
|
output_tokens: string;
|
|
@@ -37,6 +36,7 @@ export default function Tools(props: {
|
|
|
37
36
|
];
|
|
38
37
|
|
|
39
38
|
const replace = useChatAnywhereOptions(v => v.actions?.replace) ?? true;
|
|
39
|
+
const rightOption = useChatAnywhereOptions(v => v.actions?.right);
|
|
40
40
|
|
|
41
41
|
const actions = compact([
|
|
42
42
|
...actionsOptionsList.map(i => {
|
|
@@ -62,11 +62,26 @@ export default function Tools(props: {
|
|
|
62
62
|
} : null,
|
|
63
63
|
]);
|
|
64
64
|
|
|
65
|
+
let rightNode: React.ReactElement | null;
|
|
66
|
+
if (rightOption === false || (Array.isArray(rightOption) && rightOption.length === 0)) {
|
|
67
|
+
rightNode = null;
|
|
68
|
+
} else if (Array.isArray(rightOption)) {
|
|
69
|
+
const rightActions = rightOption.map(i => {
|
|
70
|
+
const res = { ...i } as any;
|
|
71
|
+
if (i.render) {
|
|
72
|
+
res.children = React.createElement(i.render, { data: props.data });
|
|
73
|
+
}
|
|
74
|
+
return { ...res, onClick: () => { i.onClick?.({ data: props.data }); } };
|
|
75
|
+
});
|
|
76
|
+
rightNode = <Bubble.Footer.Actions data={rightActions} />;
|
|
77
|
+
} else {
|
|
78
|
+
rightNode = <Usage input_tokens={props.data.usage?.input_tokens} output_tokens={props.data.usage?.output_tokens} />;
|
|
79
|
+
}
|
|
65
80
|
|
|
66
81
|
if (!AgentScopeRuntimeResponseBuilder.maybeDone(props.data)) return null;
|
|
67
82
|
return <Bubble.Footer
|
|
68
83
|
left={<Bubble.Footer.Actions data={actions} />}
|
|
69
|
-
right={
|
|
84
|
+
right={rightNode}
|
|
70
85
|
/>
|
|
71
86
|
}
|
|
72
87
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UploadProps } from 'antd';
|
|
2
2
|
import {
|
|
3
3
|
IAgentScopeRuntimeMessage,
|
|
4
|
+
IAgentScopeRuntimeRequest,
|
|
4
5
|
IAgentScopeRuntimeResponse,
|
|
5
6
|
IContent,
|
|
6
7
|
} from '../AgentScopeRuntime/types';
|
|
@@ -414,17 +415,34 @@ export interface IAgentScopeRuntimeWebUIOptions {
|
|
|
414
415
|
customToolRenderConfig?: IAgentScopeRuntimeWebUICardsOptions;
|
|
415
416
|
|
|
416
417
|
/**
|
|
417
|
-
* @description
|
|
418
|
-
* @descriptionEn Actions configuration
|
|
418
|
+
* @description 操作按钮配置(助手消息)
|
|
419
|
+
* @descriptionEn Actions configuration (assistant messages)
|
|
419
420
|
*/
|
|
420
421
|
actions?: IAgentScopeRuntimeWebUIActionsOptions;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* @description 用户消息操作按钮配置
|
|
425
|
+
* @descriptionEn Actions configuration (user messages)
|
|
426
|
+
*/
|
|
427
|
+
requestActions?: IAgentScopeRuntimeWebUIRequestActionsOptions;
|
|
421
428
|
}
|
|
422
429
|
|
|
423
|
-
export interface
|
|
430
|
+
export interface IAgentScopeRuntimeWebUIRequestActionsOptions {
|
|
424
431
|
/**
|
|
425
432
|
* @description 操作按钮列表
|
|
426
433
|
* @descriptionEn Actions button list
|
|
427
434
|
*/
|
|
435
|
+
list?: {
|
|
436
|
+
icon?: React.ReactElement;
|
|
437
|
+
onClick?: ({ data }: { data: IAgentScopeRuntimeRequest }) => void;
|
|
438
|
+
}[];
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export interface IAgentScopeRuntimeWebUIActionsOptions {
|
|
442
|
+
/**
|
|
443
|
+
* @description 操作按钮列表(左侧)
|
|
444
|
+
* @descriptionEn Actions button list (left side)
|
|
445
|
+
*/
|
|
428
446
|
list: {
|
|
429
447
|
icon?: React.ReactElement;
|
|
430
448
|
render?: ({
|
|
@@ -435,6 +453,16 @@ export interface IAgentScopeRuntimeWebUIActionsOptions {
|
|
|
435
453
|
onClick?: ({ data }: { data: IAgentScopeRuntimeResponse }) => void;
|
|
436
454
|
}[];
|
|
437
455
|
|
|
456
|
+
/**
|
|
457
|
+
* @description 右侧操作按钮列表;不传时默认展示 token 用量;传空数组或 false 隐藏右侧
|
|
458
|
+
* @descriptionEn Right-side actions; defaults to token usage; pass [] or false to hide
|
|
459
|
+
*/
|
|
460
|
+
right?: false | {
|
|
461
|
+
icon?: React.ReactElement;
|
|
462
|
+
render?: ({ data }: { data: IAgentScopeRuntimeResponse }) => React.ReactElement;
|
|
463
|
+
onClick?: ({ data }: { data: IAgentScopeRuntimeResponse }) => void;
|
|
464
|
+
}[];
|
|
465
|
+
|
|
438
466
|
/**
|
|
439
467
|
* @description 是否显示重新生成按钮
|
|
440
468
|
* @descriptionEn Whether to show the replace button
|
|
@@ -2,10 +2,10 @@ import XMarkdown from '@ant-design/x-markdown';
|
|
|
2
2
|
import { InnerMarkdownXProps } from '../types';
|
|
3
3
|
import Styles from '../styles';
|
|
4
4
|
import useCursorContent from './hooks/useCursorContent';
|
|
5
|
-
import { useMemo } from 'react';
|
|
5
|
+
import { memo, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
export default function (props: InnerMarkdownXProps) {
|
|
8
|
+
export default memo(function InnerMarkdownX(props: InnerMarkdownXProps) {
|
|
9
9
|
const { content: originalContent, cursor, animation, ...rest } = props;
|
|
10
10
|
const content = useCursorContent({
|
|
11
11
|
cursor: cursor,
|
|
@@ -33,4 +33,4 @@ export default function (props: InnerMarkdownXProps) {
|
|
|
33
33
|
}}
|
|
34
34
|
/>
|
|
35
35
|
</>;
|
|
36
|
-
};
|
|
36
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import { SparkCopyLine } from "@agentscope-ai/icons";
|
|
8
|
+
import { AgentScopeRuntimeContentType } from "../types";
|
|
9
|
+
import { Bubble } from "../../../..";
|
|
10
|
+
import { copy } from "../../../../Util/copy";
|
|
11
|
+
import { useChatAnywhereOptions } from "../../Context/ChatAnywhereOptionsContext";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
function getTextContent(data) {
|
|
14
|
+
return data.input.flatMap(function (i) {
|
|
15
|
+
return i.content;
|
|
16
|
+
}).filter(function (c) {
|
|
17
|
+
return c.type === AgentScopeRuntimeContentType.TEXT;
|
|
18
|
+
}).map(function (c) {
|
|
19
|
+
return c.text;
|
|
20
|
+
}).join('\n');
|
|
21
|
+
}
|
|
22
|
+
export default function RequestActions(props) {
|
|
23
|
+
var requestActionsOptions = useChatAnywhereOptions(function (v) {
|
|
24
|
+
return v.requestActions;
|
|
25
|
+
});
|
|
26
|
+
if (!requestActionsOptions) return null;
|
|
27
|
+
var text = getTextContent(props.data);
|
|
28
|
+
var defaultActions = text ? [{
|
|
29
|
+
icon: /*#__PURE__*/_jsx(SparkCopyLine, {}),
|
|
30
|
+
onClick: function onClick() {
|
|
31
|
+
copy(text);
|
|
32
|
+
}
|
|
33
|
+
}] : [];
|
|
34
|
+
var actions = (requestActionsOptions.list || defaultActions).map(function (i) {
|
|
35
|
+
return _objectSpread(_objectSpread({}, i), {}, {
|
|
36
|
+
onClick: function onClick() {
|
|
37
|
+
var _i$onClick;
|
|
38
|
+
(_i$onClick = i.onClick) === null || _i$onClick === void 0 || _i$onClick.call(i, {
|
|
39
|
+
data: props.data
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
if (!actions.length) return null;
|
|
45
|
+
return /*#__PURE__*/_jsx(Bubble.Footer, {
|
|
46
|
+
right: /*#__PURE__*/_jsx(Bubble.Footer.Actions, {
|
|
47
|
+
data: actions
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AgentScopeRuntimeContentType } from "../types";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { Bubble } from "../../../..";
|
|
4
|
+
import Actions from "./Actions";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
8
|
export default function AgentScopeRuntimeRequestCard(props) {
|
|
6
9
|
var cards = useMemo(function () {
|
|
7
10
|
return props.data.input[0].content.reduce(function (p, c) {
|
|
@@ -92,8 +95,12 @@ export default function AgentScopeRuntimeRequestCard(props) {
|
|
|
92
95
|
}, []);
|
|
93
96
|
}, [props.data.input]);
|
|
94
97
|
if (!(cards !== null && cards !== void 0 && cards.length)) return null;
|
|
95
|
-
return /*#__PURE__*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
99
|
+
children: [/*#__PURE__*/_jsx(Bubble, {
|
|
100
|
+
role: "user",
|
|
101
|
+
cards: cards
|
|
102
|
+
}), /*#__PURE__*/_jsx(Actions, {
|
|
103
|
+
data: props.data
|
|
104
|
+
})]
|
|
98
105
|
});
|
|
99
106
|
}
|
|
@@ -28,7 +28,7 @@ function Usage(props) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
export default function Tools(props) {
|
|
31
|
-
var _useChatAnywhereOptio
|
|
31
|
+
var _useChatAnywhereOptio;
|
|
32
32
|
var _useTranslation = useTranslation(),
|
|
33
33
|
t = _useTranslation.t;
|
|
34
34
|
var actionsOptionsList = useChatAnywhereOptions(function (v) {
|
|
@@ -44,6 +44,10 @@ export default function Tools(props) {
|
|
|
44
44
|
var _v$actions2;
|
|
45
45
|
return (_v$actions2 = v.actions) === null || _v$actions2 === void 0 ? void 0 : _v$actions2.replace;
|
|
46
46
|
})) !== null && _useChatAnywhereOptio !== void 0 ? _useChatAnywhereOptio : true;
|
|
47
|
+
var rightOption = useChatAnywhereOptions(function (v) {
|
|
48
|
+
var _v$actions3;
|
|
49
|
+
return (_v$actions3 = v.actions) === null || _v$actions3 === void 0 ? void 0 : _v$actions3.right;
|
|
50
|
+
});
|
|
47
51
|
var actions = compact([].concat(_toConsumableArray(actionsOptionsList.map(function (i) {
|
|
48
52
|
var res = i;
|
|
49
53
|
if (i.render) {
|
|
@@ -69,14 +73,41 @@ export default function Tools(props) {
|
|
|
69
73
|
});
|
|
70
74
|
}
|
|
71
75
|
} : null]));
|
|
76
|
+
var rightNode;
|
|
77
|
+
if (rightOption === false || Array.isArray(rightOption) && rightOption.length === 0) {
|
|
78
|
+
rightNode = null;
|
|
79
|
+
} else if (Array.isArray(rightOption)) {
|
|
80
|
+
var rightActions = rightOption.map(function (i) {
|
|
81
|
+
var res = _objectSpread({}, i);
|
|
82
|
+
if (i.render) {
|
|
83
|
+
res.children = /*#__PURE__*/React.createElement(i.render, {
|
|
84
|
+
data: props.data
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return _objectSpread(_objectSpread({}, res), {}, {
|
|
88
|
+
onClick: function onClick() {
|
|
89
|
+
var _i$onClick2;
|
|
90
|
+
(_i$onClick2 = i.onClick) === null || _i$onClick2 === void 0 || _i$onClick2.call(i, {
|
|
91
|
+
data: props.data
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
rightNode = /*#__PURE__*/_jsx(Bubble.Footer.Actions, {
|
|
97
|
+
data: rightActions
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
var _props$data$usage, _props$data$usage2;
|
|
101
|
+
rightNode = /*#__PURE__*/_jsx(Usage, {
|
|
102
|
+
input_tokens: (_props$data$usage = props.data.usage) === null || _props$data$usage === void 0 ? void 0 : _props$data$usage.input_tokens,
|
|
103
|
+
output_tokens: (_props$data$usage2 = props.data.usage) === null || _props$data$usage2 === void 0 ? void 0 : _props$data$usage2.output_tokens
|
|
104
|
+
});
|
|
105
|
+
}
|
|
72
106
|
if (!AgentScopeRuntimeResponseBuilder.maybeDone(props.data)) return null;
|
|
73
107
|
return /*#__PURE__*/_jsx(Bubble.Footer, {
|
|
74
108
|
left: /*#__PURE__*/_jsx(Bubble.Footer.Actions, {
|
|
75
109
|
data: actions
|
|
76
110
|
}),
|
|
77
|
-
right:
|
|
78
|
-
input_tokens: (_props$data$usage = props.data.usage) === null || _props$data$usage === void 0 ? void 0 : _props$data$usage.input_tokens,
|
|
79
|
-
output_tokens: (_props$data$usage2 = props.data.usage) === null || _props$data$usage2 === void 0 ? void 0 : _props$data$usage2.output_tokens
|
|
80
|
-
})
|
|
111
|
+
right: rightNode
|
|
81
112
|
});
|
|
82
113
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { UploadProps } from 'antd';
|
|
3
|
-
import { IAgentScopeRuntimeMessage, IAgentScopeRuntimeResponse, IContent } from '../AgentScopeRuntime/types';
|
|
3
|
+
import { IAgentScopeRuntimeMessage, IAgentScopeRuntimeRequest, IAgentScopeRuntimeResponse, IContent } from '../AgentScopeRuntime/types';
|
|
4
4
|
import { IAgentScopeRuntimeWebUISession } from './ISessions';
|
|
5
5
|
/**
|
|
6
6
|
* @description API 配置选项
|
|
@@ -394,16 +394,33 @@ export interface IAgentScopeRuntimeWebUIOptions {
|
|
|
394
394
|
*/
|
|
395
395
|
customToolRenderConfig?: IAgentScopeRuntimeWebUICardsOptions;
|
|
396
396
|
/**
|
|
397
|
-
* @description
|
|
398
|
-
* @descriptionEn Actions configuration
|
|
397
|
+
* @description 操作按钮配置(助手消息)
|
|
398
|
+
* @descriptionEn Actions configuration (assistant messages)
|
|
399
399
|
*/
|
|
400
400
|
actions?: IAgentScopeRuntimeWebUIActionsOptions;
|
|
401
|
+
/**
|
|
402
|
+
* @description 用户消息操作按钮配置
|
|
403
|
+
* @descriptionEn Actions configuration (user messages)
|
|
404
|
+
*/
|
|
405
|
+
requestActions?: IAgentScopeRuntimeWebUIRequestActionsOptions;
|
|
401
406
|
}
|
|
402
|
-
export interface
|
|
407
|
+
export interface IAgentScopeRuntimeWebUIRequestActionsOptions {
|
|
403
408
|
/**
|
|
404
409
|
* @description 操作按钮列表
|
|
405
410
|
* @descriptionEn Actions button list
|
|
406
411
|
*/
|
|
412
|
+
list?: {
|
|
413
|
+
icon?: React.ReactElement;
|
|
414
|
+
onClick?: ({ data }: {
|
|
415
|
+
data: IAgentScopeRuntimeRequest;
|
|
416
|
+
}) => void;
|
|
417
|
+
}[];
|
|
418
|
+
}
|
|
419
|
+
export interface IAgentScopeRuntimeWebUIActionsOptions {
|
|
420
|
+
/**
|
|
421
|
+
* @description 操作按钮列表(左侧)
|
|
422
|
+
* @descriptionEn Actions button list (left side)
|
|
423
|
+
*/
|
|
407
424
|
list: {
|
|
408
425
|
icon?: React.ReactElement;
|
|
409
426
|
render?: ({ data, }: {
|
|
@@ -413,6 +430,19 @@ export interface IAgentScopeRuntimeWebUIActionsOptions {
|
|
|
413
430
|
data: IAgentScopeRuntimeResponse;
|
|
414
431
|
}) => void;
|
|
415
432
|
}[];
|
|
433
|
+
/**
|
|
434
|
+
* @description 右侧操作按钮列表;不传时默认展示 token 用量;传空数组或 false 隐藏右侧
|
|
435
|
+
* @descriptionEn Right-side actions; defaults to token usage; pass [] or false to hide
|
|
436
|
+
*/
|
|
437
|
+
right?: false | {
|
|
438
|
+
icon?: React.ReactElement;
|
|
439
|
+
render?: ({ data }: {
|
|
440
|
+
data: IAgentScopeRuntimeResponse;
|
|
441
|
+
}) => React.ReactElement;
|
|
442
|
+
onClick?: ({ data }: {
|
|
443
|
+
data: IAgentScopeRuntimeResponse;
|
|
444
|
+
}) => void;
|
|
445
|
+
}[];
|
|
416
446
|
/**
|
|
417
447
|
* @description 是否显示重新生成按钮
|
|
418
448
|
* @descriptionEn Whether to show the replace button
|
package/lib/Bubble/style/list.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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.", "-bubble-list-wrapper {\n position: relative;\n overflow: hidden;\n height: 100%;\n}\n\n.", "-bubble-list-scroll {\n height: 100%;\n width: 100%;\n overflow: auto;\n scrollbar-gutter: stable both-edges;\n}\n\n.", "-bubble-list {\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 16px 16px 0 16px;\n\n &::after {\n display: block;\n content: ' ';\n height: 16px;\n }\n\n &-order-desc {\n flex-direction: column-reverse;\n\n &::before {\n display: block;\n content: ' ';\n height: 16px;\n flex: 0 0 16px;\n }\n\n &::after {\n height: 0;\n flex: 0 0 0;\n }\n }\n\n &-order-desc-short {\n height: 0;\n flex: 1;\n }\n}\n\n.", "-bubble-list-load-more {\n display: flex;\n padding: 16px 0;\n justify-content: center;\n align-items: center;\n}\n\n.", "-bubble-list-scroll-to-bottom {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 10px;\n display: flex;\n justify-content: center;\n transition: all 0.2s;\n z-index: 10;\n\n &-hide {\n opacity: 0;\n transform: translateY(100%);\n pointer-events: none;\n }\n\n &-show {\n opacity: 1;\n transform: translateY(0%);\n }\n\n button {\n &:hover {\n border-color: ", " !important;\n background-color: ", " !important;\n color: ", " !important;\n }\n }\n}\n"])), function (p) {
|
|
4
|
+
export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-bubble-list-wrapper {\n position: relative;\n overflow: hidden;\n height: 100%;\n}\n\n.", "-bubble-list-scroll {\n height: 100%;\n width: 100%;\n overflow: auto;\n scrollbar-gutter: stable both-edges;\n}\n\n.", "-bubble-list {\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 16px 16px 0 16px;\n\n > .", "-bubble {\n content-visibility: auto;\n contain-intrinsic-size: auto 120px;\n }\n\n &::after {\n display: block;\n content: ' ';\n height: 16px;\n }\n\n &-order-desc {\n flex-direction: column-reverse;\n\n &::before {\n display: block;\n content: ' ';\n height: 16px;\n flex: 0 0 16px;\n }\n\n &::after {\n height: 0;\n flex: 0 0 0;\n }\n }\n\n &-order-desc-short {\n height: 0;\n flex: 1;\n }\n}\n\n.", "-bubble-list-load-more {\n display: flex;\n padding: 16px 0;\n justify-content: center;\n align-items: center;\n}\n\n.", "-bubble-list-scroll-to-bottom {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 10px;\n display: flex;\n justify-content: center;\n transition: all 0.2s;\n z-index: 10;\n\n &-hide {\n opacity: 0;\n transform: translateY(100%);\n pointer-events: none;\n }\n\n &-show {\n opacity: 1;\n transform: translateY(0%);\n }\n\n button {\n &:hover {\n border-color: ", " !important;\n background-color: ", " !important;\n color: ", " !important;\n }\n }\n}\n"])), function (p) {
|
|
5
|
+
return p.theme.prefixCls;
|
|
6
|
+
}, function (p) {
|
|
5
7
|
return p.theme.prefixCls;
|
|
6
8
|
}, function (p) {
|
|
7
9
|
return p.theme.prefixCls;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { InnerMarkdownXProps } from '../types';
|
|
2
|
-
|
|
3
|
+
declare const _default: import("react").NamedExoticComponent<InnerMarkdownXProps>;
|
|
4
|
+
export default _default;
|
|
@@ -10,11 +10,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
10
10
|
import XMarkdown from '@ant-design/x-markdown';
|
|
11
11
|
import Styles from "../styles";
|
|
12
12
|
import useCursorContent from "./hooks/useCursorContent";
|
|
13
|
-
import { useMemo } from 'react';
|
|
13
|
+
import { memo, useMemo } from 'react';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
export default function (props) {
|
|
17
|
+
export default /*#__PURE__*/memo(function InnerMarkdownX(props) {
|
|
18
18
|
var originalContent = props.content,
|
|
19
19
|
cursor = props.cursor,
|
|
20
20
|
animation = props.animation,
|
|
@@ -37,5 +37,4 @@ export default function (props) {
|
|
|
37
37
|
streaming: streaming
|
|
38
38
|
}))]
|
|
39
39
|
});
|
|
40
|
-
}
|
|
41
|
-
;
|
|
40
|
+
});
|
package/package.json
CHANGED