Browse Source

适应项目

Gaokun Wang 5 months ago
parent
commit
f5dd1a4493

+ 0 - 17
eco-ai/ai-knowledge-api/pom.xml

@@ -1,17 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.eco.vip</groupId>
-        <artifactId>eco-ai</artifactId>
-        <version>${revision}</version>
-    </parent>
-
-    <artifactId>ai-knowledge-api</artifactId>
-    <name>${project.artifactId}</name>
-    <packaging>jar</packaging>
-    <description>
-        调用知识库 API,暴露给其它模块调用
-    </description>
-
-</project>

+ 0 - 40
eco-ai/ai-knowledge-biz/pom.xml

@@ -1,40 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.eco.vip</groupId>
-        <artifactId>eco-ai</artifactId>
-        <version>${revision}</version>
-    </parent>
-
-    <artifactId>ai-knowledge-biz</artifactId>
-    <name>${project.artifactId}</name>
-    <packaging>jar</packaging>
-
-    <description>
-        知识库实现
-    </description>
-    <dependencies>
-        <dependency>
-            <groupId>org.eco.vip</groupId>
-            <artifactId>ai-knowledge-api</artifactId>
-            <version>${revision}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.eco.vip</groupId>
-            <artifactId>com-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.github.pig-mesh.ai</groupId>
-            <artifactId>deepseek-spring-boot-starter</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>io.milvus</groupId>
-            <artifactId>milvus-sdk-java</artifactId>
-        </dependency>
-
-    </dependencies>
-
-</project>

+ 0 - 81
eco-ai/ai-knowledge-biz/src/main/java/org/eco/vip/ai/knowledge/controller/KnowledgeController.java

@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2025 GaoKunW
- *
- */
-
-package org.eco.vip.ai.knowledge.controller;
-
-
-import io.github.pigmesh.ai.deepseek.core.DeepSeekClient;
-import io.github.pigmesh.ai.deepseek.core.EmbeddingClient;
-import io.github.pigmesh.ai.deepseek.core.chat.ChatCompletionRequest;
-import io.github.pigmesh.ai.deepseek.core.chat.ChatCompletionResponse;
-import io.milvus.v2.client.ConnectConfig;
-import io.milvus.v2.client.MilvusClientV2;
-import io.milvus.v2.service.vector.request.SearchReq;
-import io.milvus.v2.service.vector.request.data.FloatVec;
-import io.milvus.v2.service.vector.response.SearchResp;
-import jakarta.annotation.Resource;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import reactor.core.publisher.Flux;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @description KnowledgeController
- *
- * @author GaoKunW
- * @date 2025/3/16 22:41
- */
-@RestController
-@RequestMapping("/ai/ollama")
-public class KnowledgeController {
-
-    @Resource
-    private EmbeddingClient embeddingClient;
-
-    @Resource
-    private DeepSeekClient deepSeekClient;
-
-    @GetMapping(value = "/chat", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
-    public Flux<ChatCompletionResponse> chat(String prompt) {
-        ConnectConfig connectConfig = ConnectConfig.builder()
-                .uri("") // 1.2 获取的 Milvus 链接端点
-                .token("")  // 1.2 获取的 Milvus 链接信息
-                .build();
-
-
-        MilvusClientV2 milvusClientV2 = new MilvusClientV2(connectConfig);
-
-        List<Float> floatList = embeddingClient.embed(prompt);
-
-        SearchReq searchReq = SearchReq.builder()
-                .collectionName("deepseek4j_test")
-                .data(Collections.singletonList(new FloatVec(floatList)))
-                .outputFields(Collections.singletonList("text"))
-                .topK(3)
-                .build();
-
-        SearchResp searchResp = milvusClientV2.search(searchReq);
-
-        List<String> resultList = new ArrayList<>();
-        List<List<SearchResp.SearchResult>> searchResults = searchResp.getSearchResults();
-        for (List<SearchResp.SearchResult> results : searchResults) {
-            System.out.println("TopK results:");
-            for (SearchResp.SearchResult result : results) {
-                resultList.add(result.getEntity().get("text").toString());
-            }
-        }
-
-
-        ChatCompletionRequest request = ChatCompletionRequest.builder()
-                .addUserMessage(String.format("你要根据用户输入的问题:%s \n \n 参考如下内容: %s  \n\n 整理处理最终结果", prompt, resultList)).build();
-
-        return deepSeekClient.chatFluxCompletion(request);
-    }
-}

+ 0 - 2
eco-ai/pom.xml

@@ -14,8 +14,6 @@
         <module>ai-text-sql-biz</module>
         <module>ai-ollama-api</module>
         <module>ai-ollama-biz</module>
-        <module>ai-knowledge-api</module>
-        <module>ai-knowledge-biz</module>
     </modules>
     <packaging>pom</packaging>
     <description>

+ 0 - 5
eco-start/pom.xml

@@ -27,11 +27,6 @@
             <artifactId>auth-biz</artifactId>
             <version>${revision}</version>
         </dependency>
-        <dependency>
-            <groupId>org.eco.vip</groupId>
-            <artifactId>ai-knowledge-biz</artifactId>
-            <version>${revision}</version>
-        </dependency>
     </dependencies>
 
     <build>

+ 1 - 1
eco-start/src/main/java/org/eco/vip/StartApplication.java

@@ -37,7 +37,7 @@ public class StartApplication {
         log.info("""
                         StartApplication
                         ----------------------------------------------------------
-                        -------------   URLshttp://localhost:{}
+                        -------------   URLs: http://localhost:{}
                                         Startup successful, welcome!    ----------
                         ----------------------------------------------------------""",
                 env.getProperty("server.port"));

+ 8 - 8
eco-start/src/main/resources/application-local.yml

@@ -13,15 +13,15 @@ mybatis-flex:
     ds1:
       type: ${spring.datasource.type}
       # MySql
-#      driver-class-name: com.mysql.cj.jdbc.Driver
-#      url: jdbc:mysql://localhost:3306/eco-boot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
-#      username: root
-#      password: root123
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      url: jdbc:mysql://localhost:3306/eco-boot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
+      username: root
+      password: root123
       #DM8数据库
-      driver-class-name: dm.jdbc.driver.DmDriver
-      url: jdbc:dm://127.0.0.1:5236?schema=eco-boot&useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
-      username: SYSDBA
-      password: SYSdba123
+#      driver-class-name: dm.jdbc.driver.DmDriver
+#      url: jdbc:dm://127.0.0.1:5236?schema=eco-boot&useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
+#      username: SYSDBA
+#      password: SYSDBA123
       # 最大连接池数量
       maximum-pool-size: 20
       # 最小空闲线程数量