refactor(ai): 移除chat,合并chat和knowledge为web

以后有需要再拆分
This commit is contained in:
2025-06-15 20:08:51 +08:00
parent 9c658afbd7
commit 44d1473c6b
46 changed files with 108 additions and 141 deletions

View File

@@ -1,14 +0,0 @@
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-chat')
await run_upload_normal('service-ai-chat')
} catch (e) {
console.error(e)
}

View File

@@ -1,14 +0,0 @@
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)
}

View File

@@ -0,0 +1,21 @@
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-web')
await run_upload_normal('service-ai-web')
} catch (e) {
console.error(e)
}

View File

@@ -11,7 +11,7 @@
<description>Hudi AI服务集合</description> <description>Hudi AI服务集合</description>
<modules> <modules>
<module>service-ai-core</module> <module>service-ai-core</module>
<module>service-ai-knowledge</module> <module>service-ai-web</module>
<module>service-ai-cli</module> <module>service-ai-cli</module>
</modules> </modules>

View File

@@ -9,7 +9,7 @@
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>service-ai-knowledge</artifactId> <artifactId>service-ai-web</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge; package com.lanyuanxiaoyao.service.ai.web;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties; import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
@@ -23,11 +23,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableEncryptableProperties @EnableEncryptableProperties
@EnableRetry @EnableRetry
@EnableScheduling @EnableScheduling
public class KnowledgeApplication implements ApplicationRunner, ApplicationContextAware { public class WebApplication implements ApplicationRunner, ApplicationContextAware {
private static ApplicationContext context; private static ApplicationContext context;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(KnowledgeApplication.class, args); SpringApplication.run(WebApplication.class, args);
} }
public static <T> T getBean(Class<T> clazz) { public static <T> T getBean(Class<T> clazz) {
@@ -40,6 +40,6 @@ public class KnowledgeApplication implements ApplicationRunner, ApplicationConte
@Override @Override
public void setApplicationContext(ApplicationContext context) throws BeansException { public void setApplicationContext(ApplicationContext context) throws BeansException {
KnowledgeApplication.context = context; WebApplication.context = context;
} }
} }

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.configuration; package com.lanyuanxiaoyao.service.ai.web.configuration;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.configuration; package com.lanyuanxiaoyao.service.ai.web.configuration;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.configuration; package com.lanyuanxiaoyao.service.ai.web.configuration;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.configuration; package com.lanyuanxiaoyao.service.ai.web.configuration;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.controller; package com.lanyuanxiaoyao.service.ai.web.controller;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
@@ -7,9 +7,9 @@ import cn.hutool.core.util.URLUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse; import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
import com.lanyuanxiaoyao.service.ai.knowledge.configuration.FileStoreConfiguration; import com.lanyuanxiaoyao.service.ai.web.configuration.FileStoreConfiguration;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO; import com.lanyuanxiaoyao.service.ai.web.entity.vo.DataFileVO;
import com.lanyuanxiaoyao.service.ai.knowledge.service.DataFileService; import com.lanyuanxiaoyao.service.ai.web.service.DataFileService;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
@@ -22,8 +22,6 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -1,13 +1,11 @@
package com.lanyuanxiaoyao.service.ai.knowledge.controller.caht; package com.lanyuanxiaoyao.service.ai.web.controller.caht;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.lanyuanxiaoyao.service.ai.knowledge.configuration.Prompts; import com.lanyuanxiaoyao.service.ai.web.configuration.Prompts;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.MessageVO; import com.lanyuanxiaoyao.service.ai.web.entity.vo.MessageVO;
import com.lanyuanxiaoyao.service.ai.knowledge.tools.ChartTool; import com.lanyuanxiaoyao.service.ai.web.tools.ChartTool;
import com.lanyuanxiaoyao.service.ai.knowledge.tools.KnowledgeTool; import com.lanyuanxiaoyao.service.ai.web.tools.TableTool;
import com.lanyuanxiaoyao.service.ai.knowledge.tools.TableTool; import com.lanyuanxiaoyao.service.ai.web.tools.YarnTool;
import com.lanyuanxiaoyao.service.ai.knowledge.tools.YarnTool;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@@ -27,7 +25,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

View File

@@ -1,11 +1,9 @@
package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge; package com.lanyuanxiaoyao.service.ai.web.controller.knowledge;
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse; import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.GroupService; import com.lanyuanxiaoyao.service.ai.web.service.knowledge.GroupService;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;

View File

@@ -1,18 +1,16 @@
package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge; package com.lanyuanxiaoyao.service.ai.web.controller.knowledge;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisMapResponse; import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisMapResponse;
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse; import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.SegmentVO; import com.lanyuanxiaoyao.service.ai.web.entity.vo.SegmentVO;
import com.lanyuanxiaoyao.service.ai.knowledge.service.EmbeddingService; import com.lanyuanxiaoyao.service.ai.web.service.EmbeddingService;
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.KnowledgeBaseService; import com.lanyuanxiaoyao.service.ai.web.service.knowledge.KnowledgeBaseService;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;

View File

@@ -1,11 +1,9 @@
package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge; package com.lanyuanxiaoyao.service.ai.web.controller.knowledge;
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse; import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.SegmentService; import com.lanyuanxiaoyao.service.ai.web.service.knowledge.SegmentService;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.entity; package com.lanyuanxiaoyao.service.ai.web.entity;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.entity; package com.lanyuanxiaoyao.service.ai.web.entity;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.entity; package com.lanyuanxiaoyao.service.ai.web.entity;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.entity.vo; package com.lanyuanxiaoyao.service.ai.web.entity.vo;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.entity.vo; package com.lanyuanxiaoyao.service.ai.web.entity.vo;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.entity.vo; package com.lanyuanxiaoyao.service.ai.web.entity.vo;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge.entity.vo; package com.lanyuanxiaoyao.service.ai.web.entity.vo;
import lombok.Data; import lombok.Data;

View File

@@ -1,11 +1,9 @@
package com.lanyuanxiaoyao.service.ai.knowledge.service; package com.lanyuanxiaoyao.service.ai.web.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.web.entity.vo.DataFileVO;
import com.lanyuanxiaoyao.service.common.Constants; import com.lanyuanxiaoyao.service.common.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

@@ -1,14 +1,14 @@
package com.lanyuanxiaoyao.service.ai.knowledge.service; package com.lanyuanxiaoyao.service.ai.web.service;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Pair; 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.web.entity.EmbeddingContext;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge; import com.lanyuanxiaoyao.service.ai.web.entity.Knowledge;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO; import com.lanyuanxiaoyao.service.ai.web.entity.vo.DataFileVO;
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.GroupService; import com.lanyuanxiaoyao.service.ai.web.service.knowledge.GroupService;
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.KnowledgeBaseService; import com.lanyuanxiaoyao.service.ai.web.service.knowledge.KnowledgeBaseService;
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.HashMap; import java.util.HashMap;
@@ -17,8 +17,6 @@ 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;
import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.document.Document; import org.springframework.ai.document.Document;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -1,10 +1,10 @@
package com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge; package com.lanyuanxiaoyao.service.ai.web.service.knowledge;
import club.kingon.sql.builder.SqlBuilder; import club.kingon.sql.builder.SqlBuilder;
import club.kingon.sql.builder.entry.Alias; 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.web.entity.Group;
import com.lanyuanxiaoyao.service.common.Constants; 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;
@@ -13,8 +13,6 @@ import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.vectorstore.VectorStore; import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.RowMapper;

View File

@@ -1,11 +1,11 @@
package com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge; package com.lanyuanxiaoyao.service.ai.web.service.knowledge;
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 cn.hutool.core.util.ObjectUtil; 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.web.entity.Knowledge;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.KnowledgeVO; import com.lanyuanxiaoyao.service.ai.web.entity.vo.KnowledgeVO;
import com.lanyuanxiaoyao.service.common.Constants; 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;
@@ -15,8 +15,6 @@ import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.document.Document; import org.springframework.ai.document.Document;
import org.springframework.ai.embedding.EmbeddingModel; import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.vectorstore.SearchRequest; import org.springframework.ai.vectorstore.SearchRequest;

View File

@@ -1,7 +1,7 @@
package com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge; package com.lanyuanxiaoyao.service.ai.web.service.knowledge;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge; import com.lanyuanxiaoyao.service.ai.web.entity.Knowledge;
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.SegmentVO; import com.lanyuanxiaoyao.service.ai.web.entity.vo.SegmentVO;
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;
@@ -10,8 +10,6 @@ import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.vectorstore.VectorStore; import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -1,10 +1,10 @@
package com.lanyuanxiaoyao.service.ai.knowledge.service.node; package com.lanyuanxiaoyao.service.ai.web.service.node;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil; 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.EmbeddingContext; import com.lanyuanxiaoyao.service.ai.web.entity.EmbeddingContext;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod; import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.NodeComponent;

View File

@@ -1,6 +1,6 @@
package com.lanyuanxiaoyao.service.ai.knowledge.tools; package com.lanyuanxiaoyao.service.ai.web.tools;
import com.lanyuanxiaoyao.service.ai.knowledge.KnowledgeApplication; import com.lanyuanxiaoyao.service.ai.web.WebApplication;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient; import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.tool.annotation.Tool; import org.springframework.ai.tool.annotation.Tool;
@@ -44,7 +44,7 @@ public class ChartTool {
""") String request """) String request
) { ) {
log.info("Enter method: mermaid[request]. request:{}", request); log.info("Enter method: mermaid[request]. request:{}", request);
ChatClient.Builder builder = KnowledgeApplication.getBean(ChatClient.Builder.class); ChatClient.Builder builder = WebApplication.getBean(ChatClient.Builder.class);
ChatClient client = builder.build(); ChatClient client = builder.build();
return client.prompt() return client.prompt()
// language=TEXT // language=TEXT

View File

@@ -1,8 +1,8 @@
package com.lanyuanxiaoyao.service.ai.knowledge.tools; package com.lanyuanxiaoyao.service.ai.web.tools;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.lanyuanxiaoyao.service.ai.knowledge.KnowledgeApplication; import com.lanyuanxiaoyao.service.ai.web.WebApplication;
import com.lanyuanxiaoyao.service.forest.service.KnowledgeService; import com.lanyuanxiaoyao.service.forest.service.KnowledgeService;
import org.springframework.ai.tool.annotation.Tool; import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam; import org.springframework.ai.tool.annotation.ToolParam;
@@ -27,7 +27,7 @@ public class KnowledgeTool {
""") """)
String query String query
) { ) {
KnowledgeService knowledgeService = KnowledgeApplication.getBean(KnowledgeService.class); KnowledgeService knowledgeService = WebApplication.getBean(KnowledgeService.class);
var documents = knowledgeService.query(knowledgeId, query, 10, 0.5); var documents = knowledgeService.query(knowledgeId, query, 10, 0.5);
if (ObjectUtil.isNotEmpty(documents)) { if (ObjectUtil.isNotEmpty(documents)) {
return StrUtil.format(""" return StrUtil.format("""

View File

@@ -1,14 +1,12 @@
package com.lanyuanxiaoyao.service.ai.knowledge.tools; package com.lanyuanxiaoyao.service.ai.web.tools;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.lanyuanxiaoyao.service.ai.knowledge.KnowledgeApplication; import com.lanyuanxiaoyao.service.ai.web.WebApplication;
import com.lanyuanxiaoyao.service.forest.service.InfoService; import com.lanyuanxiaoyao.service.forest.service.InfoService;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.tool.annotation.Tool; import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam; import org.springframework.ai.tool.annotation.ToolParam;
@@ -29,7 +27,7 @@ public class TableTool {
""") String sql """) String sql
) { ) {
log.info("Enter method: executeJdbc[sql]. sql:{}", sql); log.info("Enter method: executeJdbc[sql]. sql:{}", sql);
InfoService infoService = KnowledgeApplication.getBean(InfoService.class); InfoService infoService = WebApplication.getBean(InfoService.class);
String result = infoService.jdbc(sql) String result = infoService.jdbc(sql)
.collect(map -> map.valuesView().makeString(",")) .collect(map -> map.valuesView().makeString(","))
.makeString("\n"); .makeString("\n");
@@ -50,7 +48,7 @@ public class TableTool {
""") String type """) String type
) { ) {
log.info("Enter method: tableCount[type]. type:{}", type); log.info("Enter method: tableCount[type]. type:{}", type);
var infoService = KnowledgeApplication.getBean(InfoService.class); var infoService = WebApplication.getBean(InfoService.class);
return switch (type) { return switch (type) {
case "logic" -> StrUtil.format(""" case "logic" -> StrUtil.format("""
逻辑表共{}其中重点表{} 逻辑表共{}其中重点表{}
@@ -85,7 +83,7 @@ public class TableTool {
String type String type
) { ) {
log.info("Enter method: version[date, type]. date:{},type:{}", date, type); log.info("Enter method: version[date, type]. date:{},type:{}", date, type);
InfoService infoService = KnowledgeApplication.getBean(InfoService.class); InfoService infoService = WebApplication.getBean(InfoService.class);
String version = date; String version = date;
if (StrUtil.isBlank(version)) { if (StrUtil.isBlank(version)) {
version = LocalDateTime.now().minusDays(1).format(FORMATTER); version = LocalDateTime.now().minusDays(1).format(FORMATTER);

View File

@@ -1,15 +1,13 @@
package com.lanyuanxiaoyao.service.ai.knowledge.tools; package com.lanyuanxiaoyao.service.ai.web.tools;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.lanyuanxiaoyao.service.ai.knowledge.KnowledgeApplication; import com.lanyuanxiaoyao.service.ai.web.WebApplication;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnApplication; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnApplication;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnQueue; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnQueue;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue;
import com.lanyuanxiaoyao.service.forest.service.YarnService; import com.lanyuanxiaoyao.service.forest.service.YarnService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.tool.annotation.Tool; import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam; import org.springframework.ai.tool.annotation.ToolParam;
@@ -29,7 +27,7 @@ public class YarnTool {
""") String cluster """) String cluster
) { ) {
log.info("Enter method: yarnStatus[cluster]. cluster:{}", cluster); log.info("Enter method: yarnStatus[cluster]. cluster:{}", cluster);
YarnService yarnService = KnowledgeApplication.getBean(YarnService.class); YarnService yarnService = WebApplication.getBean(YarnService.class);
YarnRootQueue status = yarnService.cluster(cluster); YarnRootQueue status = yarnService.cluster(cluster);
return (status.getUsedCapacity() * 100.0) / status.getCapacity(); return (status.getUsedCapacity() * 100.0) / status.getCapacity();
} }
@@ -47,7 +45,7 @@ public class YarnTool {
""") String queue """) String queue
) { ) {
log.info("Enter method: yarnQueueStatus[cluster, queue]. cluster:{},queue:{}", cluster, queue); log.info("Enter method: yarnQueueStatus[cluster, queue]. cluster:{},queue:{}", cluster, queue);
YarnService yarnService = KnowledgeApplication.getBean(YarnService.class); YarnService yarnService = WebApplication.getBean(YarnService.class);
YarnQueue status = yarnService.queueDetail(cluster, queue); YarnQueue status = yarnService.queueDetail(cluster, queue);
return (status.getAbsoluteCapacity() * 100.0) / status.getAbsoluteMaxCapacity(); return (status.getAbsoluteCapacity() * 100.0) / status.getAbsoluteMaxCapacity();
} }
@@ -68,7 +66,7 @@ public class YarnTool {
""") String type """) String type
) { ) {
log.info("Enter method: yarnTaskStatus[cluster, type]. cluster:{},type:{}", cluster, type); log.info("Enter method: yarnTaskStatus[cluster, type]. cluster:{},type:{}", cluster, type);
YarnService yarnService = KnowledgeApplication.getBean(YarnService.class); YarnService yarnService = WebApplication.getBean(YarnService.class);
ImmutableList<YarnApplication> applications = yarnService.jobList(cluster).select(app -> StrUtil.isNotBlank(type) && StrUtil.contains(app.getName(), type)); ImmutableList<YarnApplication> applications = yarnService.jobList(cluster).select(app -> StrUtil.isNotBlank(type) && StrUtil.contains(app.getName(), type));
return StrUtil.format( return StrUtil.format(
""" """

View File

@@ -1,6 +1,6 @@
spring: spring:
application: application:
name: service-ai-knowledge name: service-ai-web
mvc: mvc:
async: async:
request-timeout: 3600000 request-timeout: 3600000

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge; package com.lanyuanxiaoyao.service.ai.web;
import io.qdrant.client.QdrantClient; import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient; import io.qdrant.client.QdrantGrpcClient;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge; package com.lanyuanxiaoyao.service.ai.web;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@@ -1,4 +1,4 @@
package com.lanyuanxiaoyao.service.ai.knowledge; package com.lanyuanxiaoyao.service.ai.web;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;

View File

@@ -42,7 +42,7 @@ function Conversation() {
const [agent] = useXAgent<ChatMessage>({ const [agent] = useXAgent<ChatMessage>({
request: async (info, callbacks) => { request: async (info, callbacks) => {
await fetchEventSource(`${commonInfo.baseAiChatUrl}/chat/async`, { await fetchEventSource(`${commonInfo.baseAiUrl}/chat/async`, {
method: 'POST', method: 'POST',
headers: commonInfo.authorizationHeaders, headers: commonInfo.authorizationHeaders,
body: JSON.stringify(info.messages), body: JSON.stringify(info.messages),

View File

@@ -24,7 +24,7 @@ const DataDetail: React.FC = () => {
{ {
type: 'service', type: 'service',
className: 'inline', className: 'inline',
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/name?id=${knowledge_id}`, api: `${commonInfo.baseAiUrl}/knowledge/name?id=${knowledge_id}`,
body: { body: {
type: 'tpl', type: 'tpl',
tpl: '${name}', tpl: '${name}',
@@ -38,7 +38,7 @@ const DataDetail: React.FC = () => {
body: [ body: [
{ {
type: 'crud', type: 'crud',
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/group/list?knowledge_id=${knowledge_id}`, api: `${commonInfo.baseAiUrl}/knowledge/group/list?knowledge_id=${knowledge_id}`,
...crudCommonOptions(), ...crudCommonOptions(),
headerToolbar: [ headerToolbar: [
'reload', 'reload',
@@ -146,7 +146,7 @@ const DataDetail: React.FC = () => {
level: 'link', level: 'link',
size: 'sm', size: 'sm',
actionType: 'ajax', actionType: 'ajax',
api: `get:${commonInfo.baseAiKnowledgeUrl}/knowledge/group/delete?id=\${id}`, api: `get:${commonInfo.baseAiUrl}/knowledge/group/delete?id=\${id}`,
confirmText: '确认删除', confirmText: '确认删除',
confirmTitle: '删除', confirmTitle: '删除',
}, },

View File

@@ -23,7 +23,7 @@ const DataImport: React.FC = () => {
{ {
type: 'service', type: 'service',
className: 'inline', className: 'inline',
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/name?id=${knowledge_id}`, api: `${commonInfo.baseAiUrl}/knowledge/name?id=${knowledge_id}`,
body: { body: {
type: 'tpl', type: 'tpl',
tpl: '${name}', tpl: '${name}',
@@ -109,7 +109,7 @@ const DataImport: React.FC = () => {
// 500MB 524288000 // 500MB 524288000
// 1GB 1073741824 // 1GB 1073741824
maxSize: 104857600, maxSize: 104857600,
receiver: `${commonInfo.baseAiKnowledgeUrl}/upload` receiver: `${commonInfo.baseAiUrl}/upload`
// useChunk: true, // useChunk: true,
// startChunkApi: `post:${commonInfo.baseAiKnowledgeUrl}/upload/start`, // startChunkApi: `post:${commonInfo.baseAiKnowledgeUrl}/upload/start`,
// chunkApi: `post:${commonInfo.baseAiKnowledgeUrl}/upload/slice`, // chunkApi: `post:${commonInfo.baseAiKnowledgeUrl}/upload/slice`,
@@ -130,7 +130,7 @@ const DataImport: React.FC = () => {
level: 'secondary', level: 'secondary',
api: { api: {
method: 'post', method: 'post',
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/preview_text`, url: `${commonInfo.baseAiUrl}/knowledge/preview_text`,
dataType: 'form', dataType: 'form',
data: { data: {
mode: '${mode|default:undefined}', mode: '${mode|default:undefined}',
@@ -148,7 +148,7 @@ const DataImport: React.FC = () => {
actionType: 'ajax', actionType: 'ajax',
api: { api: {
method: 'post', method: 'post',
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/submit_text`, url: `${commonInfo.baseAiUrl}/knowledge/submit_text`,
dataType: 'form', dataType: 'form',
data: { data: {
id: knowledge_id, id: knowledge_id,

View File

@@ -18,7 +18,7 @@ const DataDetail: React.FC = () => {
{ {
type: 'service', type: 'service',
className: 'inline', className: 'inline',
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/name?id=${knowledge_id}`, api: `${commonInfo.baseAiUrl}/knowledge/name?id=${knowledge_id}`,
body: { body: {
type: 'tpl', type: 'tpl',
tpl: '${name}', tpl: '${name}',
@@ -32,7 +32,7 @@ const DataDetail: React.FC = () => {
body: [ body: [
{ {
type: 'crud', type: 'crud',
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/segment/list?knowledge_id=${knowledge_id}&group_id=${group_id}`, api: `${commonInfo.baseAiUrl}/knowledge/segment/list?knowledge_id=${knowledge_id}&group_id=${group_id}`,
...crudCommonOptions(), ...crudCommonOptions(),
headerToolbar: [ headerToolbar: [
'reload', 'reload',

View File

@@ -25,7 +25,7 @@ const Knowledge: React.FC = () => {
body: [ body: [
{ {
type: 'crud', type: 'crud',
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/list`, api: `${commonInfo.baseAiUrl}/knowledge/list`,
...crudCommonOptions(), ...crudCommonOptions(),
headerToolbar: [ headerToolbar: [
'reload', 'reload',
@@ -42,7 +42,7 @@ const Knowledge: React.FC = () => {
body: { body: {
type: 'form', type: 'form',
api: { api: {
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/add`, url: `${commonInfo.baseAiUrl}/knowledge/add`,
dataType: 'form', dataType: 'form',
}, },
body: [ body: [
@@ -148,7 +148,7 @@ const Knowledge: React.FC = () => {
actionType: 'ajax', actionType: 'ajax',
api: { api: {
method: 'get', method: 'get',
url: `${commonInfo.baseAiKnowledgeUrl}/knowledge/delete`, url: `${commonInfo.baseAiUrl}/knowledge/delete`,
headers: { headers: {
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==', 'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
}, },

View File

@@ -10,9 +10,8 @@ import {isEqual} from 'licia'
export const commonInfo = { export const commonInfo = {
debug: isEqual(import.meta.env.MODE, 'development'), debug: isEqual(import.meta.env.MODE, 'development'),
baseUrl: 'http://132.126.207.130:35690/hudi_services/service_web', baseUrl: 'http://132.126.207.130:35690/hudi_services/service_web',
baseAiChatUrl: 'http://localhost:8080',
// baseAiKnowledgeUrl: 'http://132.126.207.130:35690/hudi_services/ai_knowledge', // baseAiKnowledgeUrl: 'http://132.126.207.130:35690/hudi_services/ai_knowledge',
baseAiKnowledgeUrl: 'http://localhost:8080', baseAiUrl: 'http://localhost:8080',
// baseUrl: '/hudi_services/service_web', // baseUrl: '/hudi_services/service_web',
authorizationHeaders: { authorizationHeaders: {
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==', 'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',