mirror of
https://github.com/kuaifan/dootask.git
synced 2026-06-11 09:52:26 +00:00
fix(dialog): AI 助手消息推送补全发送者身份
AI 助手为虚拟用户(userid=-1)无会员记录,userid2nickname 返回空串, 导致群聊推送拼成 ": 内容"。友盟 App 推送与前端桌面/移动通知改为取 msg.nickname 或默认"AI 助手"作为发送者名,显示为 "名称: 内容"。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
8a576595ce
commit
c706c515ee
@ -189,7 +189,12 @@ class WebSocketDialogMsgTask extends AbstractTask
|
||||
if ($umengUserid) {
|
||||
$setting = Base::setting('appPushSetting');
|
||||
if ($setting['push'] === 'open') {
|
||||
$umengTitle = User::userid2nickname($msg->userid);
|
||||
if ($msg->userid == -1) {
|
||||
// AI 助手虚拟用户没有会员记录,取自定义昵称或默认名称
|
||||
$umengTitle = ($msg->msg['nickname'] ?? '') ?: Doo::translate('AI 助手');
|
||||
} else {
|
||||
$umengTitle = User::userid2nickname($msg->userid);
|
||||
}
|
||||
$umengBody = WebSocketDialogMsg::previewMsg($msg);
|
||||
if ($dialog->type == 'group') {
|
||||
$umengBody = $umengTitle . ': ' . $umengBody;
|
||||
|
||||
@ -993,3 +993,4 @@ LDAP 用户缺少邮箱属性,请联系管理员配置
|
||||
待办提醒
|
||||
你有一条待办到提醒时间啦
|
||||
发送者昵称最多不能超过20字
|
||||
AI 助手
|
||||
|
||||
@ -1620,6 +1620,14 @@ export default {
|
||||
this.__notificationId = id;
|
||||
//
|
||||
const notificationFuncA = async (title, body) => {
|
||||
if (userid === -1) {
|
||||
// AI 助手虚拟用户没有会员记录,取自定义昵称或默认名称
|
||||
if (dialog_type === 'group') {
|
||||
body = ((data.msg && data.msg.nickname) || this.$L('AI 助手')) + ': ' + body;
|
||||
}
|
||||
notificationFuncB(title, body, $A.mainUrl('images/avatar/default_assistant.png'))
|
||||
return;
|
||||
}
|
||||
const tempUser = await this.$store.dispatch("getUserData", userid).catch(_ => {});
|
||||
if (dialog_type === 'group' && tempUser) {
|
||||
body = tempUser.nickname + ': ' + body;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user