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:1.url接受“cron_”前缀的路由;2.心跳-频道下拉框同步频道启用逻辑
yuhaiquan6a2a953b14bd
diff --git a/jiuwenswarm/channels/web/frontend/src/App.tsx b/jiuwenswarm/channels/web/frontend/src/App.tsxindex 3650b4cddb..528c5824c5 100644--- a/jiuwenswarm/channels/web/frontend/src/App.tsx+++ b/jiuwenswarm/channels/web/frontend/src/App.tsx@@ -2035,7 +2035,24 @@ function AppContent() {sessionId={sessionId}onCreateViaChat={(initialInputValue) => requestSessionNavigation('new', { initialInputValue })}onSelectSession={(session) => {- if (typeof session === 'string') { void handleRestoreSession(session); return; }+ if (typeof session === 'string') {+ // 立即执行返回的 session_id 可能还未在后端创建(agent 刚开始执行),+ // 构造最小 Session 占位对象,让 upsertSessionMetadata 直接加入会话列表,+ // 避免 loadSessionMetadata 立即失败导致"对话不存在或已删除"。+ // 后续 cron 广播到达时会刷新会话列表补全完整元数据。+ void handleRestoreSession(session, undefined, {+ session_id: session,+ title: '',+ project_id: '',+ project_dir: '',+ mode: 'agent',+ status: 'active',+ message_count: 0,+ created_at: new Date().toISOString(),+ updated_at: new Date().toISOString(),+ });+ return;+ }requestSessionNavigation(session);}}/>diff --git a/jiuwenswarm/channels/web/frontend/src/components/HeartbeatPanel/index.tsx b/jiuwenswarm/channels/web/frontend/src/components/HeartbeatPanel/index.tsxindex 4a362b1ed0..4349ecc746 100644--- a/jiuwenswarm/channels/web/frontend/src/components/HeartbeatPanel/index.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/HeartbeatPanel/index.tsx@@ -73,6 +73,7 @@ export function HeartbeatPanel() {const [startInput, setStartInput] = useState('08:00');const [endInput, setEndInput] = useState('22:00');const [filePath, setFilePath] = useState<string>('');+ const [enabledChannels, setEnabledChannels] = useState<Set<string>>(new Set(['web']));const loadConf = useCallback(async () => {setLoading(true);@@ -113,6 +114,29 @@ export function HeartbeatPanel() {void loadFilePath();}, [loadConf, loadFilePath]);+ // 拉取已启用频道列表,与频道面板保持一致:未启用的频道在心跳目标下拉中不可选+ useEffect(() => {+ void (async () => {+ try {+ const payload = await webRequest<{ channels?: unknown[] }>('channel.get');+ const channels = Array.isArray(payload?.channels) ? payload.channels : [];+ const enabled = new Set<string>(['web']);+ for (const item of channels) {+ if (!item || typeof item !== 'object') continue;+ const cid = (item as { channel_id?: unknown }).channel_id;+ if (typeof cid === 'string' && cid.trim()) {+ enabled.add(cid.trim().toLowerCase());+ }+ }+ setEnabledChannels(enabled);+ // 当前选中的频道未启用时,自动回退到 web+ setTargetInput((prev) => (prev !== 'web' && !enabled.has(prev) ? 'web' : prev));+ } catch {+ // 拉取失败时不阻塞面板使用,保持各选项可选+ }+ })();+ }, []);+useEffect(() => {if (!success) {return;@@ -353,9 +377,9 @@ export function HeartbeatPanel() {className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"><option value="web">{t('heartbeat.channels.web')}</option>- <option value="feishu">{t('heartbeat.channels.feishu')}</option>- <option value="xiaoyi" disabled style={{ color: 'var(--color-option-disabled)'}}>{t('heartbeat.channels.xiaoyi')}</option>- <option value="dingtalk" disabled style={{ color: 'var(--color-option-disabled)' }}>{t('heartbeat.channels.dingtalk')}</option>+ <option value="feishu" disabled={!enabledChannels.has('feishu')} style={!enabledChannels.has('feishu') ? { color: 'var(--color-option-disabled)' } : undefined}>{t('heartbeat.channels.feishu')}</option>+ <option value="xiaoyi" disabled={!enabledChannels.has('xiaoyi')} style={!enabledChannels.has('xiaoyi') ? { color: 'var(--color-option-disabled)' } : undefined}>{t('heartbeat.channels.xiaoyi')}</option>+ <option value="dingtalk" disabled={!enabledChannels.has('dingtalk')} style={!enabledChannels.has('dingtalk') ? { color: 'var(--color-option-disabled)' } : undefined}>{t('heartbeat.channels.dingtalk')}</option></select></label>diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.jsonindex 10096f17ac..95eb51f566 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json@@ -2098,7 +2098,7 @@"noProjectMatches": "No matching projects","noProjects": "No projects","noConversations": "No conversations",- "noSessions": "No trigger sessions",+ "noSessions": "No execution sessions","startConversation": "Start a new conversation from {{projectName}}","pinProject": "Pin project","unpinProject": "Unpin project",diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.jsonindex cacb3cc152..6cba7b849a 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json@@ -2102,7 +2102,7 @@"noProjectMatches": "暂无匹配项目","noProjects": "暂无项目","noConversations": "暂无会话",- "noSessions": "暂无触发记录",+ "noSessions": "暂无执行记录","startConversation": "从{{projectName}}开始新对话","pinProject": "置顶项目","unpinProject": "取消置顶项目",diff --git a/jiuwenswarm/channels/web/frontend/src/multi-session/routing/route.ts b/jiuwenswarm/channels/web/frontend/src/multi-session/routing/route.tsindex 2f9b2e0da0..7429f816a7 100644--- a/jiuwenswarm/channels/web/frontend/src/multi-session/routing/route.ts+++ b/jiuwenswarm/channels/web/frontend/src/multi-session/routing/route.ts@@ -9,7 +9,7 @@ export function parseChatRoute(pathname: string): ChatRoute | null {const match = path.match(/^\/chat\/([^/]+)$/);if (!match) return null;const sessionId = decodeURIComponent(match[1]);- return /^sess_[A-Za-z0-9_.@-]+$/.test(sessionId)+ return /^(sess_|cron_)[A-Za-z0-9_.@-]+$/.test(sessionId)? { kind: 'chat-session', sessionId }: { kind: 'not-found', pathname: path };}