mirror of
https://github.com/kuaifan/dootask.git
synced 2026-06-11 09:52:26 +00:00
feat(dialog): send_ai_assistant 支持自定义发送者昵称
接口新增可选 nickname 参数(最长20字),写入消息体 msg.nickname; 前端群聊昵称与回复预览对 AI 助手消息(userid=-1)显示自定义昵称, 留空回退默认"AI 助手"。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
8c809bbff1
commit
8a576595ce
@ -1716,6 +1716,7 @@ class DialogController extends AbstractController
|
||||
* @apiParam {String} text 消息内容
|
||||
* @apiParam {String} [text_type=md] 消息格式:md 或 html
|
||||
* @apiParam {String} [silence=no] 是否静默发送:yes/no
|
||||
* @apiParam {String} [nickname] 自定义发送者昵称(最多20字,留空则显示"AI 助手")
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
@ -1730,6 +1731,7 @@ class DialogController extends AbstractController
|
||||
$text = trim(Request::input('text'));
|
||||
$text_type = strtolower(trim(Request::input('text_type'))) ?: 'md';
|
||||
$silence = in_array(strtolower(trim(Request::input('silence'))), ['yes', 'true', '1']);
|
||||
$nickname = trim(Request::input('nickname'));
|
||||
$markdown = in_array($text_type, ['md', 'markdown']);
|
||||
//
|
||||
if (empty($dialog_id) && empty($task_id)) {
|
||||
@ -1741,6 +1743,9 @@ class DialogController extends AbstractController
|
||||
if (mb_strlen($text) > 200000) {
|
||||
return Base::retError('消息内容最大不能超过200000字');
|
||||
}
|
||||
if (mb_strlen($nickname) > 20) {
|
||||
return Base::retError('发送者昵称最多不能超过20字');
|
||||
}
|
||||
//
|
||||
if ($dialog_id) {
|
||||
// Direct dialog mode: verify user is a member
|
||||
@ -1787,6 +1792,9 @@ class DialogController extends AbstractController
|
||||
if ($markdown) {
|
||||
$msgData['type'] = 'md';
|
||||
}
|
||||
if ($nickname !== '') {
|
||||
$msgData['nickname'] = $nickname;
|
||||
}
|
||||
//
|
||||
$result = WebSocketDialogMsg::sendMsg(
|
||||
null,
|
||||
|
||||
@ -992,3 +992,4 @@ LDAP 用户缺少邮箱属性,请联系管理员配置
|
||||
请选择成员
|
||||
待办提醒
|
||||
你有一条待办到提醒时间啦
|
||||
发送者昵称最多不能超过20字
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div class="dialog-view" :class="viewClass" :data-id="msgData.id">
|
||||
<!--昵称-->
|
||||
<div v-if="dialogType === 'group'" class="dialog-username" @pointerdown="handleOperation($event, 'mention')">
|
||||
<UserAvatar :userid="msgData.userid" :show-icon="false" :show-name="true" :click-open-detail="msgData.userid !== -1"/>
|
||||
<UserAvatar :userid="msgData.userid" :show-icon="false" :show-name="true" :name-text="msgData.userid === -1 ? (msgData.msg.nickname || '') : ''" :click-open-detail="msgData.userid !== -1"/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
@ -13,7 +13,7 @@
|
||||
<!--回复-->
|
||||
<div v-if="!hideReply && msgData.reply_id && showReplyData(msgData.msg.reply_data)" class="dialog-reply no-dark-content" :class="replyClass" @click="viewReply">
|
||||
<div class="reply-avatar">
|
||||
<UserAvatar :userid="msgData.msg.reply_data.userid" :show-icon="false" :show-name="true"/>
|
||||
<UserAvatar :userid="msgData.msg.reply_data.userid" :show-icon="false" :show-name="true" :name-text="msgData.msg.reply_data.userid === -1 ? ((msgData.msg.reply_data.msg && msgData.msg.reply_data.msg.nickname) || '') : ''"/>
|
||||
</div>
|
||||
<div class="reply-desc" v-html="$A.getMsgSimpleDesc(msgData.msg.reply_data, 'image-preview')"></div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user