上传备份

master
王兵 4 days ago
parent 33f9bbb055
commit 2b72019978

@ -16,7 +16,7 @@ import java.util.concurrent.ThreadPoolExecutor;
* @since 1.8
*/
@Configuration
public class ThreadConfig {
public class PoolConfig {
// 获取CPU核心数
private final int cpuCount = Runtime.getRuntime().availableProcessors();

@ -22,7 +22,7 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
// 注意,如果授权认认证未通过会直接返回,此跨域配置则不会生效,前端仍然会提示跨域
registry.addMapping("/chat/**")
registry.addMapping("/**")
//允许的域,不要写*否则cookie就无法使用了
.allowedOriginPatterns("http://localhost:5173")
.allowedHeaders("*")

@ -87,6 +87,11 @@ public class ChatServiceSampleImpl implements ChatService {
streamEmitter.onStart(chatId);
char[] charArray = DEFAULT_PROMPT.toCharArray();
for (char c : charArray) {
try {
Thread.sleep(30);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
streamEmitter.onPartial(String.valueOf(c));
}
streamEmitter.onComplete();

@ -165,6 +165,7 @@ public class StreamEmitter extends SseEmitter {
})
.build();
this.pushChunk(chunk);
this.complete();
this.status = Status.SUCCESS;
}

Loading…
Cancel
Save

Powered by TurnKey Linux.