# cds_dify **Repository Path**: cdsai/cds_dify ## Basic Information - **Project Name**: cds_dify - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-24 - **Last Updated**: 2024-07-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CDS-智能体开发平台系统 ## 本项目基本信息 git地址:https://repos.capitalonline.net/cds-ai/cds-dify.git 项目说明: todo ## 目录介绍 ```` ├── doc -- 此目录用于存放项目开发中的相关文档 ├── api -- 此目录为后端api工程 ├── dev -- ├── docker -- docker相关配置文件 ├── images -- ├── sdks -- sdk └── web -- 前端工程 ```` # 前端本地运行 安装基础环境 Web 前端服务启动需要用到 [Node.js v18.x (LTS)](http://nodejs.org/) 、[NPM 版本 8.x.x ](https://www.npmjs.com/)或 [Yarn](https://yarnpkg.com/)。 - 安装 NodeJS + NPM 进入 https://nodejs.org/en/download,选择对应操作系统的 v18.x 以上的安装包下载并安装,建议 stable 版本,已自带 NPM。 启动步骤 1、进入 web 目录 `cd web` 2、安装依赖包 `npm install` 3、配置环境变量。在当前目录下创建文件 `.env.local`,并复制`.env.example`中的内容。根据需求修改这些环境变量的值(已配置可跳过): ``` # For production release, change this to PRODUCTION NEXT_PUBLIC_DEPLOY_ENV=DEVELOPMENT # The deployment edition, SELF_HOSTED NEXT_PUBLIC_EDITION=SELF_HOSTED # The base URL of console application, refers to the Console base URL of WEB service if console domain is # different from api or web app domain. # example: http://cloud.dify.ai/console/api NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from # console or api domain. # example: http://udify.app/api NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api # SENTRY NEXT_PUBLIC_SENTRY_DSN= NEXT_PUBLIC_SENTRY_ORG= NEXT_PUBLIC_SENTRY_PROJECT= ``` 4、构建代码 `npm run build` 5、启动 web 服务 ``` 本地调试运行: npm run dev npm run start ``` 正常启动后,终端会输出如下信息: `ready - started server on 0.0.0.0:3000, url: http://localhost:3000 warn - You have enabled experimental feature (appDir) in next.config.js. warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk. info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback` 最后,访问 http://127.0.0.1:3000 即可使用本地部署的 # 服务端部署 - API 接口服务 - Worker 异步队列消费服务 ## 安装基础环境 服务器启动需要 Python 3.10.x。建议使用 [pyenv](https://github.com/pyenv/pyenv) 快速安装 Python 环境。 ### 启动步骤 1、进入 api 目录 `cd api` 2、复制环境变量配置文件 (已配置可跳过) `cp .env.example .env` 3、生成随机密钥,并替换 `.env` 中 `SECRET_KEY` 的值 (已配置可跳过) `openssl rand -base64 42 sed -i 's/SECRET_KEY=.*/SECRET_KEY=/' .env` 4、安装依赖包 `pip install -r *requirements*.txt` 5、启动 API 服务 `flask run --host 0.0.0.0 --port=5001 --debug` 6、 成功示例: ` * Serving Flask app 'app' * Debug mode: off 2024-07-17 16:08:26.301 INFO [MainThread] [_internal.py:97] - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:5001 * Running on http://10.131.81.117:5001 2024-07-17 16:08:26.301 INFO [MainThread] [_internal.py:97] - Press CTRL+C to quit ` 7、启动 Worker 服务(非调试异步任务,可跳过) 用于消费异步队列任务,如数据集文件导入、更新数据集文档等异步操作。 Linux / MacOS 启动: `celery -A app.celery worker -P gevent -c 1 -Q dataset,generation,mail,ops_trace --loglevel INFO` 如果使用 Windows 系统启动,请替换为该命令:(非调试异步任务,可跳过) `celery -A app.celery worker -P solo --without-gossip --without-mingle -Q dataset,generation,mail,ops_trace --loglevel INFO`