Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
水玉婷
ai-wechat
Commits
c865fc04
Commit
c865fc04
authored
Dec 18, 2025
by
水玉婷
Browse files
feat:md模版
parent
7d91f005
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/views/components/utils/contentTemplateService.ts
View file @
c865fc04
...
@@ -304,12 +304,50 @@ export class ContentTemplateService {
...
@@ -304,12 +304,50 @@ export class ContentTemplateService {
thinkBoxExpanded
:
false
,
thinkBoxExpanded
:
false
,
});
});
}
else
{
}
else
{
// 走选项
updatedResponse
.
contentBlocks
.
push
({
updatedResponse
.
contentBlocks
.
push
({
content
:
this
.
templates
.
option
({
content
:
this
.
templates
.
option
(
messageContent
),
tips
,
hasThinkBox
:
false
,
options
,
thinkContent
:
''
,
}),
thinkBoxExpanded
:
false
,
});
}
}
break
;
case
4
:
// MD格式
if
(
updatedResponse
)
{
// 对于SSE流式数据,使用流式处理
const
markdownContent
=
templateTools
?.
markdownTemplate
?
templateTools
.
markdownTemplate
(
messageContent
||
''
,
true
)
:
this
.
templates
.
markdown
(
messageContent
||
''
,
true
);
// 检查最后一个块是否是markdown块
const
isLastMarkdown
=
templateTools
?.
isLastBlockMarkdown
?
templateTools
.
isLastBlockMarkdown
(
updatedResponse
.
contentBlocks
)
:
isLastBlockMarkdown
(
updatedResponse
.
contentBlocks
);
if
(
isLastMarkdown
)
{
// 合并到现有的markdown块
const
lastMarkdownIndex
=
templateTools
?.
getLastMarkdownBlockIndex
?
templateTools
.
getLastMarkdownBlockIndex
(
updatedResponse
.
contentBlocks
)
:
getLastMarkdownBlockIndex
(
updatedResponse
.
contentBlocks
);
if
(
lastMarkdownIndex
!==
-
1
)
{
updatedResponse
.
contentBlocks
[
lastMarkdownIndex
].
content
=
templateTools
?.
mergeMarkdownContent
?
templateTools
.
mergeMarkdownContent
(
updatedResponse
.
contentBlocks
[
lastMarkdownIndex
].
content
,
markdownContent
)
:
mergeMarkdownContent
(
updatedResponse
.
contentBlocks
[
lastMarkdownIndex
].
content
,
markdownContent
);
}
}
else
{
// 创建新的markdown块
updatedResponse
.
contentBlocks
.
push
({
content
:
markdownContent
,
hasThinkBox
:
false
,
hasThinkBox
:
false
,
thinkContent
:
''
,
thinkContent
:
''
,
thinkBoxExpanded
:
false
,
thinkBoxExpanded
:
false
,
...
@@ -317,10 +355,20 @@ export class ContentTemplateService {
...
@@ -317,10 +355,20 @@ export class ContentTemplateService {
}
}
}
}
break
;
break
;
default
:
// 默认处理
updatedResponse
.
contentBlocks
.
push
({
content
:
this
.
templates
.
text
(
messageContent
||
''
),
hasThinkBox
:
false
,
thinkContent
:
''
,
thinkBoxExpanded
:
false
,
});
break
;
}
}
}
}
break
;
break
;
case
10
:
// 思考开始
case
10
:
// 思考开始
updatedIsThinking
=
true
;
updatedIsThinking
=
true
;
// 记录思考开始时间
// 记录思考开始时间
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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