JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix:优化小屏下中间内容区域宽度;优化md样式,调整规划模式数据显示逻辑及样式;对话预览增加提示仅显示部分数据
xiaoyao425811267f6726
diff --git a/jiuwenclaw/channels/web/frontend/src/App.tsx b/jiuwenclaw/channels/web/frontend/src/App.tsxindex 48dac4be6b..7fade47be6 100644--- a/jiuwenclaw/channels/web/frontend/src/App.tsx+++ b/jiuwenclaw/channels/web/frontend/src/App.tsx@@ -4,7 +4,7 @@* 应用主布局,整合所有组件*/-import { useState, useCallback, useEffect, useRef, Component, ReactNode } from 'react';+import { useState, useCallback, useEffect, useRef, Component, ReactNode, useMemo } from 'react';import { ChatPanel } from './components/ChatPanel';import { SessionSidebar } from './components/SessionSidebar';import { SkillPanel } from './components/SkillPanel';@@ -209,7 +209,7 @@ function AppContent() {useEffect(() => () => disposeInFlightHistoryHandles(), [disposeInFlightHistoryHandles]);- const { setCurrentSession, setSessions, setAvailableModels, setMode, mode, heartbeatMessage, heartbeatUpdatedAt } = useSessionStore();+ const { setCurrentSession, setSessions, setAvailableModels, setMode, mode, heartbeatMessage, heartbeatUpdatedAt, teamTaskEvents, teamMembers } = useSessionStore();const {clearMessages,clearSubtasks,@@ -222,8 +222,19 @@ function AppContent() {setThinking,setPaused,} = useChatStore();- const { clearTodos } = useTodoStore();- const { reset: resetHarnessStore } = useHarnessStore();+ const { todos, clearTodos } = useTodoStore();+ const { extensionReady, reset: resetHarnessStore } = useHarnessStore();++ const toolPanelHasContent = useMemo(() => {+ switch (mode) {+ case 'auto_harness':+ return Boolean(extensionReady?.runtimePath);+ case 'team':+ return teamTaskEvents.length > 0 || teamMembers.length > 0;+ default:+ return todos.length > 0;+ }+ }, [mode, todos.length, teamTaskEvents.length, teamMembers.length, extensionReady?.runtimePath]);// WebSocket 连接 - provider 由后端配置决定 - provider 由后端配置决定,前端默认不在 URL query 传递const {@@ -1118,15 +1129,30 @@ function AppContent() {/></div>+ {/* StatusBar - 仅在有右侧面板内容时显示 */}+ {toolPanelHasContent && (+ <StatusBar+ onCancel={mode === 'team' ? undefined : handleCancel}+ teamMode={mode === 'team'}+ />+ )}+ </div>++ {/* Tool Panel - 仅在有内容时显示 */}+ {toolPanelHasContent && (+ <ToolPanel />+ )}+ </div>++ {/* StatusBar - 当没有右侧面板时,单独显示在底部 */}+ {!toolPanelHasContent && (+ <div className="card"><StatusBaronCancel={mode === 'team' ? undefined : handleCancel}teamMode={mode === 'team'}/></div>-- {/* Tool Panel */}- {<ToolPanel />}- </div>+ )}</>)}{activeNav === 'agents' && (diff --git a/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/FileViewer.tsx b/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/FileViewer.tsxindex d26f40265c..e91df4f1af 100644--- a/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/FileViewer.tsx+++ b/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/FileViewer.tsx@@ -240,7 +240,20 @@ export function FileViewer({ filePath, fileName, reloadNonce = 0 }: FileViewerPr) : null}{isHistoryJson && isJson && !loading ? (<div className="flex flex-shrink-0 items-center gap-2 self-stretch">- <span className="text-xs leading-snug text-text-muted whitespace-nowrap">{t('fileViewer.chatPreview')}</span>+ <span className="inline-flex items-center gap-1 text-xs leading-snug text-text-muted whitespace-nowrap">+ {t('fileViewer.chatPreview')}+ <span+ tabIndex={0}+ role="img"+ aria-label={t('fileViewer.chatPreviewHint')}+ className="group relative inline-flex h-4 w-4 items-center justify-center rounded-full border border-border bg-secondary text-[10px] font-medium text-text-muted outline-none transition-colors hover:border-border-hover hover:text-text focus-visible:border-accent focus-visible:text-text"+ >+ ?+ <span className="pointer-events-none absolute right-0 top-[calc(100%+6px)] z-50 hidden w-max max-w-[180px] rounded-md border border-border bg-[var(--popover)] px-2 py-1 text-xs font-normal leading-snug text-[var(--popover-foreground)] shadow-lg group-hover:block group-focus-visible:block">+ {t('fileViewer.chatPreviewHint')}+ </span>+ </span>+ </span><buttontype="button"role="switch"diff --git a/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/ChatPanel.css b/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/ChatPanel.cssindex 77d24453fd..f61d0557f1 100644--- a/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/ChatPanel.css+++ b/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/ChatPanel.css@@ -426,7 +426,7 @@}.chat-welcome__heading {- font-size: 32px;+ font-size: 24px;font-weight: 600;color: var(--text-strong);line-height: 48px;@@ -527,40 +527,6 @@box-shadow: 0 4px 16px rgba(96, 165, 250, 0.1);}-@media (min-width: 1440px) {- .chat-welcome__logo {- width: 72px;- height: 72px;- }-- .chat-welcome__heading {- font-size: 1.5rem;- }-- .chat-welcome__subtext {- max-width: 460px;- }-- .chat-suggestions {- max-width: 560px;- }-}--@media (min-width: 1920px) {- .chat-welcome__logo {- width: 80px;- height: 80px;- }-- .chat-welcome__heading {- font-size: 1.65rem;- }-- .chat-suggestions {- max-width: 640px;- }-}-/* ===========================HarnessProgressBar=========================== */diff --git a/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx b/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/MessageItem.tsxindex f4a2a7315b..423818ac28 100644--- a/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx+++ b/jiuwenclaw/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx@@ -522,6 +522,7 @@ export function MessageItem({className={clsx('chat-bubble relative group',isUser ? 'user' : 'assistant',+ !isUser && !isStreaming && 'markdown',isStreaming && 'streaming')}data-testid={!isUser ? 'thinking-panel' : undefined}@@ -568,50 +569,51 @@ export function MessageItem({</div>)}- {/* 时间戳和操作 */}- <div- className={clsx(- 'flex items-center gap-3 text-sm mt-2 text-text-muted',- isUser ? 'justify-end' : 'justify-start'- )}- >- <span>{formatTimestamp(timestamp)}</span>-- {showCopy && (- <button- onClick={handleCopy}- className="p-1.5 rounded-md transition-colors hover:text-accent hover:bg-secondary"- title={t('chatUi.copyMessage')}- >- <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}>- <path strokeLinecap="round" strokeLinejoin="round" d="M8.25 6.75h7.5m-7.5 3h7.5m-7.5 3h4.5M6.75 3h7.5A2.25 2.25 0 0116.5 5.25v13.5A2.25 2.25 0 0114.25 21h-7.5A2.25 2.25 0 014.5 18.75V5.25A2.25 2.25 0 016.75 3z" />- </svg>- </button>- )}-- {showTTS && (- <button- onClick={handleSpeak}- className={clsx(- 'p-1.5 rounded-md transition-colors',- isPlaying- ? 'text-accent bg-accent/10'- : 'hover:text-accent hover:bg-secondary'- )}- title={isPlaying ? t('chatUi.stopReading') : t('chatUi.readMessage')}- >- {isPlaying ? (- <svg className="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">- <rect x="6" y="6" width="12" height="12" rx="2" />- </svg>- ) : (+ {!isStreaming && (+ <div+ className={clsx(+ 'flex items-center gap-3 text-sm mt-2 text-text-muted',+ isUser ? 'justify-end' : 'justify-start'+ )}+ >+ <span>{formatTimestamp(timestamp)}</span>++ {showCopy && (+ <button+ onClick={handleCopy}+ className="p-1.5 rounded-md transition-colors hover:text-accent hover:bg-secondary"+ title={t('chatUi.copyMessage')}+ ><svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}>- <path strokeLinecap="round" strokeLinejoin="round" d="M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z" />+ <path strokeLinecap="round" strokeLinejoin="round" d="M8.25 6.75h7.5m-7.5 3h7.5m-7.5 3h4.5M6.75 3h7.5A2.25 2.25 0 0116.5 5.25v13.5A2.25 2.25 0 0114.25 21h-7.5A2.25 2.25 0 014.5 18.75V5.25A2.25 2.25 0 016.75 3z" /></svg>- )}- </button>- )}- </div>+ </button>+ )}++ {showTTS && (+ <button+ onClick={handleSpeak}+ className={clsx(+ 'p-1.5 rounded-md transition-colors',+ isPlaying+ ? 'text-accent bg-accent/10'+ : 'hover:text-accent hover:bg-secondary'+ )}+ title={isPlaying ? t('chatUi.stopReading') : t('chatUi.readMessage')}+ >+ {isPlaying ? (+ <svg className="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">+ <rect x="6" y="6" width="12" height="12" rx="2" />+ </svg>+ ) : (+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}>+ <path strokeLinecap="round" strokeLinejoin="round" d="M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z" />+ </svg>+ )}+ </button>+ )}+ </div>+ )}</div></div>);diff --git a/jiuwenclaw/channels/web/frontend/src/components/ConfigPanel/index.tsx b/jiuwenclaw/channels/web/frontend/src/components/ConfigPanel/index.tsxindex 6f1c37a772..848873de1c 100644--- a/jiuwenclaw/channels/web/frontend/src/components/ConfigPanel/index.tsx+++ b/jiuwenclaw/channels/web/frontend/src/components/ConfigPanel/index.tsx@@ -1783,7 +1783,7 @@ function TeamItemSection({onChange={(e) => updateLeader(field, e.target.value)}className="flex-1 rounded border border-border bg-bg px-2 py-1 text-text text-xs">- <option value="">-- Select Agent --</option>+ <option value="" disabled>-- Select Agent --</option>{agents.map((agent) => {const refs = getAgentTeamReferences(agent.name);const isReferenced = refs.length > 0;@@ -1837,7 +1837,7 @@ function TeamItemSection({onChange={(e) => updateTeammate(field, e.target.value)}className="flex-1 rounded border border-border bg-bg px-2 py-1 text-text text-xs">- <option value="">-- Select Agent --</option>+ <option value="" disabled>-- Select Agent --</option>{agents.map((agent) => {const refs = getAgentTeamReferences(agent.name);const isReferenced = refs.length > 0;@@ -1913,7 +1913,7 @@ function TeamItemSection({onChange={(e) => updateMember(idx, field, e.target.value)}className="flex-1 rounded border border-border bg-bg px-2 py-1 text-text text-xs">- <option value="">-- Select Agent --</option>+ <option value="" disabled>-- Select Agent --</option>{agents.map((agent) => {const refs = getAgentTeamReferences(agent.name);const isReferenced = refs.length > 0;@@ -1956,7 +1956,7 @@ function TeamItemSection({onChange={(e) => updateNewMember(field, e.target.value)}className="flex-1 rounded border border-border bg-bg px-2 py-1 text-text text-xs">- <option value="">-- Select Agent --</option>+ <option value="" disabled>-- Select Agent --</option>{agents.map((agent) => {const refs = getAgentTeamReferences(agent.name);const isReferenced = refs.length > 0;@@ -2517,15 +2517,28 @@ export function ConfigPanel({const hasAgentsTeamsValidationError = useMemo(() => {for (const agent of draftAgents) {if (!agent.name.trim()) return true;+ if (!agent.model.provider.trim()) return true;+ if (!agent.model.api_base.trim()) return true;+ if (!agent.model.api_key.trim()) return true;if (!agent.model.model.trim()) return true;}for (const team of draftTeams) {if (!team.team_name.trim()) return true;+ if (!team.lifecycle?.trim()) return true;+ if (!team.teammate_mode?.trim()) return true;+ if (!team.spawn_mode?.trim()) return true;+ if (!team.leader?.member_name?.trim()) return true;+ if (!team.leader?.display_name?.trim()) return true;+ if (!team.leader?.persona?.trim()) return true;+ if (!team.leader?.agent_key?.trim()) return true;+ if (!team.teammate?.agent_key?.trim()) return true;for (const member of team.predefined_members || []) {if (!member.member_name.trim()) return true;if (!/^[a-zA-Z0-9_]+$/.test(member.member_name)) return true;+ if (!member.display_name?.trim()) return true;+ if (!member.persona?.trim()) return true;+ if (!member.agent_key?.trim()) return true;}- if (team.leader?.member_name && !/^[a-zA-Z0-9_]+$/.test(team.leader.member_name)) return true;}return false;}, [draftAgents, draftTeams]);diff --git a/jiuwenclaw/channels/web/frontend/src/hooks/useWebSocket.ts b/jiuwenclaw/channels/web/frontend/src/hooks/useWebSocket.tsindex 9b8e5055a2..b15445d615 100644--- a/jiuwenclaw/channels/web/frontend/src/hooks/useWebSocket.ts+++ b/jiuwenclaw/channels/web/frontend/src/hooks/useWebSocket.ts@@ -725,7 +725,11 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {// 定时任务等广播的 session_id 为空/null,若仍走 currentStreamId 会写到错误气泡甚至“无可见更新”。const streamId = currentStreamId;if (streamId && payloadSessionId) {- updateMessage(streamId, { ...(content ? { content } : {}), isStreaming: false });+ updateMessage(streamId, {+ ...(content ? { content } : {}),+ isStreaming: false,+ timestamp: new Date().toISOString(),+ });stopStreaming();if (content && !content.includes('MEDIA:')) {handleTtsPlayback(streamId, content);@@ -836,13 +840,11 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {if (!shouldHandleSessionEvent(payload)) return;if (shouldDropDuplicatedEvent('chat.tool_call', payload)) return;clearThinkingForVisibleOutput();- const { currentStreamId, currentStreamContent } = useChatStore.getState();- if (currentStreamId && currentStreamContent) {- updateMessage(currentStreamId, { isStreaming: false });- stopStreaming();- handleTtsPlayback(currentStreamId, currentStreamContent);- }addToolCall(normalizeToolCallPayload(payload));+ const { currentStreamId } = useChatStore.getState();+ if (currentStreamId) {+ updateMessage(currentStreamId, { timestamp: new Date().toISOString() });+ }}),webClient.on('chat.tool_result', ({ payload }) => {if (!shouldHandleSessionEvent(payload)) return;diff --git a/jiuwenclaw/channels/web/frontend/src/i18n/locales/en.json b/jiuwenclaw/channels/web/frontend/src/i18n/locales/en.jsonindex 1a161d85c8..e857f99090 100644--- a/jiuwenclaw/channels/web/frontend/src/i18n/locales/en.json+++ b/jiuwenclaw/channels/web/frontend/src/i18n/locales/en.json@@ -1014,6 +1014,7 @@},"fileViewer": {"chatPreview": "Chat preview",+ "chatPreviewHint": "Only partial data is shown","historyPreviewEmpty": "No messages to show after the same filtering as history restore (or the file is empty). Turn off preview to see raw JSON.","edit": "Edit","unknownError": "Unknown error",diff --git a/jiuwenclaw/channels/web/frontend/src/i18n/locales/zh.json b/jiuwenclaw/channels/web/frontend/src/i18n/locales/zh.jsonindex 46b1350ba4..b66a106b5a 100644--- a/jiuwenclaw/channels/web/frontend/src/i18n/locales/zh.json+++ b/jiuwenclaw/channels/web/frontend/src/i18n/locales/zh.json@@ -1014,6 +1014,7 @@},"fileViewer": {"chatPreview": "对话预览",+ "chatPreviewHint": "仅展示部分数据","historyPreviewEmpty": "按与历史恢复相同的规则过滤后,没有可展示的消息(或文件为空)。可关闭预览查看原始 JSON。","edit": "编辑","unknownError": "未知错误",diff --git a/jiuwenclaw/channels/web/frontend/src/index.css b/jiuwenclaw/channels/web/frontend/src/index.cssindex 96a7bd7070..09e161d575 100644--- a/jiuwenclaw/channels/web/frontend/src/index.css+++ b/jiuwenclaw/channels/web/frontend/src/index.css@@ -775,12 +775,16 @@ select {.chat-bubble.assistant {border-color: transparent;- background: var(--secondary);+ background: var(--bg-muted);+ }++ .chat-bubble.assistant.markdown {+ padding: 0 14px;}:root[data-theme="light"] .chat-bubble.assistant {border-color: var(--border);- background: var(--bg-muted);+ background: #ffffff;}.chat-bubble.streaming {@@ -829,6 +833,34 @@ select {white-space: pre-wrap;}+ .chat-bubble.assistant.markdown .chat-text {+ @apply prose prose-sm max-w-none;+ --tw-prose-body: var(--chat-text);+ --tw-prose-headings: var(--text-strong);+ --tw-prose-lead: var(--muted);+ --tw-prose-links: var(--accent);+ --tw-prose-bold: var(--text-strong);+ --tw-prose-counters: var(--muted);+ --tw-prose-bullets: var(--muted);+ --tw-prose-hr: var(--border);+ --tw-prose-quotes: var(--chat-text);+ --tw-prose-quote-borders: var(--border);+ --tw-prose-captions: var(--muted);+ --tw-prose-code: var(--chat-text);+ --tw-prose-pre-code: var(--chat-text);+ --tw-prose-pre-bg: var(--secondary);+ --tw-prose-th-borders: var(--border);+ --tw-prose-td-borders: var(--border);+ white-space: normal;+ }++ .chat-bubble.assistant.streaming .chat-text {+ @apply prose-sm max-w-none;+ color: var(--chat-text);+ font-size: 0.875rem;+ line-height: 1.7142857;+ }+/* Chat input task queue */.chat-input-task-queue {margin-bottom: 12px;@@ -897,80 +929,6 @@ select {color: var(--danger);}- .chat-text :where(p) {- margin: 0.5em 0;- }-- .chat-text :where(p:first-child) {- margin-top: 0;- }-- .chat-text :where(p:last-child) {- margin-bottom: 0;- }-- .chat-text :where(ul, ol) {- margin: 0.5em 0;- padding-left: 1.25em;- }-- .chat-text :where(li) {- margin: 0.2em 0;- }-- .chat-text :where(h1, h2, h3, h4, h5, h6) {- margin: 0.8em 0 0.4em;- font-weight: 600;- line-height: 1.35;- }-- .chat-text :where(h1) { font-size: 1.15em; }- .chat-text :where(h2) { font-size: 1.1em; }- .chat-text :where(h3, h4, h5, h6) { font-size: 1em; }-- .chat-text :where(blockquote) {- margin: 0.75em 0;- padding-left: 0.75em;- border-left: 3px solid var(--border);- color: var(--muted);- }-- .chat-text :where(a) {- color: var(--accent);- text-decoration: underline;- text-underline-offset: 2px;- }-- .chat-text :where(pre) {- margin-top: 0.75em;- padding: 10px 12px;- border-radius: var(--radius-md);- border: 1px solid var(--border);- background: var(--secondary);- overflow: auto;- }-- :root[data-theme="light"] .chat-text :where(pre) {- background: var(--bg-muted);- }-- .chat-text :where(pre code) {- font-size: 12px;- white-space: pre;- }-- .chat-text :where(code) {- font-family: var(--mono);- font-size: 0.9em;- }-- .chat-text :where(:not(pre) > code) {- padding: 0.15em 0.35em;- border-radius: var(--radius-sm);- border: 1px solid var(--border);- background: var(--secondary);- }-/* Chat compose wrapper */.chat-compose {width: var(--chat-content-width);@@ -980,7 +938,7 @@ select {.chat-panel-shell {--chat-page-max-width: 920px;- --chat-page-gutter: clamp(16px, 4vw, 56px);+ --chat-page-gutter: clamp(12px, 3vw, 40px);--chat-content-width: min(var(--chat-page-max-width),calc(100% - (var(--chat-page-gutter) * 2))@@ -1003,18 +961,7 @@ select {justify-content: center;}- @media (min-width: 1280px) {- .chat-panel-shell {- --chat-page-max-width: 860px;- --chat-page-gutter: clamp(48px, 12vw, 240px);- }- }-@media (max-width: 640px) {- .chat-panel-shell {- --chat-page-gutter: 12px;- }-.chat-scroll {padding-top: 12px;}@@ -1217,15 +1164,6 @@ select {background: transparent;}- .team-event-group-list::-webkit-scrollbar {- width: 4px;- }-- .team-event-group-list::-webkit-scrollbar-thumb {- background: var(--border-strong);- border-radius: var(--radius-full);- }-.team-event-group-row {display: grid;grid-template-columns: 26px minmax(0, 1fr);@@ -1373,27 +1311,12 @@ select {.tool-tree__list {display: block;- width: max-content;+ width: 100%;max-width: 100%;max-height: 220px;overflow-y: auto;padding-left: 0;padding-right: 6px;- scrollbar-width: thin;- scrollbar-color: var(--border-strong) transparent;- }-- .tool-tree__list::-webkit-scrollbar {- width: 4px;- }-- .tool-tree__list::-webkit-scrollbar-thumb {- background: var(--border-strong);- border-radius: var(--radius-full);- }-- .tool-tree__list::-webkit-scrollbar-track {- background: transparent;}.tool-tree__latest {