diff --git a/web/src/views/Account.vue b/web/src/views/Account.vue index 5679cf7..b1a66f2 100644 --- a/web/src/views/Account.vue +++ b/web/src/views/Account.vue @@ -1,15 +1,484 @@ diff --git a/web/src/views/Chat.vue b/web/src/views/Chat.vue index 6b89da5..5b508c3 100644 --- a/web/src/views/Chat.vue +++ b/web/src/views/Chat.vue @@ -19,6 +19,14 @@ interface Agent { status: 'online' | 'offline' } +interface ChatSession { + id: number + title: string + agentId: number + lastMessage: string + timestamp: Date +} + // AI 助手配置 const chatAgents = ref([ { id: 1, name: 'Claude', avatar: '🧠', description: 'Anthropic AI', accentColor: '#f97316', gradient: 'from-orange-500/20 to-amber-500/20', status: 'online' }, @@ -32,13 +40,22 @@ const chatAgents = ref([ // 当前选中的助手 const selectedAgent = ref(chatAgents.value[0]) -const sidebarCollapsed = ref(false) // 聊天消息 const messages = ref([ { id: 1, role: 'assistant', content: '你好!我是 Claude,你的 AI 助手。有什么我可以帮助你的吗?', timestamp: new Date() }, ]) +// 模拟历史对话列表 +const chatSessions = ref([ + { id: 1, title: '关于 Python 学习的讨论', agentId: 1, lastMessage: '谢谢你!', timestamp: new Date(Date.now() - 3600000) }, + { id: 2, title: '代码调试帮助', agentId: 1, lastMessage: '让我看看这个问题...', timestamp: new Date(Date.now() - 7200000) }, + { id: 3, title: '数据分析咨询', agentId: 4, lastMessage: 'DeepSeek: 好的', timestamp: new Date(Date.now() - 86400000) }, +]) + +// 侧边栏展开/收起状态 +const sidebarCollapsed = ref(false) + // 输入内容 const inputMessage = ref('') const isLoading = ref(false) @@ -118,6 +135,17 @@ const selectAgent = (agent: Agent) => { ] } +// 选择历史对话 +const selectSession = (session: ChatSession) => { + const agent = chatAgents.value.find(a => a.id === session.agentId) + if (agent) { + selectedAgent.value = agent + } + messages.value = [ + { id: 1, role: 'assistant', content: `已加载会话:${session.title}`, timestamp: new Date() } + ] +} + // 新建聊天 const newChat = () => { messages.value = [ @@ -130,6 +158,19 @@ const formatTime = (date: Date) => { return date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }) } +// 格式化相对时间 +const formatRelativeTime = (date: Date) => { + const now = new Date() + const diff = now.getTime() - date.getTime() + const hours = Math.floor(diff / 3600000) + const days = Math.floor(diff / 86400000) + + if (hours < 1) return '刚刚' + if (hours < 24) return `${hours}小时前` + if (days < 7) return `${days}天前` + return date.toLocaleDateString('zh-CN') +} + // 回车发送 const handleKeydown = (e: KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { @@ -145,18 +186,15 @@ const autoResize = (e: Event) => { target.style.height = Math.min(target.scrollHeight, 160) + 'px' } -// 切换侧边栏 +// 折叠侧边栏 const toggleSidebar = () => { sidebarCollapsed.value = !sidebarCollapsed.value - setTimeout(() => { - scrollToBottom() - }, 350) } diff --git a/web/src/views/Script.vue b/web/src/views/Script.vue index f94fc42..acbfaea 100644 --- a/web/src/views/Script.vue +++ b/web/src/views/Script.vue @@ -1,15 +1,327 @@ diff --git a/web/src/views/Settings.vue b/web/src/views/Settings.vue index 2901ef2..c62f6aa 100644 --- a/web/src/views/Settings.vue +++ b/web/src/views/Settings.vue @@ -1,5 +1,5 @@ + + +
+
+
+

Logs

+

View system logs

+
+ +
+ + +
+
+ + +
+ + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
LevelSourceMessageUserTimestampActions
+ + {{ log.level.toUpperCase() }} + + {{ log.source }} +
{{ log.message }}
+
{{ log.user || '-' }}{{ log.timestamp }} +
+ +
+
+ + +
+ +

No logs found

+
+
+ + + +
+
+
+

Log Details

+ +
+ +
+
+ + {{ selectedLog.level.toUpperCase() }} + + {{ selectedLog.timestamp }} +
+ +
+ +
{{ selectedLog.source }}
+
+ +
+ +
{{ selectedLog.user || 'System' }}
+
+ +
+ +
+ {{ selectedLog.message }} +
+
+ +
+ +
#{{ selectedLog.id }}
+
+
+ +
+ +
+
+
+
+