@morlay/ui-conversation-manager 0.0.2-alpha.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/LICENSE +21 -0
- package/README.md +97 -0
- package/dist/client.cjs +1257 -0
- package/dist/client.d.cts +3125 -0
- package/dist/client.d.mts +3125 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +70 -0
- package/src/client/ConversationManagerIcon.tsx +9 -0
- package/src/client/ConversationManagerPage.styles.ts +247 -0
- package/src/client/ConversationManagerPage.tsx +801 -0
- package/src/client/controller.ts +216 -0
- package/src/client/format.ts +22 -0
- package/src/client/index.ts +76 -0
- package/src/client/locales.ts +152 -0
- package/src/index.ts +2 -0
package/dist/index.d.cts
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@morlay/ui-conversation-manager",
|
|
3
|
+
"version": "0.0.2-alpha.0",
|
|
4
|
+
"description": "「对话管理」全局面板页(浏览器半):已归档会话的搜索、取消归档、删除,以及导入为新会话。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"archived-sessions",
|
|
7
|
+
"conversation-manager",
|
|
8
|
+
"dsh",
|
|
9
|
+
"dsh-plugin",
|
|
10
|
+
"session-delete",
|
|
11
|
+
"session-import"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/morlay/dsh-plugin.git"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src",
|
|
21
|
+
"!**/__tests__"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./dist/index.mjs",
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
"./client": {
|
|
28
|
+
"types": "./dist/client.d.cts",
|
|
29
|
+
"default": "./dist/client.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@testing-library/react": "^16.1.0",
|
|
34
|
+
"@types/react": "~18.3.1",
|
|
35
|
+
"@types/react-dom": "~18.3.0",
|
|
36
|
+
"react": "^18.2.0",
|
|
37
|
+
"react-dom": "^18.2.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
41
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.6-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.6-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.1.6-alpha.2",
|
|
44
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.6-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.6-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-session": "^0.1.6-alpha.2",
|
|
47
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.6-alpha.2",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.6-alpha.2",
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-workspace": "^0.1.6-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
|
|
51
|
+
"@morlay/dsh-client-ui-primitives": "^0.0.2-alpha.0"
|
|
52
|
+
},
|
|
53
|
+
"dsh": {
|
|
54
|
+
"client": {
|
|
55
|
+
"platform": "web",
|
|
56
|
+
"inject": [
|
|
57
|
+
"@deepseek-ai/dsh-client-locale",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-session",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-workspace",
|
|
63
|
+
"@morlay/dsh-client-ui-primitives"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "pnpm exec tsdown"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IconArchiveOutline20 } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
2
|
+
import type { PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots";
|
|
3
|
+
|
|
4
|
+
/** nav 图标只画字形:尺寸由 nav 行给,选中态由 nav 行的按钮承担。 */
|
|
5
|
+
export type ConversationManagerIconProps = PropsRuntime<"sidebar.panellist">;
|
|
6
|
+
|
|
7
|
+
export function ConversationManagerIcon({ size }: ConversationManagerIconProps) {
|
|
8
|
+
return <IconArchiveOutline20 size={size} />;
|
|
9
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { styling, type CSSProps } from "@morlay/dsh-client-ui-primitives/client";
|
|
2
|
+
|
|
3
|
+
const spin = styling.keyframes({
|
|
4
|
+
from: { transform: "rotate(0deg)" },
|
|
5
|
+
to: { transform: "rotate(360deg)" },
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
/** 「对话管理」页面的样式表(官方 --dsw-* 变量 + 我们的 css-in-js 层)。
|
|
9
|
+
* 页面根是纵向 flex + 整页滚动:除列表外的项都 `flex: none`,否则内容变长时
|
|
10
|
+
* flex 会把这些项压到 min-content(官方 Input 的 32px 高会被压成一行文字高)。 */
|
|
11
|
+
export const styles = {
|
|
12
|
+
page: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
gap: "12px",
|
|
16
|
+
boxSizing: "border-box",
|
|
17
|
+
width: "100%",
|
|
18
|
+
height: "100%",
|
|
19
|
+
padding: "24px 28px",
|
|
20
|
+
overflow: "auto",
|
|
21
|
+
color: "var(--dsw-alias-label-primary)",
|
|
22
|
+
},
|
|
23
|
+
header: {
|
|
24
|
+
display: "flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
justifyContent: "space-between",
|
|
27
|
+
gap: "12px",
|
|
28
|
+
flex: "none",
|
|
29
|
+
},
|
|
30
|
+
headerActions: {
|
|
31
|
+
display: "flex",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
gap: "8px",
|
|
34
|
+
flex: "none",
|
|
35
|
+
},
|
|
36
|
+
title: {
|
|
37
|
+
margin: "0",
|
|
38
|
+
fontSize: "16px",
|
|
39
|
+
lineHeight: "24px",
|
|
40
|
+
fontWeight: "500",
|
|
41
|
+
},
|
|
42
|
+
// 与官方会话头部的 tab 条同形(ConversationRoot.module.css 的 .tabs/.tab/.tabActive):
|
|
43
|
+
// 时间范围与维度切换共用这一套,选中态是品牌蓝文字 + 2px 下划线。
|
|
44
|
+
tabs: {
|
|
45
|
+
position: "relative",
|
|
46
|
+
zIndex: "1",
|
|
47
|
+
display: "flex",
|
|
48
|
+
gap: "36px",
|
|
49
|
+
marginTop: "10px",
|
|
50
|
+
paddingLeft: "8px",
|
|
51
|
+
flex: "none",
|
|
52
|
+
},
|
|
53
|
+
tab: {
|
|
54
|
+
position: "relative",
|
|
55
|
+
padding: "0 0 9px",
|
|
56
|
+
border: "none",
|
|
57
|
+
background: "transparent",
|
|
58
|
+
fontSize: "13px",
|
|
59
|
+
lineHeight: "16px",
|
|
60
|
+
fontWeight: "500",
|
|
61
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
62
|
+
cursor: "pointer",
|
|
63
|
+
"&::after": {
|
|
64
|
+
content: "''",
|
|
65
|
+
position: "absolute",
|
|
66
|
+
right: "0",
|
|
67
|
+
bottom: "-1px",
|
|
68
|
+
left: "0",
|
|
69
|
+
height: "2px",
|
|
70
|
+
borderRadius: "2px",
|
|
71
|
+
background: "transparent",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
tabActive: {
|
|
75
|
+
color: "var(--dsw-alias-state-business-primary)",
|
|
76
|
+
"&::after": {
|
|
77
|
+
background: "var(--dsw-alias-state-business-primary)",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
usage: {
|
|
81
|
+
display: "flex",
|
|
82
|
+
flexDirection: "column",
|
|
83
|
+
gap: "12px",
|
|
84
|
+
flex: "none",
|
|
85
|
+
},
|
|
86
|
+
// 一行用量:label 在上,下面是横向排布的单项(每个单项内部上下)。
|
|
87
|
+
usageRow: {
|
|
88
|
+
display: "flex",
|
|
89
|
+
flexDirection: "column",
|
|
90
|
+
gap: "6px",
|
|
91
|
+
padding: "10px 12px",
|
|
92
|
+
border: "1px solid var(--dsw-alias-border-l1)",
|
|
93
|
+
borderRadius: "10px",
|
|
94
|
+
background: "var(--dsw-alias-bg-base)",
|
|
95
|
+
flex: "none",
|
|
96
|
+
},
|
|
97
|
+
usageRowLabel: {
|
|
98
|
+
overflow: "hidden",
|
|
99
|
+
fontSize: "12px",
|
|
100
|
+
lineHeight: "18px",
|
|
101
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
102
|
+
textOverflow: "ellipsis",
|
|
103
|
+
whiteSpace: "nowrap",
|
|
104
|
+
},
|
|
105
|
+
usageMetrics: {
|
|
106
|
+
display: "flex",
|
|
107
|
+
flexDirection: "row",
|
|
108
|
+
flexWrap: "wrap",
|
|
109
|
+
gap: "6px 20px",
|
|
110
|
+
},
|
|
111
|
+
usageMetric: {
|
|
112
|
+
display: "flex",
|
|
113
|
+
flexDirection: "column",
|
|
114
|
+
gap: "2px",
|
|
115
|
+
},
|
|
116
|
+
usageMetricLabel: {
|
|
117
|
+
fontSize: "12px",
|
|
118
|
+
lineHeight: "18px",
|
|
119
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
120
|
+
},
|
|
121
|
+
usageMetricValue: {
|
|
122
|
+
fontSize: "16px",
|
|
123
|
+
lineHeight: "24px",
|
|
124
|
+
fontWeight: "500",
|
|
125
|
+
fontVariantNumeric: "tabular-nums",
|
|
126
|
+
},
|
|
127
|
+
usageList: {
|
|
128
|
+
display: "flex",
|
|
129
|
+
flexDirection: "column",
|
|
130
|
+
gap: "4px",
|
|
131
|
+
margin: "0",
|
|
132
|
+
padding: "0",
|
|
133
|
+
listStyle: "none",
|
|
134
|
+
flex: "none",
|
|
135
|
+
},
|
|
136
|
+
filters: {
|
|
137
|
+
display: "flex",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
gap: "16px",
|
|
140
|
+
flex: "none",
|
|
141
|
+
},
|
|
142
|
+
// 官方 Input 的 wrap 是 inline-flex:这里只补宽度,其余样式仍归官方。
|
|
143
|
+
search: {
|
|
144
|
+
width: "360px",
|
|
145
|
+
maxWidth: "100%",
|
|
146
|
+
flex: "none",
|
|
147
|
+
},
|
|
148
|
+
list: {
|
|
149
|
+
display: "flex",
|
|
150
|
+
flexDirection: "column",
|
|
151
|
+
gap: "4px",
|
|
152
|
+
margin: "0",
|
|
153
|
+
padding: "0",
|
|
154
|
+
listStyle: "none",
|
|
155
|
+
flex: "none",
|
|
156
|
+
},
|
|
157
|
+
row: {
|
|
158
|
+
display: "flex",
|
|
159
|
+
alignItems: "center",
|
|
160
|
+
justifyContent: "space-between",
|
|
161
|
+
gap: "16px",
|
|
162
|
+
padding: "10px 12px",
|
|
163
|
+
border: "1px solid var(--dsw-alias-border-l1)",
|
|
164
|
+
borderRadius: "10px",
|
|
165
|
+
background: "var(--dsw-alias-bg-base)",
|
|
166
|
+
flex: "none",
|
|
167
|
+
},
|
|
168
|
+
identity: {
|
|
169
|
+
display: "flex",
|
|
170
|
+
flexDirection: "column",
|
|
171
|
+
gap: "2px",
|
|
172
|
+
minWidth: "0",
|
|
173
|
+
},
|
|
174
|
+
titleLine: {
|
|
175
|
+
display: "flex",
|
|
176
|
+
alignItems: "center",
|
|
177
|
+
gap: "8px",
|
|
178
|
+
minWidth: "0",
|
|
179
|
+
},
|
|
180
|
+
rowTitle: {
|
|
181
|
+
overflow: "hidden",
|
|
182
|
+
fontSize: "13px",
|
|
183
|
+
lineHeight: "20px",
|
|
184
|
+
textOverflow: "ellipsis",
|
|
185
|
+
whiteSpace: "nowrap",
|
|
186
|
+
},
|
|
187
|
+
meta: {
|
|
188
|
+
fontSize: "12px",
|
|
189
|
+
lineHeight: "18px",
|
|
190
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
191
|
+
},
|
|
192
|
+
actions: {
|
|
193
|
+
display: "flex",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
gap: "8px",
|
|
196
|
+
flex: "none",
|
|
197
|
+
},
|
|
198
|
+
pagination: {
|
|
199
|
+
display: "flex",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
justifyContent: "flex-end",
|
|
202
|
+
gap: "8px",
|
|
203
|
+
marginTop: "4px",
|
|
204
|
+
flex: "none",
|
|
205
|
+
},
|
|
206
|
+
paginationLabel: {
|
|
207
|
+
fontSize: "12px",
|
|
208
|
+
lineHeight: "18px",
|
|
209
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
210
|
+
fontVariantNumeric: "tabular-nums",
|
|
211
|
+
},
|
|
212
|
+
status: {
|
|
213
|
+
margin: "0",
|
|
214
|
+
fontSize: "13px",
|
|
215
|
+
lineHeight: "20px",
|
|
216
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
217
|
+
flex: "none",
|
|
218
|
+
},
|
|
219
|
+
failure: {
|
|
220
|
+
margin: "0",
|
|
221
|
+
fontSize: "13px",
|
|
222
|
+
lineHeight: "20px",
|
|
223
|
+
color: "var(--dsw-alias-label-error, var(--dsw-alias-label-primary))",
|
|
224
|
+
flex: "none",
|
|
225
|
+
},
|
|
226
|
+
blocking: {
|
|
227
|
+
display: "flex",
|
|
228
|
+
flexDirection: "column",
|
|
229
|
+
alignItems: "center",
|
|
230
|
+
gap: "14px",
|
|
231
|
+
padding: "32px 40px",
|
|
232
|
+
color: "var(--dsw-alias-label-primary)",
|
|
233
|
+
},
|
|
234
|
+
spinner: {
|
|
235
|
+
width: "28px",
|
|
236
|
+
height: "28px",
|
|
237
|
+
border: "2px solid var(--dsw-alias-border-l2)",
|
|
238
|
+
borderTopColor: "var(--dsw-alias-label-primary)",
|
|
239
|
+
borderRadius: "50%",
|
|
240
|
+
animation: `${spin} 900ms linear infinite`,
|
|
241
|
+
},
|
|
242
|
+
blockingText: {
|
|
243
|
+
margin: "0",
|
|
244
|
+
fontSize: "13px",
|
|
245
|
+
lineHeight: "20px",
|
|
246
|
+
},
|
|
247
|
+
} satisfies Record<string, CSSProps>;
|