165 lines
3.4 KiB
Java
165 lines
3.4 KiB
Java
package com.senmesh.sdk.dify.dto;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import java.io.Serializable;
|
|
import java.util.List;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Builder;
|
|
import lombok.Data;
|
|
import lombok.NoArgsConstructor;
|
|
|
|
/**
|
|
* Dify对话响应
|
|
*
|
|
* @author sr
|
|
*/
|
|
@Data
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
public class DifyChatResponse implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
/** 消息ID */
|
|
@JsonProperty("message_id")
|
|
private String messageId;
|
|
|
|
/** 会话ID */
|
|
@JsonProperty("conversation_id")
|
|
private String conversationId;
|
|
|
|
/** 模式 */
|
|
private String mode;
|
|
|
|
/** 回答内容 */
|
|
private String answer;
|
|
|
|
/** 元数据 */
|
|
private Metadata metadata;
|
|
|
|
/** 创建时间 */
|
|
@JsonProperty("created_at")
|
|
private Long createdAt;
|
|
|
|
/**
|
|
* 元数据
|
|
*/
|
|
@Data
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
public static class Metadata implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
/** 使用量 */
|
|
private Usage usage;
|
|
|
|
/** 检索器资源 */
|
|
@JsonProperty("retriever_resources")
|
|
private List<RetrieverResource> retrieverResources;
|
|
}
|
|
|
|
/**
|
|
* 使用量
|
|
*/
|
|
@Data
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
public static class Usage implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
/** 提示词token数 */
|
|
@JsonProperty("prompt_tokens")
|
|
private Integer promptTokens;
|
|
|
|
/** 提示词单位价格 */
|
|
@JsonProperty("prompt_unit_price")
|
|
private String promptUnitPrice;
|
|
|
|
/** 提示词价格单位 */
|
|
@JsonProperty("prompt_price_unit")
|
|
private String promptPriceUnit;
|
|
|
|
/** 提示词价格 */
|
|
@JsonProperty("prompt_price")
|
|
private String promptPrice;
|
|
|
|
/** 完成token数 */
|
|
@JsonProperty("completion_tokens")
|
|
private Integer completionTokens;
|
|
|
|
/** 完成单位价格 */
|
|
@JsonProperty("completion_unit_price")
|
|
private String completionUnitPrice;
|
|
|
|
/** 完成价格单位 */
|
|
@JsonProperty("completion_price_unit")
|
|
private String completionPriceUnit;
|
|
|
|
/** 完成价格 */
|
|
@JsonProperty("completion_price")
|
|
private String completionPrice;
|
|
|
|
/** 总token数 */
|
|
@JsonProperty("total_tokens")
|
|
private Integer totalTokens;
|
|
|
|
/** 总价格 */
|
|
@JsonProperty("total_price")
|
|
private String totalPrice;
|
|
|
|
/** 货币 */
|
|
private String currency;
|
|
|
|
/** 延迟(毫秒) */
|
|
private Double latency;
|
|
}
|
|
|
|
/**
|
|
* 检索器资源
|
|
*/
|
|
@Data
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
public static class RetrieverResource implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
/** 位置 */
|
|
private Integer position;
|
|
|
|
/** 数据集ID */
|
|
@JsonProperty("dataset_id")
|
|
private String datasetId;
|
|
|
|
/** 数据集名称 */
|
|
@JsonProperty("dataset_name")
|
|
private String datasetName;
|
|
|
|
/** 文档ID */
|
|
@JsonProperty("document_id")
|
|
private String documentId;
|
|
|
|
/** 文档名称 */
|
|
@JsonProperty("document_name")
|
|
private String documentName;
|
|
|
|
/** 分段ID */
|
|
@JsonProperty("segment_id")
|
|
private String segmentId;
|
|
|
|
/** 分数 */
|
|
private Double score;
|
|
|
|
/** 内容 */
|
|
private String content;
|
|
}
|
|
|
|
}
|
|
|