|
@@ -1,5 +1,6 @@
|
|
|
package com.storlead.knowledge.api;
|
|
package com.storlead.knowledge.api;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.json.JSON;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.storlead.framework.common.result.Result;
|
|
import com.storlead.framework.common.result.Result;
|
|
@@ -65,9 +66,12 @@ public class DocumentController {
|
|
|
|
|
|
|
|
@PostMapping("{dataset_id}/document/create_by_text")
|
|
@PostMapping("{dataset_id}/document/create_by_text")
|
|
|
@ApiOperation("以文本创建文档")
|
|
@ApiOperation("以文本创建文档")
|
|
|
- public Result<Object> createDocumentByText(@RequestBody DocumentDTO documentDTO, @PathVariable String dataset_id) throws JsonProcessingException {
|
|
|
|
|
|
|
+ public Result<Object> createDocumentByText(@RequestBody String body , @PathVariable String dataset_id) throws JsonProcessingException {
|
|
|
String url = difyProperties.getBaseUrl() + "datasets/"+dataset_id + "/document/create-by-text";
|
|
String url = difyProperties.getBaseUrl() + "datasets/"+dataset_id + "/document/create-by-text";
|
|
|
- String body = JacksonHolder.OBJECT_MAPPER.writeValueAsString(documentDTO);
|
|
|
|
|
|
|
+ //String body = JacksonHolder.OBJECT_MAPPER.writeValueAsString(documentDTO);
|
|
|
|
|
+ System.out.println(body);
|
|
|
|
|
+ System.out.println(url);
|
|
|
|
|
+ System.out.println(difyProperties.getDatasetApiKey());
|
|
|
return httpService.post(url, null, "Bearer "+difyProperties.getDatasetApiKey(), body, new TypeReference<>() {});
|
|
return httpService.post(url, null, "Bearer "+difyProperties.getDatasetApiKey(), body, new TypeReference<>() {});
|
|
|
}
|
|
}
|
|
|
|
|
|