@baishuyun/ai-design 2.1.0-alpha.4 → 2.1.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/.storybook/preview.ts +2 -0
- package/CHANGELOG.md +179 -28
- package/package.json +8 -9
- package/scripts/post-build.cjs +32 -0
- package/src/components/agent-drawer.tsx +119 -0
- package/src/components/agent-helper/agent-entry-card/index.tsx +3 -8
- package/src/components/agent-helper/agent-helper-card/index.tsx +3 -3
- package/src/components/agent-helper/app-select/index.tsx +119 -84
- package/src/components/agent-helper/condition-input/index.tsx +18 -21
- package/src/components/agent-helper/condition-item/index.tsx +1 -0
- package/src/components/agent-helper/field-edit-preference-select/index.tsx +31 -4
- package/src/components/agent-helper/field-value-input/dept-select.tsx +447 -0
- package/src/components/agent-helper/field-value-input/index.tsx +3 -2
- package/src/components/agent-helper/field-value-input/picker-inputs.tsx +20 -18
- package/src/components/agent-helper/form-select/index.tsx +12 -25
- package/src/components/agent-helper/relational-operator-select/index.tsx +37 -23
- package/src/components/agent-helper/table/index.tsx +6 -2
- package/src/components/agent-helper/team-wide-form-select/data-adapter.ts +109 -0
- package/src/components/agent-helper/team-wide-form-select/index.tsx +289 -0
- package/src/components/agent-helper/team-wide-form-select/tree-panel.tsx +180 -0
- package/src/components/agent-helper/team-wide-form-select/types.ts +36 -0
- package/src/components/agent-helper/team-wide-form-select/use-form-tree.ts +108 -0
- package/src/components/agent-helper/trigger-select/index.tsx +1 -1
- package/src/components/agent-select.tsx +115 -35
- package/src/components/bot-avatar-name.tsx +1 -1
- package/src/components/bs-entry-select/build-tree.ts +0 -6
- package/src/components/bs-entry-select/entry-item.tsx +7 -11
- package/src/components/bs-entry-select/other-app-section.tsx +2 -4
- package/src/components/bs-entry-select/scroll-slider.tsx +6 -11
- package/src/components/bs-icons.tsx +752 -206
- package/src/components/card.tsx +55 -10
- package/src/components/circle-checker.tsx +18 -3
- package/src/components/collapsible-txt-msg.tsx +18 -13
- package/src/components/fake-bot-msg.tsx +18 -7
- package/src/components/field-checker-list-msg.tsx +4 -3
- package/src/components/fields-design-info-table.tsx +9 -26
- package/src/components/fields-portal.tsx +2 -2
- package/src/components/fields-previewer.tsx +1 -0
- package/src/components/font-icon.tsx +20 -9
- package/src/components/form-info-editor.tsx +21 -6
- package/src/components/legacy-slot.tsx +11 -16
- package/src/components/memoized-markdown.tsx +32 -19
- package/src/components/message-content.tsx +7 -3
- package/src/components/output-config-editor.tsx +39 -25
- package/src/components/primary-confirm-btn.tsx +6 -1
- package/src/components/scroll-to-bottom-btn.tsx +3 -2
- package/src/components/shadow-content.tsx +19 -0
- package/src/components/shadow-portal.tsx +23 -0
- package/src/components/ui/dialog.tsx +4 -1
- package/src/components/ui/drawer.tsx +3 -1
- package/src/components/ui/enhanced-drawer.tsx +134 -0
- package/src/components/ui/popover.tsx +3 -2
- package/src/components/ui/select.tsx +3 -2
- package/src/components/ui/tooltip.tsx +3 -2
- package/src/components/user-txt-msg-bubble.tsx +41 -19
- package/src/components/warning-msg.tsx +29 -12
- package/src/const/shadow.ts +17 -0
- package/src/const/ui.ts +2 -2
- package/src/hooks/use-column-appear.ts +1 -1
- package/src/hooks/use-portal-container.ts +6 -3
- package/src/hooks/use-shadow-boundary.ts +67 -0
- package/src/hooks/use-shadow.ts +24 -7
- package/src/index.ts +21 -0
- package/src/stories/AppSelect.stories.tsx +44 -0
- package/src/stories/FieldValueInput.stories.tsx +6 -3
- package/src/stories/FormSelect.stories.tsx +40 -0
- package/src/stories/IconfontPicker.stories.tsx +106 -0
- package/src/stories/RelationalOperatorSelect.stories.tsx +27 -0
- package/src/stories/TeamWideFormSelect.stories.tsx +362 -0
- package/src/stories/UserTextMsgBubble.stories.ts +28 -0
- package/src/style.css +28 -1
- package/style.css +172 -130
package/.storybook/preview.ts
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,60 +1,211 @@
|
|
|
1
1
|
# @baishuyun/ai-design
|
|
2
2
|
|
|
3
|
-
## 2.1.0
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- MemoizedMarkdown 增加 Prose,按块套用排版。
|
|
8
|
+
|
|
9
|
+
## 2.0.61
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
- fix skill doc
|
|
8
13
|
- Updated dependencies
|
|
9
|
-
- @baishuyun/ai-feat-utils@2.0.
|
|
10
|
-
- @baishuyun/types@3.1.0-alpha.4
|
|
14
|
+
- @baishuyun/ai-feat-utils@2.0.55
|
|
11
15
|
|
|
12
|
-
## 2.
|
|
16
|
+
## 2.0.60
|
|
13
17
|
|
|
14
18
|
### Patch Changes
|
|
15
19
|
|
|
16
|
-
- refactor coze-tools
|
|
17
20
|
- Updated dependencies
|
|
18
|
-
- @baishuyun/ai-feat-utils@2.0.
|
|
19
|
-
- @baishuyun/types@3.1.0-alpha.3
|
|
21
|
+
- @baishuyun/ai-feat-utils@2.0.54
|
|
20
22
|
|
|
21
|
-
## 2.
|
|
23
|
+
## 2.0.59
|
|
22
24
|
|
|
23
25
|
### Patch Changes
|
|
24
26
|
|
|
25
|
-
- session
|
|
26
27
|
- Updated dependencies
|
|
27
|
-
- @baishuyun/ai-feat-utils@2.0.
|
|
28
|
-
- @baishuyun/types@3.1.0-alpha.2
|
|
28
|
+
- @baishuyun/ai-feat-utils@2.0.53
|
|
29
29
|
|
|
30
|
-
## 2.
|
|
30
|
+
## 2.0.58
|
|
31
31
|
|
|
32
32
|
### Patch Changes
|
|
33
33
|
|
|
34
|
-
-
|
|
34
|
+
- 4b49068: 用户文本气泡超过 200 字可关闭折叠,折叠条图标可隐藏,正文保留换行并解析 Markdown。
|
|
35
|
+
|
|
36
|
+
## 2.0.57
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- use middleware stackoverflow
|
|
35
41
|
- Updated dependencies
|
|
36
|
-
- @baishuyun/ai-feat-utils@2.0.
|
|
37
|
-
- @baishuyun/types@3.
|
|
42
|
+
- @baishuyun/ai-feat-utils@2.0.52
|
|
43
|
+
- @baishuyun/types@3.0.48
|
|
38
44
|
|
|
39
|
-
## 2.
|
|
45
|
+
## 2.0.56
|
|
40
46
|
|
|
41
|
-
###
|
|
47
|
+
### Patch Changes
|
|
42
48
|
|
|
43
|
-
-
|
|
49
|
+
- bugfi
|
|
50
|
+
- Updated dependencies
|
|
51
|
+
- @baishuyun/ai-feat-utils@2.0.51
|
|
52
|
+
- @baishuyun/types@3.0.47
|
|
44
53
|
|
|
45
|
-
|
|
46
|
-
- `@ai-sdk/provider` -> `^4.0.7`, `@ai-sdk/provider-utils` -> `^5.0.27`
|
|
47
|
-
- `@ai-sdk/deepseek` -> `^3.0.28`
|
|
48
|
-
- Remove unused `@ai-sdk/mcp`
|
|
49
|
-
- Add `engines.node >= 22`
|
|
54
|
+
## 2.0.55
|
|
50
55
|
|
|
51
56
|
### Patch Changes
|
|
52
57
|
|
|
53
|
-
-
|
|
54
|
-
- Updated dependencies
|
|
58
|
+
- 移动端样式更新
|
|
59
|
+
- Updated dependencies
|
|
60
|
+
- @baishuyun/ai-feat-utils@2.0.50
|
|
61
|
+
- @baishuyun/types@3.0.46
|
|
62
|
+
|
|
63
|
+
## 2.0.54
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- bugfix
|
|
68
|
+
- Updated dependencies
|
|
69
|
+
- @baishuyun/ai-feat-utils@2.0.49
|
|
70
|
+
- @baishuyun/types@3.0.45
|
|
71
|
+
|
|
72
|
+
## 2.0.53
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- fix mobile style
|
|
77
|
+
- Updated dependencies
|
|
78
|
+
- @baishuyun/ai-feat-utils@2.0.48
|
|
79
|
+
- @baishuyun/types@3.0.44
|
|
80
|
+
|
|
81
|
+
## 2.0.52
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- Updated dependencies
|
|
86
|
+
- @baishuyun/types@3.0.43
|
|
87
|
+
- @baishuyun/ai-feat-utils@2.0.47
|
|
88
|
+
|
|
89
|
+
## 2.0.51
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- fix mobile style
|
|
94
|
+
- Updated dependencies
|
|
95
|
+
- @baishuyun/ai-feat-utils@2.0.46
|
|
96
|
+
|
|
97
|
+
## 2.0.50
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- agent helper error
|
|
102
|
+
- Updated dependencies
|
|
103
|
+
- @baishuyun/ai-feat-utils@2.0.45
|
|
104
|
+
- @baishuyun/types@3.0.42
|
|
105
|
+
|
|
106
|
+
## 2.0.49
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- mobile style
|
|
111
|
+
- Updated dependencies
|
|
112
|
+
- @baishuyun/ai-feat-utils@2.0.44
|
|
113
|
+
- @baishuyun/types@3.0.41
|
|
114
|
+
|
|
115
|
+
## 2.0.48
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- fix style and other bugs
|
|
120
|
+
- Updated dependencies
|
|
121
|
+
- @baishuyun/ai-feat-utils@2.0.43
|
|
122
|
+
- @baishuyun/types@3.0.40
|
|
123
|
+
|
|
124
|
+
## 2.0.47
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- fix agent helper style
|
|
129
|
+
- Updated dependencies
|
|
130
|
+
- @baishuyun/ai-feat-utils@2.0.42
|
|
131
|
+
- @baishuyun/types@3.0.39
|
|
132
|
+
|
|
133
|
+
## 2.0.46
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- fix host style overwrite
|
|
138
|
+
- Updated dependencies
|
|
139
|
+
- @baishuyun/ai-feat-utils@2.0.41
|
|
140
|
+
- @baishuyun/types@3.0.38
|
|
141
|
+
|
|
142
|
+
## 2.0.45
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- fix mask layer
|
|
147
|
+
- Updated dependencies
|
|
148
|
+
- @baishuyun/ai-feat-utils@2.0.40
|
|
149
|
+
- @baishuyun/types@3.0.37
|
|
150
|
+
|
|
151
|
+
## 2.0.44
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- fix style
|
|
156
|
+
- Updated dependencies
|
|
157
|
+
- @baishuyun/ai-feat-utils@2.0.39
|
|
158
|
+
- @baishuyun/types@3.0.36
|
|
159
|
+
|
|
160
|
+
## 2.0.43
|
|
161
|
+
|
|
162
|
+
### Patch Changes
|
|
163
|
+
|
|
164
|
+
- mobile optimization
|
|
165
|
+
- Updated dependencies
|
|
166
|
+
- @baishuyun/ai-feat-utils@2.0.38
|
|
167
|
+
- @baishuyun/types@3.0.35
|
|
168
|
+
|
|
169
|
+
## 2.0.42
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- mobile update
|
|
174
|
+
- Updated dependencies
|
|
175
|
+
- @baishuyun/ai-feat-utils@2.0.37
|
|
176
|
+
- @baishuyun/types@3.0.34
|
|
177
|
+
|
|
178
|
+
## 2.0.41
|
|
179
|
+
|
|
180
|
+
### Patch Changes
|
|
181
|
+
|
|
182
|
+
- Updated dependencies
|
|
183
|
+
- @baishuyun/ai-feat-utils@2.0.36
|
|
184
|
+
- @baishuyun/types@3.0.33
|
|
185
|
+
|
|
186
|
+
## 2.0.40
|
|
187
|
+
|
|
188
|
+
### Patch Changes
|
|
189
|
+
|
|
190
|
+
- 完善必填校验逻辑
|
|
191
|
+
|
|
192
|
+
## 2.0.39
|
|
193
|
+
|
|
194
|
+
### Patch Changes
|
|
195
|
+
|
|
196
|
+
- token usage report
|
|
197
|
+
- Updated dependencies
|
|
198
|
+
- @baishuyun/ai-feat-utils@2.0.35
|
|
199
|
+
- @baishuyun/types@3.0.32
|
|
200
|
+
|
|
201
|
+
## 2.0.38
|
|
202
|
+
|
|
203
|
+
### Patch Changes
|
|
204
|
+
|
|
205
|
+
- bugfix
|
|
55
206
|
- Updated dependencies
|
|
56
|
-
- @baishuyun/
|
|
57
|
-
- @baishuyun/
|
|
207
|
+
- @baishuyun/ai-feat-utils@2.0.34
|
|
208
|
+
- @baishuyun/types@3.0.31
|
|
58
209
|
|
|
59
210
|
## 2.0.37
|
|
60
211
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baishuyun/ai-design",
|
|
3
|
-
"version": "2.1.0
|
|
4
|
-
"engines": {
|
|
5
|
-
"node": ">=22"
|
|
6
|
-
},
|
|
3
|
+
"version": "2.1.0",
|
|
7
4
|
"description": "AI 功能 UI 组件库 - 所有 AI 功能的 UI 表现唯一真相来源",
|
|
8
5
|
"type": "module",
|
|
9
6
|
"main": "src/index.ts",
|
|
@@ -46,7 +43,7 @@
|
|
|
46
43
|
"@radix-ui/react-tabs": "^1.1.14",
|
|
47
44
|
"@radix-ui/react-tooltip": "^1.2.9",
|
|
48
45
|
"@tanstack/react-table": "^8.21.3",
|
|
49
|
-
"ai": "^
|
|
46
|
+
"ai": "^5.0.101",
|
|
50
47
|
"class-variance-authority": "^0.7.1",
|
|
51
48
|
"classnames": "^2.5.1",
|
|
52
49
|
"clsx": "^2.1.1",
|
|
@@ -58,13 +55,14 @@
|
|
|
58
55
|
"react-day-picker": "^9.11.2",
|
|
59
56
|
"react-hook-form": "^7.76.0",
|
|
60
57
|
"react-markdown": "^10.1.0",
|
|
58
|
+
"remark-breaks": "^4.0.0",
|
|
61
59
|
"tailwind-merge": "^3.4.0",
|
|
62
60
|
"tailwindcss-animate": "^1.0.7",
|
|
63
61
|
"tw-animate-css": "^1.4.0",
|
|
64
62
|
"vaul": "^1.1.2",
|
|
65
63
|
"zod": "^4.1.13",
|
|
66
|
-
"@baishuyun/ai-feat-utils": "2.0.
|
|
67
|
-
"@baishuyun/types": "3.
|
|
64
|
+
"@baishuyun/ai-feat-utils": "2.0.55",
|
|
65
|
+
"@baishuyun/types": "3.0.48"
|
|
68
66
|
},
|
|
69
67
|
"peerDependencies": {
|
|
70
68
|
"react": "^19.0.0",
|
|
@@ -87,15 +85,16 @@
|
|
|
87
85
|
"vite": "^5.1.4",
|
|
88
86
|
"vite-plugin-dts": "^4.5.4",
|
|
89
87
|
"@baishuyun/tailwind-config": "3.0.9",
|
|
90
|
-
"@baishuyun/types": "3.
|
|
88
|
+
"@baishuyun/types": "3.0.48",
|
|
91
89
|
"@baishuyun/typescript-config": "2.0.9"
|
|
92
90
|
},
|
|
93
91
|
"keywords": [],
|
|
94
92
|
"author": "",
|
|
95
93
|
"license": "ISC",
|
|
96
94
|
"scripts": {
|
|
97
|
-
"build": "vite build && tailwindcss -i src/style.css -o dist/tailwind.css &&
|
|
95
|
+
"build": "vite build && tailwindcss -i src/style.css -o dist/tailwind.css && node scripts/post-build.cjs",
|
|
98
96
|
"dev": "vite build --watch",
|
|
97
|
+
"dev:build": "vite build --emptyOutDir false",
|
|
99
98
|
"storybook": "storybook dev -p 6007",
|
|
100
99
|
"build-storybook": "storybook build"
|
|
101
100
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ai-design 构建后处理:跨平台替代 cat / cp / rm。
|
|
3
|
+
* Windows 的 cmd.exe 没有这些 Unix 命令,脚本会在 cat 处失败,
|
|
4
|
+
* 而且失败前 `>` 已把 dist/ai-design.css 截断成 0 字节。
|
|
5
|
+
*
|
|
6
|
+
* 步骤:合并 tailwind CLI 产物与 vite 产物 -> 去 @layer 包裹 -> 拷到包根 style.css -> 清理临时文件。
|
|
7
|
+
*/
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const path = require('node:path');
|
|
10
|
+
|
|
11
|
+
// strip-layers.cjs 内部用相对 cwd 的路径,这里统一锚定到包根
|
|
12
|
+
process.chdir(path.resolve(__dirname, '..'));
|
|
13
|
+
|
|
14
|
+
const DIST = 'dist';
|
|
15
|
+
|
|
16
|
+
// 1. 合并(原:cat dist/tailwind.css dist/index.css > dist/ai-design.css)
|
|
17
|
+
const merged =
|
|
18
|
+
fs.readFileSync(`${DIST}/tailwind.css`, 'utf-8') + fs.readFileSync(`${DIST}/index.css`, 'utf-8');
|
|
19
|
+
fs.writeFileSync(`${DIST}/ai-design.css`, merged);
|
|
20
|
+
|
|
21
|
+
// 2. 去掉 @layer 包裹(复用现有脚本,它在 require 时执行)
|
|
22
|
+
require('./strip-layers.cjs');
|
|
23
|
+
|
|
24
|
+
// 3. 拷到包根(原:cp dist/ai-design.css style.css)
|
|
25
|
+
fs.copyFileSync(`${DIST}/ai-design.css`, 'style.css');
|
|
26
|
+
|
|
27
|
+
// 4. 清理临时文件(原:rm dist/tailwind.css dist/index.css)
|
|
28
|
+
for (const file of ['tailwind.css', 'index.css']) {
|
|
29
|
+
fs.rmSync(`${DIST}/${file}`, { force: true });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log('ai-design post-build done.');
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { EnhancedDrawer } from './ui/enhanced-drawer';
|
|
3
|
+
import { AgentSelect } from './agent-select';
|
|
4
|
+
import type { AgentSelectAgent } from './agent-select';
|
|
5
|
+
|
|
6
|
+
export interface AgentDrawerProps {
|
|
7
|
+
agents: Array<AgentSelectAgent>;
|
|
8
|
+
activeAgent?: { id: string } | null;
|
|
9
|
+
onSelect: (agent: AgentSelectAgent) => void | Promise<void>;
|
|
10
|
+
/** 受控开关 */
|
|
11
|
+
open?: boolean;
|
|
12
|
+
/** 非受控默认开关 */
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
showSearch?: boolean;
|
|
16
|
+
/** 触发器(可选;不传则完全由 open 控制) */
|
|
17
|
+
trigger?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** 关闭图标(设计稿 40434:34111,20×20,#121111) */
|
|
21
|
+
const CloseIcon = () => (
|
|
22
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true">
|
|
23
|
+
<path
|
|
24
|
+
d="M11.2584 9.99867L17.874 3.37975C18.0348 3.21757 18.125 2.99839 18.125 2.76996C18.125 2.54153 18.0348 2.32235 17.874 2.16017L17.8388 2.12495C17.6764 1.96522 17.4578 1.87572 17.23 1.87572C17.0023 1.87572 16.7837 1.96522 16.6213 2.12495L10.0027 8.75414L3.38708 2.12495C3.22461 1.96478 3.00568 1.875 2.77759 1.875C2.54951 1.875 2.33057 1.96478 2.1681 2.12495L2.13143 2.16017C2.05026 2.23946 1.98576 2.33419 1.94172 2.43878C1.89769 2.54338 1.875 2.65573 1.875 2.76923C1.875 2.88272 1.89769 2.99507 1.94172 3.09967C1.98576 3.20427 2.05026 3.299 2.13143 3.37828L8.74706 9.99867L2.13143 16.6205C1.97109 16.7826 1.88115 17.0015 1.88115 17.2296C1.88115 17.4577 1.97109 17.6765 2.13143 17.8386L2.1681 17.8739C2.33014 18.0343 2.5489 18.1243 2.77686 18.1243C3.00482 18.1243 3.22358 18.0343 3.38561 17.8739L10.0027 11.2549L16.6183 17.8739C16.7804 18.0347 16.9995 18.125 17.2278 18.125C17.4561 18.125 17.6752 18.0347 17.8373 17.8739L17.874 17.8386C18.0343 17.6765 18.1243 17.4577 18.1243 17.2296C18.1243 17.0015 18.0343 16.7826 17.874 16.6205L11.2598 9.99867H11.2584Z"
|
|
25
|
+
fill="#121111"
|
|
26
|
+
/>
|
|
27
|
+
</svg>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 智能体选择抽屉(移动端从底部滑出),复用 AgentSelect 列表,选中后自动关闭。
|
|
32
|
+
* 视觉对齐设计稿 40434:34107:顶部圆角面板 +「全部智能体」18px 标题 +
|
|
33
|
+
* 关闭按钮 + 搜索框 + 全宽列表行。
|
|
34
|
+
* shadow DOM 兼容逻辑统一由 EnhancedDrawer 处理。
|
|
35
|
+
*/
|
|
36
|
+
export const AgentDrawer = ({
|
|
37
|
+
agents,
|
|
38
|
+
activeAgent,
|
|
39
|
+
onSelect,
|
|
40
|
+
open: controlledOpen,
|
|
41
|
+
defaultOpen,
|
|
42
|
+
onOpenChange,
|
|
43
|
+
showSearch = true,
|
|
44
|
+
trigger,
|
|
45
|
+
}: AgentDrawerProps) => {
|
|
46
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);
|
|
47
|
+
const open = controlledOpen !== undefined ? controlledOpen : internalOpen;
|
|
48
|
+
|
|
49
|
+
const setOpen = useCallback(
|
|
50
|
+
(next: boolean) => {
|
|
51
|
+
if (controlledOpen === undefined) setInternalOpen(next);
|
|
52
|
+
onOpenChange?.(next);
|
|
53
|
+
},
|
|
54
|
+
[controlledOpen, onOpenChange]
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const handleSelect = useCallback(
|
|
58
|
+
async (agent: AgentSelectAgent) => {
|
|
59
|
+
await onSelect(agent);
|
|
60
|
+
setOpen(false);
|
|
61
|
+
},
|
|
62
|
+
[onSelect, setOpen]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
{trigger && (
|
|
68
|
+
<span onClick={() => setOpen(true)} style={{ display: 'contents' }}>
|
|
69
|
+
{trigger}
|
|
70
|
+
</span>
|
|
71
|
+
)}
|
|
72
|
+
<EnhancedDrawer
|
|
73
|
+
open={open}
|
|
74
|
+
onOpenChange={setOpen}
|
|
75
|
+
direction="bottom"
|
|
76
|
+
title="选择智能体"
|
|
77
|
+
// DrawerContent 内联 style 强制 borderRadius: 0(会压掉方向圆角),
|
|
78
|
+
// 用 !important 任意值恢复设计稿的顶部 10px 圆角
|
|
79
|
+
className="rounded-t-[20px]!"
|
|
80
|
+
>
|
|
81
|
+
<div className="flex flex-col">
|
|
82
|
+
{/* 头部:标题 18px Bold + 关闭(设计稿 40434:34109,上 20、下 20、左右 12) */}
|
|
83
|
+
<div className="flex items-center justify-between px-[12px] pt-[20px] pb-[20px]">
|
|
84
|
+
<span className="text-[18px] font-bold text-[#030303] leading-[normal]">
|
|
85
|
+
全部智能体
|
|
86
|
+
</span>
|
|
87
|
+
<button
|
|
88
|
+
type="button"
|
|
89
|
+
aria-label="关闭"
|
|
90
|
+
className="shrink-0 size-[20px] border-none bg-transparent p-0 text-[#121111] cursor-pointer"
|
|
91
|
+
onClick={() => setOpen(false)}
|
|
92
|
+
>
|
|
93
|
+
<CloseIcon />
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
{/* 搜索 + 列表(样式见 AgentSelect large;85px ≈ 头部块高度;
|
|
97
|
+
底部 16px 内边距,设计稿 40654:39900) */}
|
|
98
|
+
<div
|
|
99
|
+
className="overflow-y-auto pb-[16px]"
|
|
100
|
+
style={{
|
|
101
|
+
maxHeight: 'calc(100vh - 52px - 85px)',
|
|
102
|
+
scrollbarWidth: 'none',
|
|
103
|
+
}}
|
|
104
|
+
data-vaul-no-drag
|
|
105
|
+
>
|
|
106
|
+
<AgentSelect
|
|
107
|
+
agents={agents}
|
|
108
|
+
activeAgent={activeAgent}
|
|
109
|
+
onSelect={handleSelect}
|
|
110
|
+
showSearch={showSearch}
|
|
111
|
+
showAllItems
|
|
112
|
+
large
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</EnhancedDrawer>
|
|
117
|
+
</>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -9,18 +9,13 @@ export interface AgentEntryCardProps {
|
|
|
9
9
|
onLogClick: () => void;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const AgentEntryCard = ({
|
|
13
|
-
agent,
|
|
14
|
-
className,
|
|
15
|
-
onSelect,
|
|
16
|
-
onLogClick: _onLogClick,
|
|
17
|
-
}: AgentEntryCardProps) => {
|
|
12
|
+
export const AgentEntryCard = ({ agent, className, onSelect, onLogClick }: AgentEntryCardProps) => {
|
|
18
13
|
return (
|
|
19
14
|
<div
|
|
20
15
|
className={cn(
|
|
21
16
|
'bg-white border border-[#e0e0e0] border-solid content-stretch flex flex-col items-start p-[16px] rounded-[10px] w-full drop-shadow-[0px_0px_5px_rgba(0,0,0,0.04)] hover:drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)]',
|
|
22
17
|
transCls,
|
|
23
|
-
className
|
|
18
|
+
className
|
|
24
19
|
)}
|
|
25
20
|
|
|
26
21
|
onClick={onSelect}
|
|
@@ -32,7 +27,7 @@ export const AgentEntryCard = ({
|
|
|
32
27
|
<div className="content-stretch flex gap-[10px] items-center min-w-0">
|
|
33
28
|
<img
|
|
34
29
|
alt={agent.name}
|
|
35
|
-
className="rounded-[
|
|
30
|
+
className="rounded-[20px] shrink-0 size-[40px] object-cover"
|
|
36
31
|
src={agent.icon}
|
|
37
32
|
/>
|
|
38
33
|
<p className="font-bold leading-[normal] overflow-hidden shrink-0 text-[#030303] text-[18px] text-ellipsis whitespace-nowrap">
|
|
@@ -118,11 +118,11 @@ export const AgentHelperCard = ({
|
|
|
118
118
|
)}
|
|
119
119
|
>
|
|
120
120
|
{/* Header */}
|
|
121
|
-
<div className="grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full">
|
|
121
|
+
<div className="grid-cols-1 grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full">
|
|
122
122
|
<div className="col-1 content-stretch flex h-[42px] items-center justify-between ml-0 mt-0 px-[12px] row-1 w-full">
|
|
123
|
-
<div className="content-stretch flex gap-[6px] items-center
|
|
123
|
+
<div className="content-stretch flex gap-[6px] items-center min-w-0">
|
|
124
124
|
<TriggerTypeIcon triggerType={helper.triggerType} size={18} />
|
|
125
|
-
<p className="leading-[normal]
|
|
125
|
+
<p className="leading-[normal] text-[#030303] text-[14px] truncate">
|
|
126
126
|
{helper.helperName}
|
|
127
127
|
</p>
|
|
128
128
|
</div>
|