代码提交
parent
3a7929a574
commit
dbab5bcc5a
@ -0,0 +1,37 @@
|
|||||||
|
package com.supervision.chat;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
|
|
||||||
|
public enum UploadParamEnum {
|
||||||
|
to_vector_store(null, true, null),
|
||||||
|
override(null, false, null),
|
||||||
|
not_refresh_vs_cache(null, false, null),
|
||||||
|
chunk_size(null, null, 250),
|
||||||
|
chunk_overlap(null, null, 50),
|
||||||
|
zh_title_enhance(null, false, null),
|
||||||
|
docs("{\"test.txt\":[{\"page_content\":\"custom doc\",\"metadata\":{},\"type\":\"Document\"}]}", null, null);
|
||||||
|
|
||||||
|
private final String strValue;
|
||||||
|
|
||||||
|
private final Boolean booleanValue;
|
||||||
|
|
||||||
|
private final Integer intValue;
|
||||||
|
|
||||||
|
UploadParamEnum(String strValue, Boolean booleanValue, Integer intValue) {
|
||||||
|
this.strValue = strValue;
|
||||||
|
this.booleanValue = booleanValue;
|
||||||
|
this.intValue = intValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStrValue() {
|
||||||
|
return strValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getBooleanValue() {
|
||||||
|
return booleanValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIntValue() {
|
||||||
|
return intValue;
|
||||||
|
}
|
||||||
|
}
|
@ -1,32 +0,0 @@
|
|||||||
package com.supervision.chat.client;
|
|
||||||
|
|
||||||
import cn.hutool.http.HttpUtil;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.supervision.chat.client.dto.CreateBaseDTO;
|
|
||||||
import com.supervision.chat.client.dto.LangChainChatRes;
|
|
||||||
import org.apache.hc.client5.http.classic.HttpClient;
|
|
||||||
import org.apache.hc.client5.http.classic.methods.HttpPost;
|
|
||||||
import org.apache.hc.core5.http.HttpEntity;
|
|
||||||
import org.apache.hc.core5.http.HttpResponse;
|
|
||||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
|
||||||
import org.apache.hc.core5.http.io.entity.StringEntity;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class LangChainChatServiceImpl{
|
|
||||||
|
|
||||||
@Value("${langChain-chat.url}")
|
|
||||||
private String LangChainChatClientUrl;
|
|
||||||
|
|
||||||
|
|
||||||
public LangChainChatRes chat(CreateBaseDTO createBaseDTO) {
|
|
||||||
String post = HttpUtil.post(LangChainChatClientUrl + "create_knowledge_base", JSONUtil.toJsonStr(createBaseDTO));
|
|
||||||
if (JSONUtil.isTypeJSON(post)) {
|
|
||||||
return JSONUtil.toBean(post, LangChainChatRes.class);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue