Skip to content

Commit c4cb850

Browse files
committed
Initial commit
0 parents  commit c4cb850

1,470 files changed

Lines changed: 256148 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Image Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
- "V*"
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
build-amd64:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Get datasets
20+
run: |
21+
wget https://github.com/LazyAGI/LazyCraft/releases/download/common_datasets/common_datasets.zip \
22+
-O back/src/parts/data/common_datasets/common_datasets.zip
23+
24+
- name: Set IMAGE_TAG
25+
run: |
26+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
27+
RAW_TAG="${GITHUB_REF_NAME}"
28+
IMAGE_TAG="${RAW_TAG#[vV]}"
29+
else
30+
IMAGE_TAG="dev-latest"
31+
fi
32+
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
33+
34+
- name: Docker login (DockerHub)
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
40+
- name: Docker login (Aliyun)
41+
uses: docker/login-action@v3
42+
with:
43+
registry: registry.cn-hangzhou.aliyuncs.com
44+
username: ${{ secrets.ALIYUN_USERNAME }}
45+
password: ${{ secrets.ALIYUN_PASSWORD }}
46+
47+
- name: Build amd64 (back)
48+
run: |
49+
cd back
50+
IMAGE_DOCKERHUB=lazyllm/lazycraft-back
51+
IMAGE_ALIYUN=registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-back
52+
docker buildx build . \
53+
--platform linux/amd64 \
54+
-t $IMAGE_DOCKERHUB:${IMAGE_TAG}-amd64 \
55+
-t $IMAGE_ALIYUN:${IMAGE_TAG}-amd64 \
56+
--push
57+
58+
- name: Build amd64 (front)
59+
run: |
60+
cd front
61+
IMAGE_DOCKERHUB=lazyllm/lazycraft-front
62+
IMAGE_ALIYUN=registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-front
63+
docker buildx build . \
64+
--platform linux/amd64 \
65+
-t $IMAGE_DOCKERHUB:${IMAGE_TAG}-amd64 \
66+
-t $IMAGE_ALIYUN:${IMAGE_TAG}-amd64 \
67+
--push
68+
69+
build-arm64:
70+
runs-on: ubuntu-22.04-arm
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- name: Set IMAGE_TAG
75+
run: |
76+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
77+
RAW_TAG="${GITHUB_REF_NAME}"
78+
IMAGE_TAG="${RAW_TAG#[vV]}"
79+
else
80+
IMAGE_TAG="dev-latest"
81+
fi
82+
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
83+
84+
- name: Docker login (DockerHub)
85+
uses: docker/login-action@v3
86+
with:
87+
username: ${{ secrets.DOCKERHUB_USERNAME }}
88+
password: ${{ secrets.DOCKERHUB_TOKEN }}
89+
90+
- name: Docker login (Aliyun)
91+
uses: docker/login-action@v3
92+
with:
93+
registry: registry.cn-hangzhou.aliyuncs.com
94+
username: ${{ secrets.ALIYUN_USERNAME }}
95+
password: ${{ secrets.ALIYUN_PASSWORD }}
96+
97+
- name: Build arm64 (back)
98+
run: |
99+
cd back
100+
IMAGE_DOCKERHUB=lazyllm/lazycraft-back
101+
IMAGE_ALIYUN=registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-back
102+
docker buildx build . \
103+
--platform linux/arm64 \
104+
-t $IMAGE_DOCKERHUB:${IMAGE_TAG}-arm64 \
105+
-t $IMAGE_ALIYUN:${IMAGE_TAG}-arm64 \
106+
--push
107+
108+
- name: Build arm64 (front)
109+
run: |
110+
cd front
111+
IMAGE_DOCKERHUB=lazyllm/lazycraft-front
112+
IMAGE_ALIYUN=registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-front
113+
docker buildx build . \
114+
--platform linux/arm64 \
115+
-t $IMAGE_DOCKERHUB:${IMAGE_TAG}-arm64 \
116+
-t $IMAGE_ALIYUN:${IMAGE_TAG}-arm64 \
117+
--push
118+
119+
manifest:
120+
runs-on: ubuntu-22.04
121+
needs: [build-amd64, build-arm64]
122+
steps:
123+
- name: Set IMAGE_TAG
124+
run: |
125+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
126+
RAW_TAG="${GITHUB_REF_NAME}"
127+
IMAGE_TAG="${RAW_TAG#[vV]}"
128+
else
129+
IMAGE_TAG="dev-latest"
130+
fi
131+
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
132+
133+
- name: Docker login (DockerHub)
134+
uses: docker/login-action@v3
135+
with:
136+
username: ${{ secrets.DOCKERHUB_USERNAME }}
137+
password: ${{ secrets.DOCKERHUB_TOKEN }}
138+
139+
- name: Docker login (Aliyun)
140+
uses: docker/login-action@v3
141+
with:
142+
registry: registry.cn-hangzhou.aliyuncs.com
143+
username: ${{ secrets.ALIYUN_USERNAME }}
144+
password: ${{ secrets.ALIYUN_PASSWORD }}
145+
146+
- name: Create & Push manifest
147+
run: |
148+
for svc in back front; do
149+
IMAGE_DOCKERHUB=lazyllm/lazycraft-$svc
150+
IMAGE_ALIYUN=registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-$svc
151+
152+
docker manifest create $IMAGE_DOCKERHUB:${IMAGE_TAG} \
153+
--amend $IMAGE_DOCKERHUB:${IMAGE_TAG}-amd64 \
154+
--amend $IMAGE_DOCKERHUB:${IMAGE_TAG}-arm64
155+
docker manifest push $IMAGE_DOCKERHUB:${IMAGE_TAG}
156+
157+
docker manifest create $IMAGE_ALIYUN:${IMAGE_TAG} \
158+
--amend $IMAGE_ALIYUN:${IMAGE_TAG}-amd64 \
159+
--amend $IMAGE_ALIYUN:${IMAGE_TAG}-arm64
160+
docker manifest push $IMAGE_ALIYUN:${IMAGE_TAG}
161+
done

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "back/LazyLLM"]
2+
path = back/LazyLLM
3+
url = https://github.com/LazyAGI/LazyLLM.git

README.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# LazyCraft
2+
3+
## 一、简介
4+
5+
**LazyCraft** 是一个基于 **LazyLLM** 构建的 **AI Agent 应用开发与管理平台**,旨在协助开发者以 **低门槛、低成本** 快速构建和发布大模型应用。
6+
7+
无论是非开发者还是技术团队,都可以通过平台快速搭建如 **数据洞察师、文献综述生成器、代码理解助手** 等多样化的 AI 应用,并发布到商店或通过 API 集成到业务系统中。
8+
9+
平台不仅支持 **低代码、组件化应用编排**,提供从创建 → 调试 → 发布 → 监控的全链路体验,还内置 **模型管理能力**,覆盖数据集管理、模型微调与推理服务。
10+
11+
凭借灵活可插拔的架构,**LazyCraft** 能够帮助团队快速验证想法、优化效果,加速 AI 技术的业务落地与迭代。
12+
13+
### 平台特点
14+
15+
- **全流程闭环**
16+
从应用创建、调试、发布到监控与 Bad Case 分析,完整覆盖研发链路,支持快速原型迭代直达生产部署。
17+
- **灵活可插拔架构**
18+
核心模块可替换,兼容多种向量库与 RAG 策略,支持自定义知识库编排,满足不同场景需求。
19+
20+
21+
---
22+
23+
## 二、主要功能
24+
25+
### 1. 应用搭建
26+
27+
- 提供 **可视化组件画布**,快速构建、调试和发布 AI 应用。
28+
- 内置 **应用模板**,即开即用,帮助用户快速上手。
29+
30+
### 2. 全面的模型服务
31+
32+
- 集成多家模型厂商的 **本地与在线模型服务**:大语言模型、图文理解、文生图、语音转文字、文字转语音、向量模型、OCR 等。
33+
- 支持 **推理 → 微调 → 评测** 的完整流程,轻松切换模型。
34+
35+
### 3. 资源创建
36+
37+
支持管理以下资源:
38+
39+
- **Prompt 管理**:创建、编辑提示词,内置模板 + AI 辅助编写。
40+
- **知识库**:覆盖 Reader、Rewrite、Retriever、Rerank 等核心组件,覆盖从文档摄入到检索的完整链路。
41+
- 灵活配置 RAG 策略 & 多路召回
42+
- 兼容多种文件格式:`PDF``Word``PPT``Excel``CSV``TXT``JSON``HTML``Markdown``LaTeX`
43+
- **工具与 MCP**:支持自定义工具或 API 接入,可在画布中直接调用。
44+
- **数据集**
45+
- 支持 `json``csv``txt` 导入
46+
- 内置 **版本管理与模板下载**
47+
- 提供 **数据清洗、增强与标注** 能力
48+
49+
### 4. 多租户管理
50+
51+
- 支持 **多租户 / 多工作空间**
52+
- 提供 **权限控制与 API Key 管理**
53+
- 集成 **日志与审计**,满足企业安全与合规需求
54+
55+
### 5. API 发布
56+
57+
- 提供 **标准化接口**,可无缝集成至业务系统。
58+
59+
---
60+
61+
## 三、快速开始
62+
63+
### 1. 克隆代码
64+
65+
```bash
66+
git clone https://github.com/LazyAGI/LazyCraft.git
67+
cd LazyCraft
68+
```
69+
70+
### 2. 启动服务
71+
72+
[更多环境变量配置](docker/README.md)
73+
74+
```bash
75+
# 设置环境变量为平台登录地址,例如 http://127.0.0.1:30382
76+
export WEB_CONSOLE_ENDPOINT="http://your-console-url"
77+
78+
cd docker
79+
docker compose up -d
80+
81+
# 如需使用本地模型微调推理(本地有GPU)
82+
# 修改 docker-compose.yml 取消对 cloud-service 服务的注释
83+
```
84+
85+
### 3. 访问服务
86+
87+
```bash
88+
http://127.0.0.1:30382
89+
默认账号:admin
90+
默认密码:LazyCraft@2025
91+
```
92+
93+
## 四、自定义构建镜像
94+
95+
> 注意:以下操作均在 Linux 环境下进行
96+
97+
### 1. 克隆代码
98+
```bash
99+
git clone https://github.com/LazyAGI/LazyCraft.git
100+
cd LazyCraft
101+
git submodule update --init
102+
103+
mkdir -p back/src/parts/data/common_datasets
104+
wget https://github.com/LazyAGI/LazyCraft/releases/download/common_datasets/common_datasets.zip \
105+
-O back/src/parts/data/common_datasets/common_datasets.zip
106+
```
107+
108+
### 2. 构建后端服务镜像
109+
110+
```bash
111+
cd back
112+
113+
# 使用在线模型
114+
docker build --build-arg COMMIT_SHA=$(git rev-parse HEAD) -t lazycraft-back:latest .
115+
```
116+
117+
### 3. 构建前端服务镜像
118+
119+
```bash
120+
cd front
121+
docker build --build-arg COMMIT_SHA=$(git rev-parse HEAD) -t lazycraft-front:latest .
122+
```
123+
124+
### 4. 启动服务
125+
126+
```bash
127+
# 设置环境变量为平台登录地址,例如 http://127.0.0.1:30382
128+
export WEB_CONSOLE_ENDPOINT="http://your-console-url"
129+
130+
export BACK_IMAGE="lazycraft-back:latest"
131+
export FRONT_IMAGE="lazycraft-front:latest"
132+
133+
cd docker
134+
docker compose up -d
135+
```

back/.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
.Python
6+
env
7+
pip-log.txt
8+
pip-delete-this-directory.txt
9+
.tox
10+
.coverage
11+
.coverage.*
12+
.cache
13+
nosetests.xml
14+
coverage.xml
15+
*.cover
16+
*.log
17+
.git
18+
.mypy_cache
19+
.pytest_cache
20+
.hypothesis
21+
localdeploy/volumes/*
22+
lazyllm_cache/*
23+
logs
24+
*.log*
25+
.idea
26+
src/.venv

back/.flake8

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[flake8]
2+
exclude = third_part/,.git,build,dist,*.egg-info,*.egg,*.pyc,*.pyo,*.pyd,.tox,.venv,.mypy_cache,.pytest_cache,.coverage
3+
max-line-length = 120
4+
# E701: multiple statements on one line (colon)
5+
# E702: multiple statements on one line (semicolon)
6+
# E704: multiple statements on one line (def)
7+
# E302: expected 2 blank lines, found 1
8+
# E305: expected 2 blank lines after class or function definition, found 1
9+
# E124: closing bracket does not match visual indentation
10+
# W503: line break before binary operator
11+
# F841 C901 F811,E712,W504
12+
# E741 ambiguous variable name
13+
# E402 module level import not at top of file
14+
# F821 undefined name
15+
ignore = E701, E702, E704,W291,E262,F401,W293,E501,W292,F841,E226,W391,C901,E123,W605, W503, F811, E712,W504, E741,E402, F821, E999, E722, E203
16+
max-complexity = 12

0 commit comments

Comments
 (0)