4 Star 2 Fork 0

Verhan Cao/Food Buddy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

English | 简体中文

饮食陪伴师是一个管理饮食的原生大模型小程序,优势:

  1. 精确营养监控:用户记录饮食后,我们会计算出食用的营养成分与分量,并反馈给用户。
  2. 饮食建议有效:大模型经过我们训练具备大量专业知识,它给出的饮食建议科学有效。
  3. 「伴伴」情感陪伴:小程序的核心亮点在于伴伴,我们把伙伴的元素融入了饮食管理中,给予用户情绪价值。
  4. 提供一套前后端uniapp、算法源码,开源可学习

🔗 技术架构

技术选型

技术及版本 作用 原因
Vue 3.x 主要开发框架 团队成员更熟悉
图鸟UI 移动端组件库 适配移动端项目、主流
Spring Boot 2.7.x 主要开发框架 团队成员更熟悉、主流
Lombok 注解式代码生成 节省开发时间
MySQL 数据库 社区良好、稳定易用
语雀大模型API 使能够基于prompt生成回复 对人物扮演这块语雀做的很好
51.LA 网站统计 免费、易用

🔒 权限信息

本开源项目基于「Apache LICENSE」,

特别得,在里面我们提出了两个附加要求:

  1. 禁止将该软件用作任何学术作品或出版物的一部分。
  2. 禁止将该软件作为任何比赛或竞赛的产品参赛。

🔥 运行标准版

聊天页面 饮食记录页面

demo视频演示

以下列举了核心文件的结构

|-- food-buddy/
    |-- LICENSE  # 许可证书
    |-- README.en.md
    |-- README.md
    |-- diet_manage_user/
        |-- src/
    |-- diet_return/  # 后端工程目录
        |-- src/
            |-- main.java/
                |-- com.example/
                    |-- DietReturnApplication  # 启动类
                    |-- Contrller/
                        |-- ChatAdviceController  # 饮食建议控制层
                        |-- ChatReturnController  # 聊天模块
                        |-- DietAnalyseController  # 饮食分析控制层
                        |-- DietController  # 饮食信息控制层
                        |-- RecommendController  # 菜品推荐控制层
                    |-- entity/  # 实体类
                        |-- Diet  # 饮食信息
                        |-- NutritionStr  # 基础营养
                        |-- Result  # 统一接口
                        |-- User  # 用户信息
                    |-- Mapper/
                        |-- ChatAdviceMapper  # 饮食建议查询用户目标
                        |-- DataMapper  # 查询当天饮食信息和菜品
                        |-- DietMapper  # 查询当周饮食信息和新增信息
                    |-- Service/
                        |-- ChatAdviceService  # 饮食建议逻辑层
                        |-- DietAnalyseService  # 饮食分析逻辑层
                        |-- DietService  # 饮食信息逻辑层
                        |-- RecommendService  # 菜品推荐逻辑层
            |-- main.resources/
                |-- com.example.Mapper/  # 映射文件
                    |-- ChatAdviceMapper.xml
                    |-- DataMapper.xml
                    |-- DietMapper.xml
                |-- application.properties  # 配置文件
            |-- pom.xml  # 配置文件
    |-- llm_server/  # 大模型服务工程目录
        |-- chat_response/  
            |-- memory_db  # 用户记忆库
            |-- base_memory_chat.py  # 聊天对话模块
        |-- dietary_advice/
            |-- dietary_advice.py  # 饮食建议模块
        |-- recommended_dishes/
            |-- add_in_userdb.py
            |-- recommended_dishes.py  # 菜品推荐模块
            |-- recommended_judgment.py  # 饮食干预评估模块
        |-- config_ai.py  # AI配置文件
        |-- requirements.txt  # AI的库依赖
    |-- tuniao_uniapp/  # 前端工程目录
        |-- src/
            |-- App.vue  # 项目启动文件
            |-- pages
                |-- chat/chat.vue  # 大模型聊天页面
                |-- diet/diet.vue  # 饮食管理主页面
                |-- addDiet/addDiet.vue  # 添加饮食记录
                |-- personal/personal.vue  # 个人中心页
                |-- login/login.vue  # 登录页
            |-- env.d.ts
            |-- main.ts  # 项目全局文件
            |-- manifest.json uniapp  # 小程序配置(appid等)
            |-- pages.json  # 全局路由导航配置
            |-- shime-uni.d.ts
            |-- shime-vue.d.ts
            |-- uni.scss  # 全局样式文件

!!!新手强烈建议听我录制的教程视频,里面会科普知识,希望大家都能跑起来!

视频教程

一、准备运行环境

默认前提条件:已下载Git工具

food-buddy软件云盘

推荐教程

(一)克隆仓库

git clone --depth 1 --branch master https://gitee.com/verhancao/food-buddy.git

(二)下载AI依赖

2.1 下载AI软件

  • 下载PyCharm

food-buddy软件云盘

推荐教程

  • 下载python解释器

food-buddy软件云盘

推荐教程

!python需配置环境变量

  • 下载依赖包

打开 命令提示窗口 ,下载AI依赖到python环境

pip install websockets
pip install volcengine-python-sdk

下载volcengine-python-sdk时会出现报错,解决方案

2.2修改配置文件

Pycharm打开项目。在llm_server目录下,修改config_ai.py文件

# 设置火山大模型的API密钥
client = Ark(
    base_url="XXXXXXXXXX",
    ak="XXXXXXXXXX",
    sk="XXXXXXXXXX",
    api_key="XXXXXXXXXX"
)

将以上替换成你的API密钥。API密钥申请入口/火山引擎

(三)下载前端软件

3.1 安装软件

  • 安装Node.js环境

food-buddy软件云盘

推荐教程

  • 安装HbuilderX

food-buddy软件云盘(访问码:io1r)

  • 安装 微信开发者工具

food-buddy软件云盘

3.2 安装前端依赖

用命令提示窗口,切换到项目tuniao_uniapp目录下

执行下条命令,安装前端依赖

npm install

(四)下载后端软件

4.1 安装软件

IDEA需下载企业版,方便使用SpringBoot框架。(新账户有免费30day的试用期)

  • 安装 IDEA

food-buddy软件云盘

!注意springboot后端需要IDEA企业版,新账号有免费30days使用期

  • 安装 jdk

food-buddy软件云盘

推荐教程

  • 安装 maven仓库

food-buddy软件云盘(访问码:io1r)

推荐教程

!注意,MAVEN需要配置环境变量

  • mysql数据库

food-buddy软件云盘

推荐教程

安装中,数据库的账号密码请做以下设置:

name=root

password=11111111

  • Navicat

food-buddy软件云盘

4.2 修改后端配置

diet_return目录下,main.resourcesapplication.properties文件中修改下面的语句,

将对应python路径和三个py文件的绝对路径,按以下格式写出

upload.pyload=D:\\\\python\\\\python.exe
upload.advice=D:\\\\diet\\\\food-buddy\\\\llm_server\\\\dietary_advice\\\\dietary_advice.py
upload.judge=D:\\\\diet\\\\food-buddy\\\\llm_server\\\\recommended_dishes\\\\recommended_judgment.py
upload.dishes=D:\\\\diet\\\\food-buddy\\\\llm_server\\\\recommended_dishes\\\\recommended_dishes.py
upload.add=D:\\\\diet\\\\food-buddy\\\\llm_server\\\\recommended_dishes\\\\add_in_userdb.py

二、运行项目

(一)启动AI端

用Pycharm打开food-buddy项目

1.指定在项目运行时,Python的位置

推荐教程

2.启动chat小后端

为了实现AI与前端的实时通信,使用了websocket技术,可以理解为java后端内的一个小python后端。开启后chat功能才能正常

在llm_server目录下找到base_memory_chat.py文件,运行该文件(如果有包缺失,依个下载)

AI小后端启动!

(二)启动后端

用IDEA打开food-buddy项目

1.配置本地jdk

推荐教程

2.配置本地Maven

下载教程/配置教程

!注意,这里要参照教程,配置国内镜像,大大提升下一步的下载速度

3.下载后端依赖

在pom.xml文件下,点击Maven更新图标,自动下载项目后端所有依赖

4.创建数据库

打开Navicat,连接MySQL软件

!注意,创建的数据库,需命名为diet_manage

运行food-buddy的sql文件,完成创建

推荐教程

5.启动后端

找到diet_return后端文件夹入口,在java的com.example目录下找到DietReturnAPPlication.java 运行这个文件

后端启动!

(三)启动前端

1.打开HbuilderX,点击“编译”,等待编译完成

2.打开微信开发者工具,创建小程序。

3.(仅第一次需要)在微信开发者工具,点击“设置”————>“安全设置”————>打开“服务端口”

4.在微信开发者工具,继续次点击“编译”。前端启动!

软件整个启动!

🍀 致谢

  • 感谢湖北师范大学董元和老师、熊旭辉老师的指导
  • 感谢湖北师范大学青鸟工作室对本项目的大力支持
  • 感谢上海人工智能实验室对本项目提供的算力支持

📧 联系方式

如果你对项目感兴趣,想要了解项目的全套解决方案,欢迎联系我们:verhancao@foxmail.com

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Additional Terms: 1. The Software shall not be used as part of any academic work or publication. 2. The Software shall not be used as a product entry in any competition or contest.

简介

Food Buddy,饮食陪伴官项目。这是一款专注于饮食管理的uniapp程序。 在传统饮食管理APP的基础上,融入了AI伙伴,这个全新的尝试不仅能增加饮食管理的趣味性,更重要的能增加用户解决自身问题的概率。 由湖北师范大学曹飞航、于清江、石雨轩、成达四位核心成员主导开发。 展开 收起
Java 等 2 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/verhancao/food-buddy.git
git@gitee.com:verhancao/food-buddy.git
verhancao
food-buddy
Food Buddy
master

搜索帮助