咨询助理 去除AI 字段

This commit is contained in:
wangdongbo 2026-08-24 14:00:38 +08:00
parent 5d0da3af7c
commit a368474ffb
6 changed files with 30 additions and 20 deletions

View File

@ -170,14 +170,14 @@
{ {
"path": "chat", "path": "chat",
"style": { "style": {
"navigationBarTitleText": "AI咨询助理", "navigationBarTitleText": "咨询助理",
"disableScroll": true "disableScroll": true
} }
}, },
{ {
"path": "entry", "path": "entry",
"style": { "style": {
"navigationBarTitleText": "AI咨询助理", "navigationBarTitleText": "咨询助理",
"disableScroll": true "disableScroll": true
} }
} }

View File

@ -7,9 +7,9 @@
<evaluation-card v-if="item.messageType === 'consult_ended' && (item.rateId || session?.rateId)" class="rate-card" :extension="{ rateId: item.rateId || session.rateId }" :corp-id="corpId" :doctor-info="rateAssistantInfo" /> <evaluation-card v-if="item.messageType === 'consult_ended' && (item.rateId || session?.rateId)" class="rate-card" :extension="{ rateId: item.rateId || session.rateId }" :corp-id="corpId" :doctor-info="rateAssistantInfo" />
<view v-else-if="item.sender === 'system' && item.messageType !== 'risk_notice'" class="system-message" :class="{ warn: item.messageType === 'sensitive_notice' }">{{ displayContent(item) }}</view> <view v-else-if="item.sender === 'system' && item.messageType !== 'risk_notice'" class="system-message" :class="{ warn: item.messageType === 'sensitive_notice' }">{{ displayContent(item) }}</view>
<view v-else-if="item.messageType !== 'risk_notice'" class="message-content"> <view v-else-if="item.messageType !== 'risk_notice'" class="message-content">
<view v-if="item.sender === 'assistant'" class="avatar assistant-avatar">AI</view> <image v-if="item.sender === 'assistant'" class="avatar assistant-avatar" src="/static/home/ai-consult-assistant.png" mode="aspectFill" />
<view class="message-bubble-container"> <view class="message-bubble-container">
<view v-if="item.sender === 'assistant'" class="username-label">{{ session?.assistantName || 'AI咨询助理' }}</view> <view v-if="item.sender === 'assistant'" class="username-label">{{ assistantDisplayName }}</view>
<view class="message-bubble" :class="{ pending: item._sendStatus === 'pending' }"> <view class="message-bubble" :class="{ pending: item._sendStatus === 'pending' }">
<text class="message-text">{{ displayContent(item) }}</text> <text class="message-text">{{ displayContent(item) }}</text>
</view> </view>
@ -19,7 +19,7 @@
</view> </view>
</view> </view>
<view v-if="waitingAi" class="message-item message-assistant"> <view v-if="waitingAi" class="message-item message-assistant">
<view class="message-content"><view class="avatar assistant-avatar">AI</view><view class="message-bubble-container"><view class="username-label">{{ session?.assistantName || 'AI咨询助理' }}</view><view class="message-bubble thinking"><view class="thinking-dot"></view><view class="thinking-dot"></view><view class="thinking-dot"></view></view></view></view> <view class="message-content"><image class="avatar assistant-avatar" src="/static/home/ai-consult-assistant.png" mode="aspectFill" /><view class="message-bubble-container"><view class="username-label">{{ assistantDisplayName }}</view><view class="message-bubble thinking"><view class="thinking-dot"></view><view class="thinking-dot"></view><view class="thinking-dot"></view></view></view></view>
</view> </view>
<view id="bottom" /> <view id="bottom" />
</view> </view>
@ -28,7 +28,7 @@
<textarea v-model="content" class="text-input" maxlength="1000" auto-height confirm-type="send" :show-confirm-bar="false" placeholder="请输入消息" @confirm="send" /> <textarea v-model="content" class="text-input" maxlength="1000" auto-height confirm-type="send" :show-confirm-bar="false" placeholder="请输入消息" @confirm="send" />
<button class="send-btn" :disabled="!content.trim()" @click="send">发送</button> <button class="send-btn" :disabled="!content.trim()" @click="send">发送</button>
</view> </view>
<view v-else class="ended">本次AI咨询已结束</view> <view v-else class="ended">本次咨询已结束</view>
</view> </view>
</template> </template>
@ -39,6 +39,7 @@ import api from '@/utils/api';
import useAccountStore from '@/store/account'; import useAccountStore from '@/store/account';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import EvaluationCard from '@/pages/message/components/special-message/evaluation.vue'; import EvaluationCard from '@/pages/message/components/special-message/evaluation.vue';
import { removeAiLabel } from '@/utils/ai-consult-display';
const { openid } = storeToRefs(useAccountStore()); const { openid } = storeToRefs(useAccountStore());
const corpId = ref(''); const corpId = ref('');
@ -50,11 +51,13 @@ const pendingRequestCount = ref(0);
const waitingAi = ref(false); const waitingAi = ref(false);
const bottomId = ref(''); const bottomId = ref('');
const active = ref(false); const active = ref(false);
const rateAssistantInfo = computed(() => ({ name: session.value?.assistantName || 'AI咨询助理', title: 'AI咨询助理', department: session.value?.teamName || '', avatar: '' })); const assistantDisplayName = computed(() => removeAiLabel(session.value?.assistantName, '咨询助理'));
const rateAssistantInfo = computed(() => ({ name: assistantDisplayName.value, title: '咨询助理', department: session.value?.teamName || '', avatar: '' }));
function displayContent(item) { function displayContent(item) {
const value = item?.content || ''; const value = item?.content || '';
if (item?.sender !== 'assistant' || typeof value !== 'string') return value; if (typeof value !== 'string' || item?.sender === 'patient') return value;
if (item?.sender !== 'assistant') return removeAiLabel(value);
const contents = []; const contents = [];
const matcher = /"streamContent"\s*:\s*"((?:\\.|[^"\\])*)"/g; const matcher = /"streamContent"\s*:\s*"((?:\\.|[^"\\])*)"/g;
let match; let match;
@ -66,7 +69,7 @@ function displayContent(item) {
// //
} }
} }
return contents.join('') || value; return removeAiLabel(contents.join('') || value);
} }
function formatMessageTime(value) { function formatMessageTime(value) {
const date = new Date(Number(value)); const date = new Date(Number(value));
@ -84,11 +87,11 @@ async function scrollToBottom() {
} }
async function detail() { async function detail() {
const res = await api('getAiConsultSessionDetail', { corpId: corpId.value, sessionId: sessionId.value, miniAppId: openid.value || uni.getStorageSync('openid') }, false); const res = await api('getAiConsultSessionDetail', { corpId: corpId.value, sessionId: sessionId.value, miniAppId: openid.value || uni.getStorageSync('openid') }, false);
if (!res?.success) return uni.showToast({ title: res?.message || '加载失败', icon: 'none' }); if (!res?.success) return uni.showToast({ title: removeAiLabel(res?.message, '加载失败'), icon: 'none' });
session.value = res.data.session; session.value = res.data.session;
messages.value = res.data.messages || []; messages.value = res.data.messages || [];
active.value = session.value.status === 'active'; active.value = session.value.status === 'active';
uni.setNavigationBarTitle({ title: session.value.assistantName || 'AI咨询助理' }); uni.setNavigationBarTitle({ title: assistantDisplayName.value });
await scrollToBottom(); await scrollToBottom();
} }
async function send() { async function send() {
@ -104,7 +107,7 @@ async function send() {
const res = await api('sendAiConsultMessage', { corpId: corpId.value, sessionId: sessionId.value, customerId: session.value.customerId, miniAppId: openid.value || uni.getStorageSync('openid'), content: value }, false); const res = await api('sendAiConsultMessage', { corpId: corpId.value, sessionId: sessionId.value, customerId: session.value.customerId, miniAppId: openid.value || uni.getStorageSync('openid'), content: value }, false);
if (!res?.success) { if (!res?.success) {
localMessage._sendStatus = 'failed'; localMessage._sendStatus = 'failed';
uni.showToast({ title: res?.message || '发送失败', icon: 'none' }); uni.showToast({ title: removeAiLabel(res?.message, '发送失败'), icon: 'none' });
return; return;
} }
await detail(); await detail();

View File

@ -34,6 +34,7 @@ import { onLoad } from '@dcloudio/uni-app';
import api from '@/utils/api'; import api from '@/utils/api';
import useAccountStore from '@/store/account'; import useAccountStore from '@/store/account';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { removeAiLabel } from '@/utils/ai-consult-display';
const { account, openid } = storeToRefs(useAccountStore()); const { account, openid } = storeToRefs(useAccountStore());
const corpId = ref(''); const corpId = ref('');
@ -60,7 +61,7 @@ async function load() {
const miniAppId = openid.value || uni.getStorageSync('openid'); const miniAppId = openid.value || uni.getStorageSync('openid');
const res = await api('getMiniAppCustomers', { corpId: corpId.value, miniAppId }, false); const res = await api('getMiniAppCustomers', { corpId: corpId.value, miniAppId }, false);
loaded.value = true; loaded.value = true;
if (!res?.success) return uni.showToast({ title: res?.message || '查询档案失败', icon: 'none' }); if (!res?.success) return uni.showToast({ title: removeAiLabel(res?.message, '查询档案失败'), icon: 'none' });
customers.value = res.data || []; customers.value = res.data || [];
enableHis.value = res.enableHis === true; enableHis.value = res.enableHis === true;
if (!customers.value.length) toCreateArchive(); if (!customers.value.length) toCreateArchive();
@ -68,7 +69,7 @@ async function load() {
async function open(customer) { async function open(customer) {
const res = await api('openAiConsultSession', { corpId: corpId.value, teamId: teamId.value, assistantId: assistantId.value, qrid: qrid.value, customerId: customer?._id || '', miniAppId: openid.value || uni.getStorageSync('openid') }); const res = await api('openAiConsultSession', { corpId: corpId.value, teamId: teamId.value, assistantId: assistantId.value, qrid: qrid.value, customerId: customer?._id || '', miniAppId: openid.value || uni.getStorageSync('openid') });
if (!res?.success) return uni.showToast({ title: res?.message || '创建失败', icon: 'none' }); if (!res?.success) return uni.showToast({ title: removeAiLabel(res?.message, '创建失败'), icon: 'none' });
uni.redirectTo({ url: `/pages/ai-consult/chat?corpId=${corpId.value}&sessionId=${res.data.session._id}` }); uni.redirectTo({ url: `/pages/ai-consult/chat?corpId=${corpId.value}&sessionId=${res.data.session._id}` });
} }

View File

@ -11,8 +11,8 @@
<view class="page"> <view class="page">
<empty-data v-if="!loading && list.length === 0" text="暂无咨询记录" /> <empty-data v-if="!loading && list.length === 0" text="暂无咨询记录" />
<view v-for="item in list" :key="`${item.source}-${item.id}`" class="card" @click="openChat(item)"> <view v-for="item in list" :key="`${item.source}-${item.id}`" class="card" @click="openChat(item)">
<view class="title"><text>{{ item.assistantName }}</text><text class="status" :class="item.status">{{ item.statusLabel }}</text></view> <view class="title"><text>{{ removeAiLabel(item.assistantName, '咨询助理') }}</text><text class="status" :class="item.status">{{ item.statusLabel }}</text></view>
<view class="line"><text class="source" :class="item.source">{{ item.sourceLabel }}</text></view> <view class="line"><text class="source" :class="item.source">{{ removeAiLabel(item.sourceLabel, '咨询') }}</text></view>
<view class="line">团队{{ item.teamName || item.teamId || '-' }}</view> <view class="line">团队{{ item.teamName || item.teamId || '-' }}</view>
<view class="line">档案{{ item.customerName || '-' }}</view> <view class="line">档案{{ item.customerName || '-' }}</view>
<view class="line">最近互动{{ format(item.lastActiveTime) }}</view> <view class="line">最近互动{{ format(item.lastActiveTime) }}</view>
@ -29,9 +29,10 @@ import useAccountStore from '@/store/account';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import FullPage from '@/components/full-page.vue'; import FullPage from '@/components/full-page.vue';
import EmptyData from '@/components/empty-data.vue'; import EmptyData from '@/components/empty-data.vue';
import { removeAiLabel } from '@/utils/ai-consult-display';
const { openid } = storeToRefs(useAccountStore()); const { openid } = storeToRefs(useAccountStore());
const corpId = ref(''); const customerId = ref(''); const source = ref(''); const corpId = ref(''); const customerId = ref(''); const source = ref('');
const sources = [{ name: '全部咨询', value: '' }, { name: 'AI咨询', value: 'ai' }, { name: 'IM咨询', value: 'im' }]; const sources = [{ name: '全部咨询', value: '' }, { name: '咨询', value: 'ai' }, { name: 'IM咨询', value: 'im' }];
const customers = ref([{ name: '全部档案', value: '' }]); const customers = ref([{ name: '全部档案', value: '' }]);
const list = ref([]); const page = ref(1); const pages = ref(0); const loading = ref(false); const list = ref([]); const page = ref(1); const pages = ref(0); const loading = ref(false);
const format = value => value ? new Date(value).toLocaleString('zh-CN', { hour12: false }) : '-'; const format = value => value ? new Date(value).toLocaleString('zh-CN', { hour12: false }) : '-';

View File

@ -29,7 +29,7 @@
}}</text> }}</text>
</view> </view>
<view class="patient-info"> <view class="patient-info">
<text v-if="conversation.source === 'ai'" class="source-tag">AI咨询</text> <text v-if="conversation.source === 'ai'" class="source-tag">咨询</text>
咨询人 | {{ conversation.patientName }} 咨询人 | {{ conversation.patientName }}
</view> </view>
<view class="message-preview"> <view class="message-preview">
@ -75,6 +75,7 @@ import { globalUnreadListenerManager } from "@/utils/global-unread-listener.js";
import { get } from "@/utils/cache"; import { get } from "@/utils/cache";
import { normalizeCorpId } from "@/utils/api-base-config"; import { normalizeCorpId } from "@/utils/api-base-config";
import api from "@/utils/api"; import api from "@/utils/api";
import { removeAiLabel } from "@/utils/ai-consult-display";
import useGroupAvatars from "./hooks/use-group-avatars.js"; import useGroupAvatars from "./hooks/use-group-avatars.js";
import GroupAvatar from "@/components/group-avatar.vue"; import GroupAvatar from "@/components/group-avatar.vue";
import { import {
@ -279,10 +280,10 @@ const loadAiConsultationList = async () => {
source: "ai", source: "ai",
sessionId: item.id, sessionId: item.id,
corpId: item.corpId, corpId: item.corpId,
displayName: item.assistantName || "AI咨询助理", displayName: removeAiLabel(item.assistantName, "咨询助理"),
teamName: item.teamName || "", teamName: item.teamName || "",
patientName: item.customerName || "未命名患者", patientName: item.customerName || "未命名患者",
lastMessage: item.statusLabel || "AI咨询", lastMessage: removeAiLabel(item.statusLabel, "咨询"),
lastMessageTime: item.lastActiveTime || 0, lastMessageTime: item.lastActiveTime || 0,
unreadCount: 0, unreadCount: 0,
})); }));

View File

@ -0,0 +1,4 @@
export function removeAiLabel(value, fallback = '') {
const text = typeof value === 'string' ? value.replace(/AI/g, '').trim() : '';
return text || fallback;
}