Commit 952a11b4 by 李伟康

增加游客模式、修改限制次数

1 parent e5b5b2b8
<template> <template>
<div <div
class="chat-gpt-box" :class="['chat-gpt-box',{'guestMode':guestMode}]"
v-show="show" v-show="show"
> >
<div <div
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div class="content-item left"> <div class="content-item left">
<div class="sprite-icon icon-ai icon"></div> <div class="sprite-icon icon-ai icon"></div>
<div class="content"> <div class="content">
您可以向我提问公司的业务产品或销售等相关问题,我将给您组织语言并提供建议,您可以复制段落稍作润色并答复给您的客户。 您可以向我提问汽车后市场领域(如汽车精品/汽车保险/延保服务等)的业务相关问题,AI助手将给您提供方案建议。
</div> </div>
</div> </div>
<template v-for="(i,index) in contentList"> <template v-for="(i,index) in contentList">
...@@ -95,18 +95,23 @@ export default { ...@@ -95,18 +95,23 @@ export default {
issue: '', issue: '',
scriptLibraryAIId: '', scriptLibraryAIId: '',
todayQuestionLeft: 0, todayQuestionLeft: 0,
questionCountTotal: 20, questionCountTotal: 999,
lastQuestionTime: '', lastQuestionTime: '',
padding: false padding: false
} }
}, },
computed: {
guestMode () {
return this.$store.state.app.guestMode
}
},
watch: { watch: {
issue (newText) { issue (newText) {
this.issue = this.filterText(newText); this.issue = this.filterText(newText);
} }
}, },
mounted () { mounted () {
this.getAiId() if (!this.guestMode) this.getAiId()
}, },
methods: { methods: {
filterText (text) { filterText (text) {
...@@ -143,12 +148,13 @@ export default { ...@@ -143,12 +148,13 @@ export default {
} }
}, },
send (val) { send (val) {
const { issue, todayQuestionLeft, questionCountTotal, padding } = this, const { issue, todayQuestionLeft, questionCountTotal, padding, guestMode } = this,
content = val || issue content = val || issue
try { try {
if (!content) throw false if (!content) throw false
if (padding) throw '请等待回复后再试' if (padding) throw '请等待回复后再试'
if (todayQuestionLeft < 1) throw `每天每个用户最多发送提问${questionCountTotal}个问题` //游客模式不限制次数
if (todayQuestionLeft < 1 && !guestMode) throw `每天每个用户最多发送提问${questionCountTotal}个问题`
} catch (error) { } catch (error) {
if (error) this.showToast(error) if (error) this.showToast(error)
return return
...@@ -208,6 +214,7 @@ export default { ...@@ -208,6 +214,7 @@ export default {
addRecord (id) { addRecord (id) {
const { contentList, scriptLibraryAIId, lastQuestionTime } = this, const { contentList, scriptLibraryAIId, lastQuestionTime } = this,
item = contentList.find(i => i.id == id) item = contentList.find(i => i.id == id)
if (this.guestMode) return //游客模式不上报
delete item.id delete item.id
let params = { let params = {
lastQuestionTime, lastQuestionTime,
...@@ -329,8 +336,8 @@ export default { ...@@ -329,8 +336,8 @@ export default {
} }
} }
.input-box { .input-box {
padding: 7px 11px 7px 16px; padding: 7px 11px 7px 16px !important;
background: #ffffff; background: #ffffff !important;
.van-field { .van-field {
width: 278px; width: 278px;
padding: 9px 16px; padding: 9px 16px;
...@@ -359,4 +366,8 @@ export default { ...@@ -359,4 +366,8 @@ export default {
// bottom: 0; // bottom: 0;
} }
} }
.guestMode{
height: calc(100vh - var(--constantSafeAreaInsetBottom));
height: calc(100vh - var(--envSafeAreaInsetBottom));
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
*/ */
// 本地环境配置 // 本地环境配置
module.exports = { module.exports = {
title: '嘻嘻', title: '话术库',
envVersion: 'trial', envVersion: 'trial',
request: { request: {
// baseURL: '//192.168.3.191:7860', // 本地测试项目地址, // baseURL: '//192.168.3.191:7860', // 本地测试项目地址,
baseURL: '//scrm.test.glsx.com.cn', // 本地测试项目地址, baseURL: 'https://scrm.test.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
...@@ -53,16 +53,15 @@ module.exports = { ...@@ -53,16 +53,15 @@ module.exports = {
}, },
vconsole: true, vconsole: true,
issuesList: [ issuesList: [
'你这个保险有点贵啊,好像别人那里都没有那么高的价格。', '什么是太阳膜',
'我这个保险在外面朋友买没那么便宜。', '为什么车子要贴膜',
'如何衡量一张膜是好膜',
'太阳膜的参数说明',
'这个保费怎么那么贵,我第二年的保费多少钱?', '这个保费怎么那么贵,我第二年的保费多少钱?',
'座位险/驾乘险可以不要吗?', '你这个保险有点贵啊,好像别人那里都没有那么高的价格。',
'第三者怎么要买300万,我买200万/100万就可以了?', '第三者怎么要买300万,我买200万/100万就可以了?',
'这个保险我可以不买吗?', '这个保险怎么理赔的?', '座位险/驾乘险可以不要吗?',
'你说的那些服务我也不一定能用上啊', '我这个车用车比较少,车辆那么新,不会爆胎的。',
'我之前开车那么多年,没有过爆胎这些情况的。', '我这个买2年的话,第二你买其他保险也可以的吗?',
'我家里有其他车了,你们的补贴我不需要。',
'这个保险我买2年的话,第二年你买其他保险也可以的吗?',
'我这个车用车比较少,车辆那么新,不会爆胎的。'
] ]
} }
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,8 @@ import { Notify } from 'vant' ...@@ -13,7 +13,8 @@ import { Notify } from 'vant'
const state = { const state = {
pageMeta: '', pageMeta: '',
keepAlives: [], keepAlives: [],
lastPath: '' lastPath: '',
guestMode: false
} }
const mutations = { const mutations = {
SET_PAGE_META (state, meta) { SET_PAGE_META (state, meta) {
...@@ -129,7 +130,13 @@ const actions = { ...@@ -129,7 +130,13 @@ const actions = {
} }
}, },
navigation ({ dispatch }) { navigation ({ dispatch }) {
let { sessionId, corpId, agentId } = getParams() let { sessionId, corpId, agentId, guestMode } = getParams()
if (guestMode) {
dispatch('registerHttp')
state.guestMode = true
state.showWindow = true
return
}
const storage_corpId = util.getLocalStorage('dj_scrm_corpId') const storage_corpId = util.getLocalStorage('dj_scrm_corpId')
if (!corpId) corpId = storage_corpId && storage_corpId.corpId if (!corpId) corpId = storage_corpId && storage_corpId.corpId
if (corpId && storage_corpId) { if (corpId && storage_corpId) {
......
<template> <template>
<div class="layout"> <div class="layout">
<div class="sticky"> <div class="sticky">
<tab <template v-if="!guestMode">
:list="tabList" <tab
@change="change" :list="tabList"
> @change="change"
</tab> >
</tab>
</template>
<search-box <search-box
v-show="tabIndex == 1" v-show="tabIndex == 1"
@search="search" @search="search"
...@@ -86,8 +88,13 @@ export default { ...@@ -86,8 +88,13 @@ export default {
tabIndex: 0 tabIndex: 0
} }
}, },
computed: {
guestMode () {
return this.$store.state.app.guestMode
}
},
async mounted () { async mounted () {
try { if (!this.guestMode) try {
await wxConfig.init(['sendChatMessage']) await wxConfig.init(['sendChatMessage'])
} catch (error) { } catch (error) {
this.sendChatMessageDisabled = true this.sendChatMessageDisabled = true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!