Commit 7c4d2007 by 李伟康

提交0804

1 parent d19ee38a
const url = '/router'
import { utils } from 'glsx-common'
export default {
/**查询喜报战报推送日志分页列表 */
issueChatGpt (data) {
const method = 'scrm.api.knowledge.gptchat'
return httpRequest(method, data)
},
}
const httpRequest = (method, data) => {
const { secret, sign, request } = window.$fetchConfig
Object.assign(data, {
method,
...sign
})
return new Promise((resolve, reject) => {
window.fetch(`${request.baseURL}/router/${method}/1.0.0`, {
method: 'POST',
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
body: JSON.stringify(utils.createSign(data, secret))
}).then(res => {
resolve(res.json())
}).catch(err => {
reject(err)
})
})
}
\ No newline at end of file
......@@ -11,11 +11,12 @@ import merchantsApi from './merchantsApi'
import wxConfig from './wxConfig'
import marketingApi from './marketingApi'
import entmicroApi from './entmicroApi'
import chatgptApi from './chatgptApi'
export {
ssoApi,
wxConfig,
merchantsApi,
marketingApi,
entmicroApi
entmicroApi,
chatgptApi
}
\ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 133px 94px;}
.icon-ai { width: 20px; height: 20px; background-position: -84px -30px;}
.icon-close { width: 20px; height: 20px; background-position: 0px -74px;}
.icon-down { width: 12px; height: 12px; background-position: -115px -54px;}
.icon-eye { width: 13px; height: 8px; background-position: -115px -76px;}
.icon-gift-del { width: 18px; height: 18px; background-position: -115px 0px;}
......@@ -6,10 +8,8 @@
.icon-link { width: 32px; height: 32px; background-position: -42px 0px;}
.icon-menu-active { width: 22px; height: 20px; background-position: 0px -44px;}
.icon-menu { width: 22px; height: 20px; background-position: -32px -44px;}
.icon-more { width: 20px; height: 20px; background-position: -30px -74px;}
.icon-pdf { width: 32px; height: 34px; background-position: 0px 0px;}
.icon-profile { width: 20px; height: 20px; background-position: -60px -74px;}
.icon-PYQ { width: 21px; height: 20px; background-position: -84px 0px;}
.icon-send { width: 10px; height: 10px; background-position: -64px -44px;}
.icon-profile { width: 20px; height: 20px; background-position: -84px -30px;}
.icon-ai { width: 20px; height: 20px; background-position: 0px -74px;}
.icon-close { width: 20px; height: 20px; background-position: -30px -74px;}
.icon-more { width: 20px; height: 20px; background-position: -60px -74px;}
\ No newline at end of file
.icon-send { width: 10px; height: 10px; background-position: -64px -44px;}
\ No newline at end of file

17.3 KB | W: | H:

17.1 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<div class="chat-gpt-box">
<div
:class="['view',{'show-tips':showTips}]"
:class="['view',{'show-tips':showTips&& issuesList.length}]"
ref="contentView"
>
<template v-for="(i,index) in contentList">
......@@ -10,7 +10,15 @@
<div class="content-item left">
<div class="sprite-icon icon-ai icon"></div>
<div class="content">
{{i.content}}
<template v-if="!i.content">
<van-loading
class="loading"
color="#3582EE"
/>
</template>
<template v-else>
{{ i.content }}
</template>
</div>
</div>
</template>
......@@ -23,7 +31,7 @@
</div>
</template>
</div>
<template v-if="showTips">
<template v-if="showTips && issuesList.length">
<div class="tips-box">
<div class="tips-title flex">
您可以这样向我提问
......@@ -33,7 +41,7 @@
></div>
</div>
<div class="tips-view">
<template v-for="(i,index) in tipsList">
<template v-for="(i,index) in issuesList">
<div
:key="index"
class="tips-item flex"
......@@ -61,23 +69,17 @@
</template>
<script type='text/ecmascript-6'>
import { chatgptApi } from '@/api'
export default {
name: 'ChatGpt',
data () {
return {
contentList: [{
content:'您可以向我提问公司的业务产品或销售等相关问题,我将给您组织语言并提供建议,您可以复制段落稍作润色并答复给您的客户。',
speaker:'AI'
content: '您可以向我提问公司的业务产品或销售等相关问题,我将给您组织语言并提供建议,您可以复制段落稍作润色并答复给您的客户。',
speaker: 'AI'
}],
tipsList: [
'苟利国家生死岂因祸福避趋之,水电费看数据方框里圣诞节克里斯丁九龙坑水电费圣诞快乐九龙坑克里斯丁解放路卡开了机斯蒂芬库里受打击了看克里斯丁集福卡了九色鹿',
'简单介绍基础保险方案。',
'你这个保险有点贵啊,别人那里都没有那么高的价格',
'你说的那些服务我也不一定能用上啊。',
'水电费生地会考手机号',
'看守所非进口量',
'会计师的弗兰克手机打开了'
],
issuesList: window.$fetchConfig.issuesList || [],
showTips: true,
issue: ''
}
......@@ -104,23 +106,34 @@ export default {
this.$refs.input.blur()
}
this.toBottom()
this.toQuestionChatGPT()
this.toQuestionChatGPT(content)
},
toBottom () {
this.$nextTick(() => {
this.$refs.contentView.scrollTop = 99999999
})
},
toQuestionChatGPT(){
async toQuestionChatGPT (question) {
const id = Date.now()
this.contentList.push({
speaker: 'AI',
content:'...',
id
id,
content: ''
})
const { response } = await chatgptApi.issueChatGpt({
question,
history: ''
})
setTimeout(()=>{
this.contentList.find(i => i.id == id).content = `${new Date().format('yyyy-MM-dd hh:mm:ss')} ${Date.now()}`
},2e3)
let index = 0, speed = 10
const typeWriter = () => {
if (index < response.length) {
this.contentList.find(i => i.id == id).content += response.charAt(index)
index++
setTimeout(typeWriter, speed)
this.toBottom()
}
}
typeWriter()
},
}
}
......@@ -144,6 +157,7 @@ export default {
.icon {
width: 20px;
height: 20px;
user-select: none;
}
.content {
......@@ -157,14 +171,20 @@ export default {
word-break: break-all;
}
}
@keyframes typing {
from {
width: 0;
}
to {
width: 100%;
}
}
.left {
.icon {
margin-right: 6px;
}
.content {
border-radius: 0 10px 10px 10px;
transition: all 1s;
}
}
......@@ -209,9 +229,13 @@ export default {
border-bottom: 1px solid #e4e6ee;
line-height: 18px;
padding: 7px 0;
font-size: 13px;
color: #333333;
.icon-more {
margin-left: auto;
flex-shrink: 0;
// background-position: -60px -72px;
// transform: translateY(-2px);
}
&:last-of-type {
border: none;
......
......@@ -8,16 +8,19 @@
*/
// 本地环境配置
module.exports = {
title: '嘀加企微助手',
title: '嘻嘻',
envVersion: 'trial',
request: {
baseURL: '//scrm.test.glsx.com.cn', // 本地测试项目地址,
baseURL: '//192.168.1.124:7860', // 本地测试项目地址,
// baseURL: '//scrm.test.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json',
ropMerchantURL: 'http://rop-merchant.dev.glsx.com.cn'
/**
* 开发:http://rop-merchant.dev.glsx.com.cn
......@@ -44,5 +47,18 @@ module.exports = {
source: "scrm-main",
v: "1.0.0",
},
vconsole: true
vconsole: false,
issuesList: [
'你这个保险有点贵啊,好像别人那里都没有那么高的价格。',
'我这个保险在外面朋友买没那么便宜。',
'这个保费怎么那么贵,我第二年的保费多少钱?',
'座位险/驾乘险可以不要吗?',
'第三者怎么要买300万,我买200万/100万就可以了?',
'这个保险我可以不买吗?', '这个保险怎么理赔的?',
'你说的那些服务我也不一定能用上啊',
'我之前开车那么多年,没有过爆胎这些情况的。',
'我家里有其他车了,你们的补贴我不需要。',
'这个保险我买2年的话,第二年你买其他保险也可以的吗?',
'我这个车用车比较少,车辆那么新,不会爆胎的。'
]
}
\ No newline at end of file
......@@ -16,15 +16,15 @@ const state = {
lastPath: ''
}
const mutations = {
SET_PAGE_META(state, meta) {
SET_PAGE_META (state, meta) {
state.pageMeta = meta
},
PUSH_KEEP(state, name) {
PUSH_KEEP (state, name) {
if (!state.keepAlives.includes(name)) {
state.keepAlives.push(name)
}
},
REMOVE_KEEP(state, names) {
REMOVE_KEEP (state, names) {
state.keepAlives = state.keepAlives.reduce((arr, name) => {
if (!names.includes(name)) {
return arr.push(name)
......@@ -32,28 +32,28 @@ const mutations = {
return arr
}, [])
},
SET_LAST_PATH(state, path) {
SET_LAST_PATH (state, path) {
state.lastPath = path
}
}
const actions = {
setPageMeta({ commit }, meta) {
setPageMeta ({ commit }, meta) {
document.title = meta.title
commit('SET_PAGE_META', meta)
},
setLoginToken({ commit }, val) {
setLoginToken ({ commit }, val) {
commit('SET_LOGIN_TOKEN', val)
},
setAccountList({ commit }, list) {
setAccountList ({ commit }, list) {
commit('SET_ACCOUNT_LIST', list)
},
pushKeep({ commit }, name) {
pushKeep ({ commit }, name) {
commit('PUSH_KEEP', name)
},
removeKeep({ commit }, names) {
removeKeep ({ commit }, names) {
commit('REMOVE_KEEP', names)
},
login({ dispatch }) {
login ({ dispatch }) {
let [redirectUrl] = window.location.href.split('?')
// 以下是 本地调试
if (process.env.NODE_ENV == 'development') {
......@@ -114,7 +114,7 @@ const actions = {
} else {
util.showLoading()
let appid = getParams('corpId') //从链接获取
let dj_scrm = util.getLocalStorage('dj_scrm_corpId')
let dj_scrm = util.getLocalStorage('dj_scrm_corpId')
if (!appid) appid = (dj_scrm && dj_scrm.corpId) || 'wwc33bc9a3c72d45f3'
util.setLocalStorage('dj_scrm_corpId', { corpId: appid })
// 'ww657a2d4ae89a4424'
......@@ -128,7 +128,7 @@ const actions = {
window.location.href = `${url}?redirect_uri=${encodeURIComponent(redirectUrl)}&corpId=${corpId}&agentId=${agentId}`
}
},
navigation({ dispatch }) {
navigation ({ dispatch }) {
let { sessionId, corpId, agentId } = getParams()
const storage_corpId = util.getLocalStorage('dj_scrm_corpId')
if (!corpId) corpId = storage_corpId && storage_corpId.corpId
......@@ -154,7 +154,7 @@ const actions = {
}
state.showWindow = true
},
registerHttp({}, sessionId = '') {
registerHttp ({ }, sessionId = '') {
window.$HTTP = new Http({ ...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
}
}
......
......@@ -69,9 +69,7 @@
<script type='text/ecmascript-6'>
import { Notify } from 'vant'
import { wxConfig, marketingApi } from '@/api'
import ChatGPT from '../../components/ChatGPT.vue'
export default {
components: { ChatGPT },
name: 'library',
data () {
return {
......@@ -96,7 +94,6 @@ export default {
} catch (error) {
this.sendChatMessageDisabled = true
}
this.getChatLibraryList()
},
methods: {
/**发送 */
......@@ -134,6 +131,7 @@ export default {
/**切换tab */
change (index) {
this.tabIndex = index
if (index == 1) this.clearData()
// const { groupList, params: { scriptGroup } } = this
// if (scriptGroup == groupList[index] || (index == 0 && scriptGroup == '')) return
// this.params.scriptGroup = index == 0 ? '' : groupList[index]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!