调用dify,解决时间问题,源语料为空的问题

This commit is contained in:
spllzh
2025-09-08 00:00:08 +08:00
parent a25d80ae28
commit 206275317f
9 changed files with 1552 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
package com.rj.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
/**
* Dify工作流请求DTO
*
* @author 李中华
* @date 2025/1/3
*/
@Data
@Schema(description = "Dify企微对话分析工作流请求参数")
public class DifyWorkflowRequestDto {
@NotBlank(message = "企微客户unionId不能为空")
@Schema(description = "企微客户unionId", example = "test_union_12345", required = true)
private String unionId;
@NotBlank(message = "B端认证中心userId不能为空")
@Schema(description = "B端认证中心userId", example = "consultant_67890", required = true)
private String consultantId;
@NotBlank(message = "沟通时间不能为空")
@Schema(description = "沟通时间", example = "2025-01-03 10:30:00", required = true)
private String communicateDate;
@NotBlank(message = "分析场景不能为空")
@Schema(description = "分析场景", example = "sales_consultation", required = true)
private String analysisScene;
@NotBlank(message = "AI分析请求ID不能为空")
@Schema(description = "AI分析请求ID", example = "ai_req_20250103_001", required = true)
private String aiAnalysisRequestId;
@NotNull(message = "版本号不能为空")
@Schema(description = "版本号", example = "1", required = true)
private Integer version;
@NotBlank(message = "企微对话内容不能为空")
@Schema(description = "企微对话内容", example = "客户你好我想了解一下沃尔沃XC60这款车。\n顾问您好很高兴为您介绍沃尔沃XC60。", required = true)
private String chat;
}

View File

@@ -0,0 +1,62 @@
package com.rj.dto;
import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* Dify工作流响应DTO
*
* @author 李中华
* @date 2025/1/3
*/
@Data
@Schema(description = "Dify企微对话分析工作流响应结果")
public class DifyWorkflowResponseDto {
@Schema(description = "是否成功", example = "true")
private Boolean success;
@Schema(description = "响应消息", example = "工作流调用成功")
private String message;
@Schema(description = "工作流运行ID", example = "workflow_run_12345")
private String workflowRunId;
@Schema(description = "任务ID", example = "task_67890")
private String taskId;
@Schema(description = "工作流响应数据")
private JSONObject data;
@Schema(description = "元数据")
private JSONObject metadata;
@Schema(description = "错误类型(仅在失败时返回)", example = "RuntimeException")
private String error;
/**
* 创建成功响应
*/
public static DifyWorkflowResponseDto success(String workflowRunId, String taskId, JSONObject data, JSONObject metadata) {
DifyWorkflowResponseDto response = new DifyWorkflowResponseDto();
response.setSuccess(true);
response.setMessage("工作流调用成功");
response.setWorkflowRunId(workflowRunId);
response.setTaskId(taskId);
response.setData(data);
response.setMetadata(metadata);
return response;
}
/**
* 创建失败响应
*/
public static DifyWorkflowResponseDto failure(String message, String error) {
DifyWorkflowResponseDto response = new DifyWorkflowResponseDto();
response.setSuccess(false);
response.setMessage(message);
response.setError(error);
return response;
}
}