@ant-design/agentic-ui 2.28.6 → 2.28.7-beta.0
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/dist/Bubble/Bubble.js +13 -10
- package/dist/Bubble/schema-editor/SchemaEditorBridgeManager.d.ts +3 -3
- package/dist/Bubble/schema-editor/SchemaEditorBridgeManager.js +7 -7
- package/dist/Hooks/useLanguage.d.ts +4 -0
- package/dist/I18n/locales.d.ts +4 -0
- package/dist/I18n/locales.js +10 -2
- package/dist/Workspace/Browser/index.d.ts +57 -30
- package/dist/Workspace/Browser/index.js +270 -47
- package/dist/Workspace/Browser/style.js +120 -3
- package/dist/Workspace/index.js +7 -6
- package/dist/Workspace/types.d.ts +3 -3
- package/dist/Workspace/types.js +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/package.json +2 -2
package/dist/Bubble/Bubble.js
CHANGED
|
@@ -50,7 +50,7 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
-
import { memo } from "react";
|
|
53
|
+
import { memo, useMemo } from "react";
|
|
54
54
|
import React from "react";
|
|
55
55
|
import { debugInfo } from "../Utils/debugUtils";
|
|
56
56
|
import { AIBubble } from "./AIBubble";
|
|
@@ -104,19 +104,22 @@ import { UserBubble } from "./UserBubble";
|
|
|
104
104
|
* @returns {React.ReactElement} 渲染的聊天气泡组件
|
|
105
105
|
*/ export var Bubble = /*#__PURE__*/ memo(function(props) {
|
|
106
106
|
var originData = props.originData;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
/**
|
|
110
|
-
* Schema Editor Bridge Hook
|
|
111
|
-
* @description 开发环境自动启用,生产环境返回原始内容
|
|
112
|
-
*/ var content = useSchemaEditorBridge(props.id, initialContent).content;
|
|
107
|
+
var isStringContent = typeof (originData === null || originData === void 0 ? void 0 : originData.content) === 'string';
|
|
108
|
+
/** Schema Editor Bridge - 开发环境自动启用 */ var content = useSchemaEditorBridge(props.id, isStringContent ? originData.content : '').content;
|
|
113
109
|
debugInfo('useSchemaEditorBridge', content);
|
|
114
110
|
/** 根据角色自动选择组件 */ var isUserMessage = props.placement === undefined ? (originData === null || originData === void 0 ? void 0 : originData.role) === 'user' : props.placement === 'right';
|
|
111
|
+
/** 稳定 originData 引用 */ var memoizedOriginData = useMemo(function() {
|
|
112
|
+
return originData ? _object_spread({}, originData, isStringContent && {
|
|
113
|
+
content: content
|
|
114
|
+
}) : undefined;
|
|
115
|
+
}, [
|
|
116
|
+
originData,
|
|
117
|
+
isStringContent,
|
|
118
|
+
content
|
|
119
|
+
]);
|
|
115
120
|
/** 构建传递给子组件的 props */ var bubbleProps = _object_spread_props(_object_spread({}, props), {
|
|
116
121
|
placement: props.placement || (isUserMessage ? 'right' : 'left'),
|
|
117
|
-
originData:
|
|
118
|
-
content: content
|
|
119
|
-
}) : undefined
|
|
122
|
+
originData: memoizedOriginData
|
|
120
123
|
});
|
|
121
124
|
debugInfo('bubbleProps', {
|
|
122
125
|
isUserMessage: isUserMessage,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SchemaValue } from '@schema-editor/host-sdk/core';
|
|
1
|
+
import type { SchemaValue } from '@schema-element-editor/host-sdk/core';
|
|
2
2
|
/**
|
|
3
3
|
* Bubble 处理器接口
|
|
4
4
|
* @description 每个 Bubble 组件注册时提供的处理器
|
|
@@ -42,8 +42,8 @@ export declare class SchemaEditorBridgeManager {
|
|
|
42
42
|
private static instance;
|
|
43
43
|
/** Bubble 处理器注册表:id -> handler */
|
|
44
44
|
private registry;
|
|
45
|
-
/** Bridge
|
|
46
|
-
private
|
|
45
|
+
/** Bridge 实例 */
|
|
46
|
+
private bridge;
|
|
47
47
|
/** 是否启用 */
|
|
48
48
|
private enabled;
|
|
49
49
|
/** 预览 Root */
|
|
@@ -30,7 +30,7 @@ function _define_property(obj, key, value) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
-
import {
|
|
33
|
+
import { createSchemaElementEditorBridge } from "@schema-element-editor/host-sdk/core";
|
|
34
34
|
import React from "react";
|
|
35
35
|
import ReactDOM from "react-dom/client";
|
|
36
36
|
import { MarkdownEditor } from "../../MarkdownEditor";
|
|
@@ -64,7 +64,7 @@ import { MarkdownEditor } from "../../MarkdownEditor";
|
|
|
64
64
|
function SchemaEditorBridgeManager() {
|
|
65
65
|
_class_call_check(this, SchemaEditorBridgeManager);
|
|
66
66
|
/** Bubble 处理器注册表:id -> handler */ _define_property(this, "registry", new Map());
|
|
67
|
-
/** Bridge
|
|
67
|
+
/** Bridge 实例 */ _define_property(this, "bridge", null);
|
|
68
68
|
/** 是否启用 */ _define_property(this, "enabled", false);
|
|
69
69
|
/** 预览 Root */ _define_property(this, "previewRoot", null);
|
|
70
70
|
/** 当前正在编辑的 Bubble id */ _define_property(this, "currentEditingId", null);
|
|
@@ -140,8 +140,8 @@ import { MarkdownEditor } from "../../MarkdownEditor";
|
|
|
140
140
|
* 启动 Bridge(幂等,已启动时直接返回)
|
|
141
141
|
*/ function startBridge() {
|
|
142
142
|
var _this = this;
|
|
143
|
-
if (this.
|
|
144
|
-
this.
|
|
143
|
+
if (this.bridge) return;
|
|
144
|
+
this.bridge = createSchemaElementEditorBridge({
|
|
145
145
|
getSchema: function(params) {
|
|
146
146
|
var handler = _this.registry.get(params);
|
|
147
147
|
if (!handler) {
|
|
@@ -184,9 +184,9 @@ import { MarkdownEditor } from "../../MarkdownEditor";
|
|
|
184
184
|
value: /**
|
|
185
185
|
* 停止 Bridge
|
|
186
186
|
*/ function stopBridge() {
|
|
187
|
-
if (this.
|
|
188
|
-
this.cleanup();
|
|
189
|
-
this.
|
|
187
|
+
if (this.bridge) {
|
|
188
|
+
this.bridge.cleanup();
|
|
189
|
+
this.bridge = null;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
},
|
|
@@ -378,6 +378,10 @@ export declare function useLanguage(): {
|
|
|
378
378
|
'common.configFile': string;
|
|
379
379
|
'upload.notConfigured': string;
|
|
380
380
|
'upload.failed': string;
|
|
381
|
+
'browser.noResults': string;
|
|
382
|
+
'browser.totalResults': string;
|
|
383
|
+
'browser.searching': string;
|
|
384
|
+
'layout.header.title': string;
|
|
381
385
|
};
|
|
382
386
|
setLanguage: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
383
387
|
toggleLanguage: () => void;
|
package/dist/I18n/locales.d.ts
CHANGED
|
@@ -342,6 +342,10 @@ export declare const cnLabels: {
|
|
|
342
342
|
'common.configFile': string;
|
|
343
343
|
'upload.notConfigured': string;
|
|
344
344
|
'upload.failed': string;
|
|
345
|
+
'browser.noResults': string;
|
|
346
|
+
'browser.totalResults': string;
|
|
347
|
+
'browser.searching': string;
|
|
348
|
+
'layout.header.title': string;
|
|
345
349
|
};
|
|
346
350
|
/**
|
|
347
351
|
* 英文标签映射对象
|
package/dist/I18n/locales.js
CHANGED
|
@@ -362,7 +362,11 @@
|
|
|
362
362
|
'common.configFile': '配置文件',
|
|
363
363
|
// Upload related
|
|
364
364
|
'upload.notConfigured': '图片上传功能未配置',
|
|
365
|
-
'upload.failed': '图片上传失败'
|
|
365
|
+
'upload.failed': '图片上传失败',
|
|
366
|
+
'browser.noResults': '暂无结果',
|
|
367
|
+
'browser.totalResults': '共${count}个结果',
|
|
368
|
+
'browser.searching': '搜索中',
|
|
369
|
+
'layout.header.title': 'AI 助手'
|
|
366
370
|
};
|
|
367
371
|
/**
|
|
368
372
|
* 英文标签映射对象
|
|
@@ -726,5 +730,9 @@
|
|
|
726
730
|
'common.configFile': 'Configuration file',
|
|
727
731
|
// Upload related
|
|
728
732
|
'upload.notConfigured': 'Image upload function not configured',
|
|
729
|
-
'upload.failed': 'Image upload failed'
|
|
733
|
+
'upload.failed': 'Image upload failed',
|
|
734
|
+
'browser.noResults': 'No results found',
|
|
735
|
+
'browser.totalResults': 'Total ${count} results',
|
|
736
|
+
'browser.searching': 'Searching...',
|
|
737
|
+
'layout.header.title': 'AI Assistant'
|
|
730
738
|
};
|
|
@@ -1,31 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type BrowserItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
site: string;
|
|
6
|
+
url: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
export type BrowserSuggestion = {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
count: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const RESULT_COUNT_TAG_STYLE: React.CSSProperties;
|
|
16
|
+
export declare const SUGGESTION_ITEM_STYLE: React.CSSProperties;
|
|
17
|
+
export interface BrowserItemProps {
|
|
18
|
+
item: BrowserItem;
|
|
19
|
+
itemStyle?: React.CSSProperties;
|
|
20
|
+
className?: string;
|
|
13
21
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
export declare const BrowserItemComponent: React.FC<BrowserItemProps>;
|
|
23
|
+
export interface BrowserHeaderProps {
|
|
24
|
+
activeLabel: string;
|
|
25
|
+
onBack?: () => void;
|
|
26
|
+
}
|
|
27
|
+
export declare const BrowserHeader: React.FC<BrowserHeaderProps>;
|
|
28
|
+
export interface BrowserListProps {
|
|
29
|
+
items: BrowserItem[];
|
|
30
|
+
activeLabel: string;
|
|
31
|
+
onBack?: () => void;
|
|
32
|
+
customHeader?: React.ReactNode;
|
|
33
|
+
showHeader?: boolean;
|
|
34
|
+
countFormatter?: (count: number) => string;
|
|
35
|
+
emptyText?: string;
|
|
36
|
+
loading?: boolean;
|
|
37
|
+
loadingText?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const BrowserList: React.FC<BrowserListProps>;
|
|
40
|
+
export type BrowserProps = {
|
|
41
|
+
/**
|
|
42
|
+
* 搜索建议列表
|
|
43
|
+
*/
|
|
44
|
+
suggestions: BrowserSuggestion[];
|
|
45
|
+
/**
|
|
46
|
+
* 根据选中的搜索建议请求对应的结果列表
|
|
47
|
+
*/
|
|
48
|
+
request: (suggestion: BrowserSuggestion) => {
|
|
49
|
+
items: BrowserItem[];
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
};
|
|
52
|
+
suggestionIcon?: React.ReactNode;
|
|
53
|
+
countFormatter?: (count: number) => string;
|
|
54
|
+
emptyText?: string;
|
|
55
|
+
loadingText?: string;
|
|
56
|
+
};
|
|
57
|
+
declare const Browser: React.FC<BrowserProps>;
|
|
58
|
+
export default Browser;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
1
9
|
function _define_property(obj, key, value) {
|
|
2
10
|
if (key in obj) {
|
|
3
11
|
Object.defineProperty(obj, key, {
|
|
@@ -11,6 +19,33 @@ function _define_property(obj, key, value) {
|
|
|
11
19
|
}
|
|
12
20
|
return obj;
|
|
13
21
|
}
|
|
22
|
+
function _iterable_to_array_limit(arr, i) {
|
|
23
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
24
|
+
if (_i == null) return;
|
|
25
|
+
var _arr = [];
|
|
26
|
+
var _n = true;
|
|
27
|
+
var _d = false;
|
|
28
|
+
var _s, _e;
|
|
29
|
+
try {
|
|
30
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
31
|
+
_arr.push(_s.value);
|
|
32
|
+
if (i && _arr.length === i) break;
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
_d = true;
|
|
36
|
+
_e = err;
|
|
37
|
+
} finally{
|
|
38
|
+
try {
|
|
39
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
40
|
+
} finally{
|
|
41
|
+
if (_d) throw _e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return _arr;
|
|
45
|
+
}
|
|
46
|
+
function _non_iterable_rest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
14
49
|
function _object_spread(target) {
|
|
15
50
|
for(var i = 1; i < arguments.length; i++){
|
|
16
51
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -50,61 +85,249 @@ function _object_spread_props(target, source) {
|
|
|
50
85
|
}
|
|
51
86
|
return target;
|
|
52
87
|
}
|
|
53
|
-
|
|
88
|
+
function _sliced_to_array(arr, i) {
|
|
89
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
90
|
+
}
|
|
91
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
92
|
+
if (!o) return;
|
|
93
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
94
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
95
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
96
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
97
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
98
|
+
}
|
|
99
|
+
import { ArrowLeft, Search } from "@sofa-design/icons";
|
|
100
|
+
import { Avatar, Button, ConfigProvider, Empty, Image, List, Spin, Tag, Tooltip } from "antd";
|
|
54
101
|
import classNames from "classnames";
|
|
55
|
-
import React, { useContext } from "react";
|
|
56
|
-
import {
|
|
102
|
+
import React, { useContext, useMemo, useState } from "react";
|
|
103
|
+
import { I18nContext, compileTemplate } from "../../I18n";
|
|
57
104
|
import { useBrowserStyle } from "./style";
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
105
|
+
export var RESULT_COUNT_TAG_STYLE = {
|
|
106
|
+
height: 20,
|
|
107
|
+
background: 'var(--color-gray-control-fill-active)',
|
|
108
|
+
borderRadius: 200,
|
|
109
|
+
display: 'flex',
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
font: 'var(--font-text-number-xs)',
|
|
112
|
+
color: 'var(--color-gray-text-secondary)'
|
|
63
113
|
};
|
|
64
|
-
var
|
|
65
|
-
|
|
114
|
+
export var SUGGESTION_ITEM_STYLE = {
|
|
115
|
+
padding: 4,
|
|
116
|
+
margin: 4,
|
|
117
|
+
cursor: 'pointer'
|
|
66
118
|
};
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
119
|
+
var renderSiteAvatar = function(site, icon) {
|
|
120
|
+
if (icon) {
|
|
121
|
+
return /*#__PURE__*/ React.createElement(Image, {
|
|
122
|
+
src: icon,
|
|
123
|
+
width: 20,
|
|
124
|
+
height: 20,
|
|
125
|
+
preview: false,
|
|
126
|
+
style: {
|
|
127
|
+
borderRadius: 4
|
|
128
|
+
},
|
|
129
|
+
alt: site
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
var letter = (site[0] || 'W').toUpperCase();
|
|
133
|
+
return /*#__PURE__*/ React.createElement(Avatar, {
|
|
134
|
+
size: 20
|
|
135
|
+
}, letter);
|
|
79
136
|
};
|
|
80
|
-
|
|
81
|
-
* BrowserList 组件
|
|
82
|
-
*
|
|
83
|
-
* 在工作空间中显示浏览器内容,支持 Markdown 渲染
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```tsx
|
|
87
|
-
* <BrowserList
|
|
88
|
-
* data={{
|
|
89
|
-
* title: "网页内容",
|
|
90
|
-
* content: "# 标题\n内容"
|
|
91
|
-
* }}
|
|
92
|
-
* />
|
|
93
|
-
* ```
|
|
94
|
-
*/ export var BrowserList = function(param) {
|
|
95
|
-
var data = param.data;
|
|
137
|
+
var useBrowserContext = function() {
|
|
96
138
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
97
|
-
var prefixCls = getPrefixCls('
|
|
139
|
+
var prefixCls = getPrefixCls('browser');
|
|
98
140
|
var _useBrowserStyle = useBrowserStyle(prefixCls), wrapSSR = _useBrowserStyle.wrapSSR, hashId = _useBrowserStyle.hashId;
|
|
99
|
-
|
|
141
|
+
return {
|
|
142
|
+
prefixCls: prefixCls,
|
|
143
|
+
wrapSSR: wrapSSR,
|
|
144
|
+
hashId: hashId
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export var BrowserItemComponent = function(param) {
|
|
148
|
+
var item = param.item, _param_itemStyle = param.itemStyle, itemStyle = _param_itemStyle === void 0 ? SUGGESTION_ITEM_STYLE : _param_itemStyle, className = param.className;
|
|
149
|
+
var _useBrowserContext = useBrowserContext(), prefixCls = _useBrowserContext.prefixCls, wrapSSR = _useBrowserContext.wrapSSR, hashId = _useBrowserContext.hashId;
|
|
150
|
+
var handleSiteClick = function() {
|
|
151
|
+
window.open(item.url);
|
|
152
|
+
};
|
|
153
|
+
return wrapSSR(/*#__PURE__*/ React.createElement(List.Item, {
|
|
154
|
+
className: className,
|
|
155
|
+
style: itemStyle
|
|
156
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
157
|
+
style: {
|
|
158
|
+
width: '100%'
|
|
159
|
+
}
|
|
160
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
161
|
+
className: classNames("".concat(prefixCls, "-result-item-title-wrapper"), hashId)
|
|
162
|
+
}, /*#__PURE__*/ React.createElement(Tooltip, {
|
|
163
|
+
title: item.title,
|
|
164
|
+
mouseEnterDelay: 0.5
|
|
165
|
+
}, /*#__PURE__*/ React.createElement("a", {
|
|
166
|
+
href: item.url,
|
|
167
|
+
target: "_blank",
|
|
168
|
+
rel: "noreferrer",
|
|
169
|
+
style: {
|
|
170
|
+
color: 'inherit'
|
|
171
|
+
}
|
|
172
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
173
|
+
className: classNames("".concat(prefixCls, "-result-item-title"), hashId)
|
|
174
|
+
}, item.title)))), /*#__PURE__*/ React.createElement("div", {
|
|
175
|
+
className: classNames("".concat(prefixCls, "-result-item-site"), hashId),
|
|
176
|
+
onClick: handleSiteClick
|
|
177
|
+
}, renderSiteAvatar(item.site, item.icon), /*#__PURE__*/ React.createElement(Tooltip, {
|
|
178
|
+
title: item.site,
|
|
179
|
+
mouseEnterDelay: 1
|
|
180
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
181
|
+
className: classNames("".concat(prefixCls, "-result-item-site-text"), hashId)
|
|
182
|
+
}, item.site))))));
|
|
183
|
+
};
|
|
184
|
+
export var BrowserHeader = function(param) {
|
|
185
|
+
var activeLabel = param.activeLabel, onBack = param.onBack;
|
|
186
|
+
var _useBrowserContext = useBrowserContext(), prefixCls = _useBrowserContext.prefixCls, wrapSSR = _useBrowserContext.wrapSSR, hashId = _useBrowserContext.hashId;
|
|
187
|
+
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
188
|
+
className: classNames("".concat(prefixCls, "-header-left"), hashId)
|
|
189
|
+
}, onBack && /*#__PURE__*/ React.createElement(Button, {
|
|
190
|
+
type: "text",
|
|
191
|
+
icon: /*#__PURE__*/ React.createElement(ArrowLeft, {
|
|
192
|
+
style: {
|
|
193
|
+
color: 'var(--color-gray-text-quaternary)'
|
|
194
|
+
}
|
|
195
|
+
}),
|
|
196
|
+
onClick: onBack
|
|
197
|
+
}), /*#__PURE__*/ React.createElement(Tooltip, {
|
|
198
|
+
title: activeLabel,
|
|
199
|
+
mouseEnterDelay: 0.5
|
|
200
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
201
|
+
className: classNames("".concat(prefixCls, "-header-title"), hashId)
|
|
202
|
+
}, activeLabel))));
|
|
203
|
+
};
|
|
204
|
+
export var BrowserList = function(param) {
|
|
205
|
+
var items = param.items, activeLabel = param.activeLabel, onBack = param.onBack, customHeader = param.customHeader, _param_showHeader = param.showHeader, showHeader = _param_showHeader === void 0 ? true : _param_showHeader, countFormatter = param.countFormatter, emptyText = param.emptyText, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading, loadingText = param.loadingText;
|
|
206
|
+
var _useBrowserContext = useBrowserContext(), prefixCls = _useBrowserContext.prefixCls, wrapSSR = _useBrowserContext.wrapSSR, hashId = _useBrowserContext.hashId;
|
|
207
|
+
var locale = useContext(I18nContext).locale;
|
|
208
|
+
var safeItems = Array.isArray(items) ? items : [];
|
|
209
|
+
var mergedEmptyText = emptyText || locale['browser.noResults'] || 'No results found';
|
|
210
|
+
var mergedLoadingText = loadingText || locale['browser.searching'] || 'Searching...';
|
|
211
|
+
var totalResultsTemplate = locale['browser.totalResults'] || 'Total ${count} results';
|
|
100
212
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
101
|
-
className: classNames(prefixCls, hashId),
|
|
102
213
|
"data-testid": "browser-list"
|
|
103
|
-
},
|
|
214
|
+
}, /*#__PURE__*/ React.createElement("header", {
|
|
215
|
+
className: classNames("".concat(prefixCls, "-header-wrapper"), hashId),
|
|
216
|
+
style: {
|
|
217
|
+
borderBottom: showHeader ? '1px solid rgba(20, 22, 28, 0.1)' : 'none'
|
|
218
|
+
}
|
|
219
|
+
}, showHeader && (customHeader || /*#__PURE__*/ React.createElement("div", {
|
|
104
220
|
className: classNames("".concat(prefixCls, "-header"), hashId)
|
|
105
|
-
}, /*#__PURE__*/ React.createElement(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
221
|
+
}, /*#__PURE__*/ React.createElement(BrowserHeader, {
|
|
222
|
+
activeLabel: activeLabel,
|
|
223
|
+
onBack: onBack || function() {}
|
|
224
|
+
}), /*#__PURE__*/ React.createElement(Tag, {
|
|
225
|
+
style: RESULT_COUNT_TAG_STYLE
|
|
226
|
+
}, typeof countFormatter === 'function' ? countFormatter(safeItems.length) : compileTemplate(totalResultsTemplate, {
|
|
227
|
+
count: String(safeItems.length)
|
|
228
|
+
}))))), /*#__PURE__*/ React.createElement(List, {
|
|
229
|
+
dataSource: safeItems,
|
|
230
|
+
split: false,
|
|
231
|
+
loading: false,
|
|
232
|
+
locale: {
|
|
233
|
+
emptyText: loading && safeItems.length === 0 ? /*#__PURE__*/ React.createElement("div", {
|
|
234
|
+
style: {
|
|
235
|
+
padding: '48px 0',
|
|
236
|
+
textAlign: 'center'
|
|
237
|
+
}
|
|
238
|
+
}, /*#__PURE__*/ React.createElement(Spin, null), /*#__PURE__*/ React.createElement("div", {
|
|
239
|
+
style: {
|
|
240
|
+
marginTop: 8
|
|
241
|
+
}
|
|
242
|
+
}, mergedLoadingText)) : /*#__PURE__*/ React.createElement(Empty, {
|
|
243
|
+
description: mergedEmptyText
|
|
244
|
+
})
|
|
245
|
+
},
|
|
246
|
+
renderItem: function(item) {
|
|
247
|
+
return /*#__PURE__*/ React.createElement(BrowserItemComponent, {
|
|
248
|
+
key: item.id,
|
|
249
|
+
item: item,
|
|
250
|
+
className: classNames("".concat(prefixCls, "-result-item"), hashId),
|
|
251
|
+
itemStyle: SUGGESTION_ITEM_STYLE
|
|
252
|
+
});
|
|
253
|
+
},
|
|
254
|
+
footer: null
|
|
255
|
+
})));
|
|
256
|
+
};
|
|
257
|
+
var Browser = function(param) {
|
|
258
|
+
var suggestions = param.suggestions, request = param.request, suggestionIcon = param.suggestionIcon, countFormatter = param.countFormatter, emptyText = param.emptyText, loadingText = param.loadingText;
|
|
259
|
+
var _useState = _sliced_to_array(useState('suggestions'), 2), currentView = _useState[0], setCurrentView = _useState[1];
|
|
260
|
+
var _useState1 = _sliced_to_array(useState(null), 2), activeSuggestion = _useState1[0], setActiveSuggestion = _useState1[1];
|
|
261
|
+
var _useState2 = _sliced_to_array(useState(''), 2), activeLabel = _useState2[0], setActiveLabel = _useState2[1];
|
|
262
|
+
var locale = useContext(I18nContext).locale;
|
|
263
|
+
var _useBrowserContext = useBrowserContext(), prefixCls = _useBrowserContext.prefixCls, wrapSSR = _useBrowserContext.wrapSSR, hashId = _useBrowserContext.hashId;
|
|
264
|
+
var _useMemo = useMemo(function() {
|
|
265
|
+
if (!activeSuggestion) {
|
|
266
|
+
return {
|
|
267
|
+
items: [],
|
|
268
|
+
loading: false
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
var result = request(activeSuggestion);
|
|
272
|
+
return {
|
|
273
|
+
items: result.items || [],
|
|
274
|
+
loading: result.loading || false
|
|
275
|
+
};
|
|
276
|
+
}, [
|
|
277
|
+
activeSuggestion,
|
|
278
|
+
request
|
|
279
|
+
]), results = _useMemo.items, loading = _useMemo.loading;
|
|
280
|
+
var handleExecuteSearch = function(suggestion) {
|
|
281
|
+
setActiveSuggestion(suggestion);
|
|
282
|
+
setActiveLabel(suggestion.label);
|
|
283
|
+
setCurrentView('results');
|
|
284
|
+
};
|
|
285
|
+
var totalResultsTemplate = locale['browser.totalResults'] || 'Total ${count} results';
|
|
286
|
+
return wrapSSR(/*#__PURE__*/ React.createElement("div", null, currentView === 'suggestions' && /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(List, {
|
|
287
|
+
dataSource: suggestions,
|
|
288
|
+
split: false,
|
|
289
|
+
renderItem: function(item) {
|
|
290
|
+
return /*#__PURE__*/ React.createElement(List.Item, {
|
|
291
|
+
style: SUGGESTION_ITEM_STYLE,
|
|
292
|
+
onClick: function() {
|
|
293
|
+
return handleExecuteSearch(item);
|
|
294
|
+
},
|
|
295
|
+
className: classNames("".concat(prefixCls, "-suggestion"), hashId),
|
|
296
|
+
actions: [
|
|
297
|
+
/*#__PURE__*/ React.createElement("div", {
|
|
298
|
+
key: "count",
|
|
299
|
+
style: {
|
|
300
|
+
marginInlineStart: '-8px'
|
|
301
|
+
}
|
|
302
|
+
}, /*#__PURE__*/ React.createElement(Tag, {
|
|
303
|
+
style: _object_spread_props(_object_spread({}, RESULT_COUNT_TAG_STYLE), {
|
|
304
|
+
marginRight: '-8px'
|
|
305
|
+
})
|
|
306
|
+
}, typeof countFormatter === 'function' ? countFormatter(item.count) : compileTemplate(totalResultsTemplate, {
|
|
307
|
+
count: String(item.count)
|
|
308
|
+
})))
|
|
309
|
+
]
|
|
310
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
311
|
+
className: classNames("".concat(prefixCls, "-suggestion-content"), hashId)
|
|
312
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
313
|
+
className: classNames("".concat(prefixCls, "-suggestion-icon"), hashId)
|
|
314
|
+
}, suggestionIcon || /*#__PURE__*/ React.createElement(Search, null)), /*#__PURE__*/ React.createElement(Tooltip, {
|
|
315
|
+
title: item.label,
|
|
316
|
+
mouseEnterDelay: 0.5
|
|
317
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
318
|
+
className: classNames("".concat(prefixCls, "-suggestion-text"), hashId)
|
|
319
|
+
}, item.label))));
|
|
320
|
+
}
|
|
321
|
+
})), currentView === 'results' && /*#__PURE__*/ React.createElement(BrowserList, {
|
|
322
|
+
items: results,
|
|
323
|
+
activeLabel: activeLabel,
|
|
324
|
+
onBack: function() {
|
|
325
|
+
return setCurrentView('suggestions');
|
|
326
|
+
},
|
|
327
|
+
countFormatter: countFormatter,
|
|
328
|
+
emptyText: emptyText,
|
|
329
|
+
loading: loading,
|
|
330
|
+
loadingText: loadingText
|
|
331
|
+
})));
|
|
110
332
|
};
|
|
333
|
+
export default Browser;
|
|
@@ -50,10 +50,127 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
+
import { Keyframes } from "@ant-design/cssinjs";
|
|
53
54
|
import { useEditorStyleRegister } from "../../Hooks/useStyle";
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
var fadeInUp = new Keyframes('fadeInUp', {
|
|
56
|
+
from: {
|
|
57
|
+
opacity: 0,
|
|
58
|
+
transform: 'translateY(8px)'
|
|
59
|
+
},
|
|
60
|
+
to: {
|
|
61
|
+
opacity: 1,
|
|
62
|
+
transform: 'translateY(0)'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var genStyle = function(token) {
|
|
66
|
+
var componentCls = token.componentCls;
|
|
67
|
+
var _obj, _obj1, _obj2;
|
|
68
|
+
return _define_property({}, componentCls, {
|
|
69
|
+
'&-suggestion': (_obj1 = {
|
|
70
|
+
'&:hover': {
|
|
71
|
+
borderRadius: 'var(--radius-control-base)',
|
|
72
|
+
background: 'var(--color-gray-control-fill-hover)'
|
|
73
|
+
}
|
|
74
|
+
}, _define_property(_obj1, "".concat(componentCls, "-suggestion-content"), (_obj = {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
gap: '4px',
|
|
78
|
+
width: '100%',
|
|
79
|
+
overflow: 'hidden'
|
|
80
|
+
}, _define_property(_obj, "".concat(componentCls, "-suggestion-icon"), {
|
|
81
|
+
display: 'flex',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
width: '24px',
|
|
85
|
+
height: '24px',
|
|
86
|
+
padding: 'var(--padding-1x)',
|
|
87
|
+
borderRadius: '200px',
|
|
88
|
+
border: '1px solid var(--color-gray-border-dark)',
|
|
89
|
+
color: 'var(--color-gray-text-secondary)'
|
|
90
|
+
}), _define_property(_obj, "".concat(componentCls, "-suggestion-text"), {
|
|
91
|
+
overflow: 'hidden',
|
|
92
|
+
textOverflow: 'ellipsis',
|
|
93
|
+
whiteSpace: 'nowrap',
|
|
94
|
+
font: 'var(--font-text-body-sm)',
|
|
95
|
+
letterSpacing: 'var(--letter-spacing-body-sm, normal)',
|
|
96
|
+
color: 'var(--color-gray-text-secondary)'
|
|
97
|
+
}), _obj)), _define_property(_obj1, '.ant-tag', {
|
|
98
|
+
marginInlineEnd: '0'
|
|
99
|
+
}), _obj1),
|
|
100
|
+
'&-header': _define_property({
|
|
101
|
+
display: 'flex',
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
justifyContent: 'space-between',
|
|
104
|
+
height: '48px',
|
|
105
|
+
width: 'calc(100% - 20px)',
|
|
106
|
+
padding: '4px',
|
|
107
|
+
margin: '4px',
|
|
108
|
+
'.ant-tag': {
|
|
109
|
+
marginInlineEnd: '0'
|
|
110
|
+
}
|
|
111
|
+
}, "".concat(componentCls, "-header-left"), _define_property({
|
|
112
|
+
display: 'flex',
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
gap: '4px',
|
|
115
|
+
overflow: 'hidden',
|
|
116
|
+
flex: 1,
|
|
117
|
+
minWidth: 0
|
|
118
|
+
}, "".concat(componentCls, "-header-title"), {
|
|
119
|
+
flex: 1,
|
|
120
|
+
minWidth: 0,
|
|
121
|
+
marginRight: '4px',
|
|
122
|
+
fontWeight: 500,
|
|
123
|
+
fontSize: '14px',
|
|
124
|
+
overflow: 'hidden',
|
|
125
|
+
textOverflow: 'ellipsis',
|
|
126
|
+
whiteSpace: 'nowrap',
|
|
127
|
+
color: 'var(--color-gray-text-default)'
|
|
128
|
+
})),
|
|
129
|
+
'&-header-wrapper': {
|
|
130
|
+
marginLeft: '-16px',
|
|
131
|
+
marginRight: '-16px'
|
|
132
|
+
},
|
|
133
|
+
'&-result-item': (_obj2 = {
|
|
134
|
+
width: '100%',
|
|
135
|
+
overflow: 'hidden',
|
|
136
|
+
padding: '4px',
|
|
137
|
+
animationName: fadeInUp,
|
|
138
|
+
animationDuration: '0.3s',
|
|
139
|
+
animationTimingFunction: 'ease-out',
|
|
140
|
+
animationFillMode: 'both',
|
|
141
|
+
'&:hover': {
|
|
142
|
+
borderRadius: '12px',
|
|
143
|
+
background: 'var(--color-gray-control-fill-hover)'
|
|
144
|
+
}
|
|
145
|
+
}, _define_property(_obj2, "".concat(componentCls, "-result-item-title"), {
|
|
146
|
+
fontSize: '12px',
|
|
147
|
+
color: 'var(--color-gray-text-default)',
|
|
148
|
+
display: 'block',
|
|
149
|
+
maxWidth: '100%',
|
|
150
|
+
overflow: 'hidden',
|
|
151
|
+
textOverflow: 'ellipsis',
|
|
152
|
+
whiteSpace: 'nowrap'
|
|
153
|
+
}), _define_property(_obj2, "".concat(componentCls, "-result-item-title-wrapper"), {
|
|
154
|
+
overflow: 'hidden',
|
|
155
|
+
textOverflow: 'ellipsis',
|
|
156
|
+
whiteSpace: 'nowrap',
|
|
157
|
+
fontSize: '14px',
|
|
158
|
+
color: 'var(--color-gray-text-default)'
|
|
159
|
+
}), _define_property(_obj2, "".concat(componentCls, "-result-item-site-text"), {
|
|
160
|
+
font: 'var(--font-text-paragraph-sm)',
|
|
161
|
+
letterSpacing: 'var(--letter-spacing-paragraph-sm, normal)',
|
|
162
|
+
color: 'var(--color-gray-text-light)'
|
|
163
|
+
}), _define_property(_obj2, "".concat(componentCls, "-result-item-site"), {
|
|
164
|
+
display: 'flex',
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
gap: '4px',
|
|
167
|
+
overflow: 'hidden',
|
|
168
|
+
textOverflow: 'ellipsis',
|
|
169
|
+
whiteSpace: 'nowrap',
|
|
170
|
+
fontSize: '12px',
|
|
171
|
+
cursor: 'pointer'
|
|
172
|
+
}), _obj2)
|
|
173
|
+
});
|
|
57
174
|
};
|
|
58
175
|
export function useBrowserStyle(prefixCls) {
|
|
59
176
|
return useEditorStyleRegister('WorkspaceBrowser', function(token) {
|
package/dist/Workspace/index.js
CHANGED
|
@@ -78,7 +78,7 @@ import { ConfigProvider, Segmented } from "antd";
|
|
|
78
78
|
import classNames from "classnames";
|
|
79
79
|
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
80
80
|
import { I18nContext } from "../I18n";
|
|
81
|
-
import
|
|
81
|
+
import Browser from "./Browser";
|
|
82
82
|
import { File } from "./File";
|
|
83
83
|
import { RealtimeFollowList } from "./RealtimeFollow";
|
|
84
84
|
import { useWorkspaceStyle } from "./style";
|
|
@@ -135,11 +135,12 @@ var RealtimeComponent = function(param) {
|
|
|
135
135
|
data: data
|
|
136
136
|
}) : null;
|
|
137
137
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
// Updated BrowserComponent to support both new and old API (for backward compatibility if needed, though strictly we should move to new)
|
|
139
|
+
// For now, if data is present (old API), use BrowserList directly (assuming data matches old structure, but BrowserList now expects specific props too)
|
|
140
|
+
// Actually, BrowserList props also changed. So we should just use Browser (default export) which handles suggestions/results.
|
|
141
|
+
// The new BrowserProps interface has suggestions/getItemsById.
|
|
142
|
+
var BrowserComponent = function(props) {
|
|
143
|
+
return /*#__PURE__*/ React.createElement(Browser, props);
|
|
143
144
|
};
|
|
144
145
|
var TaskComponent = function(param) {
|
|
145
146
|
var data = param.data, onItemClick = param.onItemClick;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
2
|
import type { MarkdownEditorProps } from '../MarkdownEditor';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BrowserProps as InternalBrowserProps } from './Browser';
|
|
4
4
|
import type { RealtimeFollowData } from './RealtimeFollow';
|
|
5
5
|
import type { TaskItem, TaskItemInput } from './Task';
|
|
6
|
+
export type { BrowserItem, BrowserSuggestion } from './Browser';
|
|
6
7
|
export interface TabConfiguration {
|
|
7
8
|
key?: string;
|
|
8
9
|
icon?: ReactNode;
|
|
@@ -34,8 +35,7 @@ export interface BaseChildProps {
|
|
|
34
35
|
export interface RealtimeProps extends BaseChildProps {
|
|
35
36
|
data?: RealtimeFollowData;
|
|
36
37
|
}
|
|
37
|
-
export interface BrowserProps extends BaseChildProps {
|
|
38
|
-
data?: BrowserItemInput;
|
|
38
|
+
export interface BrowserProps extends BaseChildProps, InternalBrowserProps {
|
|
39
39
|
}
|
|
40
40
|
export interface TaskProps extends BaseChildProps {
|
|
41
41
|
data?: TaskItemInput;
|
package/dist/Workspace/types.js
CHANGED
|
@@ -45,6 +45,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
45
45
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
46
46
|
}
|
|
47
47
|
import React from "react";
|
|
48
|
+
// ... (rest of the file content unchanged)
|
|
48
49
|
// 文件类型分类
|
|
49
50
|
export var FileCategory = /*#__PURE__*/ function(FileCategory) {
|
|
50
51
|
FileCategory["Text"] = "text";
|
package/dist/index.d.ts
CHANGED
|
@@ -87,8 +87,7 @@ export * from './MarkdownInputField/AttachmentButton/AttachmentFileList/Attachme
|
|
|
87
87
|
export * from './MarkdownInputField/AttachmentButton/AttachmentFileList';
|
|
88
88
|
export * from './MarkdownInputField/AttachmentButton/utils';
|
|
89
89
|
/**
|
|
90
|
-
* Schema Editor Chrome 插件底层 SDK
|
|
90
|
+
* Schema Element Editor Chrome 插件底层 SDK
|
|
91
91
|
* @description 原始 SDK 导出,一般用户无需直接使用
|
|
92
|
-
* 推荐通过 Bubble 组件的 schemaEditorConfig 属性集成
|
|
93
92
|
*/
|
|
94
|
-
export * from '@schema-editor/host-sdk';
|
|
93
|
+
export * from '@schema-element-editor/host-sdk';
|
package/dist/index.js
CHANGED
|
@@ -103,7 +103,6 @@ export * from "./MarkdownInputField/AttachmentButton/AttachmentFileList/Attachme
|
|
|
103
103
|
export * from "./MarkdownInputField/AttachmentButton/AttachmentFileList";
|
|
104
104
|
export * from "./MarkdownInputField/AttachmentButton/utils";
|
|
105
105
|
/**
|
|
106
|
-
* Schema Editor Chrome 插件底层 SDK
|
|
106
|
+
* Schema Element Editor Chrome 插件底层 SDK
|
|
107
107
|
* @description 原始 SDK 导出,一般用户无需直接使用
|
|
108
|
-
|
|
109
|
-
*/ export * from "@schema-editor/host-sdk";
|
|
108
|
+
*/ export * from "@schema-element-editor/host-sdk";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/agentic-ui",
|
|
3
|
-
"version": "2.28.
|
|
3
|
+
"version": "2.28.7-beta.0",
|
|
4
4
|
"description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
|
|
5
5
|
"repository": "git@github.com:ant-design/agentic-ui.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@better-scroll/scroll-bar": "^2.5.1",
|
|
54
54
|
"@galacean/effects": "^2.6.5",
|
|
55
55
|
"@juggle/resize-observer": "^3.4.0",
|
|
56
|
-
"@schema-editor/host-sdk": "^
|
|
56
|
+
"@schema-element-editor/host-sdk": "^2.0.0",
|
|
57
57
|
"@sofa-design/icons": "^1.6.1",
|
|
58
58
|
"ace-builds": "^1.43.4",
|
|
59
59
|
"ajv": "^8.17.1",
|