Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-middle-front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-middle-front
Commits
19f1170e
Commit
19f1170e
authored
Apr 07, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
1c500b13
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
14 deletions
+0
-14
src/views/ai/index.vue
+0
-14
No files found.
src/views/ai/index.vue
View file @
19f1170e
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment