diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php
index 15b3041d3..c50b44fd6 100644
--- a/app/Models/WebSocketDialogMsg.php
+++ b/app/Models/WebSocketDialogMsg.php
@@ -665,8 +665,16 @@ class WebSocketDialogMsg extends AbstractModel
if (preg_match('/:::\s*reasoning\s+/', $text)) {
return Doo::translate('思考中...');
}
- $text = Base::markdown2html($text);
- $text = self::previewConvertTaskList($text);
+ $title = '';
+ if (preg_match('/^#{1,2}\s+(.+)/m', $text, $matches)) {
+ $title = trim($matches[1]);
+ }
+ if ($title) {
+ $text = $title;
+ } else {
+ $text = Base::markdown2html($text);
+ $text = self::previewConvertTaskList($text);
+ }
}
$text = preg_replace("/
]*?alt=\"(\S+)\"[^>]*?>/", "[$1]", $text);
$text = preg_replace("/
]*?>/", "[" . Doo::translate('动画表情') . "]", $text);
diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js
index 27b8193fc..7b2e995f3 100755
--- a/resources/assets/js/functions/web.js
+++ b/resources/assets/js/functions/web.js
@@ -250,7 +250,16 @@ import {convertLocalResourcePath} from "../components/Replace/utils";
if (/:::\s*reasoning\s+/.test(text)) {
return $A.L('思考中...')
}
- text = MarkdownPreview(text);
+ let titleText = '';
+ const titleMatch = text.match(/^#{1,2}\s+(.+)/m);
+ if (titleMatch) {
+ titleText = titleMatch[1].trim();
+ }
+ if (titleText) {
+ text = titleText;
+ } else {
+ text = MarkdownPreview(text);
+ }
}
//
text = text.replace(/
]*?alt="(\S+)"[^>]*?>/g, "[$1]")