AI生成话术
This commit is contained in:
@@ -52,23 +52,6 @@ export function delProductSalesScript(scriptId) {
|
||||
})
|
||||
}
|
||||
|
||||
// // 记录话术访问频率
|
||||
// export function recordVisit(productId) {
|
||||
// return request({
|
||||
// url: '/klp/productSalesScript/recordVisit/' + productId,
|
||||
// method: 'post'
|
||||
// })
|
||||
// }
|
||||
|
||||
// // 获取热门产品排行
|
||||
// export function getHotProducts(limit = 10) {
|
||||
// return request({
|
||||
// url: '/klp/productSalesScript/hotProducts',
|
||||
// method: 'get',
|
||||
// params: { limit }
|
||||
// })
|
||||
// }
|
||||
|
||||
// 获取产品咨询热度排行
|
||||
export function getProductRanking() {
|
||||
return request({
|
||||
@@ -76,3 +59,18 @@ export function getProductRanking() {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据产品生成话术
|
||||
* @param {*} data.productId 产品id
|
||||
* @param {*} data.scriptCount 生成话术数量
|
||||
* @returns
|
||||
*/
|
||||
export function generateForProduct(data) {
|
||||
return request({
|
||||
url: '/wms/salesScriptGenerator/generateForProduct',
|
||||
method: 'post',
|
||||
data,
|
||||
timeout: 1000000
|
||||
})
|
||||
}
|
||||
|
||||
@@ -93,7 +93,23 @@
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="话术内容" prop="scriptContent">
|
||||
<VditorEditor v-model="form.scriptContent" />
|
||||
<div style="position: relative;">
|
||||
<el-button
|
||||
style="position: absolute; right: 20px; bottom: 20px; z-index: 1000;"
|
||||
v-if="form.productId"
|
||||
type="primary"
|
||||
:loading="generateScriptLoading"
|
||||
@click="handleGenerateScript">
|
||||
生成话术
|
||||
</el-button>
|
||||
<VditorEditor
|
||||
v-loading="generateScriptLoading"
|
||||
:disabled="generateScriptLoading"
|
||||
element-loading-text="生成中..."
|
||||
v-model="form.scriptContent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -120,7 +136,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
import { listProductSalesScript, getProductSalesScript, delProductSalesScript, addProductSalesScript, updateProductSalesScript } from "@/api/wms/productSalesScript";
|
||||
import { listProductSalesScript, getProductSalesScript, delProductSalesScript, addProductSalesScript, updateProductSalesScript, generateForProduct } from "@/api/wms/productSalesScript";
|
||||
import ProductSelect from '@/components/KLPService/ProductSelect';
|
||||
import VditorEditor from '@/components/VditorEditor.vue';
|
||||
|
||||
@@ -183,7 +199,8 @@ export default {
|
||||
remark: [
|
||||
{ required: true, message: "备注不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
},
|
||||
generateScriptLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -319,6 +336,22 @@ export default {
|
||||
// 跳转详情页
|
||||
goToDetail(scriptId) {
|
||||
this.$router.push({ path: `/shop/rich/${scriptId}` });
|
||||
},
|
||||
handleGenerateScript() {
|
||||
this.generateScriptLoading = true;
|
||||
const payload = {
|
||||
productId: this.form.productId,
|
||||
scriptCount: 1
|
||||
}
|
||||
if (this.form.scriptTitle) {
|
||||
payload.customPrompt = '本条话术的标题为:' + this.form.scriptTitle;
|
||||
}
|
||||
generateForProduct(payload).then(response => {
|
||||
this.form.scriptContent = response.data[0].scriptContent;
|
||||
// console.log(response.data[0], 'response');
|
||||
}).finally(() => {
|
||||
this.generateScriptLoading = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user