{
+// @Override
+// public void serialize(OffsetDateTimeWrapper value, SerializerProvider serializers, com.fasterxml.jackson.core.JsonGenerator gen) throws IOException {
+// gen.writeString(value.getDateTime().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
+// }
+
+ @Override
+ public void serialize(OffsetDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
+ LocalDateTime localDateTimeBJ=value.plusHours(8).toLocalDateTime();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ gen.writeString(localDateTimeBJ.format(formatter));
+ //gen.writeString(value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
+ }
+}
diff --git a/flx-ai/src/main/resources/application.yml b/flx-ai/src/main/resources/application.yml
index 0f984de..26f77d5 100644
--- a/flx-ai/src/main/resources/application.yml
+++ b/flx-ai/src/main/resources/application.yml
@@ -43,6 +43,7 @@ management:
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
typeAliasesPackage: com.pjilisense.flxai.entity
+ configLocation: classpath:/mybatis-config.xml
global-config:
db-config:
id-type: ASSIGN_ID
@@ -50,12 +51,12 @@ mybatis-plus:
#logic-delete-value: 1
#logic-not-delete-value: 0
banner: false
- configuration:
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
- map-underscore-to-camel-case: true
- cache-enabled: false
- call-setters-on-nulls: true
- jdbc-type-for-null: 'null'
+ #configuration:
+ #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ #map-underscore-to-camel-case: true
+ #cache-enabled: false
+ #call-setters-on-nulls: true
+ #jdbc-type-for-null: 'null'
configuration-properties:
prefix:
blobType: BLOB
diff --git a/flx-ai/src/main/resources/mapper/postgres/FilesDao.xml b/flx-ai/src/main/resources/mapper/postgres/FilesDao.xml
new file mode 100644
index 0000000..d9f6d77
--- /dev/null
+++ b/flx-ai/src/main/resources/mapper/postgres/FilesDao.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE files SET name = #{name,jdbcType=VARCHAR},updated_at = now() WHERE id = #{id}
+
+
+
+ UPDATE files SET file_status = #{fileStatus,jdbcType=VARCHAR},updated_at = now() WHERE id = #{id}
+
+
+
+ UPDATE files SET file_category = #{fileCategory,jdbcType=VARCHAR},updated_at = now() WHERE id = #{id}
+
+
\ No newline at end of file
diff --git a/flx-ai/src/main/resources/mapper/postgres/KnowledgeBasesDao.xml b/flx-ai/src/main/resources/mapper/postgres/KnowledgeBasesDao.xml
new file mode 100644
index 0000000..bde4571
--- /dev/null
+++ b/flx-ai/src/main/resources/mapper/postgres/KnowledgeBasesDao.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE knowledge_bases SET description = #{description,jdbcType=VARCHAR},updated_at = now() WHERE id = #{id}
+
+
+
\ No newline at end of file
diff --git a/flx-ai/src/main/resources/mybatis-config.xml b/flx-ai/src/main/resources/mybatis-config.xml
new file mode 100644
index 0000000..0a56887
--- /dev/null
+++ b/flx-ai/src/main/resources/mybatis-config.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/FilesControllerTest.java b/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/FilesControllerTest.java
new file mode 100644
index 0000000..8d7ba86
--- /dev/null
+++ b/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/FilesControllerTest.java
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package test.com.pjilisense.flxai.controller;
+
+import com.alibaba.fastjson.JSON;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import test.com.pjilisense.flxai.TestUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class FilesControllerTest {
+ @BeforeEach
+ public void setUpTestDataWithinTransaction() {
+ // set up test data within the transaction
+ }
+ @AfterEach
+ public void tearDownWithinTransaction() {
+ // execute "tear down" logic within the transaction
+ }
+
+ @Test
+ public void testGetAllAiTools() {
+ String url = TestUtils.WebconnectURL+"/api/robot/files/file_2FbUmaefz5b4";
+ String charset = TestUtils.UTF8;
+ try {
+ String body = TestUtils.doGet(url, charset);
+ System.out.println(body);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+// @Test
+// public void testsave() {
+// String url = TestUtils.WebconnectURL+"/api/robot/files/";
+// String charset = TestUtils.UTF8;
+// try {
+// Map params = new HashMap();
+// params.put("userId","fd8ae359-64dc-4a57-ab41-5438e2fda975");
+// params.put("fileType","text/plain");
+// params.put("name","jykc3.sql");
+// params.put("size",1864714);
+// params.put("url","files/482454/d2b0edb3-15bf-4fe6-ba2e-97b5f1fe0288.sql");
+// params.put("fileHash","1d66edbc0b5da3289ecea1ae00ac384b2378603193574c5f0bc9a9a988de2a16");
+// params.put("chunkTaskId","ab3f259e-775a-4c57-8338-b273684f70d1");
+// params.put("embeddingTaskId","12020d55-d453-46d7-a8c8-b0bba5f5c747");
+// params.put("fileCategory","1");
+// params.put("fileStatus","1");
+//
+// Map metadata = new HashMap();
+// params.put("metadata",metadata);
+// metadata.put("date","482454");
+// metadata.put("path","files/482454/d2b0edb3-15bf-4fe6-ba2e-97b5f1fe0288.sql");
+// metadata.put("filename","d2b0edb3-15bf-4fe6-ba2e-97b5f1fe0288.sql");
+// metadata.put("dirname","files/482454");
+//
+// String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
+// System.out.println(body);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+ @Test
+ public void testmodifyFileName() {
+ String url = TestUtils.WebconnectURL+"/api/robot/files/modifyFileName";
+ String charset = TestUtils.UTF8;
+ try {
+ Map params = new HashMap();
+ params.put("id","file_2FbUmaefz5b4");
+ params.put("name","jykc2.sql");
+ String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
+ System.out.println(body);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testmodifyFileStatus() {
+ String url = TestUtils.WebconnectURL+"/api/robot/files/modifyFileStatus";
+ String charset = TestUtils.UTF8;
+ try {
+ Map params = new HashMap();
+ params.put("id","file_2FbUmaefz5b4");
+ params.put("fileStatus","1");
+ String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
+ System.out.println(body);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ @Test
+ public void testmodifyFileCategory() {
+ String url = TestUtils.WebconnectURL+"/api/robot/files/modifyFileCategory";
+ String charset = TestUtils.UTF8;
+ try {
+ Map params = new HashMap();
+ params.put("id","file_2FbUmaefz5b4");
+ params.put("fileCategory","1");
+ String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
+ System.out.println(body);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/KnowledgeBasesControllerTest.java b/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/KnowledgeBasesControllerTest.java
new file mode 100644
index 0000000..d552f20
--- /dev/null
+++ b/flx-ai/src/test/java/test/com/pjilisense/flxai/controller/KnowledgeBasesControllerTest.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package test.com.pjilisense.flxai.controller;
+
+import com.alibaba.fastjson.JSON;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import test.com.pjilisense.flxai.TestUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class KnowledgeBasesControllerTest {
+ @BeforeEach
+ public void setUpTestDataWithinTransaction() {
+ // set up test data within the transaction
+ }
+ @AfterEach
+ public void tearDownWithinTransaction() {
+ // execute "tear down" logic within the transaction
+ }
+
+ @Test
+ public void testGet() {
+ String url = TestUtils.WebconnectURL+"/api/robot/knowledgebases/kb_E5EcemGyKnh9";
+ String charset = TestUtils.UTF8;
+ try {
+ String body = TestUtils.doGet(url, charset);
+ System.out.println(body);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+// @Test
+// public void testsave() {
+// String url = TestUtils.WebconnectURL+"/api/robot/knowledgebases/";
+// String charset = TestUtils.UTF8;
+// try {
+// Map params = new HashMap();
+//// params.put("id","kb_E5EcemGyKnh9");
+// params.put("name","知识库4");
+// params.put("description","知识库4测试");
+// params.put("userId","fd8ae359-64dc-4a57-ab41-5438e2fda975");
+// params.put("isPublic",true);
+//// params.put("createdAt","2025-01-14 14:27:55");
+//// params.put("updatedAt","2025-01-14 14:27:55");
+//// params.put("accessedAt","2025-01-14 14:27:55");
+//// "id":"kb_E5EcemGyKnh9",
+//// "name":"知识库1",
+//// "description":"知识库测试2",
+//// "avatar":null,
+//// "type":null,
+//// "userId":"fd8ae359-64dc-4a57-ab41-5438e2fda975",
+//// "isPublic":false,
+//// "settings":null,
+//// "createdAt":"2025-01-14 14:27:55",
+//// "updatedAt":"2025-01-14 14:27:55",
+//// "accessedAt":"2025-01-14 14:27:55"
+//
+// String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
+// System.out.println(body);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+ @Test
+ public void testmodifyDescriptuon() {
+ String url = TestUtils.WebconnectURL+"/api/robot/knowledgebases/modifyDescriptuon";
+ String charset = TestUtils.UTF8;
+ try {
+ Map params = new HashMap();
+ params.put("id","kb_E5EcemGyKnh9");
+ params.put("description","知识库测试23");
+ String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
+ System.out.println(body);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file