feat: 完善智能体图片聊天与会话恢复

- 增加私有图片上传、绑定、历史回显与生命周期清理

- 支持输入草稿恢复、图片交互和模型图片能力约束

- 修复旧脏会话幂等删除与前端会话恢复
This commit is contained in:
2026-07-17 19:54:26 +08:00
parent 62d763199f
commit 1e6158be77
62 changed files with 5333 additions and 189 deletions

View File

@@ -0,0 +1,56 @@
package tech.easyflow.agent.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.time.Duration;
/**
* Agent 图片上传、草稿和对象存储配置。
*/
@ConfigurationProperties(prefix = "easyflow.agent.media")
public class AgentMediaProperties {
/** x-file-storage 中的私有 Agent 媒体平台。 */
private String platform = "minio-agent-media";
/** 单次对话最多图片数。 */
private int maxImageCount = 5;
/** 单张图片最大字节数。 */
private long maxImageBytes = 10L * 1024L * 1024L;
/** 单张图片最大像素数。 */
private long maxImagePixels = 40_000_000L;
/** 临时图片有效期。 */
private Duration uploadTtl = Duration.ofHours(24);
/** 输入草稿有效期。 */
private Duration composerDraftTtl = Duration.ofHours(24);
/** 过期对象清理周期。 */
private Duration cleanupInterval = Duration.ofMinutes(10);
/** @return 私有媒体平台名称 */
public String getPlatform() { return platform; }
/** @param platform 私有媒体平台名称 */
public void setPlatform(String platform) { this.platform = platform; }
/** @return 单次图片上限 */
public int getMaxImageCount() { return maxImageCount; }
/** @param maxImageCount 单次图片上限 */
public void setMaxImageCount(int maxImageCount) { this.maxImageCount = maxImageCount; }
/** @return 单图字节上限 */
public long getMaxImageBytes() { return maxImageBytes; }
/** @param maxImageBytes 单图字节上限 */
public void setMaxImageBytes(long maxImageBytes) { this.maxImageBytes = maxImageBytes; }
/** @return 单图像素上限 */
public long getMaxImagePixels() { return maxImagePixels; }
/** @param maxImagePixels 单图像素上限 */
public void setMaxImagePixels(long maxImagePixels) { this.maxImagePixels = maxImagePixels; }
/** @return 临时图片 TTL */
public Duration getUploadTtl() { return uploadTtl; }
/** @param uploadTtl 临时图片 TTL */
public void setUploadTtl(Duration uploadTtl) { this.uploadTtl = uploadTtl; }
/** @return 草稿 TTL */
public Duration getComposerDraftTtl() { return composerDraftTtl; }
/** @param composerDraftTtl 草稿 TTL */
public void setComposerDraftTtl(Duration composerDraftTtl) { this.composerDraftTtl = composerDraftTtl; }
/** @return 清理周期 */
public Duration getCleanupInterval() { return cleanupInterval; }
/** @param cleanupInterval 清理周期 */
public void setCleanupInterval(Duration cleanupInterval) { this.cleanupInterval = cleanupInterval; }
}

View File

@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* Agent 模块自动配置。
@@ -11,6 +12,7 @@ import org.springframework.context.annotation.ComponentScan;
@AutoConfiguration
@MapperScan("tech.easyflow.agent.mapper")
@ComponentScan("tech.easyflow.agent")
@EnableConfigurationProperties(AgentRuntimeProperties.class)
@EnableScheduling
@EnableConfigurationProperties({AgentRuntimeProperties.class, AgentMediaProperties.class})
public class AgentModuleConfig {
}