Commit 270fea0c5dc736a5733611d27f4a4a8783ddfe67
1 parent
acf68b1c
【解决 TODO 】AI PPT:解决一些 TODO
Showing
4 changed files
with
89 additions
and
94 deletions
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/wenduoduo/api/WddPptApi.java renamed to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/wenduoduo/api/WenDuoDuoPptApi.java
| @@ -24,16 +24,15 @@ import java.util.Objects; | @@ -24,16 +24,15 @@ import java.util.Objects; | ||
| 24 | import java.util.function.Function; | 24 | import java.util.function.Function; |
| 25 | import java.util.function.Predicate; | 25 | import java.util.function.Predicate; |
| 26 | 26 | ||
| 27 | -// TODO @新:要不改成 WenDuoDuoPptApi | 27 | + |
| 28 | /** | 28 | /** |
| 29 | * 文多多 API | 29 | * 文多多 API |
| 30 | * | 30 | * |
| 31 | - * @see <a href="https://docmee.cn/open-platform/api">PPT 生成 API</a> | ||
| 32 | - * | ||
| 33 | * @author xiaoxin | 31 | * @author xiaoxin |
| 32 | + * @see <a href="https://docmee.cn/open-platform/api">PPT 生成 API</a> | ||
| 34 | */ | 33 | */ |
| 35 | @Slf4j | 34 | @Slf4j |
| 36 | -public class WddPptApi { | 35 | +public class WenDuoDuoPptApi { |
| 37 | 36 | ||
| 38 | public static final String BASE_URL = "https://docmee.cn"; | 37 | public static final String BASE_URL = "https://docmee.cn"; |
| 39 | 38 | ||
| @@ -50,7 +49,7 @@ public class WddPptApi { | @@ -50,7 +49,7 @@ public class WddPptApi { | ||
| 50 | }); | 49 | }); |
| 51 | 50 | ||
| 52 | // TODO @新:是不是不用 baseUrl 哈 | 51 | // TODO @新:是不是不用 baseUrl 哈 |
| 53 | - public WddPptApi(String baseUrl) { | 52 | + public WenDuoDuoPptApi(String baseUrl) { |
| 54 | this.webClient = WebClient.builder() | 53 | this.webClient = WebClient.builder() |
| 55 | .baseUrl(baseUrl) | 54 | .baseUrl(baseUrl) |
| 56 | // TODO @新:建议,token 作为 defaultHeader | 55 | // TODO @新:建议,token 作为 defaultHeader |
| @@ -82,35 +81,14 @@ public class WddPptApi { | @@ -82,35 +81,14 @@ public class WddPptApi { | ||
| 82 | .block(); | 81 | .block(); |
| 83 | } | 82 | } |
| 84 | 83 | ||
| 85 | - // TODO @xin:是不是给个 API 连接,这样 type、content、files 都不用写注释太细了 | ||
| 86 | /** | 84 | /** |
| 87 | * 创建任务 | 85 | * 创建任务 |
| 88 | * | 86 | * |
| 89 | * @param type 类型 | 87 | * @param type 类型 |
| 90 | - * 1.智能生成(主题、要求) | ||
| 91 | - * 2.上传文件生成 | ||
| 92 | - * 3.上传思维导图生成 | ||
| 93 | - * 4.通过word精准转ppt | ||
| 94 | - * 5.通过网页链接生成 | ||
| 95 | - * 6.粘贴文本内容生成 | ||
| 96 | - * 7.Markdown大纲生成 | ||
| 97 | * @param content 内容 | 88 | * @param content 内容 |
| 98 | - * type=1 用户输入主题或要求(不超过1000字符) | ||
| 99 | - * type=2、4 不传 | ||
| 100 | - * type=3 幕布等分享链接 | ||
| 101 | - * type=5 网页链接地址(http/https) | ||
| 102 | - * type=6 粘贴文本内容(不超过20000字符) | ||
| 103 | - * type=7 大纲内容(markdown) | ||
| 104 | * @param files 文件列表 | 89 | * @param files 文件列表 |
| 105 | - * 文件列表(文件数不超过5个,总大小不超过50M): | ||
| 106 | - * type=1 上传参考文件(非必传,支持多个) | ||
| 107 | - * type=2 上传文件(支持多个) | ||
| 108 | - * type=3 上传思维导图(xmind/mm/md)(仅支持一个) | ||
| 109 | - * type=4 上传word文件(仅支持一个) | ||
| 110 | - * type=5、6、7 不传 | ||
| 111 | - * <p> | ||
| 112 | - * 支持格式:doc/docx/pdf/ppt/pptx/txt/md/xls/xlsx/csv/html/epub/mobi/xmind/mm | ||
| 113 | * @return 任务ID | 90 | * @return 任务ID |
| 91 | + * @see <a href="https://docmee.cn/open-platform/api#%E5%88%9B%E5%BB%BA%E4%BB%BB%E5%8A%A1">创建任务</a> | ||
| 114 | */ | 92 | */ |
| 115 | public ApiResponse createTask(String token, Integer type, String content, List<MultipartFile> files) { | 93 | public ApiResponse createTask(String token, Integer type, String content, List<MultipartFile> files) { |
| 116 | MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>(); | 94 | MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>(); |
| @@ -258,7 +236,8 @@ public class WddPptApi { | @@ -258,7 +236,8 @@ public class WddPptApi { | ||
| 258 | Integer code, | 236 | Integer code, |
| 259 | String message, | 237 | String message, |
| 260 | Map<String, Object> data | 238 | Map<String, Object> data |
| 261 | - ) { } | 239 | + ) { |
| 240 | + } | ||
| 262 | 241 | ||
| 263 | /** | 242 | /** |
| 264 | * 创建任务 | 243 | * 创建任务 |
| @@ -268,7 +247,8 @@ public class WddPptApi { | @@ -268,7 +247,8 @@ public class WddPptApi { | ||
| 268 | Integer type, | 247 | Integer type, |
| 269 | String content, | 248 | String content, |
| 270 | List<MultipartFile> files | 249 | List<MultipartFile> files |
| 271 | - ) { } | 250 | + ) { |
| 251 | + } | ||
| 272 | 252 | ||
| 273 | /** | 253 | /** |
| 274 | * 生成大纲内容请求 | 254 | * 生成大纲内容请求 |
| @@ -281,7 +261,8 @@ public class WddPptApi { | @@ -281,7 +261,8 @@ public class WddPptApi { | ||
| 281 | String audience, | 261 | String audience, |
| 282 | String lang, | 262 | String lang, |
| 283 | String prompt | 263 | String prompt |
| 284 | - ) { } | 264 | + ) { |
| 265 | + } | ||
| 285 | 266 | ||
| 286 | /** | 267 | /** |
| 287 | * 修改大纲内容请求 | 268 | * 修改大纲内容请求 |
| @@ -291,7 +272,8 @@ public class WddPptApi { | @@ -291,7 +272,8 @@ public class WddPptApi { | ||
| 291 | String id, | 272 | String id, |
| 292 | String markdown, | 273 | String markdown, |
| 293 | String question | 274 | String question |
| 294 | - ) { } | 275 | + ) { |
| 276 | + } | ||
| 295 | 277 | ||
| 296 | /** | 278 | /** |
| 297 | * 生成 PPT 请求 | 279 | * 生成 PPT 请求 |
| @@ -302,7 +284,8 @@ public class WddPptApi { | @@ -302,7 +284,8 @@ public class WddPptApi { | ||
| 302 | String id, | 284 | String id, |
| 303 | String templateId, | 285 | String templateId, |
| 304 | String markdown | 286 | String markdown |
| 305 | - ) { } | 287 | + ) { |
| 288 | + } | ||
| 306 | 289 | ||
| 307 | // TODO @新:要不写下类注释 | 290 | // TODO @新:要不写下类注释 |
| 308 | @JsonInclude(value = JsonInclude.Include.NON_NULL) | 291 | @JsonInclude(value = JsonInclude.Include.NON_NULL) |
| @@ -323,7 +306,8 @@ public class WddPptApi { | @@ -323,7 +306,8 @@ public class WddPptApi { | ||
| 323 | LocalDateTime createTime, | 306 | LocalDateTime createTime, |
| 324 | String createUser, | 307 | String createUser, |
| 325 | String updateUser | 308 | String updateUser |
| 326 | - ) { } | 309 | + ) { |
| 310 | + } | ||
| 327 | 311 | ||
| 328 | // TODO @新:要不写下类注释 | 312 | // TODO @新:要不写下类注释 |
| 329 | @JsonInclude(value = JsonInclude.Include.NON_NULL) | 313 | @JsonInclude(value = JsonInclude.Include.NON_NULL) |
| @@ -339,7 +323,8 @@ public class WddPptApi { | @@ -339,7 +323,8 @@ public class WddPptApi { | ||
| 339 | String category, | 323 | String category, |
| 340 | String style, | 324 | String style, |
| 341 | String themeColor | 325 | String themeColor |
| 342 | - ) { } | 326 | + ) { |
| 327 | + } | ||
| 343 | 328 | ||
| 344 | } | 329 | } |
| 345 | 330 | ||
| @@ -348,7 +333,8 @@ public class WddPptApi { | @@ -348,7 +333,8 @@ public class WddPptApi { | ||
| 348 | public record PagePptTemplateInfo( | 333 | public record PagePptTemplateInfo( |
| 349 | List<PptTemplateInfo> data, | 334 | List<PptTemplateInfo> data, |
| 350 | String total | 335 | String total |
| 351 | - ) {} | 336 | + ) { |
| 337 | + } | ||
| 352 | 338 | ||
| 353 | 339 | ||
| 354 | // TODO @新:要不写下类注释 | 340 | // TODO @新:要不写下类注释 |
| @@ -380,6 +366,7 @@ public class WddPptApi { | @@ -380,6 +366,7 @@ public class WddPptApi { | ||
| 380 | LocalDateTime createTime, | 366 | LocalDateTime createTime, |
| 381 | String createUser, | 367 | String createUser, |
| 382 | String updateUser | 368 | String updateUser |
| 383 | - ) { } | 369 | + ) { |
| 370 | + } | ||
| 384 | 371 | ||
| 385 | } | 372 | } |
| 386 | \ No newline at end of file | 373 | \ No newline at end of file |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XunfeiPptApi.java renamed to yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/model/xinghuo/api/XunFeiPptApi.java
| 1 | package cn.iocoder.yudao.framework.ai.core.model.xinghuo.api; | 1 | package cn.iocoder.yudao.framework.ai.core.model.xinghuo.api; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.util.ObjUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 4 | import com.fasterxml.jackson.annotation.JsonInclude; | 5 | import com.fasterxml.jackson.annotation.JsonInclude; |
| 5 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
| @@ -28,16 +29,16 @@ import java.util.Map; | @@ -28,16 +29,16 @@ import java.util.Map; | ||
| 28 | import java.util.function.Function; | 29 | import java.util.function.Function; |
| 29 | import java.util.function.Predicate; | 30 | import java.util.function.Predicate; |
| 30 | 31 | ||
| 31 | -// TODO @新:要不改成 XunFeiPptApi | 32 | + |
| 33 | + | ||
| 32 | /** | 34 | /** |
| 33 | * 讯飞智能 PPT 生成 API | 35 | * 讯飞智能 PPT 生成 API |
| 34 | * | 36 | * |
| 35 | - * @see <a href="https://www.xfyun.cn/doc/spark/PPTv2.html">智能 PPT 生成 API</a> | ||
| 36 | - * | ||
| 37 | * @author xiaoxin | 37 | * @author xiaoxin |
| 38 | + * @see <a href="https://www.xfyun.cn/doc/spark/PPTv2.html">智能 PPT 生成 API</a> | ||
| 38 | */ | 39 | */ |
| 39 | @Slf4j | 40 | @Slf4j |
| 40 | -public class XunfeiPptApi { | 41 | +public class XunFeiPptApi { |
| 41 | 42 | ||
| 42 | public static final String BASE_URL = "https://zwapi.xfyun.cn/api/ppt/v2"; | 43 | public static final String BASE_URL = "https://zwapi.xfyun.cn/api/ppt/v2"; |
| 43 | 44 | ||
| @@ -54,7 +55,7 @@ public class XunfeiPptApi { | @@ -54,7 +55,7 @@ public class XunfeiPptApi { | ||
| 54 | }); | 55 | }); |
| 55 | 56 | ||
| 56 | // TODO @新:是不是不用 baseUrl 哈 | 57 | // TODO @新:是不是不用 baseUrl 哈 |
| 57 | - public XunfeiPptApi(String baseUrl, String appId, String apiSecret) { | 58 | + public XunFeiPptApi(String baseUrl, String appId, String apiSecret) { |
| 58 | // TODO @新:建议,增加 defaultheaders,例如说 appid 之类的;或者每个请求,通过 headers customer 处理。 | 59 | // TODO @新:建议,增加 defaultheaders,例如说 appid 之类的;或者每个请求,通过 headers customer 处理。 |
| 59 | this.webClient = WebClient.builder() | 60 | this.webClient = WebClient.builder() |
| 60 | .baseUrl(baseUrl) | 61 | .baseUrl(baseUrl) |
| @@ -134,8 +135,7 @@ public class XunfeiPptApi { | @@ -134,8 +135,7 @@ public class XunfeiPptApi { | ||
| 134 | SignatureInfo signInfo = getSignature(); | 135 | SignatureInfo signInfo = getSignature(); |
| 135 | Map<String, Object> requestBody = new HashMap<>(); | 136 | Map<String, Object> requestBody = new HashMap<>(); |
| 136 | requestBody.put("style", style); | 137 | requestBody.put("style", style); |
| 137 | - // TODO @新:可以使用 ObjUtil.defaultIfNull | ||
| 138 | - requestBody.put("pageSize", pageSize != null ? pageSize : 10); | 138 | + requestBody.put("pageSize", ObjUtil.defaultIfNull(pageSize, 20)); |
| 139 | return this.webClient.post() | 139 | return this.webClient.post() |
| 140 | .uri("/template/list") | 140 | .uri("/template/list") |
| 141 | .header("appId", signInfo.appId) | 141 | .header("appId", signInfo.appId) |
| @@ -288,7 +288,8 @@ public class XunfeiPptApi { | @@ -288,7 +288,8 @@ public class XunfeiPptApi { | ||
| 288 | String appId, | 288 | String appId, |
| 289 | String timestamp, | 289 | String timestamp, |
| 290 | String signature | 290 | String signature |
| 291 | - ) { } | 291 | + ) { |
| 292 | + } | ||
| 292 | 293 | ||
| 293 | /** | 294 | /** |
| 294 | * 模板列表响应 | 295 | * 模板列表响应 |
| @@ -300,7 +301,8 @@ public class XunfeiPptApi { | @@ -300,7 +301,8 @@ public class XunfeiPptApi { | ||
| 300 | String desc, | 301 | String desc, |
| 301 | Integer count, | 302 | Integer count, |
| 302 | TemplatePageData data | 303 | TemplatePageData data |
| 303 | - ) { } | 304 | + ) { |
| 305 | + } | ||
| 304 | 306 | ||
| 305 | /** | 307 | /** |
| 306 | * 模板列表数据 | 308 | * 模板列表数据 |
| @@ -310,7 +312,8 @@ public class XunfeiPptApi { | @@ -310,7 +312,8 @@ public class XunfeiPptApi { | ||
| 310 | String total, | 312 | String total, |
| 311 | List<TemplateInfo> records, | 313 | List<TemplateInfo> records, |
| 312 | Integer pageNum | 314 | Integer pageNum |
| 313 | - ) { } | 315 | + ) { |
| 316 | + } | ||
| 314 | 317 | ||
| 315 | /** | 318 | /** |
| 316 | * 模板信息 | 319 | * 模板信息 |
| @@ -324,7 +327,8 @@ public class XunfeiPptApi { | @@ -324,7 +327,8 @@ public class XunfeiPptApi { | ||
| 324 | String industry, | 327 | String industry, |
| 325 | String style, | 328 | String style, |
| 326 | String detailImage | 329 | String detailImage |
| 327 | - ) { } | 330 | + ) { |
| 331 | + } | ||
| 328 | 332 | ||
| 329 | /** | 333 | /** |
| 330 | * 创建响应 | 334 | * 创建响应 |
| @@ -336,7 +340,8 @@ public class XunfeiPptApi { | @@ -336,7 +340,8 @@ public class XunfeiPptApi { | ||
| 336 | String desc, | 340 | String desc, |
| 337 | Integer count, | 341 | Integer count, |
| 338 | CreateResponseData data | 342 | CreateResponseData data |
| 339 | - ) { } | 343 | + ) { |
| 344 | + } | ||
| 340 | 345 | ||
| 341 | /** | 346 | /** |
| 342 | * 创建响应数据 | 347 | * 创建响应数据 |
| @@ -348,7 +353,8 @@ public class XunfeiPptApi { | @@ -348,7 +353,8 @@ public class XunfeiPptApi { | ||
| 348 | String title, | 353 | String title, |
| 349 | String subTitle, | 354 | String subTitle, |
| 350 | OutlineData outline | 355 | OutlineData outline |
| 351 | - ) { } | 356 | + ) { |
| 357 | + } | ||
| 352 | 358 | ||
| 353 | /** | 359 | /** |
| 354 | * 大纲数据结构 | 360 | * 大纲数据结构 |
| @@ -375,7 +381,8 @@ public class XunfeiPptApi { | @@ -375,7 +381,8 @@ public class XunfeiPptApi { | ||
| 375 | @JsonInclude(value = JsonInclude.Include.NON_NULL) | 381 | @JsonInclude(value = JsonInclude.Include.NON_NULL) |
| 376 | public record ChapterContent( | 382 | public record ChapterContent( |
| 377 | String chapterTitle | 383 | String chapterTitle |
| 378 | - ) { } | 384 | + ) { |
| 385 | + } | ||
| 379 | 386 | ||
| 380 | } | 387 | } |
| 381 | 388 | ||
| @@ -397,7 +404,8 @@ public class XunfeiPptApi { | @@ -397,7 +404,8 @@ public class XunfeiPptApi { | ||
| 397 | int code, | 404 | int code, |
| 398 | String desc, | 405 | String desc, |
| 399 | ProgressResponseData data | 406 | ProgressResponseData data |
| 400 | - ) { } | 407 | + ) { |
| 408 | + } | ||
| 401 | 409 | ||
| 402 | /** | 410 | /** |
| 403 | * 进度响应数据 | 411 | * 进度响应数据 |
| @@ -407,13 +415,12 @@ public class XunfeiPptApi { | @@ -407,13 +415,12 @@ public class XunfeiPptApi { | ||
| 407 | int process, | 415 | int process, |
| 408 | String pptId, | 416 | String pptId, |
| 409 | String pptUrl, | 417 | String pptUrl, |
| 410 | - // TODO @新:字段注释,去掉 | ||
| 411 | - String pptStatus, // PPT构建状态:building(构建中),done(已完成),build_failed(生成失败) | ||
| 412 | - String aiImageStatus, // ai配图状态:building(构建中),done(已完成) | ||
| 413 | - String cardNoteStatus, // 演讲备注状态:building(构建中),done(已完成) | ||
| 414 | - String errMsg, // 生成PPT的失败信息 | ||
| 415 | - Integer totalPages, // 生成PPT的总页数 | ||
| 416 | - Integer donePages // 生成PPT的完成页数 | 418 | + String pptStatus, |
| 419 | + String aiImageStatus, | ||
| 420 | + String cardNoteStatus, | ||
| 421 | + String errMsg, | ||
| 422 | + Integer totalPages, | ||
| 423 | + Integer donePages | ||
| 417 | ) { | 424 | ) { |
| 418 | 425 | ||
| 419 | /** | 426 | /** |
| @@ -480,6 +487,7 @@ public class XunfeiPptApi { | @@ -480,6 +487,7 @@ public class XunfeiPptApi { | ||
| 480 | } | 487 | } |
| 481 | 488 | ||
| 482 | // TODO @新:这个可以用 lombok 简化么? | 489 | // TODO @新:这个可以用 lombok 简化么? |
| 490 | + | ||
| 483 | /** | 491 | /** |
| 484 | * 构建器类 | 492 | * 构建器类 |
| 485 | */ | 493 | */ |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/ppt/wdd/WddPptApiTests.java renamed to yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/ppt/wdd/WenDuoDuoPptApiTests.java
| 1 | package cn.iocoder.yudao.framework.ai.ppt.wdd; | 1 | package cn.iocoder.yudao.framework.ai.ppt.wdd; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.ai.core.model.wenduoduo.api.WddPptApi; | 3 | +import cn.iocoder.yudao.framework.ai.core.model.wenduoduo.api.WenDuoDuoPptApi; |
| 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 5 | import org.junit.jupiter.api.Disabled; | 5 | import org.junit.jupiter.api.Disabled; |
| 6 | import org.junit.jupiter.api.Test; | 6 | import org.junit.jupiter.api.Test; |
| @@ -10,13 +10,13 @@ import java.util.Map; | @@ -10,13 +10,13 @@ import java.util.Map; | ||
| 10 | import java.util.Objects; | 10 | import java.util.Objects; |
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | - * {@link WddPptApi} 集成测试 | 13 | + * {@link WenDuoDuoPptApi} 集成测试 |
| 14 | * | 14 | * |
| 15 | * @author xiaoxin | 15 | * @author xiaoxin |
| 16 | */ | 16 | */ |
| 17 | -public class WddPptApiTests { | 17 | +public class WenDuoDuoPptApiTests { |
| 18 | 18 | ||
| 19 | - private final WddPptApi wddPptApi = new WddPptApi("https://docmee.cn"); | 19 | + private final WenDuoDuoPptApi wenDuoDuoPptApi = new WenDuoDuoPptApi("https://docmee.cn"); |
| 20 | 20 | ||
| 21 | private final String token = ""; // API Token | 21 | private final String token = ""; // API Token |
| 22 | 22 | ||
| @@ -25,9 +25,9 @@ public class WddPptApiTests { | @@ -25,9 +25,9 @@ public class WddPptApiTests { | ||
| 25 | public void testCreateApiToken() { | 25 | public void testCreateApiToken() { |
| 26 | // 准备参数 | 26 | // 准备参数 |
| 27 | String apiKey = ""; | 27 | String apiKey = ""; |
| 28 | - WddPptApi.CreateTokenRequest request = new WddPptApi.CreateTokenRequest(apiKey); | 28 | + WenDuoDuoPptApi.CreateTokenRequest request = new WenDuoDuoPptApi.CreateTokenRequest(apiKey); |
| 29 | // 调用方法 | 29 | // 调用方法 |
| 30 | - String token = wddPptApi.createApiToken(request); | 30 | + String token = wenDuoDuoPptApi.createApiToken(request); |
| 31 | // 打印结果 | 31 | // 打印结果 |
| 32 | System.out.println(token); | 32 | System.out.println(token); |
| 33 | } | 33 | } |
| @@ -38,7 +38,7 @@ public class WddPptApiTests { | @@ -38,7 +38,7 @@ public class WddPptApiTests { | ||
| 38 | @Test | 38 | @Test |
| 39 | @Disabled | 39 | @Disabled |
| 40 | public void testCreateTask() { | 40 | public void testCreateTask() { |
| 41 | - WddPptApi.ApiResponse apiResponse = wddPptApi.createTask(token, 1, "dify 介绍", null); | 41 | + WenDuoDuoPptApi.ApiResponse apiResponse = wenDuoDuoPptApi.createTask(token, 1, "dify 介绍", null); |
| 42 | System.out.println(apiResponse); | 42 | System.out.println(apiResponse); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| @@ -46,10 +46,10 @@ public class WddPptApiTests { | @@ -46,10 +46,10 @@ public class WddPptApiTests { | ||
| 46 | @Test // 创建大纲 | 46 | @Test // 创建大纲 |
| 47 | @Disabled | 47 | @Disabled |
| 48 | public void testGenerateOutlineRequest() { | 48 | public void testGenerateOutlineRequest() { |
| 49 | - WddPptApi.CreateOutlineRequest request = new WddPptApi.CreateOutlineRequest( | 49 | + WenDuoDuoPptApi.CreateOutlineRequest request = new WenDuoDuoPptApi.CreateOutlineRequest( |
| 50 | "1901539019628613632", "medium", null, null, null, null); | 50 | "1901539019628613632", "medium", null, null, null, null); |
| 51 | // 调用 | 51 | // 调用 |
| 52 | - Flux<Map<String, Object>> flux = wddPptApi.createOutline(token, request); | 52 | + Flux<Map<String, Object>> flux = wenDuoDuoPptApi.createOutline(token, request); |
| 53 | StringBuffer contentBuffer = new StringBuffer(); | 53 | StringBuffer contentBuffer = new StringBuffer(); |
| 54 | flux.doOnNext(chunk -> { | 54 | flux.doOnNext(chunk -> { |
| 55 | contentBuffer.append(chunk.get("text")); | 55 | contentBuffer.append(chunk.get("text")); |
| @@ -69,10 +69,10 @@ public class WddPptApiTests { | @@ -69,10 +69,10 @@ public class WddPptApiTests { | ||
| 69 | @Test | 69 | @Test |
| 70 | @Disabled | 70 | @Disabled |
| 71 | public void testUpdateOutlineRequest() { | 71 | public void testUpdateOutlineRequest() { |
| 72 | - WddPptApi.UpdateOutlineRequest request = new WddPptApi.UpdateOutlineRequest( | 72 | + WenDuoDuoPptApi.UpdateOutlineRequest request = new WenDuoDuoPptApi.UpdateOutlineRequest( |
| 73 | "1901539019628613632", TEST_OUT_LINE_CONTENT, "精简一点,三个章节即可"); | 73 | "1901539019628613632", TEST_OUT_LINE_CONTENT, "精简一点,三个章节即可"); |
| 74 | // 调用 | 74 | // 调用 |
| 75 | - Flux<Map<String, Object>> flux = wddPptApi.updateOutline(token, request); | 75 | + Flux<Map<String, Object>> flux = wenDuoDuoPptApi.updateOutline(token, request); |
| 76 | StringBuffer contentBuffer = new StringBuffer(); | 76 | StringBuffer contentBuffer = new StringBuffer(); |
| 77 | flux.doOnNext(chunk -> { | 77 | flux.doOnNext(chunk -> { |
| 78 | contentBuffer.append(chunk.get("text")); | 78 | contentBuffer.append(chunk.get("text")); |
| @@ -94,11 +94,11 @@ public class WddPptApiTests { | @@ -94,11 +94,11 @@ public class WddPptApiTests { | ||
| 94 | @Disabled | 94 | @Disabled |
| 95 | public void testGetPptTemplatePage() { | 95 | public void testGetPptTemplatePage() { |
| 96 | // 准备参数 | 96 | // 准备参数 |
| 97 | - WddPptApi.TemplateQueryRequest.Filter filter = new WddPptApi.TemplateQueryRequest.Filter( | 97 | + WenDuoDuoPptApi.TemplateQueryRequest.Filter filter = new WenDuoDuoPptApi.TemplateQueryRequest.Filter( |
| 98 | 1, null, null, null); | 98 | 1, null, null, null); |
| 99 | - WddPptApi.TemplateQueryRequest request = new WddPptApi.TemplateQueryRequest(1, 10, filter); | 99 | + WenDuoDuoPptApi.TemplateQueryRequest request = new WenDuoDuoPptApi.TemplateQueryRequest(1, 10, filter); |
| 100 | // 调用 | 100 | // 调用 |
| 101 | - WddPptApi.PagePptTemplateInfo pptTemplatePage = wddPptApi.getTemplatePage(token, request); | 101 | + WenDuoDuoPptApi.PagePptTemplateInfo pptTemplatePage = wenDuoDuoPptApi.getTemplatePage(token, request); |
| 102 | // 打印结果 | 102 | // 打印结果 |
| 103 | System.out.println(pptTemplatePage); | 103 | System.out.println(pptTemplatePage); |
| 104 | } | 104 | } |
| @@ -110,9 +110,9 @@ public class WddPptApiTests { | @@ -110,9 +110,9 @@ public class WddPptApiTests { | ||
| 110 | @Disabled | 110 | @Disabled |
| 111 | public void testGeneratePptx() { | 111 | public void testGeneratePptx() { |
| 112 | // 准备参数 | 112 | // 准备参数 |
| 113 | - WddPptApi.CreatePptRequest request = new WddPptApi.CreatePptRequest("1901539019628613632", "1805081814809960448", TEST_OUT_LINE_CONTENT); | 113 | + WenDuoDuoPptApi.CreatePptRequest request = new WenDuoDuoPptApi.CreatePptRequest("1901539019628613632", "1805081814809960448", TEST_OUT_LINE_CONTENT); |
| 114 | // 调用 | 114 | // 调用 |
| 115 | - WddPptApi.PptInfo pptInfo = wddPptApi.create(token, request); | 115 | + WenDuoDuoPptApi.PptInfo pptInfo = wenDuoDuoPptApi.create(token, request); |
| 116 | // 打印结果 | 116 | // 打印结果 |
| 117 | System.out.println(pptInfo); | 117 | System.out.println(pptInfo); |
| 118 | } | 118 | } |
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/ppt/xunfei/XunfeiPptApiTests.java renamed to yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/ppt/xunfei/XunFeiPptApiTests.java
| 1 | package cn.iocoder.yudao.framework.ai.ppt.xunfei; | 1 | package cn.iocoder.yudao.framework.ai.ppt.xunfei; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.FileUtil; | 3 | import cn.hutool.core.io.FileUtil; |
| 4 | -import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XunfeiPptApi; | 4 | +import cn.iocoder.yudao.framework.ai.core.model.xinghuo.api.XunFeiPptApi; |
| 5 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 5 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 6 | import org.junit.jupiter.api.Disabled; | 6 | import org.junit.jupiter.api.Disabled; |
| 7 | import org.junit.jupiter.api.Test; | 7 | import org.junit.jupiter.api.Test; |
| @@ -11,17 +11,17 @@ import org.springframework.web.multipart.MultipartFile; | @@ -11,17 +11,17 @@ import org.springframework.web.multipart.MultipartFile; | ||
| 11 | import java.io.File; | 11 | import java.io.File; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | - * {@link XunfeiPptApi} 集成测试 | 14 | + * {@link XunFeiPptApi} 集成测试 |
| 15 | * | 15 | * |
| 16 | * @author xiaoxin | 16 | * @author xiaoxin |
| 17 | */ | 17 | */ |
| 18 | -public class XunfeiPptApiTests { | 18 | +public class XunFeiPptApiTests { |
| 19 | 19 | ||
| 20 | // 讯飞 API 配置信息,实际使用时请替换为您的应用信息 | 20 | // 讯飞 API 配置信息,实际使用时请替换为您的应用信息 |
| 21 | private static final String APP_ID = ""; | 21 | private static final String APP_ID = ""; |
| 22 | private static final String API_SECRET = ""; | 22 | private static final String API_SECRET = ""; |
| 23 | 23 | ||
| 24 | - private final XunfeiPptApi xunfeiPptApi = new XunfeiPptApi(XunfeiPptApi.BASE_URL, APP_ID, API_SECRET); | 24 | + private final XunFeiPptApi xunfeiPptApi = new XunFeiPptApi(XunFeiPptApi.BASE_URL, APP_ID, API_SECRET); |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * 获取 PPT 模板列表 | 27 | * 获取 PPT 模板列表 |
| @@ -30,7 +30,7 @@ public class XunfeiPptApiTests { | @@ -30,7 +30,7 @@ public class XunfeiPptApiTests { | ||
| 30 | @Disabled | 30 | @Disabled |
| 31 | public void testGetTemplatePage() { | 31 | public void testGetTemplatePage() { |
| 32 | // 调用方法 | 32 | // 调用方法 |
| 33 | - XunfeiPptApi.TemplatePageResponse response = xunfeiPptApi.getTemplatePage("商务", 10); | 33 | + XunFeiPptApi.TemplatePageResponse response = xunfeiPptApi.getTemplatePage("商务", 10); |
| 34 | // 打印结果 | 34 | // 打印结果 |
| 35 | System.out.println("模板列表响应:" + JsonUtils.toJsonString(response)); | 35 | System.out.println("模板列表响应:" + JsonUtils.toJsonString(response)); |
| 36 | 36 | ||
| @@ -41,7 +41,7 @@ public class XunfeiPptApiTests { | @@ -41,7 +41,7 @@ public class XunfeiPptApiTests { | ||
| 41 | 41 | ||
| 42 | // 打印第一个模板的信息(如果存在) | 42 | // 打印第一个模板的信息(如果存在) |
| 43 | if (!response.data().records().isEmpty()) { | 43 | if (!response.data().records().isEmpty()) { |
| 44 | - XunfeiPptApi.TemplateInfo firstTemplate = response.data().records().get(0); | 44 | + XunFeiPptApi.TemplateInfo firstTemplate = response.data().records().get(0); |
| 45 | System.out.println("模板ID:" + firstTemplate.templateIndexId()); | 45 | System.out.println("模板ID:" + firstTemplate.templateIndexId()); |
| 46 | System.out.println("模板风格:" + firstTemplate.style()); | 46 | System.out.println("模板风格:" + firstTemplate.style()); |
| 47 | System.out.println("模板颜色:" + firstTemplate.color()); | 47 | System.out.println("模板颜色:" + firstTemplate.color()); |
| @@ -56,7 +56,7 @@ public class XunfeiPptApiTests { | @@ -56,7 +56,7 @@ public class XunfeiPptApiTests { | ||
| 56 | @Test | 56 | @Test |
| 57 | @Disabled | 57 | @Disabled |
| 58 | public void testCreateOutline() { | 58 | public void testCreateOutline() { |
| 59 | - XunfeiPptApi.CreateResponse response = getCreateResponse(); | 59 | + XunFeiPptApi.CreateResponse response = getCreateResponse(); |
| 60 | // 打印结果 | 60 | // 打印结果 |
| 61 | System.out.println("创建大纲响应:" + JsonUtils.toJsonString(response)); | 61 | System.out.println("创建大纲响应:" + JsonUtils.toJsonString(response)); |
| 62 | 62 | ||
| @@ -77,7 +77,7 @@ public class XunfeiPptApiTests { | @@ -77,7 +77,7 @@ public class XunfeiPptApiTests { | ||
| 77 | * 创建大纲(通过文本) | 77 | * 创建大纲(通过文本) |
| 78 | * @return 创建大纲响应 | 78 | * @return 创建大纲响应 |
| 79 | */ | 79 | */ |
| 80 | - private XunfeiPptApi.CreateResponse getCreateResponse() { | 80 | + private XunFeiPptApi.CreateResponse getCreateResponse() { |
| 81 | String param = "智能体平台 Dify 介绍"; | 81 | String param = "智能体平台 Dify 介绍"; |
| 82 | return xunfeiPptApi.createOutline(param); | 82 | return xunfeiPptApi.createOutline(param); |
| 83 | } | 83 | } |
| @@ -89,9 +89,9 @@ public class XunfeiPptApiTests { | @@ -89,9 +89,9 @@ public class XunfeiPptApiTests { | ||
| 89 | @Disabled | 89 | @Disabled |
| 90 | public void testCreatePptByOutlineWithFullParams() { | 90 | public void testCreatePptByOutlineWithFullParams() { |
| 91 | // 创建大纲对象 | 91 | // 创建大纲对象 |
| 92 | - XunfeiPptApi.CreateResponse createResponse = getCreateResponse(); | 92 | + XunFeiPptApi.CreateResponse createResponse = getCreateResponse(); |
| 93 | // 调用方法 | 93 | // 调用方法 |
| 94 | - XunfeiPptApi.CreateResponse response = xunfeiPptApi.createPptByOutline(createResponse.data().outline(), "精简一些,不要超过6个章节"); | 94 | + XunFeiPptApi.CreateResponse response = xunfeiPptApi.createPptByOutline(createResponse.data().outline(), "精简一些,不要超过6个章节"); |
| 95 | // 打印结果 | 95 | // 打印结果 |
| 96 | System.out.println("通过大纲创建 PPT 响应:" + JsonUtils.toJsonString(response)); | 96 | System.out.println("通过大纲创建 PPT 响应:" + JsonUtils.toJsonString(response)); |
| 97 | 97 | ||
| @@ -114,13 +114,13 @@ public class XunfeiPptApiTests { | @@ -114,13 +114,13 @@ public class XunfeiPptApiTests { | ||
| 114 | String sid = "e96dac09f2ec4ee289f029a5fb874ecd"; // 替换为实际的sid | 114 | String sid = "e96dac09f2ec4ee289f029a5fb874ecd"; // 替换为实际的sid |
| 115 | 115 | ||
| 116 | // 调用方法 | 116 | // 调用方法 |
| 117 | - XunfeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid); | 117 | + XunFeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid); |
| 118 | // 打印结果 | 118 | // 打印结果 |
| 119 | System.out.println("检查进度响应:" + JsonUtils.toJsonString(response)); | 119 | System.out.println("检查进度响应:" + JsonUtils.toJsonString(response)); |
| 120 | 120 | ||
| 121 | // 安全地访问响应数据 | 121 | // 安全地访问响应数据 |
| 122 | if (response != null && response.data() != null) { | 122 | if (response != null && response.data() != null) { |
| 123 | - XunfeiPptApi.ProgressResponseData data = response.data(); | 123 | + XunFeiPptApi.ProgressResponseData data = response.data(); |
| 124 | 124 | ||
| 125 | // 打印PPT生成状态 | 125 | // 打印PPT生成状态 |
| 126 | System.out.println("PPT 构建状态: " + data.pptStatus()); | 126 | System.out.println("PPT 构建状态: " + data.pptStatus()); |
| @@ -171,11 +171,11 @@ public class XunfeiPptApiTests { | @@ -171,11 +171,11 @@ public class XunfeiPptApiTests { | ||
| 171 | System.out.println("第" + (i + 1) + "次查询进度..."); | 171 | System.out.println("第" + (i + 1) + "次查询进度..."); |
| 172 | 172 | ||
| 173 | // 调用方法 | 173 | // 调用方法 |
| 174 | - XunfeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid); | 174 | + XunFeiPptApi.ProgressResponse response = xunfeiPptApi.checkProgress(sid); |
| 175 | 175 | ||
| 176 | // 安全地访问响应数据 | 176 | // 安全地访问响应数据 |
| 177 | if (response != null && response.data() != null) { | 177 | if (response != null && response.data() != null) { |
| 178 | - XunfeiPptApi.ProgressResponseData data = response.data(); | 178 | + XunFeiPptApi.ProgressResponseData data = response.data(); |
| 179 | 179 | ||
| 180 | // 打印进度信息 | 180 | // 打印进度信息 |
| 181 | System.out.println("PPT 构建状态: " + data.pptStatus()); | 181 | System.out.println("PPT 构建状态: " + data.pptStatus()); |
| @@ -218,7 +218,7 @@ public class XunfeiPptApiTests { | @@ -218,7 +218,7 @@ public class XunfeiPptApiTests { | ||
| 218 | String query = "合肥天气趋势分析,包括近5年的气温变化、降水量变化、极端天气事件,以及对城市生活的影响"; | 218 | String query = "合肥天气趋势分析,包括近5年的气温变化、降水量变化、极端天气事件,以及对城市生活的影响"; |
| 219 | 219 | ||
| 220 | // 调用方法 | 220 | // 调用方法 |
| 221 | - XunfeiPptApi.CreateResponse response = xunfeiPptApi.create(query); | 221 | + XunFeiPptApi.CreateResponse response = xunfeiPptApi.create(query); |
| 222 | // 打印结果 | 222 | // 打印结果 |
| 223 | System.out.println("直接创建 PPT 响应:" + JsonUtils.toJsonString(response)); | 223 | System.out.println("直接创建 PPT 响应:" + JsonUtils.toJsonString(response)); |
| 224 | 224 | ||
| @@ -244,7 +244,7 @@ public class XunfeiPptApiTests { | @@ -244,7 +244,7 @@ public class XunfeiPptApiTests { | ||
| 244 | MultipartFile multipartFile = convertFileToMultipartFile(file); | 244 | MultipartFile multipartFile = convertFileToMultipartFile(file); |
| 245 | 245 | ||
| 246 | // 调用方法 | 246 | // 调用方法 |
| 247 | - XunfeiPptApi.CreateResponse response = xunfeiPptApi.create(multipartFile, file.getName()); | 247 | + XunFeiPptApi.CreateResponse response = xunfeiPptApi.create(multipartFile, file.getName()); |
| 248 | // 打印结果 | 248 | // 打印结果 |
| 249 | System.out.println("通过文件创建PPT响应:" + JsonUtils.toJsonString(response)); | 249 | System.out.println("通过文件创建PPT响应:" + JsonUtils.toJsonString(response)); |
| 250 | 250 | ||
| @@ -269,7 +269,7 @@ public class XunfeiPptApiTests { | @@ -269,7 +269,7 @@ public class XunfeiPptApiTests { | ||
| 269 | String query = "合肥天气趋势分析,包括近 5 年的气温变化、降水量变化、极端天气事件,以及对城市生活的影响"; | 269 | String query = "合肥天气趋势分析,包括近 5 年的气温变化、降水量变化、极端天气事件,以及对城市生活的影响"; |
| 270 | 270 | ||
| 271 | // 创建请求对象 | 271 | // 创建请求对象 |
| 272 | - XunfeiPptApi.CreatePptRequest request = XunfeiPptApi.CreatePptRequest.builder() | 272 | + XunFeiPptApi.CreatePptRequest request = XunFeiPptApi.CreatePptRequest.builder() |
| 273 | .query(query) | 273 | .query(query) |
| 274 | .language("cn") | 274 | .language("cn") |
| 275 | .isCardNote(true) | 275 | .isCardNote(true) |
| @@ -280,7 +280,7 @@ public class XunfeiPptApiTests { | @@ -280,7 +280,7 @@ public class XunfeiPptApiTests { | ||
| 280 | .build(); | 280 | .build(); |
| 281 | 281 | ||
| 282 | // 调用方法 | 282 | // 调用方法 |
| 283 | - XunfeiPptApi.CreateResponse response = xunfeiPptApi.create(request); | 283 | + XunFeiPptApi.CreateResponse response = xunfeiPptApi.create(request); |
| 284 | // 打印结果 | 284 | // 打印结果 |
| 285 | System.out.println("使用完整参数创建 PPT 响应:" + JsonUtils.toJsonString(response)); | 285 | System.out.println("使用完整参数创建 PPT 响应:" + JsonUtils.toJsonString(response)); |
| 286 | 286 | ||
| @@ -296,9 +296,9 @@ public class XunfeiPptApiTests { | @@ -296,9 +296,9 @@ public class XunfeiPptApiTests { | ||
| 296 | 296 | ||
| 297 | // 立即查询一次进度 | 297 | // 立即查询一次进度 |
| 298 | System.out.println("立即查询进度..."); | 298 | System.out.println("立即查询进度..."); |
| 299 | - XunfeiPptApi.ProgressResponse progressResponse = xunfeiPptApi.checkProgress(sid); | 299 | + XunFeiPptApi.ProgressResponse progressResponse = xunfeiPptApi.checkProgress(sid); |
| 300 | if (progressResponse != null && progressResponse.data() != null) { | 300 | if (progressResponse != null && progressResponse.data() != null) { |
| 301 | - XunfeiPptApi.ProgressResponseData progressData = progressResponse.data(); | 301 | + XunFeiPptApi.ProgressResponseData progressData = progressResponse.data(); |
| 302 | System.out.println("PPT 构建状态: " + progressData.pptStatus()); | 302 | System.out.println("PPT 构建状态: " + progressData.pptStatus()); |
| 303 | if (progressData.totalPages() != null && progressData.donePages() != null) { | 303 | if (progressData.totalPages() != null && progressData.donePages() != null) { |
| 304 | System.out.println("完成进度: " + progressData.donePages() + "/" + progressData.totalPages() | 304 | System.out.println("完成进度: " + progressData.donePages() + "/" + progressData.totalPages() |