fix(客户详情): 修复SOP分析功能并优化通话记录显示逻辑
重构SOP分析功能,移除不必要的recordContext参数,改为使用组件内部数据。优化通话记录显示逻辑,当存在通话记录时优先显示record_context内容。在sale.vue中添加对SOP分析事件的处理,通过ref调用CustomerDetail组件的方法。
This commit is contained in:
@@ -258,7 +258,7 @@ ${formInfoText}
|
|||||||
${chatInfoText}
|
${chatInfoText}
|
||||||
|
|
||||||
=== 通话记录 ===
|
=== 通话记录 ===
|
||||||
${callInfoText}
|
${callData.length > 0 && callData[0].record_context ? callData[0].record_context : callInfoText}
|
||||||
|
|
||||||
请基于以上客户的表单信息、聊天记录和通话记录,分析客户的基本情况、背景信息和初步画像。`;
|
请基于以上客户的表单信息、聊天记录和通话记录,分析客户的基本情况、背景信息和初步画像。`;
|
||||||
try {
|
try {
|
||||||
@@ -280,15 +280,19 @@ ${callInfoText}
|
|||||||
};
|
};
|
||||||
|
|
||||||
// SOP通话分析
|
// SOP通话分析
|
||||||
const startSopAnalysis = async (recordContext) => {
|
const startSopAnalysis = async () => {
|
||||||
if (!props.selectedContact) return;
|
if (!props.selectedContact) return;
|
||||||
|
|
||||||
isSopAnalysisLoading.value = true;
|
isSopAnalysisLoading.value = true;
|
||||||
sopAnalysisResult.value = '';
|
sopAnalysisResult.value = '';
|
||||||
|
// 构建通话记录信息
|
||||||
|
const callData = props.callRecords || [];
|
||||||
|
const callInfoText = callData.length > 0 ?
|
||||||
|
`通话记录数量: ${callData.length}次\n通话记录详情: ${JSON.stringify(callData, null, 2)}` :
|
||||||
|
'暂无通话记录';
|
||||||
|
const query = `=== 通话记录 ===
|
||||||
|
${callData.length > 0 && callData[0].record_context ? callData[0].record_context : callInfoText}`;
|
||||||
|
|
||||||
const query = callData.value
|
|
||||||
|
|
||||||
console.log(888888, recordContext);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await chatService.sendMessage(
|
await chatService.sendMessage(
|
||||||
|
|||||||
@@ -69,7 +69,8 @@
|
|||||||
:call-info="callRecords"
|
:call-info="callRecords"
|
||||||
@view-form-data="handleViewFormData"
|
@view-form-data="handleViewFormData"
|
||||||
@view-chat-data="handleViewChatData"
|
@view-chat-data="handleViewChatData"
|
||||||
@view-call-data="handleViewCallData" />
|
@view-call-data="handleViewCallData"
|
||||||
|
@analyze-sop="handleAnalyzeSop" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -84,6 +85,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="section-content">
|
<div class="section-content">
|
||||||
<CustomerDetail
|
<CustomerDetail
|
||||||
|
ref="customerDetailRef"
|
||||||
:selected-contact="selectedContact"
|
:selected-contact="selectedContact"
|
||||||
:form-info="formInfo"
|
:form-info="formInfo"
|
||||||
:chat-records="chatRecords"
|
:chat-records="chatRecords"
|
||||||
@@ -169,6 +171,7 @@ const goBack = () => {
|
|||||||
// STATE
|
// STATE
|
||||||
const selectedContactId = ref(null);
|
const selectedContactId = ref(null);
|
||||||
const contextPanelRef = ref(null);
|
const contextPanelRef = ref(null);
|
||||||
|
const customerDetailRef = ref(null);
|
||||||
const selectedStage = ref('全部'); // 选中的销售阶段
|
const selectedStage = ref('全部'); // 选中的销售阶段
|
||||||
|
|
||||||
const isPageLoading = ref(true); // 页面整体加载状态
|
const isPageLoading = ref(true); // 页面整体加载状态
|
||||||
@@ -725,6 +728,14 @@ const handleViewChatData = async (contact) => {
|
|||||||
const handleViewCallData = (contact) => {
|
const handleViewCallData = (contact) => {
|
||||||
// TODO: 实现通话录音查看逻辑
|
// TODO: 实现通话录音查看逻辑
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 处理SOP分析事件
|
||||||
|
const handleAnalyzeSop = (analyzeData) => {
|
||||||
|
console.log('收到SOP分析请求:', analyzeData);
|
||||||
|
if (customerDetailRef.value && analyzeData.content) {
|
||||||
|
customerDetailRef.value.startSopAnalysis(analyzeData.content);
|
||||||
|
}
|
||||||
|
};
|
||||||
// 销售漏斗
|
// 销售漏斗
|
||||||
const SalesFunnel = ref([])
|
const SalesFunnel = ref([])
|
||||||
async function CenterGetSalesFunnel() {
|
async function CenterGetSalesFunnel() {
|
||||||
|
|||||||
Reference in New Issue
Block a user