From 1c2acfd2e9e076f466b752ae797ed91c7cd1b574 Mon Sep 17 00:00:00 2001 From: matevip Date: Thu, 9 Apr 2026 20:56:50 +0800 Subject: [PATCH] refactor(ux): simplify interactions and humanize UI with Jobs-inspired review --- .../conversation/ConversationService.java | 13 + .../controller/ConversationController.java | 18 + mateclaw-ui/src/api/index.ts | 2 + .../workspace/WorkspaceSwitcher.vue | 239 +++++--- mateclaw-ui/src/i18n/locales/en-US.ts | 19 +- mateclaw-ui/src/i18n/locales/zh-CN.ts | 19 +- mateclaw-ui/src/views/AgentContext.vue | 8 + mateclaw-ui/src/views/Agents.vue | 228 +++++--- mateclaw-ui/src/views/ChatConsole.vue | 552 ++++++++++++++++-- mateclaw-ui/src/views/Dashboard.vue | 32 +- mateclaw-ui/src/views/layout/MainLayout.vue | 11 +- 11 files changed, 916 insertions(+), 225 deletions(-) diff --git a/mateclaw-server/src/main/java/vip/mate/workspace/conversation/ConversationService.java b/mateclaw-server/src/main/java/vip/mate/workspace/conversation/ConversationService.java index 92d45826..3c31d6f3 100644 --- a/mateclaw-server/src/main/java/vip/mate/workspace/conversation/ConversationService.java +++ b/mateclaw-server/src/main/java/vip/mate/workspace/conversation/ConversationService.java @@ -261,6 +261,19 @@ public class ConversationService { messageMapper.updateById(message); } + /** + * 重命名会话 + */ + @Transactional + public void renameConversation(String conversationId, String title) { + ConversationEntity conv = conversationMapper.selectOne(new LambdaQueryWrapper() + .eq(ConversationEntity::getConversationId, conversationId)); + if (conv != null) { + conv.setTitle(title); + conversationMapper.updateById(conv); + } + } + /** * 更新会话的流状态(running / idle) */ diff --git a/mateclaw-server/src/main/java/vip/mate/workspace/conversation/controller/ConversationController.java b/mateclaw-server/src/main/java/vip/mate/workspace/conversation/controller/ConversationController.java index bdee3cf8..93b10b3e 100644 --- a/mateclaw-server/src/main/java/vip/mate/workspace/conversation/controller/ConversationController.java +++ b/mateclaw-server/src/main/java/vip/mate/workspace/conversation/controller/ConversationController.java @@ -68,6 +68,24 @@ public class ConversationController { return R.ok(); } + /** + * 重命名会话 + */ + @Operation(summary = "重命名会话") + @PutMapping("/{conversationId}/title") + public R rename(@PathVariable String conversationId, @RequestBody Map body, Authentication auth) { + String username = auth != null ? auth.getName() : "anonymous"; + if (!conversationService.isConversationOwner(conversationId, username)) { + return R.fail("无权操作该会话"); + } + String title = body.getOrDefault("title", "").trim(); + if (title.isEmpty() || title.length() > 100) { + return R.fail("标题不合法"); + } + conversationService.renameConversation(conversationId, title); + return R.ok(); + } + /** * 清空会话消息(保留会话记录) */ diff --git a/mateclaw-ui/src/api/index.ts b/mateclaw-ui/src/api/index.ts index 4da9811a..e39290be 100644 --- a/mateclaw-ui/src/api/index.ts +++ b/mateclaw-ui/src/api/index.ts @@ -136,6 +136,8 @@ export const conversationApi = { http.delete(`/conversations/${conversationId}`), clearMessages: (conversationId: string) => http.delete(`/conversations/${conversationId}/messages`), + rename: (conversationId: string, title: string) => + http.put(`/conversations/${conversationId}/title`, { title }), } // ==================== Skill ==================== diff --git a/mateclaw-ui/src/components/workspace/WorkspaceSwitcher.vue b/mateclaw-ui/src/components/workspace/WorkspaceSwitcher.vue index b002c635..c0eced9c 100644 --- a/mateclaw-ui/src/components/workspace/WorkspaceSwitcher.vue +++ b/mateclaw-ui/src/components/workspace/WorkspaceSwitcher.vue @@ -1,65 +1,67 @@ diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index c96e5f63..4aee82bc 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -22,6 +22,7 @@ export default { search: 'Search', expandSidebar: 'Expand sidebar', collapseSidebar: 'Collapse sidebar', + manageWorkspaces: 'Manage Workspaces', show: 'Show', hide: 'Hide', on: 'On', @@ -115,6 +116,7 @@ export default { loadConversationsFailed: 'Failed to load conversations', loadMessagesFailed: 'Failed to load messages', deleteConversationFailed: 'Failed to delete conversation', + deleteConfirm: 'Delete this conversation? This cannot be undone.', switchModelFailed: 'Failed to switch model', uploadFailed: 'File upload failed', dropToUpload: 'Drop files or folders here', @@ -597,6 +599,10 @@ export default { planExecute: 'Plan-Execute', enabled: 'Enabled', disabled: 'Disabled', + basic: 'Basic', + skills: 'Skills', + tools: 'Tools', + context: 'Context', }, columns: { name: 'Name', @@ -656,6 +662,14 @@ export default { toggleFailed: 'Failed to toggle agent status', toggleSuccess: 'Status updated', }, + binding: { + skillsHint: 'Select skills this agent can use. Leave empty to use all enabled skills.', + toolsHint: 'Select tools this agent can use. Leave empty to use all enabled tools.', + noSkills: 'No skills available', + noTools: 'No tools available', + contextHint: 'Manage context files (e.g. AGENT.md) that define this agent\'s behavior, knowledge, and instructions.', + goToContext: 'Edit Context Files', + }, }, security: { title: 'Security', @@ -727,6 +741,7 @@ export default { workspaces: { title: 'Workspaces', desc: 'Manage workspaces for your organization.', + manage: 'Manage Workspaces', newWorkspace: 'New Workspace', loading: 'Loading workspaces...', noWorkspaces: 'No workspaces found.', @@ -1527,8 +1542,8 @@ export default { periodDesc: 'A sharper view of how your system behaves across short, medium, and monthly horizons.', runsDesc: 'Execution history with timing, cost, and outcome at a glance.', trend: { - title: '7-Day Trend', - subtitle: 'Messages and token consumption over the past week.', + title: 'Your Week', + subtitle: 'How often you and your AI have been working together.', }, periodComparison: 'Period Comparison', periods: { diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index 2093df1c..e1032491 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -22,6 +22,7 @@ export default { search: '搜索', expandSidebar: '展开侧边栏', collapseSidebar: '折叠侧边栏', + manageWorkspaces: '管理工作区', show: '显示', hide: '隐藏', on: '开启', @@ -115,6 +116,7 @@ export default { loadConversationsFailed: '加载会话列表失败', loadMessagesFailed: '加载消息记录失败', deleteConversationFailed: '删除会话失败', + deleteConfirm: '确定删除这个会话?此操作不可恢复。', switchModelFailed: '切换模型失败', uploadFailed: '文件上传失败', dropToUpload: '拖放文件或文件夹到此处', @@ -597,6 +599,10 @@ export default { planExecute: 'Plan-Execute', enabled: '已启用', disabled: '已停用', + basic: '基本信息', + skills: '技能', + tools: '工具', + context: '上下文', }, columns: { name: '名称', @@ -656,6 +662,14 @@ export default { toggleFailed: '切换状态失败', toggleSuccess: '状态已更新', }, + binding: { + skillsHint: '选择此智能体可使用的技能。留空则使用所有已启用的技能。', + toolsHint: '选择此智能体可使用的工具。留空则使用所有已启用的工具。', + noSkills: '暂无可用技能', + noTools: '暂无可用工具', + contextHint: '管理此智能体的上下文文件(如 AGENT.md),定义智能体的行为、知识和指令。', + goToContext: '前往编辑上下文', + }, }, security: { title: '安全管理', @@ -727,6 +741,7 @@ export default { workspaces: { title: '工作区管理', desc: '管理组织的工作区。', + manage: '管理工作区', newWorkspace: '新建工作区', loading: '加载中...', noWorkspaces: '暂无工作区。', @@ -1537,8 +1552,8 @@ export default { periodDesc: '从日、周、月三个维度观察系统运行状况。', runsDesc: '定时任务执行记录,包含耗时、消耗和结果。', trend: { - title: '7 天趋势', - subtitle: '过去一周的消息量和 Token 消耗趋势。', + title: '本周活跃度', + subtitle: '你和 AI 的互动频率。', }, periodComparison: '周期对比', periods: { diff --git a/mateclaw-ui/src/views/AgentContext.vue b/mateclaw-ui/src/views/AgentContext.vue index 7952f274..90f53604 100644 --- a/mateclaw-ui/src/views/AgentContext.vue +++ b/mateclaw-ui/src/views/AgentContext.vue @@ -207,6 +207,7 @@