咨询助理 去除AI 字段
This commit is contained in:
parent
5d0da3af7c
commit
a368474ffb
@ -170,14 +170,14 @@
|
||||
{
|
||||
"path": "chat",
|
||||
"style": {
|
||||
"navigationBarTitleText": "AI咨询助理",
|
||||
"navigationBarTitleText": "咨询助理",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "entry",
|
||||
"style": {
|
||||
"navigationBarTitleText": "AI咨询助理",
|
||||
"navigationBarTitleText": "咨询助理",
|
||||
"disableScroll": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -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" />
|
||||
<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-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 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' }">
|
||||
<text class="message-text">{{ displayContent(item) }}</text>
|
||||
</view>
|
||||
@ -19,7 +19,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<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 id="bottom" />
|
||||
</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" />
|
||||
<button class="send-btn" :disabled="!content.trim()" @click="send">发送</button>
|
||||
</view>
|
||||
<view v-else class="ended">本次AI咨询已结束</view>
|
||||
<view v-else class="ended">本次咨询已结束</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -39,6 +39,7 @@ import api from '@/utils/api';
|
||||
import useAccountStore from '@/store/account';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import EvaluationCard from '@/pages/message/components/special-message/evaluation.vue';
|
||||
import { removeAiLabel } from '@/utils/ai-consult-display';
|
||||
|
||||
const { openid } = storeToRefs(useAccountStore());
|
||||
const corpId = ref('');
|
||||
@ -50,11 +51,13 @@ const pendingRequestCount = ref(0);
|
||||
const waitingAi = ref(false);
|
||||
const bottomId = ref('');
|
||||
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) {
|
||||
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 matcher = /"streamContent"\s*:\s*"((?:\\.|[^"\\])*)"/g;
|
||||
let match;
|
||||
@ -66,7 +69,7 @@ function displayContent(item) {
|
||||
// 兼容历史会话中无法解析的单段协议消息。
|
||||
}
|
||||
}
|
||||
return contents.join('') || value;
|
||||
return removeAiLabel(contents.join('') || value);
|
||||
}
|
||||
function formatMessageTime(value) {
|
||||
const date = new Date(Number(value));
|
||||
@ -84,11 +87,11 @@ async function scrollToBottom() {
|
||||
}
|
||||
async function detail() {
|
||||
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;
|
||||
messages.value = res.data.messages || [];
|
||||
active.value = session.value.status === 'active';
|
||||
uni.setNavigationBarTitle({ title: session.value.assistantName || 'AI咨询助理' });
|
||||
uni.setNavigationBarTitle({ title: assistantDisplayName.value });
|
||||
await scrollToBottom();
|
||||
}
|
||||
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);
|
||||
if (!res?.success) {
|
||||
localMessage._sendStatus = 'failed';
|
||||
uni.showToast({ title: res?.message || '发送失败', icon: 'none' });
|
||||
uni.showToast({ title: removeAiLabel(res?.message, '发送失败'), icon: 'none' });
|
||||
return;
|
||||
}
|
||||
await detail();
|
||||
|
||||
@ -34,6 +34,7 @@ import { onLoad } from '@dcloudio/uni-app';
|
||||
import api from '@/utils/api';
|
||||
import useAccountStore from '@/store/account';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { removeAiLabel } from '@/utils/ai-consult-display';
|
||||
|
||||
const { account, openid } = storeToRefs(useAccountStore());
|
||||
const corpId = ref('');
|
||||
@ -60,7 +61,7 @@ async function load() {
|
||||
const miniAppId = openid.value || uni.getStorageSync('openid');
|
||||
const res = await api('getMiniAppCustomers', { corpId: corpId.value, miniAppId }, false);
|
||||
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 || [];
|
||||
enableHis.value = res.enableHis === true;
|
||||
if (!customers.value.length) toCreateArchive();
|
||||
@ -68,7 +69,7 @@ async function load() {
|
||||
|
||||
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') });
|
||||
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}` });
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
<view class="page">
|
||||
<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 class="title"><text>{{ 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="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">{{ removeAiLabel(item.sourceLabel, '咨询') }}</text></view>
|
||||
<view class="line">团队:{{ item.teamName || item.teamId || '-' }}</view>
|
||||
<view class="line">档案:{{ item.customerName || '-' }}</view>
|
||||
<view class="line">最近互动:{{ format(item.lastActiveTime) }}</view>
|
||||
@ -29,9 +29,10 @@ import useAccountStore from '@/store/account';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import FullPage from '@/components/full-page.vue';
|
||||
import EmptyData from '@/components/empty-data.vue';
|
||||
import { removeAiLabel } from '@/utils/ai-consult-display';
|
||||
const { openid } = storeToRefs(useAccountStore());
|
||||
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 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 }) : '-';
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
}}</text>
|
||||
</view>
|
||||
<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 }}
|
||||
</view>
|
||||
<view class="message-preview">
|
||||
@ -75,6 +75,7 @@ import { globalUnreadListenerManager } from "@/utils/global-unread-listener.js";
|
||||
import { get } from "@/utils/cache";
|
||||
import { normalizeCorpId } from "@/utils/api-base-config";
|
||||
import api from "@/utils/api";
|
||||
import { removeAiLabel } from "@/utils/ai-consult-display";
|
||||
import useGroupAvatars from "./hooks/use-group-avatars.js";
|
||||
import GroupAvatar from "@/components/group-avatar.vue";
|
||||
import {
|
||||
@ -279,10 +280,10 @@ const loadAiConsultationList = async () => {
|
||||
source: "ai",
|
||||
sessionId: item.id,
|
||||
corpId: item.corpId,
|
||||
displayName: item.assistantName || "AI咨询助理",
|
||||
displayName: removeAiLabel(item.assistantName, "咨询助理"),
|
||||
teamName: item.teamName || "",
|
||||
patientName: item.customerName || "未命名患者",
|
||||
lastMessage: item.statusLabel || "AI咨询",
|
||||
lastMessage: removeAiLabel(item.statusLabel, "咨询"),
|
||||
lastMessageTime: item.lastActiveTime || 0,
|
||||
unreadCount: 0,
|
||||
}));
|
||||
|
||||
4
utils/ai-consult-display.js
Normal file
4
utils/ai-consult-display.js
Normal file
@ -0,0 +1,4 @@
|
||||
export function removeAiLabel(value, fallback = '') {
|
||||
const text = typeof value === 'string' ? value.replace(/AI/g, '').trim() : '';
|
||||
return text || fallback;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user