mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-16 14:12:51 +00:00
perf: 优化预览消息
This commit is contained in:
parent
937e7ba154
commit
1a841c4b5d
@ -665,8 +665,16 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
if (preg_match('/:::\s*reasoning\s+/', $text)) {
|
if (preg_match('/:::\s*reasoning\s+/', $text)) {
|
||||||
return Doo::translate('思考中...');
|
return Doo::translate('思考中...');
|
||||||
}
|
}
|
||||||
$text = Base::markdown2html($text);
|
$title = '';
|
||||||
$text = self::previewConvertTaskList($text);
|
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("/<img\s+class=\"emoticon\"[^>]*?alt=\"(\S+)\"[^>]*?>/", "[$1]", $text);
|
$text = preg_replace("/<img\s+class=\"emoticon\"[^>]*?alt=\"(\S+)\"[^>]*?>/", "[$1]", $text);
|
||||||
$text = preg_replace("/<img\s+class=\"emoticon\"[^>]*?>/", "[" . Doo::translate('动画表情') . "]", $text);
|
$text = preg_replace("/<img\s+class=\"emoticon\"[^>]*?>/", "[" . Doo::translate('动画表情') . "]", $text);
|
||||||
|
|||||||
11
resources/assets/js/functions/web.js
vendored
11
resources/assets/js/functions/web.js
vendored
@ -250,7 +250,16 @@ import {convertLocalResourcePath} from "../components/Replace/utils";
|
|||||||
if (/:::\s*reasoning\s+/.test(text)) {
|
if (/:::\s*reasoning\s+/.test(text)) {
|
||||||
return $A.L('思考中...')
|
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(/<img\s+class="emoticon"[^>]*?alt="(\S+)"[^>]*?>/g, "[$1]")
|
text = text.replace(/<img\s+class="emoticon"[^>]*?alt="(\S+)"[^>]*?>/g, "[$1]")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user