Commit 19f1170e by zhangxingmin

push

parent 1c500b13
...@@ -113,9 +113,6 @@ import { marked } from 'marked' ...@@ -113,9 +113,6 @@ import { marked } from 'marked'
import hljs from 'highlight.js' import hljs from 'highlight.js'
import 'highlight.js/styles/github-dark.css' import 'highlight.js/styles/github-dark.css'
// 购买关键词正则(可根据需要调整)
const PURCHASE_KEYWORDS = /购买|产品|商品|套餐|服务|有哪些产品|商品列表|购买服务|推荐产品|产品列表|选购|下单/i
// 配置 marked,增强安全性 // 配置 marked,增强安全性
marked.setOptions({ marked.setOptions({
highlight: function(code, lang) { highlight: function(code, lang) {
...@@ -228,11 +225,6 @@ export default { ...@@ -228,11 +225,6 @@ export default {
return html return html
}, },
// 检查是否包含购买关键词
isPurchaseIntent(text) {
return PURCHASE_KEYWORDS.test(text)
},
// 获取并展示产品列表 // 获取并展示产品列表
async fetchAndShowProducts(userQuestion) { async fetchAndShowProducts(userQuestion) {
this.isLoading = true this.isLoading = true
...@@ -307,12 +299,6 @@ export default { ...@@ -307,12 +299,6 @@ export default {
this.question = '' this.question = ''
this.scrollToBottom() this.scrollToBottom()
// 检查是否包含购买关键词
if (this.isPurchaseIntent(userQuestion)) {
await this.fetchAndShowProducts(userQuestion)
return
}
// 正常流式回答 // 正常流式回答
this.isLoading = true this.isLoading = true
const assistantMessageIndex = this.messages.length const assistantMessageIndex = this.messages.length
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment