chat robot 调试修改 消息响应修改为一秒一条

This commit is contained in:
zhouchengrong
2023-07-26 10:44:20 +08:00
parent 677bd53842
commit efdaa75be0
2 changed files with 3 additions and 21 deletions

View File

@@ -9,7 +9,6 @@ import com.ai.da.service.ChatRobotService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
@@ -72,7 +71,10 @@ public class ChatRobotServiceImpl implements ChatRobotService {
String line;
while ((line = reader.readLine()) != null) {
log.info(line);
emitter.send(line);
Thread.sleep(1000);
}
reader.close();
} else {