chore:智能客服回答不重复

This commit is contained in:
2026-03-19 14:26:32 +08:00
parent e33ad16d10
commit 5a46bb8d69
2 changed files with 32 additions and 38 deletions

View File

@@ -875,33 +875,28 @@ export default {
}, },
(completeResult) => { (completeResult) => {
// 流结束回调 // 流结束回调
let finalContent = '';
let convId = ''; let convId = '';
if (typeof completeResult === 'string') { if (typeof completeResult !== 'string') {
finalContent = completeResult;
} else {
finalContent = completeResult.content || '';
convId = completeResult.conversation_id || ''; convId = completeResult.conversation_id || '';
} }
// 更新最终内容 // 标记流式结束
streamMessage.isStreaming = false; streamMessage.isStreaming = false;
streamMessage.content = finalContent;
// 添加操作按钮 // 添加操作按钮
streamMessage.actions = [ streamMessage.actions = [
{ id: 1, text: '有帮助', type: 'like' }, { id: 1, text: '有帮助', type: 'like' },
{ id: 2, text: '没帮助', type: 'dislike' } { id: 2, text: '没帮助', type: 'dislike' }
]; ];
// 保存会话 ID // 保存会话 ID
if (convId) { if (convId) {
this.currentConversationId = convId; this.currentConversationId = convId;
aiService.setConversationId(convId); aiService.setConversationId(convId);
this.saveConversationIdToLocal(convId); this.saveConversationIdToLocal(convId);
} }
// 触发事件 // 触发事件
this.$emit('ai-response', streamMessage); this.$emit('ai-response', streamMessage);
} }
@@ -918,30 +913,28 @@ export default {
this.$forceUpdate(); this.$forceUpdate();
}, },
(completeResult) => { (completeResult) => {
// 流结束回调 // 流结束回调
let finalContent = completeResult?.content || ''; let convId = completeResult?.conversation_id || '';
let convId = completeResult?.conversation_id || '';
// 标记流式结束
// 更新最终内容 streamMessage.isStreaming = false;
streamMessage.isStreaming = false;
streamMessage.content = finalContent; // 添加操作按钮
streamMessage.actions = [
// 添加操作按钮 { id: 1, text: '有帮助', type: 'like' },
streamMessage.actions = [ { id: 2, text: '没帮助', type: 'dislike' }
{ id: 1, text: '有帮助', type: 'like' }, ];
{ id: 2, text: '没帮助', type: 'dislike' }
]; // 保存会话 ID
if (convId) {
// 保存会话 ID this.currentConversationId = convId;
if (convId) { aiService.setConversationId(convId);
this.currentConversationId = convId; this.saveConversationIdToLocal(convId);
aiService.setConversationId(convId); }
this.saveConversationIdToLocal(convId);
} // 触发事件
this.$emit('ai-response', streamMessage);
// 触发事件 }
this.$emit('ai-response', streamMessage);
}
); );
// #endif // #endif
} catch (error) { } catch (error) {

View File

@@ -134,8 +134,9 @@ async function main() {
// 2) 创建 ZIP 文件(如果未指定 --no-zip) // 2) 创建 ZIP 文件(如果未指定 --no-zip)
if (!options.noZip) { if (!options.noZip) {
const cwd = path.join(__dirname, '..'); const cwd = path.join(__dirname, '..');
const sourceDir = path.join(cwd, 'unpackage', 'dist', 'build', 'mp-weixin'); const buildDir = options.mode === 'production' ? 'build' : 'dev';
const destDir = path.join(cwd, 'unpackage', 'dist', 'build'); const sourceDir = path.join(cwd, 'unpackage', 'dist', buildDir, 'mp-weixin');
const destDir = path.join(cwd, 'unpackage', 'dist', buildDir);
const zipFilePath = await createZipWithSystemCommand(sourceDir, destDir); const zipFilePath = await createZipWithSystemCommand(sourceDir, destDir);
console.log(`ZIP 文件路径: ${zipFilePath}`); console.log(`ZIP 文件路径: ${zipFilePath}`);