【解决 TODO 】AI PPT:解决一些 TODO

This commit is contained in:
xiaoxin
2025-03-18 14:41:06 +08:00
parent acf68b1cec
commit 270fea0c5d
4 changed files with 89 additions and 94 deletions

View File

@@ -24,16 +24,15 @@ import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
// TODO @新要不改成 WenDuoDuoPptApi
/**
* 文多多 API
*
* @see <a href="https://docmee.cn/open-platform/api">PPT 生成 API</a>
*
* @author xiaoxin
* @see <a href="https://docmee.cn/open-platform/api">PPT 生成 API</a>
*/
@Slf4j
public class WddPptApi {
public class WenDuoDuoPptApi {
public static final String BASE_URL = "https://docmee.cn";
@@ -50,7 +49,7 @@ public class WddPptApi {
});
// TODO @新是不是不用 baseUrl
public WddPptApi(String baseUrl) {
public WenDuoDuoPptApi(String baseUrl) {
this.webClient = WebClient.builder()
.baseUrl(baseUrl)
// TODO @新建议token 作为 defaultHeader
@@ -82,35 +81,14 @@ public class WddPptApi {
.block();
}
// TODO @xin是不是给个 API 连接这样 typecontentfiles 都不用写注释太细了
/**
* 创建任务
*
* @param type 类型
* 1.智能生成主题要求
* 2.上传文件生成
* 3.上传思维导图生成
* 4.通过word精准转ppt
* 5.通过网页链接生成
* 6.粘贴文本内容生成
* 7.Markdown大纲生成
* @param content 内容
* type=1 用户输入主题或要求不超过1000字符
* type=24 不传
* type=3 幕布等分享链接
* type=5 网页链接地址http/https
* type=6 粘贴文本内容不超过20000字符
* type=7 大纲内容markdown
* @param files 文件列表
* 文件列表文件数不超过5个总大小不超过50M
* type=1 上传参考文件非必传支持多个
* type=2 上传文件支持多个
* type=3 上传思维导图xmind/mm/md仅支持一个
* type=4 上传word文件仅支持一个
* type=567 不传
* <p>
* 支持格式doc/docx/pdf/ppt/pptx/txt/md/xls/xlsx/csv/html/epub/mobi/xmind/mm
* @return 任务ID
* @see <a href="https://docmee.cn/open-platform/api#%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1">创建任务</a>
*/
public ApiResponse createTask(String token, Integer type, String content, List<MultipartFile> files) {
MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>();
@@ -258,7 +236,8 @@ public class WddPptApi {
Integer code,
String message,
Map<String, Object> data
) { }
) {
}
/**
* 创建任务
@@ -268,7 +247,8 @@ public class WddPptApi {
Integer type,
String content,
List<MultipartFile> files
) { }
) {
}
/**
* 生成大纲内容请求
@@ -281,7 +261,8 @@ public class WddPptApi {
String audience,
String lang,
String prompt
) { }
) {
}
/**
* 修改大纲内容请求
@@ -291,7 +272,8 @@ public class WddPptApi {
String id,
String markdown,
String question
) { }
) {
}
/**
* 生成 PPT 请求
@@ -302,7 +284,8 @@ public class WddPptApi {
String id,
String templateId,
String markdown
) { }
) {
}
// TODO @新要不写下类注释
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@@ -323,7 +306,8 @@ public class WddPptApi {
LocalDateTime createTime,
String createUser,
String updateUser
) { }
) {
}
// TODO @新要不写下类注释
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@@ -339,7 +323,8 @@ public class WddPptApi {
String category,
String style,
String themeColor
) { }
) {
}
}
@@ -348,7 +333,8 @@ public class WddPptApi {
public record PagePptTemplateInfo(
List<PptTemplateInfo> data,
String total
) {}
) {
}
// TODO @新要不写下类注释
@@ -380,6 +366,7 @@ public class WddPptApi {
LocalDateTime createTime,
String createUser,
String updateUser
) { }
) {
}
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.framework.ai.core.model.xinghuo.api;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.extern.slf4j.Slf4j;
@@ -28,16 +29,16 @@ import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
// TODO @新要不改成 XunFeiPptApi
/**
* 讯飞智能 PPT 生成 API
*
* @see <a href="https://www.xfyun.cn/doc/spark/PPTv2.html">智能 PPT 生成 API</a>
*
* @author xiaoxin
* @see <a href="https://www.xfyun.cn/doc/spark/PPTv2.html">智能 PPT 生成 API</a>
*/
@Slf4j
public class XunfeiPptApi {
public class XunFeiPptApi {
public static final String BASE_URL = "https://zwapi.xfyun.cn/api/ppt/v2";
@@ -54,7 +55,7 @@ public class XunfeiPptApi {
});
// TODO @新是不是不用 baseUrl
public XunfeiPptApi(String baseUrl, String appId, String apiSecret) {
public XunFeiPptApi(String baseUrl, String appId, String apiSecret) {
// TODO @新建议增加 defaultheaders例如说 appid 之类的或者每个请求通过 headers customer 处理
this.webClient = WebClient.builder()
.baseUrl(baseUrl)
@@ -134,8 +135,7 @@ public class XunfeiPptApi {
SignatureInfo signInfo = getSignature();
Map<String, Object> requestBody = new HashMap<>();
requestBody.put("style", style);
// TODO @新可以使用 ObjUtil.defaultIfNull
requestBody.put("pageSize", pageSize != null ? pageSize : 10);
requestBody.put("pageSize", ObjUtil.defaultIfNull(pageSize, 20));
return this.webClient.post()
.uri("/template/list")
.header("appId", signInfo.appId)
@@ -288,7 +288,8 @@ public class XunfeiPptApi {
String appId,
String timestamp,
String signature
) { }
) {
}
/**
* 模板列表响应
@@ -300,7 +301,8 @@ public class XunfeiPptApi {
String desc,
Integer count,
TemplatePageData data
) { }
) {
}
/**
* 模板列表数据
@@ -310,7 +312,8 @@ public class XunfeiPptApi {
String total,
List<TemplateInfo> records,
Integer pageNum
) { }
) {
}
/**
* 模板信息
@@ -324,7 +327,8 @@ public class XunfeiPptApi {
String industry,
String style,
String detailImage
) { }
) {
}
/**
* 创建响应
@@ -336,7 +340,8 @@ public class XunfeiPptApi {
String desc,
Integer count,
CreateResponseData data
) { }
) {
}
/**
* 创建响应数据
@@ -348,7 +353,8 @@ public class XunfeiPptApi {
String title,
String subTitle,
OutlineData outline
) { }
) {
}
/**
* 大纲数据结构
@@ -375,7 +381,8 @@ public class XunfeiPptApi {
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public record ChapterContent(
String chapterTitle
) { }
) {
}
}
@@ -397,7 +404,8 @@ public class XunfeiPptApi {
int code,
String desc,
ProgressResponseData data
) { }
) {
}
/**
* 进度响应数据
@@ -407,13 +415,12 @@ public class XunfeiPptApi {
int process,
String pptId,
String pptUrl,
// TODO @新字段注释去掉
String pptStatus, // PPT构建状态building构建中done已完成build_failed生成失败
String aiImageStatus, // ai配图状态building构建中done已完成
String cardNoteStatus, // 演讲备注状态building构建中done已完成
String errMsg, // 生成PPT的失败信息
Integer totalPages, // 生成PPT的总页数
Integer donePages // 生成PPT的完成页数
String pptStatus,
String aiImageStatus,
String cardNoteStatus,
String errMsg,
Integer totalPages,
Integer donePages
) {
/**
@@ -480,6 +487,7 @@ public class XunfeiPptApi {
}
// TODO @新这个可以用 lombok 简化么
/**
* 构建器类
*/