增加 ai 异步任务池定义

This commit is contained in:
thinkgem
2025-05-08 11:51:52 +08:00
parent 31eab113a2
commit 95ab40a14f
2 changed files with 36 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
*/
package com.jeesite.modules.cms.ai.config;
import com.jeesite.common.config.Global;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* MVC 异步任务池定义
* @author ThinkGem
*/
@Configuration
public class CmsAiWebMvcConfig implements WebMvcConfigurer {
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setTaskExecutor(webMvcAsyncTaskExecutor());
}
@Bean
public ThreadPoolTaskExecutor webMvcAsyncTaskExecutor() {
ThreadPoolTaskExecutor bean = new ThreadPoolTaskExecutor();
bean.setCorePoolSize(Global.getPropertyToInteger("web.taskPool.corePoolSize", "8"));
bean.setMaxPoolSize(Global.getPropertyToInteger("web.taskPool.maxPoolSize", "20"));
bean.setKeepAliveSeconds(Global.getPropertyToInteger("web.taskPool.keepAliveSeconds", "60"));
bean.setQueueCapacity(Global.getPropertyToInteger("web.taskPool.queueCapacity", String.valueOf(Integer.MAX_VALUE)));
bean.setThreadNamePrefix("web-async-");
return bean;
}
}

View File

@@ -113,7 +113,6 @@ spring:
3. 可以用少量表情,避免过多表情。
4. 增加互动,如 “您的看法如何?”
# ========= Postgresql 向量数据库数据源 =========