fix:修复问题
This commit is contained in:
@@ -45,7 +45,7 @@ function updateRenderedContent() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理内容更新
|
* 处理内容更新
|
||||||
* 普通流式渲染:直接显示所有内容,不使用打字机效果
|
* 流式渲染:需要拼接增量内容
|
||||||
*/
|
*/
|
||||||
function handleContentUpdate(newContent) {
|
function handleContentUpdate(newContent) {
|
||||||
if (!newContent) {
|
if (!newContent) {
|
||||||
@@ -54,8 +54,14 @@ function handleContentUpdate(newContent) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新当前内容
|
// 流式模式下拼接增量内容
|
||||||
currentContent.value = newContent
|
if (props.isStreaming) {
|
||||||
|
currentContent.value += newContent
|
||||||
|
} else {
|
||||||
|
// 非流式模式下直接替换
|
||||||
|
currentContent.value = newContent
|
||||||
|
}
|
||||||
|
|
||||||
updateRenderedContent()
|
updateRenderedContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +81,11 @@ watch(() => props.content, (newContent) => {
|
|||||||
|
|
||||||
// 监听 isStreaming 变化
|
// 监听 isStreaming 变化
|
||||||
watch(() => props.isStreaming, (newVal, oldVal) => {
|
watch(() => props.isStreaming, (newVal, oldVal) => {
|
||||||
|
// 流式传输开始时,清空之前的内容
|
||||||
|
if (newVal && !oldVal) {
|
||||||
|
currentContent.value = ''
|
||||||
|
renderedContent.value = ''
|
||||||
|
}
|
||||||
// 流式传输结束时,确保显示完整内容
|
// 流式传输结束时,确保显示完整内容
|
||||||
if (!newVal && oldVal && props.content) {
|
if (!newVal && oldVal && props.content) {
|
||||||
currentContent.value = props.content
|
currentContent.value = props.content
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
|||||||
|
|
||||||
@Tag(name = "用户 App - AI 聊天对话")
|
@Tag(name = "用户 App - AI 聊天对话")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/chat/conversation")
|
@RequestMapping("/api/ai/chat/conversation")
|
||||||
@Validated
|
@Validated
|
||||||
public class AppAiChatConversationController {
|
public class AppAiChatConversationController {
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
|||||||
|
|
||||||
@Tag(name = "用户 App - 聊天消息")
|
@Tag(name = "用户 App - 聊天消息")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/chat/message")
|
@RequestMapping("/api/ai/chat/message")
|
||||||
@Validated
|
@Validated
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AppAiChatMessageController {
|
public class AppAiChatMessageController {
|
||||||
|
|||||||
Reference in New Issue
Block a user