源码介绍
AI智能聊天小程序开源版本,目前支持对接阿里百炼、百度千帆文心一言、讯飞星火大模型. 基于ruoyi-vue-plus的java8版本 目前支持主要的三家厂商+本地ollama接口调用
主要技术
- 后端:springboot2.7.18、mybatisplus、mysql、redis
- web前端:vue2、markdown编辑器cherry-markdown
- 小程序:微信原生语法、vant ui组件
源码功能
- 微信小程序
- 后端
- 管理后台前端
- 开源功能
- 微信登录
- AI聊天功能
- 次数记录
- 首次赠送
- 支持后台配置对接的AI厂商,目前支持阿里通义千问,百度千帆大模型(文心一言),讯飞星火大模型
- 支持本地ollama的api,实际应用待开发
源码目录
├── ai-chat-ui-mini //微信小程序
├── ai-chat-ui-web //管理后台前端
├── doc
├── LICENSE
├── pom.xml
├── README.md
├── ruoyi-admin
├── ruoyi-ai //AI相关接口
├── ruoyi-common
├── ruoyi-demo
├── ruoyi-framework
├── ruoyi-generator
├── ruoyi-oss
├── ruoyi-sms
├── ruoyi-system
└── script
数据库导入
- sql文件路径:script/sql/ai-chat-open.sql
- 新建数据库ai-chat-open,将sql文件导入即可
后端配置
# 修改下面的数据库配置
master:
type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://localhost:3306/ai-chat-open?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root
password: 123456
#修改下面的redis配置
spring:
redis:
# 地址
host: localhost
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
# 密码(如没有密码请注释掉)
# password:
# 连接超时时间
timeout: 10s
# 是否开启ssl
ssl: false
# 修改小程序的appid和secret
wx:
miniapp:
configs:
- appid: 你自己的小程序id
secret: 你自己的小程序秘钥
token: 111 #暂不需要
aesKey: 111 #暂不需要
msgDataFormat: JSON
h5Url: http://www.baidu.com
小程序配置
/**
* 全局配置
*/
const config = {
//开发版
'develop': {
//请求的地址
baseUrl: 'http://localhost:8080/',
wsUrl: 'ws://localhost:8080/ws/ma/chat/'
},
//体验版
'trial': {
//请求的地址
baseUrl: 'https://xxxx/prod-api/',
wsUrl: 'wss://xxxx/ws/ma/chat/'
},
//正式版
'release': {
//请求的地址
baseUrl: 'https://xxxx/prod-api/',
wsUrl: 'wss://xxxx/ws/ma/chat/'
}
}[wx.getAccountInfoSync().miniProgram.envVersion];
/**
* 全局配置
*/
module.exports = {
config
}
源码截图
后台
模型配置
小程序页面
下载链接
© 免责声明
没有回复内容