mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-14 05:33:42 +08:00
新增 ChatDto 数据传输对象,更新聊天接口以支持知识库功能,优化聊天服务逻辑,调整前端组件以提升用户体验。
This commit is contained in:
@@ -2,6 +2,7 @@ package com.zl.mjga.controller;
|
||||
|
||||
import com.zl.mjga.dto.PageRequestDto;
|
||||
import com.zl.mjga.dto.PageResponseDto;
|
||||
import com.zl.mjga.dto.ai.ChatDto;
|
||||
import com.zl.mjga.dto.ai.LlmQueryDto;
|
||||
import com.zl.mjga.dto.ai.LlmVm;
|
||||
import com.zl.mjga.exception.BusinessException;
|
||||
@@ -72,9 +73,9 @@ public class AiController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/chat", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public Flux<String> chat(Principal principal, @RequestBody String userMessage) {
|
||||
public Flux<String> chat(Principal principal, @RequestBody ChatDto chatDto) {
|
||||
Sinks.Many<String> sink = Sinks.many().unicast().onBackpressureBuffer();
|
||||
TokenStream chat = aiChatService.chatPrecedenceLlmWith(principal.getName(), userMessage);
|
||||
TokenStream chat = aiChatService.chat(principal.getName(), chatDto);
|
||||
chat.onPartialResponse(
|
||||
text ->
|
||||
sink.tryEmitNext(
|
||||
|
||||
Reference in New Issue
Block a user