Skip to content

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: 聊天消息中代码块/表格字号过小的问题;对话框复制消息后弹出已复制提示;过期定时任务不再反复更新时间;

cjh_jinduoxia778219b0ea3e
diff --git a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx
index aa7eb9d993..53b05953d7 100644
--- a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx
+++ b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx
@@ -7,6 +7,7 @@
import { useState, useCallback, useEffect, useRef, memo } from 'react';
import type { ReactNode } from 'react';
import {
+ Check,
Copy,
Info,
Square,
@@ -235,6 +236,7 @@ export const MessageItem = memo(function MessageItem({
const [hasAutoSpoken, setHasAutoSpoken] = useState(false);
const [isAudioPlaying, setIsAudioPlaying] = useState(false);
const [isExpanded, setIsExpanded] = useState(false);
+ const [copied, setCopied] = useState(false);
const audioRef = useRef<HTMLAudioElement | null>(null);
// TTS
@@ -325,6 +327,8 @@ export const MessageItem = memo(function MessageItem({
document.execCommand('copy');
document.body.removeChild(textarea);
}
+ setCopied(true);
+ window.setTimeout(() => setCopied(false), 2000);
}, [content]);
// 自动朗读新消息(仅助手消息,由父组件通过 autoSpeak 控制)
@@ -619,13 +623,27 @@ export const MessageItem = memo(function MessageItem({
<span>{formatTimestamp(timestamp)}</span>
{showCopy && (
- <button
- onClick={handleCopy}
- className="p-1.5 rounded-md hover:text-accent hover:bg-secondary"
- title={t('chatUi.copyMessage')}
- >
- <Copy className="w-4 h-4" strokeWidth={1.5} />
- </button>
+ <div className="relative">
+ {copied && (
+ <span className="animate-fade-in absolute bottom-full left-1/2 -translate-x-1/2 mb-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2 py-1 text-xs text-text shadow-md">
+ {t('chatUi.copied')}
+ </span>
+ )}
+ <button
+ onClick={handleCopy}
+ className={clsx(
+ 'p-1.5 rounded-md ',
+ copied ? 'text-accent' : 'hover:text-accent hover:bg-secondary'
+ )}
+ title={t('chatUi.copyMessage')}
+ >
+ {copied ? (
+ <Check className="w-4 h-4" strokeWidth={1.5} />
+ ) : (
+ <Copy className="w-4 h-4" strokeWidth={1.5} />
+ )}
+ </button>
+ </div>
)}
{showTTS && (
diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json
index ff0e3514be..b70389b4fd 100644
--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json
+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json
@@ -1754,6 +1754,7 @@
},
"chatUi": {
"copyMessage": "Copy message",
+ "copied": "Copied",
"stopReading": "Stop reading",
"readMessage": "Read message",
"fileExpired": "Expired",
diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json
index 9da26452e7..a66379efe3 100644
--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json
+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json
@@ -1755,6 +1755,7 @@
},
"chatUi": {
"copyMessage": "复制消息",
+ "copied": "已复制",
"stopReading": "停止朗读",
"readMessage": "朗读消息",
"fileExpired": "已过期",
diff --git a/jiuwenswarm/channels/web/frontend/src/index.css b/jiuwenswarm/channels/web/frontend/src/index.css
index 0a968c08bf..df4e12abb1 100644
--- a/jiuwenswarm/channels/web/frontend/src/index.css
+++ b/jiuwenswarm/channels/web/frontend/src/index.css
@@ -660,6 +660,7 @@ select {
.chat-markdown :where(pre, table) {
max-width: 100%;
overflow-x: auto;
+ font-size: 1em;
}
.chat-markdown :where(pre code) {
@@ -671,6 +672,15 @@ select {
.chat-markdown :where(:not(pre) > code) {
overflow-wrap: anywhere;
white-space: break-spaces;
+ font-size: 1em;
+ }
+
+ /* Typography's own `code { font-size: .857em }` rule comes after its
+ `pre code { font-size: inherit }` reset in the generated CSS, with equal
+ specificity, so it wins and shrinks code-block text too. Override `code`
+ itself (not just `pre`) so both inline and fenced code end up at 1em. */
+ .chat-markdown :where(code) {
+ font-size: 1em;
}
/* Remove the default prose paragraph margins so single-line messages sit flush
diff --git a/jiuwenswarm/gateway/cron/scheduler.py b/jiuwenswarm/gateway/cron/scheduler.py
index c522faf89d..ec360b5794 100644
--- a/jiuwenswarm/gateway/cron/scheduler.py
+++ b/jiuwenswarm/gateway/cron/scheduler.py
@@ -420,20 +420,29 @@ class CronSchedulerService:
# 被手动暂停,同样需要能被检测到"已经没有下一次执行时间"从而转入过期态,
# 否则会永远卡在"已暂停"(见 2026-07-16 bugfix)。
# proactive job 的 enabled 由 ConfigPanel 开关管,scheduler 不碰。
- try:
- is_proactive = getattr(job, "mode", "") == "proactive.tick"
- patch = {"expired": True}
- if not is_proactive:
- patch["enabled"] = False
- job.enabled = False
- job.expired = True
- await self._store.update_job(job.id, patch)
- except Exception as update_exc: # noqa: BLE001
- logger.warning(
- "[Cron] mark expired failed job=%s: %s",
- job.id,
- update_exc,
- )
+ # 幂等保护:已经是 expired+disabled 状态的任务不再重复写回——
+ # store.update_job 每次都会刷 updated_at 和 cron_jobs.json 的 mtime,
+ # 若对已过期任务每次 reload 都写一次,会形成"mtime 变 → _check_store_changed
+ # 触发 reload → 又写一次 → mtime 又变"的循环(每 5 秒一轮),导致过期任务的
+ # updated_at 一直是最新的、永远排在任务列表最前面(PR #3756 review 期间
+ # 发现的 Bug7 回归)
+ is_proactive = getattr(job, "mode", "") == "proactive.tick"
+ already_expired = bool(getattr(job, "expired", False))
+ already_disabled = is_proactive or not bool(getattr(job, "enabled", True))
+ if not (already_expired and already_disabled):
+ try:
+ patch = {"expired": True}
+ if not is_proactive:
+ patch["enabled"] = False
+ job.enabled = False
+ job.expired = True
+ await self._store.update_job(job.id, patch)
+ except Exception as update_exc: # noqa: BLE001
+ logger.warning(
+ "[Cron] mark expired failed job=%s: %s",
+ job.id,
+ update_exc,
+ )
else:
logger.warning("[Cron] compute next run failed job=%s: %s", job.id, exc)
continue