diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7517fa8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,123 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.5 + + + com.supervision + nx-llm + 1.0.0 + nx-llm + nx-llm + + 17 + 0.8.1 + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + io.springboot.ai + spring-ai-ollama-spring-boot-starter + + + + cn.hutool + hutool-all + 5.8.26 + + + + org.apache.poi + poi-ooxml + 4.1.2 + + + + com.baomidou + mybatis-plus-spring-boot3-starter + 3.5.5 + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + mysql + mysql-connector-java + 8.0.26 + + + + com.alibaba + druid-spring-boot-3-starter + 1.2.21 + + + + + + + + io.springboot.ai + spring-ai-bom + 1.0.3 + pom + import + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + diff --git a/src/main/java/com/supervision/nxllm/NxLlmApplication.java b/src/main/java/com/supervision/nxllm/NxLlmApplication.java new file mode 100644 index 0000000..b113481 --- /dev/null +++ b/src/main/java/com/supervision/nxllm/NxLlmApplication.java @@ -0,0 +1,14 @@ +package com.supervision.nxllm; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@MapperScan(basePackages = {"com.supervision.**.mapper"}) +@SpringBootApplication(scanBasePackages = {"com.supervision.**"}) +public class NxLlmApplication { + + public static void main(String[] args) { + SpringApplication.run(NxLlmApplication.class, args); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..c0dd3f4 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,50 @@ +spring: + application: + name: nx-llm + ai: + # 文档地址 https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/api/chat/ollama-chat.html + ollama: +# base-url: http://113.128.242.110:11434 + base-url: http://192.168.10.70:11434 + chat: + enabled: true + options: + model: llama3-chinese:8b + # 控制模型在请求后加载到内存中的时间(稍微长一点的时间,避免重复加载浪费性能,加快处理速度) + keep_alive: 30m + # 例如0.3 + temperature: 0.1 + format: json + # 减少产生废话的可能性。较高的值(例如,100)将给出更多样化的答案,而较低的值(例如,10)将更加保守。 + top-k: 90 + # 与top-k一起工作。较高的值(例如,0.95)将导致更加多样化的文本,而较低的值(例如,0.5)将生成更加集中和保守的文本。 + top-p: 0.95 + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://192.168.10.137:3306/nx_llm?useUnicode=true&characterEncoding=utf-8&useSSL=true&nullCatalogMeansCurrent=true&serverTimezone=GMT%2B8 + username: root + password: '123456' + initial-size: 5 # 初始化大小 + min-idle: 10 # 最小连接数 + max-active: 20 # 最大连接数 + max-wait: 60000 # 获取连接时的最大等待时间 + min-evictable-idle-time-millis: 300000 # 一个连接在池中最小生存的时间,单位是毫秒 + time-between-eviction-runs-millis: 60000 # 多久才进行一次检测需要关闭的空闲连接,单位是毫秒 + filters: stat,wall # 配置扩展插件:stat-监控统计,log4j-日志,wall-防火墙(防止SQL注入),去掉后,监控界面的sql无法统计 + validation-query: SELECT 1 # 检测连接是否有效的 SQL语句,为空时以下三个配置均无效 + test-on-borrow: true # 申请连接时执行validationQuery检测连接是否有效,默认true,开启后会降低性能 + test-on-return: true # 归还连接时执行validationQuery检测连接是否有效,默认false,开启后会降低性能 + test-while-idle: true # 申请连接时如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效,默认false,建议开启,不影响性能 + stat-view-servlet: + enabled: false # 是否开启 StatViewServlet + filter: + stat: + enabled: true # 是否开启 FilterStat,默认true + log-slow-sql: true # 是否开启 慢SQL 记录,默认false + slow-sql-millis: 5000 # 慢 SQL 的标准,默认 3000,单位:毫秒 + merge-sql: false # 合并多个连接池的监控数据,默认false +logging: + level: + org.springframework.ai: TRACE \ No newline at end of file