main
黄海 7 months ago
parent 2b06e4b5a7
commit 9e4c8c0bc9

@ -158,7 +158,7 @@ public class MaxKbImpl {
* @param documentId id * @param documentId id
* @return * @return
*/ */
public static JSONObject generateQuestion(String zskId, String modelId, String documentId) { public static JSONObject genQuestion(String zskId, String modelId, String documentId) {
String authCode = MaxKbImpl.getAuthorization(); String authCode = MaxKbImpl.getAuthorization();
String url = baseUrl + "/api/dataset/" + zskId + "/document/batch_generate_related"; String url = baseUrl + "/api/dataset/" + zskId + "/document/batch_generate_related";
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
@ -168,9 +168,6 @@ public class MaxKbImpl {
list.add(documentId); list.add(documentId);
jo.put("document_id_list", list); jo.put("document_id_list", list);
System.out.println("modelId=" + modelId);
System.out.println(jo.toString());
HttpResponse response = HttpRequest.put(url) HttpResponse response = HttpRequest.put(url)
.header("Accept", "application/json, text/plain, */*") .header("Accept", "application/json, text/plain, */*")
.header("Accept-Encoding", "gzip,deflate") .header("Accept-Encoding", "gzip,deflate")

@ -126,28 +126,16 @@ public class MaxKbService {
* @param documentId Id * @param documentId Id
* @return * @return
*/ */
public JSONObject generateQuestion(String zskName, String modelName, String documentId) throws InterruptedException { public JSONObject genQuestion(String zskName, String modelName, String documentId) throws InterruptedException {
//等待模型生成问题完毕 //等待模型生成问题完毕
while (true) { while (true) {
boolean finish = autoIndexed(documentId); boolean finish = mm.autoIndexed(documentId);
if (finish) { if (finish) {
//手动生成问题
JSONObject res = generateQuestion(zskName, modelName, documentId);
break; break;
} }
Thread.sleep(500); Thread.sleep(500);
System.out.println(CommonUtil.getCurrentTime() + " 正在等待模型生成问题完毕..."); System.out.println(CommonUtil.getCurrentTime() + " 正在等待模型生成问题完毕...");
} }
return MaxKbImpl.generateQuestion(getZskId(zskName), getModelIdByModelName(modelName), documentId); return MaxKbImpl.genQuestion(getZskId(zskName), getModelIdByModelName(modelName), documentId);
}
/**
*
*
* @param documentId id
* @return
*/
public boolean autoIndexed(String documentId) {
return mm.autoIndexed(documentId);
} }
} }

@ -21,7 +21,7 @@ public class UploadQA {
//2、手动生成问题 //2、手动生成问题
String modelName = "DeepSeek";//使用哪个模型 String modelName = "DeepSeek";//使用哪个模型
service.generateQuestion(zskName, modelName, documentId); service.genQuestion(zskName, modelName, documentId);
System.out.println("恭喜,所有操作成功完成!"); System.out.println("恭喜,所有操作成功完成!");
} }

Loading…
Cancel
Save