diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php
index 770d2be..4201aec 100644
--- a/resources/views/chat/partials/scripts.blade.php
+++ b/resources/views/chat/partials/scripts.blade.php
@@ -219,6 +219,69 @@
// 系统用户名列表(不可被选为聊天对象)
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', 'AI小班长', '送花播报', '系统'];
+
+ // 动作文字映射表:情绪型(着/地,放"对"之前)和动作型(了,替换"对X说")
+ const actionTextMap = {
+ '微笑': {
+ type: 'emotion',
+ word: '微笑着'
+ },
+ '大笑': {
+ type: 'emotion',
+ word: '大笑着'
+ },
+ '愤怒': {
+ type: 'emotion',
+ word: '愤怒地'
+ },
+ '哭泣': {
+ type: 'emotion',
+ word: '哭泣着'
+ },
+ '害羞': {
+ type: 'emotion',
+ word: '害羞地'
+ },
+ '鄙视': {
+ type: 'emotion',
+ word: '鄙视地'
+ },
+ '得意': {
+ type: 'emotion',
+ word: '得意地'
+ },
+ '疑惑': {
+ type: 'emotion',
+ word: '疑惑地'
+ },
+ '同情': {
+ type: 'emotion',
+ word: '同情地'
+ },
+ '无奈': {
+ type: 'emotion',
+ word: '无奈地'
+ },
+ '拳打': {
+ type: 'verb',
+ word: '拳打了'
+ },
+ '飞吻': {
+ type: 'verb',
+ word: '飞吻了'
+ },
+ '偷看': {
+ type: 'verb',
+ word: '偷看了'
+ },
+ };
+ // 生成自然语序的动作串:情绪型=[人][着/地]对[目标][verb]:;动作型=[人][了][目标],[verb]:
+ const buildActionStr = (action, fromHtml, toHtml, verb = '说') => {
+ const info = actionTextMap[action];
+ if (!info) return `${fromHtml}对${toHtml}${action}${verb}:`;
+ if (info.type === 'emotion') return `${fromHtml}${info.word}对${toHtml}${verb}:`;
+ return `${fromHtml}${info.word}${toHtml},${verb}:`;
+ };
// 用户名(单击切换发言对象,双击查看资料;系统用户仅显示文本)
const clickableUser = (uName, color) => {
if (systemUsers.includes(uName)) {
@@ -273,20 +336,29 @@
html =
`📢 系统:${msg.content}`;
} else {
- // 普通悄悄话样式(原版:紫色斜体)
- html =
- `${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`;
- if (msg.action) html += `${msg.action}`;
- html += `悄悄说:${msg.content}`;
+ // 普通悄悄话样式(原版:紫色斜体,使用自然语序动作)
+ const fromHtml = clickableUser(msg.from_user, '#cc00cc');
+ const toHtml = clickableUser(msg.to_user, '#cc00cc');
+ const verbStr = msg.action ?
+ buildActionStr(msg.action, fromHtml, toHtml, '悄悄说') :
+ `${fromHtml}对${toHtml}悄悄说:`;
+ html = `${headImg}${verbStr}${msg.content}`;
}
} else if (msg.to_user && msg.to_user !== '大家') {
- html = `${headImg}${clickableUser(msg.from_user, '#000099')}对${clickableUser(msg.to_user, '#000099')}`;
- if (msg.action) html += `${msg.action}`;
- html += `说:${msg.content}`;
+ // 对特定对象说话
+ const fromHtml = clickableUser(msg.from_user, '#000099');
+ const toHtml = clickableUser(msg.to_user, '#000099');
+ const verbStr = msg.action ?
+ buildActionStr(msg.action, fromHtml, toHtml) :
+ `${fromHtml}对${toHtml}说:`;
+ html = `${headImg}${verbStr}${msg.content}`;
} else {
- html = `${headImg}${clickableUser(msg.from_user, '#000099')}对大家`;
- if (msg.action) html += `${msg.action}`;
- html += `说:${msg.content}`;
+ // 对大家说话
+ const fromHtml = clickableUser(msg.from_user, '#000099');
+ const verbStr = msg.action ?
+ buildActionStr(msg.action, fromHtml, '大家') :
+ `${fromHtml}对大家说:`;
+ html = `${headImg}${verbStr}${msg.content}`;
}
if (!timeStrOverride) {