Compare commits
5 Commits
3ee6303cf5
...
8c9cb6f21d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c9cb6f21d | ||
|
|
e6e24dff27 | ||
|
|
fc2ea107d2 | ||
|
|
6f9c898d51 | ||
|
|
7fd484eeab |
@@ -1,6 +1,6 @@
|
|||||||
import {cd, path} from 'zx'
|
import {cd, path} from 'zx'
|
||||||
import {trim} from "licia";
|
import {trim} from "licia";
|
||||||
import {run_deploy_batch, run_deploy_root, run_package, run_upload, run_upload_normal} from "./library.js";
|
import {run_deploy_batch, run_deploy_root, run_package, run_upload_normal} from "./library.js";
|
||||||
|
|
||||||
// 切换目录
|
// 切换目录
|
||||||
cd(trim(path.dirname(import.meta.dirname)))
|
cd(trim(path.dirname(import.meta.dirname)))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {cd, path} from 'zx'
|
import {cd, path} from 'zx'
|
||||||
import {trim} from "licia";
|
import {trim} from "licia";
|
||||||
import {run_deploy_batch, run_deploy_root, run_package, run_upload, run_upload_normal} from "./library.js";
|
import {run_deploy_batch, run_deploy_root, run_package, run_upload_normal} from "./library.js";
|
||||||
|
|
||||||
// 切换目录
|
// 切换目录
|
||||||
cd(trim(path.dirname(import.meta.dirname)))
|
cd(trim(path.dirname(import.meta.dirname)))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {cd, path} from 'zx'
|
import {cd, path} from 'zx'
|
||||||
import {trim} from "licia";
|
import {trim} from "licia";
|
||||||
import {run_deploy_batch, run_deploy_root, run_package, run_upload, run_upload_normal} from "./library.js";
|
import {run_deploy_batch, run_deploy_root, run_package, run_upload_normal} from "./library.js";
|
||||||
|
|
||||||
// 切换目录
|
// 切换目录
|
||||||
cd(trim(path.dirname(import.meta.dirname)))
|
cd(trim(path.dirname(import.meta.dirname)))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {cd, path} from 'zx'
|
import {cd, path} from 'zx'
|
||||||
import {trim} from "licia";
|
import {trim} from "licia";
|
||||||
import {run_deploy_batch, run_deploy_root, run_package, run_upload, run_upload_normal} from "./library.js";
|
import {run_deploy_batch, run_deploy_root, run_package, run_upload_normal} from "./library.js";
|
||||||
|
|
||||||
// 切换目录
|
// 切换目录
|
||||||
cd(trim(path.dirname(import.meta.dirname)))
|
cd(trim(path.dirname(import.meta.dirname)))
|
||||||
|
|||||||
14
service-ai/bin/build-ai-knowledge.js
Normal file
14
service-ai/bin/build-ai-knowledge.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import {cd, path} from 'zx'
|
||||||
|
import {trim} from "licia";
|
||||||
|
import {run_deploy, run_package, run_upload_normal} from '../../bin/library.js'
|
||||||
|
|
||||||
|
// 切换目录
|
||||||
|
cd(trim(path.dirname(import.meta.dirname)))
|
||||||
|
// 执行流程
|
||||||
|
try {
|
||||||
|
await run_deploy('service-ai-core')
|
||||||
|
await run_package('service-ai-knowledge')
|
||||||
|
await run_upload_normal('service-ai-knowledge')
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
11
service-ai/database/service_ai_file.sql
Normal file
11
service-ai/database/service_ai_file.sql
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
CREATE TABLE `service_ai_file`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL,
|
||||||
|
`filename` varchar(500) DEFAULT NULL,
|
||||||
|
`size` bigint DEFAULT NULL,
|
||||||
|
`md5` varchar(100) DEFAULT NULL,
|
||||||
|
`path` varchar(500) DEFAULT NULL,
|
||||||
|
`type` varchar(50) DEFAULT NULL,
|
||||||
|
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) DEFAULT CHARSET = utf8mb4;
|
||||||
9
service-ai/database/service_ai_group.sql
Normal file
9
service-ai/database/service_ai_group.sql
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
CREATE TABLE `service_ai_group`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL,
|
||||||
|
`knowledge_id` bigint NOT NULL,
|
||||||
|
`name` varchar(100) NOT NULL,
|
||||||
|
`status` varchar(10) NOT NULL DEFAULT 'RUNNING',
|
||||||
|
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
) DEFAULT CHARSET = utf8mb4;
|
||||||
10
service-ai/database/service_ai_knowledge.sql
Normal file
10
service-ai/database/service_ai_knowledge.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
CREATE TABLE `service_ai_knowledge`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL,
|
||||||
|
`vector_source_id` varchar(100) NOT NULL,
|
||||||
|
`name` varchar(100) NOT NULL,
|
||||||
|
`strategy` varchar(10) NOT NULL,
|
||||||
|
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) DEFAULT CHARSET = utf8mb4;
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.lanyuanxiaoyao.service.ai.core.configuration;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web 配置
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2023-04-21
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebConfiguration implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
// 避免跨域影响调试
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedOriginPatterns("*")
|
||||||
|
.allowCredentials(true)
|
||||||
|
.allowedMethods("*")
|
||||||
|
.maxAge(3600);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,7 +90,6 @@ public class DataFileController {
|
|||||||
|
|
||||||
@PostMapping("/start")
|
@PostMapping("/start")
|
||||||
public AmisResponse<StartResponse> start(@RequestBody StartRequest request) {
|
public AmisResponse<StartResponse> start(@RequestBody StartRequest request) {
|
||||||
log.info("Request: {}", request);
|
|
||||||
Long id = dataFileService.initialDataFile(request.filename);
|
Long id = dataFileService.initialDataFile(request.filename);
|
||||||
return AmisResponse.responseSuccess(new StartResponse(id.toString()));
|
return AmisResponse.responseSuccess(new StartResponse(id.toString()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.lanyuanxiaoyao.service.ai.knowledge.service;
|
|||||||
import club.kingon.sql.builder.SqlBuilder;
|
import club.kingon.sql.builder.SqlBuilder;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO;
|
||||||
|
import com.lanyuanxiaoyao.service.common.Constants;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
@@ -16,7 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
public class DataFileService {
|
public class DataFileService {
|
||||||
private static final Logger log = LoggerFactory.getLogger(DataFileService.class);
|
private static final Logger log = LoggerFactory.getLogger(DataFileService.class);
|
||||||
private static final String DATA_FILE_TABLE_NAME = "service_ai_file";
|
private static final String DATA_FILE_TABLE_NAME = Constants.DATABASE_NAME + ".service_ai_file";
|
||||||
|
|
||||||
private final JdbcTemplate template;
|
private final JdbcTemplate template;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.lanyuanxiaoyao.service.ai.knowledge.service;
|
package com.lanyuanxiaoyao.service.ai.knowledge.service;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.lang.Pair;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.EmbeddingContext;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.EmbeddingContext;
|
||||||
@@ -8,6 +9,7 @@ import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge;
|
|||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO;
|
||||||
import com.yomahub.liteflow.core.FlowExecutor;
|
import com.yomahub.liteflow.core.FlowExecutor;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
@@ -79,9 +81,15 @@ public class EmbeddingService {
|
|||||||
public void submit(Long id, String mode, ImmutableList<String> ids) {
|
public void submit(Long id, String mode, ImmutableList<String> ids) {
|
||||||
executors.submit(() -> {
|
executors.submit(() -> {
|
||||||
Knowledge knowledge = knowledgeService.get(id);
|
Knowledge knowledge = knowledgeService.get(id);
|
||||||
|
List<Pair<Long, DataFileVO>> vos = Lists.mutable.empty();
|
||||||
for (String fileId : ids) {
|
for (String fileId : ids) {
|
||||||
DataFileVO vo = dataFileService.downloadFile(Long.parseLong(fileId));
|
DataFileVO vo = dataFileService.downloadFile(Long.parseLong(fileId));
|
||||||
Long groupId = groupService.add(id, vo.getFilename());
|
Long groupId = groupService.add(id, vo.getFilename());
|
||||||
|
vos.add(Pair.of(groupId, vo));
|
||||||
|
}
|
||||||
|
for (Pair<Long, DataFileVO> pair : vos) {
|
||||||
|
Long groupId = pair.getKey();
|
||||||
|
DataFileVO vo = pair.getValue();
|
||||||
EmbeddingContext context = EmbeddingContext.builder()
|
EmbeddingContext context = EmbeddingContext.builder()
|
||||||
.vectorSourceId(knowledge.getVectorSourceId())
|
.vectorSourceId(knowledge.getVectorSourceId())
|
||||||
.groupId(groupId)
|
.groupId(groupId)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import club.kingon.sql.builder.entry.Alias;
|
|||||||
import club.kingon.sql.builder.entry.Column;
|
import club.kingon.sql.builder.entry.Column;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Group;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Group;
|
||||||
|
import com.lanyuanxiaoyao.service.common.Constants;
|
||||||
import io.qdrant.client.ConditionFactory;
|
import io.qdrant.client.ConditionFactory;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.grpc.Points;
|
import io.qdrant.client.grpc.Points;
|
||||||
@@ -26,7 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class GroupService {
|
public class GroupService {
|
||||||
public static final String GROUP_TABLE_NAME = "service_ai_group";
|
public static final String GROUP_TABLE_NAME = Constants.DATABASE_NAME + ".service_ai_group";
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GroupService.class);
|
private static final Logger logger = LoggerFactory.getLogger(GroupService.class);
|
||||||
private static final RowMapper<Group> groupMapper = (rs, row) -> {
|
private static final RowMapper<Group> groupMapper = (rs, row) -> {
|
||||||
Group vo = new Group();
|
Group vo = new Group();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.KnowledgeVO;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.KnowledgeVO;
|
||||||
|
import com.lanyuanxiaoyao.service.common.Constants;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.grpc.Collections;
|
import io.qdrant.client.grpc.Collections;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
@@ -27,7 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class KnowledgeService {
|
public class KnowledgeService {
|
||||||
public static final String KNOWLEDGE_TABLE_NAME = "service_ai_knowledge";
|
public static final String KNOWLEDGE_TABLE_NAME = Constants.DATABASE_NAME + ".service_ai_knowledge";
|
||||||
private static final Logger logger = LoggerFactory.getLogger(KnowledgeService.class);
|
private static final Logger logger = LoggerFactory.getLogger(KnowledgeService.class);
|
||||||
private static final RowMapper<Knowledge> knowledgeMapper = (rs, row) -> {
|
private static final RowMapper<Knowledge> knowledgeMapper = (rs, row) -> {
|
||||||
Knowledge knowledge = new Knowledge();
|
Knowledge knowledge = new Knowledge();
|
||||||
|
|||||||
@@ -195,7 +195,6 @@ public class EmbeddingNodes {
|
|||||||
.call()
|
.call()
|
||||||
.content();
|
.content();
|
||||||
Assert.notBlank(response, "LLM response is empty");
|
Assert.notBlank(response, "LLM response is empty");
|
||||||
logger.info("{}", response);
|
|
||||||
// noinspection DataFlowIssue
|
// noinspection DataFlowIssue
|
||||||
return Arrays.stream(StrUtil.trim(response).split("---"))
|
return Arrays.stream(StrUtil.trim(response).split("---"))
|
||||||
.map(text -> text.replaceAll("(?!^.+) +$", ""))
|
.map(text -> text.replaceAll("(?!^.+) +$", ""))
|
||||||
|
|||||||
@@ -2,31 +2,7 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: service-ai-knowledge
|
name: service-ai-knowledge
|
||||||
profiles:
|
profiles:
|
||||||
include: common,metrics,forest
|
include: random-port,common,discovery,metrics,forest
|
||||||
cloud:
|
|
||||||
zookeeper:
|
|
||||||
enabled: true
|
|
||||||
connect-string: b1m2.hdp.dc:2181,b1m3.hdp.dc:2181,b1m4.hdp.dc:2181,b1m5.hdp.dc:2181,b1m6.hdp.dc:2181
|
|
||||||
discovery:
|
|
||||||
enabled: ${spring.cloud.zookeeper.enabled}
|
|
||||||
root: /hudi-services
|
|
||||||
instance-id: ${spring.application.name}-127.0.0.1-${random.uuid}-20250514
|
|
||||||
metadata:
|
|
||||||
discovery: zookeeper
|
|
||||||
ip: 127.0.0.1
|
|
||||||
hostname: localhost
|
|
||||||
hostname_full: localhost
|
|
||||||
start_time: 20250514112750
|
|
||||||
datasource:
|
|
||||||
url: jdbc:mysql://localhost:3307/ai?useSSL=false
|
|
||||||
username: test
|
|
||||||
password: test
|
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
||||||
security:
|
|
||||||
meta:
|
|
||||||
authority: ENC(GXKnbq1LS11U2HaONspvH+D/TkIx13aWTaokdkzaF7HSvq6Z0Rv1+JUWFnYopVXu)
|
|
||||||
username: ENC(moIO5mO39V1Z+RDwROK9JXY4GfM8ZjDgM6Si7wRZ1MPVjbhTpmLz3lz28rAiw7c2LeCmizfJzHkEXIwGlB280g==)
|
|
||||||
darkcode: ENC(0jzpQ7T6S+P7bZrENgYsUoLhlqGvw7DA2MN3BRqEOwq7plhtg72vuuiPQNnr3DaYz0CpyTvxInhpx11W3VZ1trD6NINh7O3LN70ZqO5pWXk=)
|
|
||||||
ai:
|
ai:
|
||||||
openai:
|
openai:
|
||||||
base-url: http://132.121.206.65:10086
|
base-url: http://132.121.206.65:10086
|
||||||
@@ -39,16 +15,10 @@ spring:
|
|||||||
model: 'Bge-m3-vllm'
|
model: 'Bge-m3-vllm'
|
||||||
vectorstore:
|
vectorstore:
|
||||||
qdrant:
|
qdrant:
|
||||||
api-key: lanyuanxiaoyao
|
host: 132.121.206.65
|
||||||
jasypt:
|
port: 29463
|
||||||
encryptor:
|
api-key: ENC(0/0UkIKeAvyV17yNqSU3v04wmm8CdWKe4BYSSJa2FuBtK12TcZRJPdwk+ZpYnpISv+KmVTUrrmFBzAYrDR3ysA==)
|
||||||
password: 'r#(R,P"Dp^A47>WSn:Wn].gs/+"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.'
|
|
||||||
server:
|
|
||||||
port: 8080
|
|
||||||
liteflow:
|
liteflow:
|
||||||
rule-source: config/flow.xml
|
rule-source: config/flow.xml
|
||||||
print-banner: false
|
print-banner: false
|
||||||
check-node-exists: false
|
check-node-exists: false
|
||||||
knowledge:
|
|
||||||
download-prefix: "http://localhost:8080"
|
|
||||||
upload-path: /Users/lanyuanxiaoyao/Project/IdeaProjects/hudi-service/service-ai/temp
|
|
||||||
@@ -29,6 +29,6 @@
|
|||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="Console"/>
|
<appender-ref ref="Console"/>
|
||||||
<!-- <appender-ref ref="RollingFile"/>-->
|
<appender-ref ref="RollingFile"/>
|
||||||
</root>
|
</root>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -168,3 +168,16 @@ deploy:
|
|||||||
source-jar: service-ai-chat-1.0.0-SNAPSHOT.jar
|
source-jar: service-ai-chat-1.0.0-SNAPSHOT.jar
|
||||||
jdk: "jdk17"
|
jdk: "jdk17"
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
service-ai-knowledge:
|
||||||
|
order: 6
|
||||||
|
groups:
|
||||||
|
- "ai"
|
||||||
|
source-jar: service-ai-knowledge-1.0.0-SNAPSHOT.jar
|
||||||
|
jdk: "jdk17"
|
||||||
|
replicas: 1
|
||||||
|
arguments:
|
||||||
|
"[knowledge.upload-path]": ${deploy.runtime.data-path}/knowledge
|
||||||
|
"[spring.datasource.url]": ${deploy.runtime.database.config.url}
|
||||||
|
"[spring.datasource.username]": ${deploy.runtime.database.config.username}
|
||||||
|
"[spring.datasource.password]": ${deploy.runtime.database.config.password}
|
||||||
|
"[spring.datasource.driver-class-name]": ${deploy.runtime.database.config.driver-class-name}
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ public class TestSecurityDecrypt {
|
|||||||
config.setStringOutputType("base64");
|
config.setStringOutputType("base64");
|
||||||
encryptor.setConfig(config);
|
encryptor.setConfig(config);
|
||||||
|
|
||||||
System.out.println(encryptor.decrypt("GXKnbq1LS11U2HaONspvH+D/TkIx13aWTaokdkzaF7HSvq6Z0Rv1+JUWFnYopVXu"));
|
System.out.println(encryptor.encrypt("jdHyKdp9qxNqCK3c"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {useNavigate, useParams} from 'react-router'
|
import {useNavigate, useParams} from 'react-router'
|
||||||
import {amisRender, crudCommonOptions, mappingField, mappingItem} from '../../../util/amis.tsx'
|
import {amisRender, commonInfo, crudCommonOptions, mappingField, mappingItem} from '../../../util/amis.tsx'
|
||||||
|
|
||||||
const statusMapping = [
|
const statusMapping = [
|
||||||
mappingItem('解析中', 'RUNNING', 'bg-warning'),
|
mappingItem('解析中', 'RUNNING', 'bg-warning'),
|
||||||
@@ -24,16 +24,7 @@ const DataDetail: React.FC = () => {
|
|||||||
{
|
{
|
||||||
type: 'service',
|
type: 'service',
|
||||||
className: 'inline',
|
className: 'inline',
|
||||||
api: {
|
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/name?id=${knowledge_id}`,
|
||||||
method: 'get',
|
|
||||||
url: 'http://127.0.0.1:8080/knowledge/name',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id: knowledge_id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
body: {
|
body: {
|
||||||
type: 'tpl',
|
type: 'tpl',
|
||||||
tpl: '${name}',
|
tpl: '${name}',
|
||||||
@@ -47,16 +38,7 @@ const DataDetail: React.FC = () => {
|
|||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: {
|
api: `${commonInfo.baseAiKnowledgeUrl}/group/list?knowledge_id=${knowledge_id}`,
|
||||||
method: 'get',
|
|
||||||
url: 'http://127.0.0.1:8080/group/list',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
knowledge_id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
@@ -128,16 +110,7 @@ const DataDetail: React.FC = () => {
|
|||||||
level: 'link',
|
level: 'link',
|
||||||
size: 'sm',
|
size: 'sm',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: {
|
api: `${commonInfo.baseAiKnowledgeUrl}/group/delete?id=\${id}`,
|
||||||
method: 'get',
|
|
||||||
url: 'http://127.0.0.1:8080/group/delete',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id: '${id}',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
confirmText: '确认删除',
|
confirmText: '确认删除',
|
||||||
confirmTitle: '删除',
|
confirmTitle: '删除',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {useParams} from 'react-router'
|
import {useParams} from 'react-router'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import {amisRender} from '../../../util/amis.tsx'
|
import {amisRender, commonInfo} from '../../../util/amis.tsx'
|
||||||
|
|
||||||
const ImportDataDiv = styled.div`
|
const ImportDataDiv = styled.div`
|
||||||
.antd-EditorControl {
|
.antd-EditorControl {
|
||||||
@@ -23,16 +23,7 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
type: 'service',
|
type: 'service',
|
||||||
className: 'inline',
|
className: 'inline',
|
||||||
api: {
|
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/name?id=${knowledge_id}`,
|
||||||
method: 'get',
|
|
||||||
url: 'http://127.0.0.1:8080/knowledge/name',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id: knowledge_id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
body: {
|
body: {
|
||||||
type: 'tpl',
|
type: 'tpl',
|
||||||
tpl: '${name}',
|
tpl: '${name}',
|
||||||
@@ -50,6 +41,7 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
|
id: 'a5219cc7-72dd-4199-9eeb-61305fe41075',
|
||||||
type: 'form',
|
type: 'form',
|
||||||
wrapWithPanel: false,
|
wrapWithPanel: false,
|
||||||
actions: [],
|
actions: [],
|
||||||
@@ -93,6 +85,7 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
visibleOn: 'type === \'text\'',
|
visibleOn: 'type === \'text\'',
|
||||||
type: 'editor',
|
type: 'editor',
|
||||||
|
required: true,
|
||||||
label: '数据内容',
|
label: '数据内容',
|
||||||
name: 'content',
|
name: 'content',
|
||||||
language: 'plaintext',
|
language: 'plaintext',
|
||||||
@@ -104,55 +97,40 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
visibleOn: 'type === \'file\'',
|
visibleOn: 'type === \'file\'',
|
||||||
type: 'input-file',
|
type: 'input-file',
|
||||||
|
required: true,
|
||||||
name: 'files',
|
name: 'files',
|
||||||
label: '数据文件',
|
label: '数据文件',
|
||||||
autoUpload: false,
|
autoUpload: false,
|
||||||
drag: true,
|
drag: true,
|
||||||
multiple: true,
|
multiple: true,
|
||||||
useChunk: true,
|
|
||||||
accept: '*',
|
accept: '*',
|
||||||
// 5MB 5242880
|
// 5MB 5242880
|
||||||
// 100MB 104857600
|
// 100MB 104857600
|
||||||
// 500MB 524288000
|
// 500MB 524288000
|
||||||
// 1GB 1073741824
|
// 1GB 1073741824
|
||||||
maxSize: '',
|
maxSize: 104857600,
|
||||||
maxLength: 0,
|
receiver: `${commonInfo.baseAiKnowledgeUrl}/upload`
|
||||||
startChunkApi: {
|
// useChunk: true,
|
||||||
method: 'post',
|
// startChunkApi: `post:${commonInfo.baseAiKnowledgeUrl}/upload/start`,
|
||||||
url: 'http://127.0.0.1:8080/upload/start',
|
// chunkApi: `post:${commonInfo.baseAiKnowledgeUrl}/upload/slice`,
|
||||||
headers: {
|
// finishChunkApi: `post:${commonInfo.baseAiKnowledgeUrl}/upload/finish`,
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
chunkApi: {
|
|
||||||
method: 'post',
|
|
||||||
url: 'http://127.0.0.1:8080/upload/slice',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
finishChunkApi: {
|
|
||||||
method: 'post',
|
|
||||||
url: 'http://127.0.0.1:8080/upload/finish',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
className: 'text-right',
|
className: 'text-right',
|
||||||
type: 'button-toolbar',
|
type: 'button-toolbar',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'reset',
|
||||||
|
label: '重置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'submit',
|
||||||
label: '预览',
|
label: '预览',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
|
level: 'secondary',
|
||||||
api: {
|
api: {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: 'http://127.0.0.1:8080/knowledge/preview_text',
|
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/preview_text`,
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
dataType: 'form',
|
dataType: 'form',
|
||||||
data: {
|
data: {
|
||||||
mode: '${mode|default:undefined}',
|
mode: '${mode|default:undefined}',
|
||||||
@@ -170,10 +148,7 @@ const DataImport: React.FC = () => {
|
|||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: {
|
api: {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: 'http://127.0.0.1:8080/knowledge/submit_text',
|
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/submit_text`,
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
dataType: 'form',
|
dataType: 'form',
|
||||||
data: {
|
data: {
|
||||||
id: knowledge_id,
|
id: knowledge_id,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {useParams} from 'react-router'
|
import {useParams} from 'react-router'
|
||||||
import {amisRender, crudCommonOptions} from '../../../util/amis.tsx'
|
import {amisRender, commonInfo, crudCommonOptions} from '../../../util/amis.tsx'
|
||||||
|
|
||||||
const DataDetail: React.FC = () => {
|
const DataDetail: React.FC = () => {
|
||||||
const {knowledge_id, group_id} = useParams()
|
const {knowledge_id, group_id} = useParams()
|
||||||
@@ -18,16 +18,7 @@ const DataDetail: React.FC = () => {
|
|||||||
{
|
{
|
||||||
type: 'service',
|
type: 'service',
|
||||||
className: 'inline',
|
className: 'inline',
|
||||||
api: {
|
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/name?id=${knowledge_id}`,
|
||||||
method: 'get',
|
|
||||||
url: 'http://127.0.0.1:8080/knowledge/name',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
id: knowledge_id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
body: {
|
body: {
|
||||||
type: 'tpl',
|
type: 'tpl',
|
||||||
tpl: '${name}',
|
tpl: '${name}',
|
||||||
@@ -41,17 +32,7 @@ const DataDetail: React.FC = () => {
|
|||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: {
|
api: `${commonInfo.baseAiKnowledgeUrl}/segment/list?knowledge_id=${knowledge_id}&group_id=${group_id}`,
|
||||||
method: 'get',
|
|
||||||
url: 'http://127.0.0.1:8080/segment/list',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
knowledge_id,
|
|
||||||
group_id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
@@ -110,12 +91,6 @@ const DataDetail: React.FC = () => {
|
|||||||
level: 'link',
|
level: 'link',
|
||||||
size: 'sm',
|
size: 'sm',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: {
|
|
||||||
method: 'get',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
confirmText: '删除后无法恢复,确认删除该记录?',
|
confirmText: '删除后无法恢复,确认删除该记录?',
|
||||||
confirmTitle: '删除',
|
confirmTitle: '删除',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {useNavigate} from 'react-router'
|
import {useNavigate} from 'react-router'
|
||||||
import {amisRender, crudCommonOptions, mappingField, mappingItem} from '../../../util/amis.tsx'
|
import {amisRender, commonInfo, crudCommonOptions, mappingField, mappingItem} from '../../../util/amis.tsx'
|
||||||
|
|
||||||
const strategyMapping = [
|
const strategyMapping = [
|
||||||
mappingItem('文本', 'Cosine'),
|
mappingItem('文本', 'Cosine'),
|
||||||
@@ -25,12 +25,7 @@ const Knowledge: React.FC = () => {
|
|||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: {
|
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/list`,
|
||||||
url: 'http://127.0.0.1:8080/knowledge/list',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
@@ -47,11 +42,8 @@ const Knowledge: React.FC = () => {
|
|||||||
body: {
|
body: {
|
||||||
type: 'form',
|
type: 'form',
|
||||||
api: {
|
api: {
|
||||||
url: 'http://127.0.0.1:8080/knowledge/add',
|
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/add`,
|
||||||
dataType: 'form',
|
dataType: 'form',
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
@@ -156,7 +148,7 @@ const Knowledge: React.FC = () => {
|
|||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: {
|
api: {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: 'http://127.0.0.1:8080/knowledge/delete',
|
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/delete`,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import axios from 'axios'
|
|||||||
|
|
||||||
export const commonInfo = {
|
export const commonInfo = {
|
||||||
baseUrl: 'http://132.126.207.130:35690/hudi_services/service_web',
|
baseUrl: 'http://132.126.207.130:35690/hudi_services/service_web',
|
||||||
|
baseAiChatUrl: 'http://132.126.207.130:35690/hudi_services/ai_chat',
|
||||||
|
baseAiKnowledgeUrl: 'http://132.126.207.130:35690/hudi_services/ai_knowledge',
|
||||||
// baseUrl: '/hudi_services/service_web',
|
// baseUrl: '/hudi_services/service_web',
|
||||||
clusters: {
|
clusters: {
|
||||||
// hudi同步运行集群和yarn队列名称
|
// hudi同步运行集群和yarn队列名称
|
||||||
|
|||||||
Reference in New Issue
Block a user