Commit 6f6e77c3 by liimin

调优

1 parent 747577e0
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
<script> <script>
import { getTableList, getDictionaryFun, getStaffList, syncCustomer, clientManageExportApi } from '@/api/modules/clientManage' import { getTableList, getDictionaryFun, getStaffList, syncCustomer, clientManageExportApi } from '@/api/modules/clientManage'
import url from '@/assets/clientDataOverview/nodata.png' import url from '@/assets/clientDataOverview/nodata.png'
import * as dayjs from 'dayjs'
export default { export default {
name: 'clientManage', name: 'clientManage',
data() { data() {
...@@ -376,7 +377,7 @@ export default { ...@@ -376,7 +377,7 @@ export default {
flushTime: false, flushTime: false,
orderform: { order: '', result: '' }, orderform: { order: '', result: '' },
disabled: false, disabled: false,
placeholder: '帮我给广东车主发一条5.1劳动节保养相关的营销文案', placeholder: '为购车时间在5年内的陕西省的男性车主准备五一节主题的营销',
drawer: false, drawer: false,
gptRequest: false, gptRequest: false,
keys: { keys: {
...@@ -674,14 +675,14 @@ export default { ...@@ -674,14 +675,14 @@ export default {
Object.assign(this.keys, { subject: '', festival: '' }) Object.assign(this.keys, { subject: '', festival: '' })
const order = this.orderform.order const order = this.orderform.order
// const content = '帮我查询从2023-3-29日至2023-04-05日期间西安飞广州或者深圳的机票,从上面一句话中提取出发日期,命名为date,出发地,命名为start,目的地,命名为end,输出json格式。' // const content = '帮我查询从2023-3-29日至2023-04-05日期间西安飞广州或者深圳的机票,从上面一句话中提取出发日期,命名为date,出发地,命名为start,目的地,命名为end,输出json格式。'
const content = `${order},今年是2023,针对上面这段文字, const content = `${order},针对上面这段文字,
提取出营销文案关键字,命名为subject; 提取出营销文案关键字,命名为subject;
提取出开始时间,命名为beginDate,格式为:yyyy-MM-dd,例如:2022-11-12,只有以上文字包含"购车"或者"时间"才提取,不然取值''; 如果有提到购车时间,则提取出购车时间范围,命名为beginDate和endDate,格式为:yyyy-MM-dd,例如:2022-11-12;
提取出结束时间,命名为endDate,格式为:yyyy-MM-dd,例如:2022-11-12,只有以上文字包含"购车"或者"时间"才提取,不然取值'';
提取出节日,命名为festival,如果是数字,转化成大写,例如:五一节; 提取出节日,命名为festival,如果是数字,转化成大写,例如:五一节;
提取出车主归属地或者车牌号,命名为carNumber,如广东的车主,则取值为"粤"; 提取出车主归属地或者车牌号,命名为carNumber,如广东的车主,则取值为"粤";
提取出性别,命名为customerSex,取值范围:"0,1,2",0表示全部,1表示男,2表示女; 提取出性别,命名为customerSex,取值范围:"0,1,2",0表示全部,1表示男,2表示女;
所有提取的字段未精确匹配到的不提取和输出。 所有提取的字段未精确匹配到的不提取和输出。
今天是${dayjs(new Date()).format('YYYY年MM月DD日')}。
输出json格式` 输出json格式`
const result = await this.$apis.crowdManage.gpt(content) const result = await this.$apis.crowdManage.gpt(content)
this.disabled = false this.disabled = false
...@@ -735,38 +736,65 @@ export default { ...@@ -735,38 +736,65 @@ export default {
return element return element
}) })
// let content = '我有一批客户,资料(id,customerName,customerSex,customerPhone,buyDate,carVin,carNumber) 分别是:' // let content = '我有一批客户,资料(id,customerName,customerSex,customerPhone,buyDate,carVin,carNumber) 分别是:'
let content = `现在是2023年,我有${list.length}个客户资料分别是:` // let content = `现在是2023年,我有${list.length}个客户资料分别是:`
let cutomerInfo = [] // let cutomerInfo = []
for (let index = 0; index < list.length; index++) { // for (let index = 0; index < list.length; index++) {
let { customerName, customerSex, customerPhone, buyDate, carVin, carNumber } = list[index] // let { customerName, customerSex, customerPhone, buyDate, carVin, carNumber } = list[index]
// const content = `忽略之前的上下文,对姓名为${k.customerName}客户,${k.customerName}是一个人,性别为${{ 1: '男', 2: '女' }[k.customerSex] || '先生/女士'},客户手机号为${k.customerPhone},${k.customerPhone}是客户的电话不是客服电话;生成一条最少100字的4s店新车营销文案,字段命名为content。只需content一个字段即可;输出json格式` // // const content = `忽略之前的上下文,对姓名为${k.customerName}客户,${k.customerName}是一个人,性别为${{ 1: '男', 2: '女' }[k.customerSex] || '先生/女士'},客户手机号为${k.customerPhone},${k.customerPhone}是客户的电话不是客服电话;生成一条最少100字的4s店新车营销文案,字段命名为content。只需content一个字段即可;输出json格式`
// console.log(content, 'content') 车架号:${carVin}, // // console.log(content, 'content') 车架号:${carVin},
cutomerInfo.push(`客户${index + 1},姓名:${customerName},性别:${{ 1: '男', 2: '女' }[customerSex] || '先生/女士'},电话:${customerPhone},购车日期:${buyDate},车牌号:${carNumber}`) // cutomerInfo.push(`客户${index + 1},姓名:${customerName},性别:${{ 1: '男', 2: '女' }[customerSex] || '先生/女士'},电话:${customerPhone},购车日期:${buyDate},车牌号:${carNumber}`)
} // }
content += `${cutomerInfo.join(';')};请根据客户的特征,分别为每个客户生成一条50字左右关于${this.keys.subject || ''}的营销文案。字段命名为content;整条结果以数组输出,命名为customers。输出json格式.` // content += `${cutomerInfo.join(';')};请根据客户的特征,分别为每个客户生成一条50字左右关于${this.keys.subject || ''}的营销文案。字段命名为content;整条结果以数组输出,命名为customers。输出json格式.`
let content = `今天是${dayjs(new Date()).format('YYYY年MM月DD日')}。请帮我生成一条50字左右关于${this.keys.subject || ''}的营销文案。字段命名为content;输出json格式.:`
// this.$apis.crowdManage.gpt(content).then(result => {
// const { code, success, message, data } = result
// if (code == '000000' && success) {
// // if (!result.data) {
// // this.$message.error('生成文案异常,请重试!')
// // return
// // }
// // console.log(result)
// // let _obj = result.data
// // this.$refs.clientManage.data[index].content = _obj.content
// // this.$refs.clientManage.data = this.$refs.clientManage.data
// list.map((k, i) => {
// k.content = result?.data?.customers[i]?.content || '生成文案异常,请重试!'
// const { customerName, customerSex, customerPhone } = k
// k.content &&
// k.content != '生成文案异常,请重试!' &&
// setTimeout(() => {
// this.$notify({
// title: `发送成功!`,
// message: `${customerName}${{ 1: '先生', 2: '女士' }[customerSex] || '先生/女士'},手机号:${customerPhone} 发送成功.`,
// type: 'success'
// })
// }, i * 1000)
// return k
// })
// this.$forceUpdate()
// } else {
// this.$message.error(message || '生成文案异常,请重试!')
// }
// })
this.$apis.crowdManage.gpt(content).then(result => { this.$apis.crowdManage.gpt(content).then(result => {
const { code, success, message, data } = result const { code, success, message } = result
const _content = result?.data?.content
if (code == '000000' && success) { if (code == '000000' && success) {
// if (!result.data) {
// this.$message.error('生成文案异常,请重试!')
// return
// }
// console.log(result)
// let _obj = result.data
// this.$refs.clientManage.data[index].content = _obj.content
// this.$refs.clientManage.data = this.$refs.clientManage.data
list.map((k, i) => { list.map((k, i) => {
k.content = result?.data?.customers[i]?.content || '生成文案异常,请重试!'
const { customerName, customerSex, customerPhone } = k const { customerName, customerSex, customerPhone } = k
k.content && const user = `${customerName}${{ 1: '先生', 2: '女士' }[customerSex] || '先生/女士'}`
k.content != '生成文案异常,请重试!' && if (_content) {
k.content = `尊敬的${user}: ${_content}`
setTimeout(() => { setTimeout(() => {
this.$notify({ this.$notify({
title: `发送成功!`, title: `发送成功!`,
message: `${customerName}${{ 1: '先生', 2: '女士' }[customerSex] || '先生/女士'},手机号:${customerPhone} 发送成功.`, message: `${user},手机号:${customerPhone} 发送成功.`,
type: 'success' type: 'success'
}) })
}, i * 1000) }, i * 1000)
} else {
k.content = '生成文案异常,请重试!'
}
return k return k
}) })
this.$forceUpdate() this.$forceUpdate()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!