fix:修复问题

This commit is contained in:
2025-11-22 17:17:15 +08:00
parent f38a0f3143
commit 307c90f93e
3 changed files with 16 additions and 5 deletions

View File

@@ -45,7 +45,7 @@ function updateRenderedContent() {
/**
* 处理内容更新
* 普通流式渲染:直接显示所有内容,不使用打字机效果
* 流式渲染:需要拼接增量内容
*/
function handleContentUpdate(newContent) {
if (!newContent) {
@@ -54,8 +54,14 @@ function handleContentUpdate(newContent) {
return
}
// 更新当前内容
currentContent.value = newContent
// 流式模式下拼接增量内容
if (props.isStreaming) {
currentContent.value += newContent
} else {
// 非流式模式下直接替换
currentContent.value = newContent
}
updateRenderedContent()
}
@@ -75,6 +81,11 @@ watch(() => props.content, (newContent) => {
// 监听 isStreaming 变化
watch(() => props.isStreaming, (newVal, oldVal) => {
// 流式传输开始时,清空之前的内容
if (newVal && !oldVal) {
currentContent.value = ''
renderedContent.value = ''
}
// 流式传输结束时,确保显示完整内容
if (!newVal && oldVal && props.content) {
currentContent.value = props.content

View File

@@ -26,7 +26,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
@Tag(name = "用户 App - AI 聊天对话")
@RestController
@RequestMapping("/api/chat/conversation")
@RequestMapping("/api/ai/chat/conversation")
@Validated
public class AppAiChatConversationController {

View File

@@ -36,7 +36,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
@Tag(name = "用户 App - 聊天消息")
@RestController
@RequestMapping("/api/chat/message")
@RequestMapping("/api/ai/chat/message")
@Validated
@Slf4j
public class AppAiChatMessageController {