【解决 TODO 】AI PPT:解决一些 TODO
This commit is contained in:
parent
acf68b1cec
commit
270fea0c5d
|
@ -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 连接,这样 type、content、files 都不用写注释太细了
|
||||
/**
|
||||
* 创建任务
|
||||
*
|
||||
* @param type 类型
|
||||
* 1.智能生成(主题、要求)
|
||||
* 2.上传文件生成
|
||||
* 3.上传思维导图生成
|
||||
* 4.通过word精准转ppt
|
||||
* 5.通过网页链接生成
|
||||
* 6.粘贴文本内容生成
|
||||
* 7.Markdown大纲生成
|
||||
* @param content 内容
|
||||
* type=1 用户输入主题或要求(不超过1000字符)
|
||||
* type=2、4 不传
|
||||
* 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=5、6、7 不传
|
||||
* <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
|
||||
) { }
|
||||
) {
|
||||
}
|
||||
|
||||
}
|
|
@ -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 简化么?
|
||||
|
||||
/**
|
||||
* 构建器类
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.framework.ai.ppt.wdd;
|
||||
|
||||
import cn.iocoder.yudao.framework.ai.core.model.wenduoduo.api.WddPptApi;
|
||||
import cn.iocoder.yudao.framework.ai.core.model.wenduoduo.api.WenDuoDuoPptApi;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -10,13 +10,13 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* {@link WddPptApi} 集成测试
|
||||
* {@link WenDuoDuoPptApi} 集成测试
|
||||
*
|
||||
* @author xiaoxin
|
||||
*/
|
||||
public class WddPptApiTests {
|
||||
public class WenDuoDuoPptApiTests {
|
||||
|
||||
private final WddPptApi wddPptApi = new WddPptApi("https://docmee.cn");
|
||||
private final WenDuoDuoPptApi wenDuoDuoPptApi = new WenDuoDuoPptApi("https://docmee.cn");
|
||||
|
||||
private final String token = ""; // API Token
|
||||
|
||||
|
@ -25,9 +25,9 @@ public class WddPptApiTests {
|
|||
public void testCreateApiToken() {
|
||||
// 准备参数
|
||||
String apiKey = "";
|
||||
WddPptApi.CreateTokenRequest request = new WddPptApi.CreateTokenRequest(apiKey);
|
||||
WenDuoDuoPptApi.CreateTokenRequest request = new WenDuoDuoPptApi.CreateTokenRequest(apiKey);
|
||||
// 调用方法
|
||||
String token = wddPptApi.createApiToken(request);
|
||||
String token = wenDuoDuoPptApi.createApiToken(request);
|
||||
// 打印结果
|
||||
System.out.println(token);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class WddPptApiTests {
|
|||
@Test
|
||||
@Disabled
|
||||
public void testCreateTask() {
|
||||
WddPptApi.ApiResponse apiResponse = wddPptApi.createTask(token, 1, "dify 介绍", null);
|
||||
WenDuoDuoPptApi.ApiResponse apiResponse = wenDuoDuoPptApi.createTask(token, 1, "dify 介绍", null);
|
||||
System.out.println(apiResponse);
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,10 @@ public class WddPptApiTests {
|
|||
@Test // 创建大纲
|
||||
@Disabled
|
||||
public void testGenerateOutlineRequest() {
|
||||
WddPptApi.CreateOutlineRequest request = new WddPptApi.CreateOutlineRequest(
|
||||
WenDuoDuoPptApi.CreateOutlineRequest request = new WenDuoDuoPptApi.CreateOutlineRequest(
|
||||
"1901539019628613632", "medium", null, null, null, null);
|
||||
// 调用
|
||||
Flux<Map<String, Object>> flux = wddPptApi.createOutline(token, request);
|
||||
Flux<Map<String, Object>> flux = wenDuoDuoPptApi.createOutline(token, request);
|
||||
StringBuffer contentBuffer = new StringBuffer();
|
||||
flux.doOnNext(chunk -> {
|
||||
contentBuffer.append(chunk.get("text"));
|
||||
|
@ -69,10 +69,10 @@ public class WddPptApiTests {
|
|||
@Test
|
||||
@Disabled
|
||||
public void testUpdateOutlineRequest() {
|
||||
WddPptApi.UpdateOutlineRequest request = new WddPptApi.UpdateOutlineRequest(
|
||||
WenDuoDuoPptApi.UpdateOutlineRequest request = new WenDuoDuoPptApi.UpdateOutlineRequest(
|
||||
"1901539019628613632", TEST_OUT_LINE_CONTENT, "精简一点,三个章节即可");
|
||||
// 调用
|
||||
Flux<Map<String, Object>> flux = wddPptApi.updateOutline(token, request);
|
||||
Flux<Map<String, Object>> flux = wenDuoDuoPptApi.updateOutline(token, request);
|
||||
StringBuffer contentBuffer = new StringBuffer();
|
||||
flux.doOnNext(chunk -> {
|
||||
contentBuffer.append(chunk.get("text"));
|
||||
|
@ -94,11 +94,11 @@ public class WddPptApiTests {
|
|||
@Disabled
|
||||
public void testGetPptTemplatePage() {
|
||||
// 准备参数
|
||||
WddPptApi.TemplateQueryRequest.Filter filter = new WddPptApi.TemplateQueryRequest.Filter(
|
||||
WenDuoDuoPptApi.TemplateQueryRequest.Filter filter = new WenDuoDuoPptApi.TemplateQueryRequest.Filter(
|
||||
1, null, null, null);
|
||||
WddPptApi.TemplateQueryRequest request = new WddPptApi.TemplateQueryRequest(1, 10, filter);
|
||||
WenDuoDuoPptApi.TemplateQueryRequest request = new WenDuoDuoPptApi.TemplateQueryRequest(1, 10, filter);
|
||||
// 调用
|
||||
WddPptApi.PagePptTemplateInfo pptTemplatePage = wddPptApi.getTemplatePage(token, request);
|
||||
WenDuoDuoPptApi.PagePptTemplateInfo pptTemplatePage = wenDuoDuoPptApi.getTemplatePage(token, request);
|
||||
// 打印结果
|
||||
System.out.println(pptTemplatePage);
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ public class WddPptApiTests {
|
|||
@Disabled
|
||||
public void testGeneratePptx() {
|
||||
// 准备参数
|
||||
WddPptApi.CreatePptRequest request = new WddPptApi.CreatePptRequest("1901539019628613632", "1805081814809960448", TEST_OUT_LINE_CONTENT);
|
||||
WenDuoDuoPptApi.CreatePptRequest request = new WenDuoDuoPptApi.CreatePptRequest("1901539019628613632", "1805081814809960448", TEST_OUT_LINE_CONTENT);
|
||||
// 调用
|
||||
WddPptApi.PptInfo pptInfo = wddPptApi.create(token, request);
|
||||
WenDuoDuoPptApi.PptInfo pptInfo = wenDuoDuoPptApi.create(token, request);
|
||||
// 打印结果
|
||||
System.out.println(pptInfo);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package cn.iocoder.yudao.framework.ai.ppt.xunfei;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XunfeiPptApi;
|
||||
import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XunFeiPptApi;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -11,17 +11,17 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import java.io.File;
|
||||
|
||||
/**
|
||||
* {@link XunfeiPptApi} 集成测试
|
||||
* {@link XunFeiPptApi} 集成测试
|
||||
*
|
||||
* @author xiaoxin
|
||||
*/
|
||||
public class XunfeiPptApiTests {
|
||||
public class XunFeiPptApiTests {
|
||||
|
||||
// 讯飞 API 配置信息,实际使用时请替换为您的应用信息
|
||||
private static final String APP_ID = "";
|
||||
private static final String API_SECRET = "";
|
||||
|
||||
private final XunfeiPptApi xunfeiPptApi = new XunfeiPptApi(XunfeiPptApi.BASE_URL, APP_ID, API_SECRET);
|
||||
private final XunFeiPptApi xunfeiPptApi = new XunFeiPptApi(XunFeiPptApi.BASE_URL, APP_ID, API_SECRET);
|
||||
|
||||
/**
|
||||
* 获取 PPT 模板列表
|
||||
|
@ -30,7 +30,7 @@ public class XunfeiPptApiTests {
|
|||
@Disabled
|
||||
public void testGetTemplatePage() {
|
||||
// 调用方法
|
||||
XunfeiPptApi.TemplatePageResponse response = xunfeiPptApi.getTemplatePage("商务", 10);
|
||||
XunFeiPptApi.TemplatePageResponse response = xunfeiPptApi.getTemplatePage("商务", 10);
|
||||
// 打印结果
|
||||
System.out.println("模板列表响应:" + JsonUtils.toJsonString(response));
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class XunfeiPptApiTests {
|
|||
|
||||
// 打印第一个模板的信息(如果存在)
|
||||
if (!response.data().records().isEmpty()) {
|
||||
XunfeiPptApi.TemplateInfo firstTemplate = response.data().records().get(0);
|
||||
XunFeiPptApi.TemplateInfo firstTemplate = response.data().records().get(0);
|
||||
System.out.println("模板ID:" + firstTemplate.templateIndexId());
|
||||
System.out.println("模板风格:" + firstTemplate.style());
|
||||
System.out.println("模板颜色:" + firstTemplate.color());
|
||||
|
@ -56,7 +56,7 @@ public class XunfeiPptApiTests {
|
|||
@Test
|
||||
@Disabled
|
||||
public void testCreateOutline() {
|
||||
XunfeiPptApi.CreateResponse response = getCreateResponse();
|
||||
XunFeiPptApi.CreateResponse response = getCreateResponse();
|
||||
// 打印结果
|
||||
System.out.println("创建大纲响应:" + JsonUtils.toJsonString(response));
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class XunfeiPptApiTests {
|
|||
* 创建大纲(通过文本)
|
||||
* @return 创建大纲响应
|
||||
*/
|
||||
private XunfeiPptApi.CreateResponse getCreateResponse() {
|
||||
private XunFeiPptApi.CreateResponse getCreateResponse() {
|
||||
String param = "智能体平台 Dify 介绍";
|
||||
return xunfeiPptApi.createOutline(param);
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ public class XunfeiPptApiTests {
|
|||
@Disabled
|
||||
public void testCreatePptByOutlineWithFullParams() {
|
||||
// 创建大纲对象
|
||||
XunfeiPptApi.CreateResponse createResponse = getCreateResponse();
|
||||
XunFeiPptApi.CreateResponse createResponse = getCreateResponse();
|
||||
// 调用方法
|
||||
XunfeiPptApi.CreateResponse response = xunfeiPptApi.createPptByOutline(createResponse.data().outline(), "精简一些,不要超过6个章节");
|
||||
XunFeiPptApi.CreateResponse response = xunfeiPptApi.createPptByOutline(createResponse.data().outline(), "精简一些,不要超过6个章节");
|
||||
// 打印结果
|
||||
System.out.println("通过大纲创建 PPT 响应:" + JsonUtils.toJsonString(response));
|
||||
|
||||
|
@ -114,13 +114,13 @@ public class XunfeiPptApiTests {
|
|||
String sid = "e96dac09f2ec4ee289f029a5fb874ecd"; // 替换为实际的sid
|
||||
|
||||
// 调用方法
|
||||
XunfeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid);
|
||||
XunFeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid);
|
||||
// 打印结果
|
||||
System.out.println("检查进度响应:" + JsonUtils.toJsonString(response));
|
||||
|
||||
// 安全地访问响应数据
|
||||
if (response != null && response.data() != null) {
|
||||
XunfeiPptApi.ProgressResponseData data = response.data();
|
||||
XunFeiPptApi.ProgressResponseData data = response.data();
|
||||
|
||||
// 打印PPT生成状态
|
||||
System.out.println("PPT 构建状态: " + data.pptStatus());
|
||||
|
@ -171,11 +171,11 @@ public class XunfeiPptApiTests {
|
|||
System.out.println("第" + (i + 1) + "次查询进度...");
|
||||
|
||||
// 调用方法
|
||||
XunfeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid);
|
||||
XunFeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid);
|
||||
|
||||
// 安全地访问响应数据
|
||||
if (response != null && response.data() != null) {
|
||||
XunfeiPptApi.ProgressResponseData data = response.data();
|
||||
XunFeiPptApi.ProgressResponseData data = response.data();
|
||||
|
||||
// 打印进度信息
|
||||
System.out.println("PPT 构建状态: " + data.pptStatus());
|
||||
|
@ -218,7 +218,7 @@ public class XunfeiPptApiTests {
|
|||
String query = "合肥天气趋势分析,包括近5年的气温变化、降水量变化、极端天气事件,以及对城市生活的影响";
|
||||
|
||||
// 调用方法
|
||||
XunfeiPptApi.CreateResponse response = xunfeiPptApi.create(query);
|
||||
XunFeiPptApi.CreateResponse response = xunfeiPptApi.create(query);
|
||||
// 打印结果
|
||||
System.out.println("直接创建 PPT 响应:" + JsonUtils.toJsonString(response));
|
||||
|
||||
|
@ -244,7 +244,7 @@ public class XunfeiPptApiTests {
|
|||
MultipartFile multipartFile = convertFileToMultipartFile(file);
|
||||
|
||||
// 调用方法
|
||||
XunfeiPptApi.CreateResponse response = xunfeiPptApi.create(multipartFile, file.getName());
|
||||
XunFeiPptApi.CreateResponse response = xunfeiPptApi.create(multipartFile, file.getName());
|
||||
// 打印结果
|
||||
System.out.println("通过文件创建PPT响应:" + JsonUtils.toJsonString(response));
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class XunfeiPptApiTests {
|
|||
String query = "合肥天气趋势分析,包括近 5 年的气温变化、降水量变化、极端天气事件,以及对城市生活的影响";
|
||||
|
||||
// 创建请求对象
|
||||
XunfeiPptApi.CreatePptRequest request = XunfeiPptApi.CreatePptRequest.builder()
|
||||
XunFeiPptApi.CreatePptRequest request = XunFeiPptApi.CreatePptRequest.builder()
|
||||
.query(query)
|
||||
.language("cn")
|
||||
.isCardNote(true)
|
||||
|
@ -280,7 +280,7 @@ public class XunfeiPptApiTests {
|
|||
.build();
|
||||
|
||||
// 调用方法
|
||||
XunfeiPptApi.CreateResponse response = xunfeiPptApi.create(request);
|
||||
XunFeiPptApi.CreateResponse response = xunfeiPptApi.create(request);
|
||||
// 打印结果
|
||||
System.out.println("使用完整参数创建 PPT 响应:" + JsonUtils.toJsonString(response));
|
||||
|
||||
|
@ -296,9 +296,9 @@ public class XunfeiPptApiTests {
|
|||
|
||||
// 立即查询一次进度
|
||||
System.out.println("立即查询进度...");
|
||||
XunfeiPptApi.ProgressResponse progressResponse = xunfeiPptApi.checkProgress(sid);
|
||||
XunFeiPptApi.ProgressResponse progressResponse = xunfeiPptApi.checkProgress(sid);
|
||||
if (progressResponse != null && progressResponse.data() != null) {
|
||||
XunfeiPptApi.ProgressResponseData progressData = progressResponse.data();
|
||||
XunFeiPptApi.ProgressResponseData progressData = progressResponse.data();
|
||||
System.out.println("PPT 构建状态: " + progressData.pptStatus());
|
||||
if (progressData.totalPages() != null && progressData.donePages() != null) {
|
||||
System.out.println("完成进度: " + progressData.donePages() + "/" + progressData.totalPages()
|
Loading…
Reference in New Issue