diff --git a/pages.json b/pages.json
index 6eb635a..db88402 100644
--- a/pages.json
+++ b/pages.json
@@ -170,14 +170,14 @@
{
"path": "chat",
"style": {
- "navigationBarTitleText": "AI咨询助理",
+ "navigationBarTitleText": "咨询助理",
"disableScroll": true
}
},
{
"path": "entry",
"style": {
- "navigationBarTitleText": "AI咨询助理",
+ "navigationBarTitleText": "咨询助理",
"disableScroll": true
}
}
diff --git a/pages/ai-consult/chat.vue b/pages/ai-consult/chat.vue
index 3942999..875b6de 100644
--- a/pages/ai-consult/chat.vue
+++ b/pages/ai-consult/chat.vue
@@ -7,9 +7,9 @@
{{ displayContent(item) }}
- AI
+
- {{ session?.assistantName || 'AI咨询助理' }}
+ {{ assistantDisplayName }}
{{ displayContent(item) }}
@@ -19,7 +19,7 @@
- AI{{ session?.assistantName || 'AI咨询助理' }}
+ {{ assistantDisplayName }}
@@ -28,7 +28,7 @@
- 本次AI咨询已结束
+ 本次咨询已结束
@@ -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();
diff --git a/pages/ai-consult/entry.vue b/pages/ai-consult/entry.vue
index 13974e0..3a7f9e8 100644
--- a/pages/ai-consult/entry.vue
+++ b/pages/ai-consult/entry.vue
@@ -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}` });
}
diff --git a/pages/ai-consult/list.vue b/pages/ai-consult/list.vue
index b7ac116..ce91418 100644
--- a/pages/ai-consult/list.vue
+++ b/pages/ai-consult/list.vue
@@ -11,8 +11,8 @@
- {{ item.assistantName }}{{ item.statusLabel }}
- {{ item.sourceLabel }}
+ {{ removeAiLabel(item.assistantName, '咨询助理') }}{{ item.statusLabel }}
+ {{ removeAiLabel(item.sourceLabel, '咨询') }}
团队:{{ item.teamName || item.teamId || '-' }}
档案:{{ item.customerName || '-' }}
最近互动:{{ format(item.lastActiveTime) }}
@@ -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 }) : '-';
diff --git a/pages/message/message.vue b/pages/message/message.vue
index 2bded82..5e30eba 100644
--- a/pages/message/message.vue
+++ b/pages/message/message.vue
@@ -29,7 +29,7 @@
}}
- AI咨询
+ 咨询
咨询人 | {{ conversation.patientName }}
@@ -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,
}));
diff --git a/utils/ai-consult-display.js b/utils/ai-consult-display.js
new file mode 100644
index 0000000..0ea490a
--- /dev/null
+++ b/utils/ai-consult-display.js
@@ -0,0 +1,4 @@
+export function removeAiLabel(value, fallback = '') {
+ const text = typeof value === 'string' ? value.replace(/AI/g, '').trim() : '';
+ return text || fallback;
+}