[全量] 初始化项目代码、配置、文档及Agent协同harness

This commit is contained in:
2026-04-02 11:36:05 +08:00
parent 0553309cdf
commit 87e571d9ec
1133 changed files with 221948 additions and 0 deletions

View File

@@ -0,0 +1,102 @@
# 对外服务的IP端口地址(可以写作前端的服务IP地址对外暴露前后端是一个整体)
serverUrlPrefix: http://localhost:1002
serverFrontUrlPrefix: /chat_web
# Tomcat
server:
# 应用服务 WEB 访问端口
name: llm
port: 8099
servlet:
context-path: /chat_backend_test
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 请求头内容大小
max-http-header-size: 102400
spring:
# 缓存
redis:
open: true # 是否开启redis缓存 true开启 false关闭
database: 2
host: localhost
port: 6379
password: # 密码(默认为空)
timeout: 6000 # 连接超时时长(毫秒
lettuce:
pool:
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接
#指定数据源
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/chat_gpt_yj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
username: root
password: 1234567890
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
filters: stat,wall,slf4j,config
useGlobalDataSourceStat: true
stat:
log-slow-sql: true
merge-sql: true
slow-sql-millis: 10000
# 数据库1
# 系统配置参数
system:
upload-path: /Users/master/Documents/upload/
url:
base:
# 阿里云配置文件
ali:
oss:
key: LTAI5tKV3JEn6EX6eVeQjrYN
secret: CtMmajeabIVU6xjCVt6KCcWp9IcgD1
sms:
key:
secret:
security:
oauth2:
server-host: https://kxsso.cast.org.cn/
server-login: https://kxsso.cast.org.cn/
server-logout: ${serverUrlPrefix}
app-login: ${serverUrlPrefix}${serverFrontUrlPrefix}
app-logout: /logout
chat:
# 服务器langchain backend api接口地址
ip: http://localhost
port: 7961
modelName: Qwen2-72B-Instruct
host: ${chat.ip}:${chat.port}
prompt-config-url: ${chat.host}/server/configs

View File

@@ -0,0 +1,101 @@
# 对外服务的IP端口地址(可以写作前端的服务IP地址对外暴露前后端是一个整体)
serverUrlPrefix: http://localhost:3000
serverFrontUrlPrefix: /metalinfo
# Tomcat
server:
# 应用服务 WEB 访问端口
name: metal_llm
port: 8099
servlet:
context-path: /chat_web_backend
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 请求头内容大小
max-http-header-size: 102400
spring:
# 缓存
redis:
open: true # 是否开启redis缓存 true开启 false关闭
database: 0
host: 127.0.0.1
port: 6379
password: "" # 本地 Docker Redis 无密码
timeout: 6000 # 连接超时时长(毫秒
lettuce:
pool:
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接
#指定数据源
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/chat_gpt_yj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
username: root
password: 1234567890
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: true
testOnReturn: false
# 连接保活配置(防止连接超时)
keepAlive: true
phyTimeoutMillis: 600000
# 连接超时时间10分钟
connectTimeout: 60000
poolPreparedStatements: true
filters: stat,wall,slf4j,config
useGlobalDataSourceStat: true
stat:
log-slow-sql: true
merge-sql: true
slow-sql-millis: 10000
# 系统配置参数
system:
upload-path: /Users/master/Documents/upload/
url:
base:
# 阿里云配置文件
ali:
oss:
key: LTAI5tKV3JEn6EX6eVeQjrYN
secret: CtMmajeabIVU6xjCVt6KCcWp9IcgD1
sms:
key:
secret:
#chat连接配置
chat:
# 服务器langchain backend api接口地址
ip: http://localhost
port: 7861
modelName: qwen-max
host: ${chat.ip}:${chat.port}
prompt-config-url: ${chat.host}/server/configs

View File

@@ -0,0 +1,76 @@
# 对外服务的IP端口地址(可以写作前端的服务IP地址对外暴露前后端是一个整体)
serverUrlPrefix: http://localhost:3000
serverFrontUrlPrefix: /chat_web_yj
# Tomcat
server:
# 应用服务 WEB 访问端口
port: 8093
name: chat_backend_yj
servlet:
context-path: /chat_backend_yj
spring:
# 缓存
redis:
open: true # 是否开启redis缓存 true开启 false关闭
database: 0
host: 127.0.0.1
port: 6379
password: ""
timeout: 6000 # 连接超时时长(毫秒
lettuce:
pool:
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接
#指定数据源
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#master:XQ
driver-class-name: com.mysql.cj.jdbc.Driver
# 本地 MySQLDocker
url: jdbc:mysql://127.0.0.1:33306/chat_gpt_yj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
username: root
password: "1234567890"
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
filters: stat,wall,slf4j,config
useGlobalDataSourceStat: true
stat:
log-slow-sql: true
merge-sql: true
slow-sql-millis: 10000
# 系统配置参数
system:
upload-path: /opt/upload/${server.name}
#chat连接配置
chat:
# 服务器langchain backend api接口地址
ip: http://localhost
port: 7861
modelName: Qwen2-72B-Instruct
host: ${chat.ip}:${chat.port}
prompt-config-url: ${chat.host}/server/configs

View File

@@ -0,0 +1,112 @@
# MySQL 使用宿主机 33306gangyan/mysql/docker-compose.yml勿与仅暴露 3306 的 MySQL 实例混用以免连错库。
# 数据层默认指向本机 DockerMySQL/Redis 见下方;镜像 tar 见 /opt/docker-images
# 对外服务的IP端口地址(可以写作前端的服务IP地址对外暴露前后端是一个整体)
serverUrlPrefix: http://localhost:3000
serverFrontUrlPrefix: /chat_web
# Tomcat
server:
# 应用服务 WEB 访问端口
name: llm
port: 8099
servlet:
context-path: /chat_web_backend
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 请求头内容大小
max-http-header-size: 102400
spring:
# 缓存
redis:
open: true # 是否开启redis缓存 true开启 false关闭
database: 0
host: 127.0.0.1
port: 6379
password: "" # 密码
timeout: 6000 # 连接超时时长(毫秒
lettuce:
pool:
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接
#指定数据源
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#master:
driver-class-name: com.mysql.cj.jdbc.Driver
# 使用本地数据库
url: jdbc:mysql://127.0.0.1:33306/chat_gpt_yj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
username: root
password: "1234567890"
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: true
testOnReturn: false
# 连接保活配置(防止连接超时)
keepAlive: true
phyTimeoutMillis: 600000
# 连接超时时间10分钟
connectTimeout: 60000
poolPreparedStatements: true
filters: stat,wall,slf4j,config
useGlobalDataSourceStat: true
stat:
log-slow-sql: true
merge-sql: true
slow-sql-millis: 10000
# 数据库1
# 系统配置参数
system:
upload-path: /Users/master/Documents/upload/
url:
base:
# 阿里云配置文件
ali:
oss:
key: LTAI5tKV3JEn6EX6eVeQjrYN
secret: CtMmajeabIVU6xjCVt6KCcWp9IcgD1
sms:
key:
secret:
security:
oauth2:
server-host: https://kxsso.cast.org.cn/
server-login: https://kxsso.cast.org.cn/
server-logout: ${serverUrlPrefix}
app-login: ${serverUrlPrefix}${serverFrontUrlPrefix}
app-logout: /logout
chat:
# 服务器langchain backend api接口地址
ip: http://localhost
port: 7861
# 写作大纲/正文走 LangChain模型须与 10.102.24.75 网关令牌权限一致Qwen2-72B-Instruct 当前返回 403
modelName: deepseek-v3
host: ${chat.ip}:${chat.port}
prompt-config-url: ${chat.host}/server/configs

View File

@@ -0,0 +1,82 @@
# 对外服务的IP端口地址(可以写作前端的服务IP地址对外暴露前后端是一个整体)
serverUrlPrefix: http://localhost:81
serverFrontUrlPrefix: /chat_web
# Tomcat
server:
# 应用服务 WEB 访问端口
port: 8090
name: chat_backend
servlet:
context-path: /chat_backend
security:
oauth2:
server-host: http://www.metalinfo.cn
server-login: ${security.cas.server-host}/web/oauth/authorize
server-logout: ${security.cas.server-host}/logout
client-id: nstlBj454x93w6n8rll3
app-logout: /logout
spring:
# 缓存
redis:
open: true # 是否开启redis缓存 true开启 false关闭
database: 0
host: ENC(AOmgP3xJKn1NVDYy0Gsq5lf/32WTts0i)
port: 6379
password: ENC(VVw0uRyXb26nIUGJyqzDkTNAksKOianhGoI1z8O20A/ZVkgQSbsgTw==) # 密码(默认为空)
timeout: 6000 # 连接超时时长(毫秒
lettuce:
pool:
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接
#指定数据源
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ENC(qKlzZQiJB+ad+THmDEP2c1Ij6+ku6Z6q2lshPCtYZVS2AAFJ4X3YgALzkOTD3Khgv60a+zkJ/CqgR5g6w1NbiPbmXKVUVoqtPOKZKstPL8eZ0bQSJTb0THS9Vgmepu/lPNrDl+M8/WRRVlIzw0E+7HykjqrbOOcHgKCiD3ZRVUnzKqJ6p2gWTAKN9JjxTPjI1s/ojxWf8yPPJBQpQt+kfnWwi3dDBskYjnV+BbOwfRMNKI0WuKKLyw==)
username: ENC(jQTC6XCoKyF7wb5YKBKqFQ==)
password: ENC(0Ct/GIuGgo0i9LGbOOxv2PNJ7KrCAyIvTDOhRdNBmFo5SF1zvecp1w==)
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
filters: stat,wall,slf4j,config
useGlobalDataSourceStat: true
stat:
log-slow-sql: true
merge-sql: true
slow-sql-millis: 10000
# 数据库1
# 系统配置参数
system:
upload-path: /opt/upload/${server.name}
#chat连接配置
chat:
# 服务器langchain backend api接口地址
ip: http://localhost
port: 7965
modelName: Qwen2-72B-Instruct
host: ${chat.ip}:${chat.port}
prompt-config-url: ${chat.host}/server/configs

View File

@@ -0,0 +1,94 @@
# Tomcat
server:
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
accesslog:
enabled: false
buffered: true
directory: /opt/logs/${server.name}/access
file-date-format: .yyyMMdd
pattern: '%h %l %u %{yyyy-MM-dd HH:mm:ss}t "%r" %s %b "%{Referer}i" "%{User-Agent}i" %D ms'
prefix: access_log
rename-on-rotate: false
request-attributes-enabled: false
rotate: true
suffix: .log
# 请求头内容大小
max-http-header-size: 102400
# mybatis-plus
spring:
# 环境 dev|test|prod
profiles:
active: yj
# 应用名称
application:
name: ${server.name}
# bean定义允许覆盖
main:
allow-bean-definition-overriding: true
# jackson时间格式化
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
# 文件上传限制
servlet:
multipart:
max-file-size: 50MB
max-request-size: 50MB
enabled: true
# 指定静态资源的路径
resources:
static-locations: classpath:/static/,classpath:/templates/
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*Mapper.xml
#实体扫描多个package用逗号或者分号分隔
typeAliasesPackage: com.inspur.llm.chat.gpt.entity;com.inspur.llm.chat.sys.entity
# 支持统配符 * 或者 ; 分割
typeEnumsPackage: com.inspur.llm.chat.gpt.enums
global-config:
db-config:
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
id-type: 0
#字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
field-strategy: 2
#驼峰下划线转换
db-column-underline: true
#刷新mapper 调试神器
refresh-mapper: true
#数据库大写下划线转换
#capital-mode: true
#序列接口实现类配置
#key-generator: cn.jeefast.xxx
#逻辑删除配置
logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2)
logic-delete-value: 1
logic-not-delete-value: 0
#自定义填充策略接口实现
#meta-object-handler: cn.jeefast.xxx
#自定义SQL注入器
#sql-injector: cn.jeefast.xxx
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /notice
# 匹配链接
urlPatterns: /monitor/*,/tool/*
# 词向量模型名称
embedding-model-name: bge_m3

View File

@@ -0,0 +1,12 @@
${AnsiColor.BRIGHT_YELLOW}
Spring Boot Version: ${spring-boot.version}
___ _ _ __ __ _ ___ _ _
/ __| | |_ __ _ | |_ o O O\ \ / / ___ | |__ o O O | _ ) __ _ __ | |__ ___ _ _ __| |
| (__ | ' \ / _` | | _| o \ \/\/ / / -_) | '_ \ o | _ \ / _` | / _| | / / / -_) | ' \ / _` |
\___| |_||_| \__,_| _\__| TS__[O] \_/\_/ \___| |_.__/ TS__[O] |___/ \__,_| \__|_ |_\_\ \___| |_||_| \__,_|
_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
Chat Web Backend 服务端项目正在启动···
${AnsiColor.BRIGHT_YELLOW}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="http://dozermapper.github.io/schema/bean-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping http://dozermapper.github.io/schema/bean-mapping.xsd">
<configuration>
<!-- 默认是 true当发生转换错误时抛出异常停止转换这里设置成false如果转换错误继续转换 -->
<stop-on-errors>false</stop-on-errors>
<date-format>yyyy-MM-dd HH:mm:ss</date-format>
</configuration>
</mappings>

View File

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<!--设置存储路径变量-->
<property name="LOG_HOME" value="/opt/apps/logs/chat-server-backend-cast"/>
<!--控制台输出appender-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--设置输出格式-->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<!--设置编码-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- INFO 日志 文件输出,时间窗口滚动-->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 过滤ERROR级别日志 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<!--日志名,指定最新的文件名其他文件名使用FileNamePattern -->
<File>${LOG_HOME}/info.log</File>
<!--文件滚动模式-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名,可设置文件类型为gz,开启文件压缩-->
<FileNamePattern>${LOG_HOME}/info.%d{yyyy-MM-dd}.%i.log.gz</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>180</MaxHistory>
<!--按大小分割同一天的-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!--输出格式-->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<!--设置编码-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- INFO 日志 文件输出,时间窗口滚动-->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 过滤ERROR级别日志 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<!--日志名,指定最新的文件名其他文件名使用FileNamePattern -->
<File>${LOG_HOME}/warn.log</File>
<!--文件滚动模式-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名,可设置文件类型为gz,开启文件压缩-->
<FileNamePattern>${LOG_HOME}/warn.%d{yyyy-MM-dd}.%i.log.gz</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>180</MaxHistory>
<!--按大小分割同一天的-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!--输出格式-->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<!--设置编码-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- ERROR 日志 文件输出,时间窗口滚动-->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 过滤ERROR级别日志 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<!--日志名,指定最新的文件名其他文件名使用FileNamePattern -->
<File>${LOG_HOME}/error.log</File>
<!--文件滚动模式-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名,可设置文件类型为gz,开启文件压缩-->
<FileNamePattern>${LOG_HOME}/error.%d{yyyy-MM-dd}.%i.log.gz</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>180</MaxHistory>
<!--按大小分割同一天的-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!--输出格式-->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<!--设置编码-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--指定基础的日志输出级别-->
<!-- <root level="INFO">-->
<!-- &lt;!&ndash;appender将会添加到这个loger&ndash;&gt;-->
<!-- <appender-ref ref="CONSOLE"/>-->
<!-- <appender-ref ref="INFO_FILE"/>-->
<!-- <appender-ref ref="ERROR_FILE"/>-->
<!-- </root>-->
<!-- 多环境日志输出 -->
<!-- 测试环境+开发环境. 多个使用逗号隔开 -->
<springProfile name="test,dev,default,cast">
<logger name="com.inspur.llm" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</logger>
</springProfile>
<!-- 生产环境. -->
<springProfile name="prod">
<logger name="com.inspur.llm" level="INFO" additivity="false">
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</logger>
</springProfile>
</configuration>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.AssistantMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.Assistant" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="title" property="title"/>
<result column="icon" property="icon"/>
<result column="tag" property="tag"/>
<result column="type_id" property="typeId"/>
<result column="main_model" property="mainModel"/>
<result column="sort" property="sort"/>
<result column="status" property="status"/>
<result column="description" property="description"/>
<result column="system_prompt" property="systemPrompt"/>
<result column="first_message" property="firstMessage"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.title, t.icon, t.tag, t.description, t.system_prompt, t.first_message,
t.type_id, t.main_model, t.status, t.sort, t.deleted, t.prompt
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>, t1.name as typeName ,t1.chat_type as chatType
from gpt_assistant t
left join gpt_assistant_type t1 on t.type_id = t1.id
<where>
t.deleted = 0
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.title != null and q.title != ''"> and t.title = #{q.title}</if>
<if test="q.tag != null and q.tag != ''"> and t.tag = #{q.tag}</if>
<if test="q.typeId != null and q.typeId != -1"> and t.type_id = #{q.typeId}</if>
<if test="q.mainModel != null"> and t.main_model = #{q.mainModel}</if>
<if test="q.sort != null"> and t.sort = #{q.sort}</if>
<if test="q.status != null"> and t.status = #{q.status}</if>
<if test="q.chatType != null and q.chatType != ''"> and t1.chat_type = #{q.chatType}</if>
<if test="q.description != null and q.description != ''"> and t.description = #{q.description}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.sort desc, t.id desc
</sql>
<select id="pageAssistant" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantVO">
<include refid="BaseSelect"></include>
</select>
<select id="listAssistant" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantVO">
<include refid="BaseSelect"></include>
</select>
<select id="listAssistantRandom" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantVO">
select <include refid="Base_Column_List"></include>
from gpt_assistant t
<where>
t.deleted = 0
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.title != null and q.title != ''"> and t.title = #{q.title}</if>
<if test="q.typeId != null and q.typeId != -1"> and t.type_id = #{q.typeId}</if>
<if test="q.mainModel != null"> and t.main_model = #{q.mainModel}</if>
<if test="q.sort != null"> and t.sort = #{q.sort}</if>
<if test="q.status != null"> and t.status = #{q.status}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
ORDER BY RAND() LIMIT #{q.size}
</select>
<!-- 模糊搜索查询 -->
<select id="searchAssistant" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantVO">
SELECT <include refid="Base_Column_List"></include>, t1.name as typeName ,t1.chat_type as chatType
from gpt_assistant t left join gpt_assistant_type t1 on t.type_id = t1.id
where t.deleted=0 and (title like concat('%',#{q.searchWord},'%') or
description like concat('%',#{q.searchWord},'%') or
system_prompt like concat('%',#{q.searchWord},'%'))
</select>
<select id="getAssistant" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantVO">
<include refid="BaseSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.AssistantTypeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.AssistantType" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="name" property="name"/>
<result column="chat_type" property="chatType"/>
<result column="icon" property="icon"/>
<result column="sort" property="sort"/>
<result column="status" property="status"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.name,t.chat_type, t.icon, t.sort, t.status, t.deleted
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>
from gpt_assistant_type t
<where>
t.deleted = 0
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.name != null and q.name != ''"> and t.name like concat('%', #{q.name}, '%')</if>
<if test="q.chatType != null and q.chatType != ''"> and t.chat_Type like concat('%', #{q.chatType}, '%')</if>
<if test="q.status != null"> and t.status = #{q.status}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.sort desc, t.id desc
</sql>
<select id="pageAssistantType" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantTypeVO">
<include refid="BaseSelect"></include>
</select>
<select id="listAssistantType" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantTypeVO">
<include refid="BaseSelect"></include>
</select>
<select id="getAssistantType" resultType="com.inspur.llm.chat.gpt.pojo.vo.AssistantTypeVO">
<include refid="BaseSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.ChatMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.Chat" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="chat_number" property="chatNumber"/>
<result column="assistant_id" property="assistantId"/>
<result column="user_id" property="userId"/>
<result column="title" property="title"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.chat_number, t.assistant_id, t.user_id, t.title, t.deleted,t.type
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>, t1.nick_name as userName
from gpt_chat t
left join gpt_user t1 on t.user_id = t1.id
<where>
t.deleted = 0 and t.type != 99
<if test="q.type !=null and q.type!='' ">and t.type = #{q.type} </if>
<if test="q.userId != null"> and t.user_id = #{q.userId}</if>
<if test="q.userName != null"> and t1.nick_name like concat('%', #{q.userName}, '%')</if>
<if test="q.title != null and q.title != ''"> and t.title = #{q.title}</if>
<if test="q.assistantId != null"> and t.assistant_id = #{q.assistantId}</if>
<if test="q.chatNumber != null and q.chatNumber != ''"> and t.chat_number = ${q.chatNumber} </if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.id desc
</sql>
<sql id="AllSelect">
select <include refid="Base_Column_List"></include>, t1.nick_name as userName
from gpt_chat t
left join gpt_user t1 on t.user_id = t1.id
<where>
t.deleted = 0
<if test="q.type !=null and q.type!='' ">and t.type = #{q.type} </if>
<if test="q.userId != null"> and t.user_id = #{q.userId}</if>
<if test="q.userName != null"> and t1.nick_name like concat('%', #{q.userName}, '%')</if>
<if test="q.title != null and q.title != ''"> and t.title = #{q.title}</if>
<if test="q.assistantId != null"> and t.assistant_id = #{q.assistantId}</if>
<if test="q.chatNumber != null and q.chatNumber != ''"> and t.chat_number = ${q.chatNumber} </if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.id desc
</sql>
<select id="pageChat" resultType="com.inspur.llm.chat.gpt.pojo.vo.ChatVO">
<include refid="BaseSelect"></include>
</select>
<select id="listChat" resultType="com.inspur.llm.chat.gpt.pojo.vo.ChatVO">
<include refid="BaseSelect"></include>
</select>
<select id="getChat" resultType="com.inspur.llm.chat.gpt.pojo.vo.ChatVO">
<include refid="BaseSelect"></include>
</select>
<select id="getAllChat" resultType="com.inspur.llm.chat.gpt.pojo.vo.ChatVO">
<include refid="AllSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.ChatMessageMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.ChatMessage" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="chat_id" property="chatId"/>
<result column="parent_message_id" property="parentMessageId"/>
<result column="message_id" property="messageId"/>
<result column="model" property="model"/>
<result column="model_version" property="modelVersion"/>
<result column="role" property="role"/>
<result column="content" property="content"/>
<result column="content_type" property="contentType"/>
<result column="app_key" property="appKey"/>
<result column="finish_reason" property="finishReason"/>
<result column="status" property="status"/>
<result column="used_tokens" property="usedTokens"/>
<result column="response" property="response"/>
<result column="size" property="size"/>
<result column="deleted" property="deleted"/>
<result column="summary" property="summary"/>
<result column="last_content" property="lastContent"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.chat_id, parent_message_id, t.message_id, t.model, t.model_version, t.role, t.content, t.content_type, t.finish_reason,
t.status, t.app_key, t.used_tokens, t.response,t.size, t.deleted, t.summary, t.last_content, t.think
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>, t1.title as chatTitle
from gpt_chat_message t
left join gpt_chat t1 on t.chat_id = t1.id
<where>
t.deleted = 0
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.chatId != null"> and t1.id = #{q.chatId}</if>
<if test="q.type != null and q.type != ''">and t1.type = #{q.type}</if>
<if test="q.chatNumber != null"> and t1.chat_number = #{q.chatNumber}</if>
<if test="q.userId != null and q.userId != ''"> and t1.user_id = #{q.userId}</if>
<if test="q.messageId != null"> and t.message_id = #{q.messageId}</if>
<if test="q.model != null and q.model != ''"> and t.model = #{q.model}</if>
<if test="q.role != null and q.role != ''"> and t.role = #{q.role}</if>
<if test="q.appKey != null and q.appKey != ''"> and t.app_key = #{q.appKey}</if>
<if test="q.finishReason != null and q.finishReason != ''"> and t.finish_reason = #{q.finishReason}</if>
<if test="q.status != null"> and t.status = #{q.status}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
</sql>
<select id="pageChatMessage" resultType="com.inspur.llm.chat.gpt.pojo.vo.ChatMessageVO">
<include refid="BaseSelect"></include>
</select>
<select id="listChatMessage" resultType="com.inspur.llm.chat.gpt.pojo.vo.ChatMessageVO">
<include refid="BaseSelect"></include>
</select>
<select id="getChatMessage" resultType="com.inspur.llm.chat.gpt.pojo.vo.ChatMessageVO">
<include refid="BaseSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.FolderMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.Folder" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="name" property="name"/>
<result column="icon" property="icon"/>
<result column="tag" property="tag"/>
<result column="description" property="description"/>
<result column="uid" property="uid"/>
<result column="sort" property="sort"/>
<result column="status" property="status"/>
<result column="user_id" property="userId"/>
<result column="knowledge_base_id" property="knowledgeBaseId"/>
<result column="type" property="type"/>
<result column="deleted" property="deleted"/>
<result column="patent_id" property="patentId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.name, t.icon, t.tag, t.description, t.uid,
t.type, t.patent_id, t.knowledge_base_id, t.user_id,t.status, t.sort, t.deleted
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>
from gpt_folder t
<where>
t.deleted = 0
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.name != null and q.name != ''"> and t.name = #{q.name}</if>
<if test="q.patentId != null and q.patentId > -1"> and t.patent_id = #{q.patentId}</if>
<if test="q.userId != null"> and t.user_id = #{q.userId}</if>
<if test="q.knowledgeBaseId != null"> and t.knowledge_base_id = #{q.knowledgeBaseId}</if>
<if test="q.tag != null and q.tag != ''"> and t.tag = #{q.tag}</if>
<if test="q.typeId != null and q.typeId != -1"> and t.type_id = #{q.typeId}</if>
<if test="q.mainModel != null"> and t.main_model = #{q.mainModel}</if>
<if test="q.sort != null"> and t.sort = #{q.sort}</if>
<if test="q.status != null"> and t.status = #{q.status}</if>
<if test="q.description != null and q.description != ''"> and t.description = #{q.description}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.sort desc, t.id desc
</sql>
<select id="listFolder" resultType="com.inspur.llm.chat.gpt.pojo.vo.FolderVO">
<include refid="BaseSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.KnowledgeBaseMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.KnowledgeBase" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="name" property="name"/>
<result column="icon" property="icon"/>
<result column="tag" property="tag"/>
<result column="description" property="description"/>
<result column="uid" property="uid"/>
<result column="sort" property="sort"/>
<result column="llm_name" property="llmName"/>
<result column="status" property="status"/>
<result column="user_id" property="userId"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.name, t.icon, t.tag,
t.description, t.uid, t.user_id, t.status, t.sort, t.llm_name , t.deleted
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>
from gpt_knowledge_base t
<where>
t.deleted = 0
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.name != null and q.title != ''"> and t.name = #{q.name}</if>
<if test="q.patentId != null and q.patentId != ''"> and t.patent_id = #{q.patentId}</if>
<if test="q.userId != null"> and t.user_id = #{q.userId}</if>
<if test="q.llmName != null"> and t.llm_name = #{q.llmName}</if>
<if test="q.knowledgeBaseId != null"> and t.knowledge_base_id = #{q.knowledgeBaseId}</if>
<if test="q.tag != null and q.tag != ''"> and t.tag = #{q.tag}</if>
<if test="q.typeId != null and q.typeId != -1"> and t.type_id = #{q.typeId}</if>
<if test="q.mainModel != null"> and t.main_model = #{q.mainModel}</if>
<if test="q.sort != null"> and t.sort = #{q.sort}</if>
<if test="q.status != null"> and t.status = #{q.status}</if>
<if test="q.keyword != null and q.keyword != ''"> and t.name like CONCAT('%', #{q.keyword}, '%') </if>
<if test="q.description != null and q.description != ''"> and t.description = #{q.description}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.sort desc, t.id desc
</sql>
<select id="listKnowledgeBase" resultType="com.inspur.llm.chat.gpt.pojo.vo.KnowledgeBaseVO">
<include refid="BaseSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.UploadFileHtmlMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.UploadFileHtml">
<id column="id" property="id"/>
<result column="file_id" property="fileId"/>
<result column="content" property="content"/>
<result column="create_time" property="createTime"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="BaseColumnList">
id, file_id, content, create_time, deleted
</sql>
<select id="getByFileId" resultType="com.inspur.llm.chat.gpt.pojo.entity.UploadFileHtml">
select *
from gpt_upload_file_html t
where t.file_id = #{fileId} and deleted = 0
</select>
</mapper>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.UploadFileMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.UploadFile" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="filepath" property="filepath"/>
<result column="folder_id" property="folderId"/>
<result column="knowledge_base_id" property="knowledgeBaseId"/>
<result column="folder_id" property="folderId"/>
<result column="embedding_id" property="embeddingId"/>
<result column="hash" property="hash"/>
<result column="disk" property="disk"/>
<result column="type" property="type"/>
<result column="chat_number" property="chatNumber"/>
<result column="context" property="context"/>
<result column="summary" property="summary"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.filepath, t.hash, t.disk,
t.type, t.chat_number, t.filename, t.file_id, t.size, t.folder_id, t.knowledge_base_id,
t.embedding_id, t.context, t.summary, t.article_abstract, t.article_keywords, t.article_paragraph
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>
from gpt_upload_file t
<where>
t.deleted = 0
<if test="q.chatNumber != null and q.chatNumber != ''"> and t.chat_number = #{q.chatNumber} </if>
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.filepath != null and q.filepath != ''"> and t.filepath = #{q.filepath}</if>
<if test="q.hash != null and q.hash != ''"> and t.hash = #{q.hash}</if>
<if test="q.disk != null and q.disk != ''"> and t.disk = #{q.disk}</if>
<if test="q.filename != null and q.filename != ''"> and t.filename = #{q.filename}</if>
<if test="q.folderId != null and q.folderId > -1"> and t.folder_id = #{q.folderId}</if>
<if test="q.embeddingId != null and q.embeddingId != ''"> and t.embedding_id = #{q.embeddingId}</if>
<if test="q.knowledgeBaseId != null and q.knowledgeBaseId != ''"> and t.knowledge_base_id = #{q.knowledgeBaseId}</if>
<if test="q.type != null"> and t.type = #{q.type}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.id desc
</sql>
<select id="pageFile" resultType="com.inspur.llm.chat.gpt.pojo.vo.UploadFileVO">
<include refid="BaseSelect"></include>
</select>
<select id="listFile" resultType="com.inspur.llm.chat.gpt.pojo.vo.UploadFileVO">
<include refid="BaseSelect"></include>
</select>
<select id="getFile" resultType="com.inspur.llm.chat.gpt.pojo.vo.UploadFileVO">
<include refid="BaseSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.UploadFileNoteMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.UploadFileNote">
<id column="id" property="id"/>
<result column="file_id" property="fileId"/>
<result column="p_tag_id" property="pTagId"/>
<result column="word_content" property="wordContent"/>
<result column="start_index" property="startIndex"/>
<result column="end_index" property="endIndex"/>
<result column="note_num" property="noteNum"/>
<result column="note_content" property="noteContent"/>
<result column="deleted" property="deleted"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="user_id" property="userId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="BaseColumnList">
id, file_id, p_tag_id, word_content, start_index, end_index, note_num, note_content, deleted, create_time, end_time, user_id
</sql>
</mapper>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.UserMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.User" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="login_time" property="loginTime"/>
<result column="uid" property="uid"/>
<result column="name" property="name"/>
<result column="nick_name" property="nickName"/>
<result column="tel" property="tel"/>
<result column="password" property="password"/>
<result column="avatar" property="avatar"/>
<result column="openid" property="openid"/>
<result column="unionid" property="unionid"/>
<result column="ip" property="ip"/>
<result column="context" property="context"/>
<result column="num" property="num"/>
<result column="share_id" property="shareId"/>
<result column="type" property="type"/>
<result column="status" property="status"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.login_time, t.uid, t.name, t.nick_name, t.tel, t.password,
t.avatar, t.openid, t.unionid, t.ip, t.context, t.num, t.share_id, t.type, t.status, t.deleted
</sql>
<!-- 通用查询条件 -->
<sql id="BaseSelect">
select <include refid="Base_Column_List"></include>, t1.nick_name as shareName
from gpt_user t
left join gpt_user t1 on t.share_id = t1.id
<where>
t.deleted = 0
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
<if test="q.name != null and q.name != ''"> and t.name like concat('%', #{q.name}, '%')</if>
<if test="q.nickName != null and q.nickName != ''"> and t.nick_name like concat('%', #{q.nickName}, '%')</if>
<if test="q.tel != null and q.tel != ''"> and t.tel = #{q.tel}</if>
<if test="q.password != null and q.password != ''"> and t.password = #{q.password}</if>
<if test="q.avatar != null and q.avatar != ''"> and t.avatar = #{q.avatar}</if>
<if test="q.openid != null and q.openid != ''"> and t.openid = #{q.openid}</if>
<if test="q.unionid != null and q.unionid != ''"> and t.unionid = #{q.unionid}</if>
<if test="q.ip != null and q.ip != ''"> and t.ip = #{q.ip}</if>
<if test="q.num != null"> and t.num = #{q.num}</if>
<if test="q.shareId != null"> and t.share_id = #{q.shareId}</if>
<if test="q.type != null"> and t.type = #{q.type}</if>
<if test="q.status != null"> and t.status = #{q.status}</if>
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &gt;= #{q.startDate} </if>
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') &lt;= #{q.endDate} </if>
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
</where>
order by t.id desc
</sql>
<select id="pageUser" resultType="com.inspur.llm.chat.gpt.pojo.vo.UserVO">
<include refid="BaseSelect"></include>
</select>
<select id="listUser" resultType="com.inspur.llm.chat.gpt.pojo.vo.UserVO">
<include refid="BaseSelect"></include>
</select>
<select id="getUser" resultType="com.inspur.llm.chat.gpt.pojo.vo.UserVO">
<include refid="BaseSelect"></include>
</select>
</mapper>

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.gpt.mapper.UserPromptMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.UserPrompt" >
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="user_id" property="userId"/>
<result column="prompt_name" property="promptName"/>
<result column="status" property="status"/>
</resultMap>
<select id="getUserPrompts" parameterType="com.inspur.llm.chat.gpt.pojo.entity.UserPrompt"
resultMap="BaseResultMap">
select id,create_user,create_time,update_user,update_time,prompt_name,user_id,status
from gpt_user_prompt
<where>
<if test="id != null">
id = #{id}
</if>
<if test="createUser != null and createUser != ''">
AND create_user = #{createUser}
</if>
<if test="createTime != null and createTime != ''">
AND create_time = #{createTime}
</if>
<if test="updateUser != null and updateUser != ''">
AND update_user = #{updateUser}
</if>
<if test="updateTime != null and updateTime != ''">
AND update_time = #{updateTime}
</if>
<if test="promptName != null and promptName != ''">
AND prompt_name = #{promptName}
</if>
<if test="userId != null">
AND user_id = #{userId}
</if>
<if test="status != null">
AND status = #{status}
</if>
</where>
order by update_time desc
</select>
<insert id="addCollection">
INSERT INTO gpt_user_prompt (create_user,create_time,update_user,update_time, user_id,prompt_name, status)
VALUES (#{createUser},#{createTime},#{updateUser},#{updateTime},#{userId},#{promptName},#{status})
</insert>
<update id="updateCollection" parameterType="com.inspur.llm.chat.gpt.pojo.entity.UserPrompt">
update gpt_user_prompt
<set>
<if test="status == 1">
status = 0,
</if>
<if test="status == 0">
status = 1,
</if>
<if test="updateUser != null and updateUser != ''">
update_user= #{updateUser},
</if>
<if test="updateTime != null">
update_time = #{updateTime}
</if>
</set>
<where>
user_id = #{userId} and prompt_name=#{promptName}
</where>
</update>
</mapper>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.sys.mapper.SysLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.SysLog">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="sys_user_id" property="sysUserId"/>
<result column="fk_id" property="fkId"/>
<result column="username" property="username"/>
<result column="ip" property="ip"/>
<result column="address" property="address"/>
<result column="domain" property="domain"/>
<result column="browser" property="browser"/>
<result column="os" property="os"/>
<result column="method" property="method"/>
<result column="request_method" property="requestMethod"/>
<result column="uri" property="uri"/>
<result column="operation" property="operation"/>
<result column="title" property="title"/>
<result column="business_type" property="businessType"/>
<result column="time" property="time"/>
<result column="params" property="params"/>
<result column="result" property="result"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
create_user,
create_time,
sys_user_id, fk_id, username, ip, address, domain, browser, os, method, request_method, uri, operation, title, business_type, time, params, result, deleted
</sql>
<delete id="clearSyslog">
truncate table sys_log
</delete>
</mapper>

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.llm.chat.sys.mapper.SysUserMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.SysUser">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="login_time" property="loginTime"/>
<result column="username" property="username"/>
<result column="password" property="password"/>
<result column="uid" property="uid"/>
<result column="name" property="name"/>
<result column="nick_name" property="nickName"/>
<result column="tel" property="tel"/>
<result column="avatar" property="avatar"/>
<result column="email" property="email"/>
<result column="gender" property="gender"/>
<result column="status" property="status"/>
<result column="admind" property="admind"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, create_user, create_time, update_user, update_time, login_time, username, password, uid, name, nick_name, tel,
avatar, email, gender, status, admind, deleted
</sql>
<sql id="selectSysUser">
select t.*,
t2.`name` as deptName
from sys_user t
left join sys_user_dept t1 on t.id = t1.sys_user_id
left join sys_dept t2 on t1.dept_id = t2.id
left join sys_user_role t3 on t.id = t3.sys_user_id
<where>
t.deleted = 0
<if test="q.username != null and q.username != ''">
and t.username like concat('%',#{q.username},'%')
</if>
<if test="q.name != null and q.name != ''">
and t.name like concat('%',#{q.name},'%')
</if>
<if test="q.tel != null and q.tel != ''">
and t.tel like concat('%',#{q.tel},'%')
</if>
<if test="q.status != null and q.status != -1">
and t.status = #{q.status}
</if>
<if test="q.deptId != null and q.deptId != '' and q.deptId >0 ">
and (t1.dept_id in (select t.id from sys_dept t where find_in_set(#{q.deptId},
replace(t.tree_path,'-',',')) and t.deleted = 0))
</if>
<if test="q.authorization != null">
<choose>
<when test="q.authorization == 1">
and t3.role_id = #{q.roleId}
</when>
<otherwise>
and t.id not in (select t.sys_user_id from sys_user_role t where t.role_id = #{q.roleId} and
t.status = 1)
</otherwise>
</choose>
</if>
<if test="q.startDate != null and q.startDate != ''">
and DATE_FORMAT(t.create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{q.startDate}, '%Y-%m-%d')
</if>
<if test="q.endDate != null and q.endDate != ''">
and DATE_FORMAT(t.create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{q.endDate}, '%Y-%m-%d')
</if>
</where>
group by t.id order by t.id desc
</sql>
<update id="updateLoginTime">
update sys_user t set t.login_time = now() where t.id = #{id}
</update>
<select id="pageSysUser" resultType="com.inspur.llm.chat.gpt.pojo.vo.SysUserVO">
<include refid="selectSysUser"></include>
</select>
<select id="listSysUser" resultType="com.inspur.llm.chat.gpt.pojo.vo.SysUserVO">
<include refid="selectSysUser"></include>
</select>
</mapper>

View File

@@ -0,0 +1,80 @@
{
"imageActionName": "image",
"imageFieldName": "file",
"imageMaxSize": 10485760,
"imageAllowFiles": [
".jpg",
".png",
".jpeg"
],
"imageCompressEnable": true,
"imageCompressBorder": 5000,
"imageInsertAlign": "none",
"imageUrlPrefix": "",
"scrawlActionName": "crawl",
"scrawlFieldName": "file",
"scrawlMaxSize": 10485760,
"scrawlUrlPrefix": "",
"scrawlInsertAlign": "none",
"snapscreenActionName": "snap",
"snapscreenUrlPrefix": "",
"snapscreenInsertAlign": "none",
"catcherLocalDomain": [
"127.0.0.1",
"localhost"
],
"catcherActionName": "catch",
"catcherFieldName": "source",
"catcherUrlPrefix": "",
"catcherMaxSize": 10485760,
"catcherAllowFiles": [
".jpg",
".png",
".jpeg"
],
"videoActionName": "video",
"videoFieldName": "file",
"videoUrlPrefix": "",
"videoMaxSize": 104857600,
"videoAllowFiles": [
".mp4"
],
"fileActionName": "file",
"fileFieldName": "file",
"fileUrlPrefix": "",
"fileMaxSize": 104857600,
"fileAllowFiles": [
".zip",
".pdf",
".doc"
],
"imageManagerActionName": "listImage",
"imageManagerListSize": 20,
"imageManagerUrlPrefix": "",
"imageManagerInsertAlign": "none",
"imageManagerAllowFiles": [
".jpg",
".png",
".jpeg"
],
"fileManagerActionName": "listFile",
"fileManagerUrlPrefix": "",
"fileManagerListSize": 20,
"fileManagerAllowFiles": [
".zip",
".pdf",
".doc"
],
"formulaConfig": {
"imageUrlTemplate": "https://latex.codecogs.com/svg.image?{}"
}
}