From 2bcdca571a3daee7a387ce850fb85bd533d05c8f Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 12:47:25 +0800 Subject: [PATCH 01/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-push-python-pg.yml | 3 +-- .github/workflows/build-and-push-vector-model.yml | 3 +-- .github/workflows/build-and-push.yml | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-push-python-pg.yml b/.github/workflows/build-and-push-python-pg.yml index fff8265be..cad0c7f9e 100644 --- a/.github/workflows/build-and-push-python-pg.yml +++ b/.github/workflows/build-and-push-python-pg.yml @@ -43,10 +43,9 @@ jobs: DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ --build-arg VERSION=${TAG_NAME} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --build-arg --no-cache --provenance=false \ --build-arg VCS_REF=${GITHUB_SHA::8} \ ${DOCKER_IMAGE_TAGS} . - name: Set up QEMU diff --git a/.github/workflows/build-and-push-vector-model.yml b/.github/workflows/build-and-push-vector-model.yml index 6dc736bf9..73c3a36af 100644 --- a/.github/workflows/build-and-push-vector-model.yml +++ b/.github/workflows/build-and-push-vector-model.yml @@ -48,10 +48,9 @@ jobs: DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ --build-arg VERSION=${TAG_NAME} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --build-arg --no-cache --provenance=false \ --build-arg VCS_REF=${GITHUB_SHA::8} \ ${DOCKER_IMAGE_TAGS} . - name: Set up QEMU diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index dcff2a1fa..c2ab4d146 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -48,10 +48,9 @@ jobs: DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ --build-arg VERSION=${TAG_NAME} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --build-arg --no-cache \ --build-arg VCS_REF=${GITHUB_SHA::8} \ ${DOCKER_IMAGE_TAGS} . - name: Set up QEMU @@ -106,10 +105,9 @@ jobs: DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ --build-arg VERSION=${TAG_NAME} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --build-arg --no-cache --provenance=false \ --build-arg VCS_REF=${GITHUB_SHA::8} \ ${DOCKER_IMAGE_TAGS} . - name: Set up QEMU From 6a5f7a85935d8a8472615f083dd7591afbb78029 Mon Sep 17 00:00:00 2001 From: baixin <52996290+baixin513@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:48:39 +0800 Subject: [PATCH 02/27] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新 Readme 添加 logo --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c14b7a81..e048003ff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -

+ +

MaxKB

基于大语言模型的知识库问答系统

License: GPL v3 From 99c328177f3eef62a583ba9b5e6c211d6993617d Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:35:25 +0800 Subject: [PATCH 03/27] Update README.md --- README.md | 60 ++++++++++++++++++------------------------------------- 1 file changed, 19 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index e048003ff..767597bf0 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,38 @@ - -

MaxKB

-

基于大语言模型的知识库问答系统

-

- License: GPL v3 - Codacy - Latest release - Stars - +

MaxKB

+

基于 LLM 大语言模型的知识库问答系统

+

+ License: GPL v3 + Codacy + Latest release + Stars


+MaxKB 是一款基于 LLM 大语言模型的知识库问答系统。 -MaxKB( Max Knowlegde Base 的简称)是一款基于大语言模型的知识库问答系统,其核心目标是利用大语言模型对自然语言理解和生成的能力揣摩用户意图,对原始知识点进行汇总、整合,生成更贴切的答案。 - -MaxKB 的产品特性: -- **多模型对接** -MaxKB 支持对接市场上主流的模型供应商,包括百度千帆大模型、 Azure OpenAI 和 Ollama 私有模型平台等。 - -- **开箱即用** -支持一键获取在线文本或直接上传文档,MaxKB 系统自动进行文本拆分、知识向量化;构建应用实现 LLM 问答功能,根据用户提问和知识库内容生成精确回答。 - -- **无缝集成** -MaxKB 应用支持零编码集成到企业第三方系统。 +- **多模型**:支持对接主流的大模型,包括本地私有大模型平台(如 Llama 2)、Azure OpenAI 和 百度千帆大模型 等; +- **开箱即用**:支持直接上传文档、自动爬取在线文档,支持文本自动拆分、向量化,智能问答交互体验好; +- **无缝嵌入**:支持零编码快速嵌入到第三方业务系统。 ## 一键启动 -MaxKB 支持一键启动,仅需执行以下命令: ``` -docker run --name="maxkb" -p 8000:8000 -d ghcr.io/1panel-dev/maxkb +docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb ``` +也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 + ## 整体架构 + ![arch](https://github.com/1Panel-dev/maxkb/assets/52996290/ca786342-8a0a-4921-b847-a96fff9a3e09) -## 实现原理 +## UI 展示 -- 获取本地文档; -- 读取文本; -- 文本分割; -- 文本向量化; -- Query 向量化; -- 向量匹配最相似的 TOP N 个文本; -- 匹配出的文本作为上下文和问题一起添加到 prompt 中; -- 提交给 LLM 做生成回答。 +TBD -![Implementation principle](https://github.com/1Panel-dev/maxkb/assets/52996290/51956c12-1396-4625-8b29-005ac60ca11d) +## 微信交流群 - - -## 社区 - -如果您在使用过程中有任何疑问或建议,欢迎提交 GitHub Issue 或到我们官方论坛进行交流沟通: - -- [论坛](https://bbs.fit2cloud.com/) +TBD ## 技术栈 @@ -61,8 +41,6 @@ docker run --name="maxkb" -p 8000:8000 -d ghcr.io/1panel-dev/maxkb - 中间件:[postgresql](https://www.postgresql.org/) - 基础设施:[Docker](https://www.docker.com/) - - ## License Copyright (c) 2014-2024 飞致云 FIT2CLOUD, All rights reserved. From 9bb6fd81d03e800628efe3a57c11195e0a34f9ff Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:37:54 +0800 Subject: [PATCH 04/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 767597bf0..166be0d30 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ MaxKB 是一款基于 LLM 大语言模型的知识库问答系统。 -- **多模型**:支持对接主流的大模型,包括本地私有大模型平台(如 Llama 2)、Azure OpenAI 和 百度千帆大模型 等; +- **多模型**:支持对接主流的大模型,包括本地私有大模型平台(如 Llama 2)、Azure OpenAI 和百度千帆大模型等; - **开箱即用**:支持直接上传文档、自动爬取在线文档,支持文本自动拆分、向量化,智能问答交互体验好; - **无缝嵌入**:支持零编码快速嵌入到第三方业务系统。 From e40173769a1df3a1968cf8cb878b30f1f0cd0c67 Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:38:23 +0800 Subject: [PATCH 05/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 166be0d30..ef80ff21e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ MaxKB 是一款基于 LLM 大语言模型的知识库问答系统。 - **开箱即用**:支持直接上传文档、自动爬取在线文档,支持文本自动拆分、向量化,智能问答交互体验好; - **无缝嵌入**:支持零编码快速嵌入到第三方业务系统。 -## 一键启动 +## 快速开始 ``` docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb From be90fc68f43b7fc6514ccc90bc5264978598557e Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:39:37 +0800 Subject: [PATCH 06/27] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef80ff21e..448798dad 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ TBD ## 技术栈 - 前端:[Vue3.js](https://cn.vuejs.org/)、[Element Plus](https://element-plus.org/zh-CN/)、[TypeScript](https://www.tslang.cn/) -- 后端:[django](https://www.djangoproject.com/)、[langchain](https://www.langchain.com/) -- 中间件:[postgresql](https://www.postgresql.org/) +- 后端:[Django](https://www.djangoproject.com/)、[Langchain](https://www.langchain.com/) +- 中间件:[PostgreSQL](https://www.postgresql.org/) - 基础设施:[Docker](https://www.docker.com/) ## License From 8663cc148a5de500e28581197dae45c6edceabf8 Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:40:48 +0800 Subject: [PATCH 07/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 448798dad..9ae1e92c6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ MaxKB 是一款基于 LLM 大语言模型的知识库问答系统。 -- **多模型**:支持对接主流的大模型,包括本地私有大模型平台(如 Llama 2)、Azure OpenAI 和百度千帆大模型等; +- **多模型**:支持对接主流的大模型,包括本地私有大模型(如 Llama 2)、Azure OpenAI 和百度千帆大模型等; - **开箱即用**:支持直接上传文档、自动爬取在线文档,支持文本自动拆分、向量化,智能问答交互体验好; - **无缝嵌入**:支持零编码快速嵌入到第三方业务系统。 From 4025fda709c35f3b2e21903c88fa6ddef53dc464 Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:03:25 +0800 Subject: [PATCH 08/27] Update README.md --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9ae1e92c6..e74d7f148 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,6 @@ docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb 也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 -## 整体架构 - -![arch](https://github.com/1Panel-dev/maxkb/assets/52996290/ca786342-8a0a-4921-b847-a96fff9a3e09) ## UI 展示 @@ -36,10 +33,11 @@ TBD ## 技术栈 -- 前端:[Vue3.js](https://cn.vuejs.org/)、[Element Plus](https://element-plus.org/zh-CN/)、[TypeScript](https://www.tslang.cn/) -- 后端:[Django](https://www.djangoproject.com/)、[Langchain](https://www.langchain.com/) -- 中间件:[PostgreSQL](https://www.postgresql.org/) -- 基础设施:[Docker](https://www.docker.com/) +- 前端:[Vue.js](https://cn.vuejs.org/) +- 后端:[Django](https://www.djangoproject.com/) +- Langchain:[Langchain](https://www.langchain.com/) +- 向量数据库:[PostgreSQL](https://www.postgresql.org/) +- 大模型:Azure OpenAI、百度千帆大模型、[Ollama](https://github.com/ollama/ollama) ## License From aa72ee892bb0d68dcdbbffff77ac1dc387638228 Mon Sep 17 00:00:00 2001 From: wanghe-fit2cloud Date: Tue, 19 Mar 2024 17:21:02 +0800 Subject: [PATCH 09/27] chore: Update .gitignore --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 8a566649a4581cb4a471ce4f0af515ba5613d58d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHM&5ja55Uyr%8G;&OG;%SS#4ABycTJ2JmW9J6>R~Z@P=f=5>$t--;YZvMlDVqy z;4664C-Gf8=~vyeo0$QOr;QuCNO$#g*VonaRWVHuL?oIsw?bhC*woh>jQ{Iyndp$9N;M54F~C z63R2?i9Czwgd(DYhp?47iH6puHVhaBRvF;0OO_lO;WJ5{-}fwi90E~B76iiVN1;J!`l$PUHI|gX+)M&#MYXlM|4OB)TSrYp?1ppbIMx|vpdS;rn%!hY{%A;;w*EVnmJ+Hn@>j3`;qUx zk?&2W)#?wC*~(to&RIFDV7=Fe{FnM>T$`_4G;kQ8*xU)QP(*WP{y!+2Xr6!3X0s2iE(V6j*uPu)S}1G6(HQCH8oZ!Z=*du6*`tN$U)AF*u6#xQdlsN0Q)m*X2UN{5=Y+5f?Z z5yQY`WME4#y2R)I_U8Bhm+{ujnhgVnfxl!xWLuq96UMy3uM^(oZIst2ENmBQtstlp hKLl`n{)ZvjHcT1Qh;*nmdLZUSfTF=vhJg!Z;5R+1EgAp- diff --git a/.gitignore b/.gitignore index 7147555f8..8627829c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,18 @@ +# Mac +.DS_Store +*/.DS_Store + +# VS Code +.vscode +*.project +*.factorypath + +# IntelliJ IDEA +.idea +*.iws +*.iml +*.ipr + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -165,4 +180,4 @@ models/ data .idea .dev -poetry.lock \ No newline at end of file +poetry.lock From 9f17657b7cd4f060a3cd062606f424f596c0e910 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 17:31:21 +0800 Subject: [PATCH 10/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/buildkitd.toml | 2 - .../workflows/build-and-push-python-pg.yml | 4 +- .../workflows/build-and-push-vector-model.yml | 4 +- .github/workflows/build-and-push.yml | 77 ++++--------------- 4 files changed, 15 insertions(+), 72 deletions(-) delete mode 100644 .github/buildkitd.toml diff --git a/.github/buildkitd.toml b/.github/buildkitd.toml deleted file mode 100644 index 19615ad72..000000000 --- a/.github/buildkitd.toml +++ /dev/null @@ -1,2 +0,0 @@ -[worker.oci] - max-parallelism=1 \ No newline at end of file diff --git a/.github/workflows/build-and-push-python-pg.yml b/.github/workflows/build-and-push-python-pg.yml index cad0c7f9e..d82ca86bd 100644 --- a/.github/workflows/build-and-push-python-pg.yml +++ b/.github/workflows/build-and-push-python-pg.yml @@ -43,7 +43,7 @@ jobs: DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ --build-arg VERSION=${TAG_NAME} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg VCS_REF=${GITHUB_SHA::8} \ @@ -52,8 +52,6 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - config: .github/buildkitd.toml - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: diff --git a/.github/workflows/build-and-push-vector-model.yml b/.github/workflows/build-and-push-vector-model.yml index 73c3a36af..1e8556461 100644 --- a/.github/workflows/build-and-push-vector-model.yml +++ b/.github/workflows/build-and-push-vector-model.yml @@ -48,7 +48,7 @@ jobs: DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ --build-arg VERSION=${TAG_NAME} \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg VCS_REF=${GITHUB_SHA::8} \ @@ -57,8 +57,6 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - config: .github/buildkitd.toml - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index c2ab4d146..c14fb3c72 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -18,7 +18,7 @@ on: - linux/amd64,linux/arm64 jobs: - build-and-push-fit2cloud-registry: + build-and-push: runs-on: ubuntu-latest steps: - name: Check Disk Space @@ -42,86 +42,35 @@ jobs: - name: Prepare id: prepare run: | - DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb + DOCKER_IMAGE_FIT2CLOUD=registry-hkproxy.fit2cloud.com/maxkb/maxkb + DOCKER_IMAGE_DOCKERHUB=1panel/maxkb DOCKER_PLATFORMS=${{ github.event.inputs.architecture }} TAG_NAME=${{ github.event.inputs.dockerImageTag }} - DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" - echo ::set-output name=docker_image::${DOCKER_IMAGE} + DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE_FIT2CLOUD}:${TAG_NAME} --tag ${DOCKER_IMAGE_FIT2CLOUD}:latest --tag ${DOCKER_IMAGE_DOCKERHUB}:${TAG_NAME} --tag ${DOCKER_IMAGE_DOCKERHUB}:latest" echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ - --build-arg VERSION=${TAG_NAME} \ - --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --build-arg VCS_REF=${GITHUB_SHA::8} \ + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ ${DOCKER_IMAGE_TAGS} . - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - config: .github/buildkitd.toml + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GH_TOKEN }} - name: Login to FIT2CLOUD Registry uses: docker/login-action@v3 with: registry: registry-hkproxy.fit2cloud.com username: ${{ secrets.FIT2CLOUD_REGISTRY_USERNAME }} password: ${{ secrets.FIT2CLOUD_REGISTRY_PASSWORD }} - - name: Login to GitHub Container Registry + - name: Login to Docker Hub uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GH_TOKEN }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Docker Buildx (build-and-push) run: | docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile - - build-and-push-to-ghcr: - runs-on: ubuntu-latest - steps: - - name: Check Disk Space - run: df -h - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: true - - name: Check Disk Space - run: df -h - - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - - name: Prepare - id: prepare - run: | - DOCKER_IMAGE=ghcr.io/1panel-dev/maxkb - DOCKER_PLATFORMS=${{ github.event.inputs.architecture }} - TAG_NAME=${{ github.event.inputs.dockerImageTag }} - DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" - echo ::set-output name=docker_image::${DOCKER_IMAGE} - echo ::set-output name=version::${TAG_NAME} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache --provenance=false \ - --build-arg VERSION=${TAG_NAME} \ - --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --build-arg VCS_REF=${GITHUB_SHA::8} \ - ${DOCKER_IMAGE_TAGS} . - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - config: .github/buildkitd.toml - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GH_TOKEN }} - - name: Docker Buildx (build-and-push) - run: | - docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile \ No newline at end of file From 6bd42a47ebc275fc9f86c836cd7aa166266fc3ec Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 17:56:11 +0800 Subject: [PATCH 11/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index c14fb3c72..6b5c2758d 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -10,7 +10,7 @@ on: architecture: description: 'Architecture' required: true - default: 'linux/amd64' + default: 'linux/amd64,linux/arm64' type: choice options: - linux/amd64 From c681a276071fee3498781e447b0c664a2c7b3f25 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 18:14:17 +0800 Subject: [PATCH 12/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 6b5c2758d..7614f99bd 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -5,12 +5,12 @@ on: inputs: dockerImageTag: description: 'Docker Image Tag' - default: 'v1.0.0' + default: 'v1.0.0-dev' required: true architecture: description: 'Architecture' required: true - default: 'linux/amd64,linux/arm64' + default: 'linux/amd64' type: choice options: - linux/amd64 From 6228b77c23356418c0e91023380ae3a1b92e063b Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Tue, 19 Mar 2024 18:47:57 +0800 Subject: [PATCH 13/27] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index e74d7f148..810faf196 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,6 @@ docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb TBD -## 微信交流群 - -TBD ## 技术栈 From b63116eee6e03fac22aa197d10c72abe3e8df72a Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 18:52:42 +0800 Subject: [PATCH 14/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 1 + installer/Dockerfile | 30 +++++++++++------------------- 2 files changed, 12 insertions(+), 19 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..92c02acca --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git* \ No newline at end of file diff --git a/installer/Dockerfile b/installer/Dockerfile index ac81d8aeb..3d8c1d3d0 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -13,28 +13,20 @@ RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/ # 拷贝项目 COPY . /opt/maxkb/app COPY installer/config.yaml /opt/maxkb/conf -ENV POSTGRES_USER root -ENV POSTGRES_PASSWORD Password123@postgres -RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build COPY --from=vector-model model /opt/maxkb/app/model COPY --from=web-build ui /opt/maxkb/app/ui -RUN ls -la /opt/maxkb/app -# 复制模型 -RUN mv /opt/maxkb/app/model/* /opt/maxkb/model -RUN ls /opt/maxkb/model -RUN cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer -# 设置工作目录 +ENV POSTGRES_USER root +ENV POSTGRES_PASSWORD Password123@postgres WORKDIR /opt/maxkb/app -# 更新apt-get包管理器 -RUN apt-get update&&apt-get install -y curl -# 更新pip -RUN pip3 install --upgrade pip -# 安装 poetry包管理器 -RUN pip3 install poetry -# 导出依赖 -RUN poetry export -f requirements.txt --output requirements.txt --without-hashes -# 下载python依赖 -RUN pip3 install --no-cache-dir -r requirements.txt +RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build && \ + mv /opt/maxkb/app/model/* /opt/maxkb/model && \ + cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \ + apt-get install -y curl && \ + pip3 install --upgrade pip && \ + pip3 install poetry && \ + poetry export -f requirements.txt --output requirements.txt --without-hashes && \ + pip3 install --no-cache-dir -r requirements.txt && \ + rm -rf /var/lib/apt/lists/* # 启动命令 VOLUME /opt/maxkb/conf EXPOSE 8000 From 2578d753016b151f7edef59d8a19572d953576dd Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 18:59:30 +0800 Subject: [PATCH 15/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/Dockerfile b/installer/Dockerfile index 3d8c1d3d0..0a3b0245c 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -14,12 +14,12 @@ RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/ COPY . /opt/maxkb/app COPY installer/config.yaml /opt/maxkb/conf COPY --from=vector-model model /opt/maxkb/app/model +RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build COPY --from=web-build ui /opt/maxkb/app/ui ENV POSTGRES_USER root ENV POSTGRES_PASSWORD Password123@postgres WORKDIR /opt/maxkb/app -RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build && \ - mv /opt/maxkb/app/model/* /opt/maxkb/model && \ +RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \ cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \ apt-get install -y curl && \ pip3 install --upgrade pip && \ From 489ea64e2015e0b156eac3aacfa3212103db97b8 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 19:07:40 +0800 Subject: [PATCH 16/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/Dockerfile b/installer/Dockerfile index 0a3b0245c..5b42803b3 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -21,7 +21,7 @@ ENV POSTGRES_PASSWORD Password123@postgres WORKDIR /opt/maxkb/app RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \ cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \ - apt-get install -y curl && \ + apt-get update && apt-get install -y curl && \ pip3 install --upgrade pip && \ pip3 install poetry && \ poetry export -f requirements.txt --output requirements.txt --without-hashes && \ From b50689f529448d485804d538ad77f01c91f41e0e Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 19:32:41 +0800 Subject: [PATCH 17/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 3 ++- installer/Dockerfile | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 92c02acca..1463db15b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ -.git* \ No newline at end of file +.git* +ui \ No newline at end of file diff --git a/installer/Dockerfile b/installer/Dockerfile index 5b42803b3..39b1f304e 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -4,28 +4,28 @@ FROM node:18-alpine3.18 as web-build COPY ui ui RUN cd ui && \ npm install && \ - npm run build && \ - rm -rf ./node_modules + npm run build FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3 # 创建工作目录 -RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf +RUN mkdir -p /opt/maxkb/app && /opt/maxkb/app/ui && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf # 拷贝项目 COPY . /opt/maxkb/app COPY installer/config.yaml /opt/maxkb/conf COPY --from=vector-model model /opt/maxkb/app/model -RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build -COPY --from=web-build ui /opt/maxkb/app/ui +COPY --from=web-build ui/dist /opt/maxkb/app/ui ENV POSTGRES_USER root ENV POSTGRES_PASSWORD Password123@postgres WORKDIR /opt/maxkb/app -RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \ +RUN rm -rf /opt/maxkb/app/build && \ + mv /opt/maxkb/app/model/* /opt/maxkb/model && \ cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \ apt-get update && apt-get install -y curl && \ pip3 install --upgrade pip && \ pip3 install poetry && \ poetry export -f requirements.txt --output requirements.txt --without-hashes && \ pip3 install --no-cache-dir -r requirements.txt && \ + pip3 cache purge && \ rm -rf /var/lib/apt/lists/* # 启动命令 VOLUME /opt/maxkb/conf From 0e4256b61887f55d2d20965a3ef7e148e0511a92 Mon Sep 17 00:00:00 2001 From: baixin <52996290+baixin513@users.noreply.github.com> Date: Tue, 19 Mar 2024 19:34:24 +0800 Subject: [PATCH 18/27] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新 Readme 文档 增加 UI 展示图片 --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 810faf196..78b6fcc0e 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,22 @@ docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb 也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 -## UI 展示 -TBD +## UI 展示 + + + + + + + + + +
Demo1Demo2
Demo3Demo4
+ +## 社区交流 + +[论坛](https://bbs.fit2cloud.com/c/mk/11) ## 技术栈 From a935021f131eaf0018f66caee0fb3f1fb37698bb Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 19:53:47 +0800 Subject: [PATCH 19/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 3 +- .github/workflows/build-and-push.yml | 71 ++++++++++++++++++++++++++-- installer/Dockerfile | 6 +-- 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/.dockerignore b/.dockerignore index 1463db15b..92c02acca 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1 @@ -.git* -ui \ No newline at end of file +.git* \ No newline at end of file diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 7614f99bd..39e8d8ddd 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -16,9 +16,19 @@ on: - linux/amd64 - linux/arm64 - linux/amd64,linux/arm64 + registry: + description: 'Push To Registry' + required: true + default: 'dockerhub, fit2cloud-registry' + type: choice + options: + - dockerhub + - fit2cloud-registry + - dockerhub, fit2cloud-registry jobs: - build-and-push: + build-and-push-to-fit2cloud-registry: + if: contains(${{ github.event.inputs.registry }}, 'fit2cloud') runs-on: ubuntu-latest steps: - name: Check Disk Space @@ -42,12 +52,14 @@ jobs: - name: Prepare id: prepare run: | - DOCKER_IMAGE_FIT2CLOUD=registry-hkproxy.fit2cloud.com/maxkb/maxkb - DOCKER_IMAGE_DOCKERHUB=1panel/maxkb + DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb DOCKER_PLATFORMS=${{ github.event.inputs.architecture }} TAG_NAME=${{ github.event.inputs.dockerImageTag }} - DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE_FIT2CLOUD}:${TAG_NAME} --tag ${DOCKER_IMAGE_FIT2CLOUD}:latest --tag ${DOCKER_IMAGE_DOCKERHUB}:${TAG_NAME} --tag ${DOCKER_IMAGE_DOCKERHUB}:latest" - echo ::set-output name=version::${TAG_NAME} + if [[ TAG_NAME == *dev* ]]; then + DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}" + else + DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" + fi echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ ${DOCKER_IMAGE_TAGS} . - name: Set up QEMU @@ -66,6 +78,55 @@ jobs: registry: registry-hkproxy.fit2cloud.com username: ${{ secrets.FIT2CLOUD_REGISTRY_USERNAME }} password: ${{ secrets.FIT2CLOUD_REGISTRY_PASSWORD }} + - name: Docker Buildx (build-and-push) + run: | + docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile + + build-and-push-to-dockerhub: + if: contains(${{ github.event.inputs.registry }}, 'dockerhub') + runs-on: ubuntu-latest + steps: + - name: Check Disk Space + run: df -h + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + - name: Check Disk Space + run: df -h + - name: Checkout + uses: actions/checkout@v4 + with: + ref: main + - name: Prepare + id: prepare + run: | + DOCKER_IMAGE=1panel/maxkb + DOCKER_PLATFORMS=${{ github.event.inputs.architecture }} + TAG_NAME=${{ github.event.inputs.dockerImageTag }} + if [[ TAG_NAME == *dev* ]]; then + DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}" + else + DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" + fi + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ + ${DOCKER_IMAGE_TAGS} . + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GH_TOKEN }} - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/installer/Dockerfile b/installer/Dockerfile index 39b1f304e..50dff3c1a 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -8,17 +8,17 @@ RUN cd ui && \ FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3 # 创建工作目录 -RUN mkdir -p /opt/maxkb/app && /opt/maxkb/app/ui && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf +RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf # 拷贝项目 COPY . /opt/maxkb/app +RUN rm -rf /opt/maxkb/app/ui/* COPY installer/config.yaml /opt/maxkb/conf COPY --from=vector-model model /opt/maxkb/app/model COPY --from=web-build ui/dist /opt/maxkb/app/ui ENV POSTGRES_USER root ENV POSTGRES_PASSWORD Password123@postgres WORKDIR /opt/maxkb/app -RUN rm -rf /opt/maxkb/app/build && \ - mv /opt/maxkb/app/model/* /opt/maxkb/model && \ +RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \ cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \ apt-get update && apt-get install -y curl && \ pip3 install --upgrade pip && \ From 02d2e1b0dc1c72b1829d962c3cb64b6122c43d48 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Tue, 19 Mar 2024 19:54:15 +0800 Subject: [PATCH 20/27] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A7=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 4 ++-- ui/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cf26ea8fc..cd9fea832 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.11" -django = "4.1.10" +django = "4.1.13" djangorestframework = "3.14.0" drf-yasg = "1.21.7" django-filter = "23.2" @@ -16,7 +16,7 @@ langchain = "^0.1.11" psycopg2-binary = "2.9.7" jieba = "^0.42.1" diskcache = "^5.6.3" -pillow = "9.5.0" +pillow = "^10.2.0" filetype = "^1.2.0" chardet = "^5.2.0" sentence-transformers = "^2.2.2" diff --git a/ui/package.json b/ui/package.json index ca9174f91..742ff4658 100644 --- a/ui/package.json +++ b/ui/package.json @@ -13,7 +13,7 @@ "format": "prettier --write src/" }, "dependencies": { - "axios": "^0.27.2", + "axios": "^0.28.0", "element-plus": "^2.5.6", "install": "^0.13.0", "lodash": "^4.17.21", From 6c412c7bb0ca57d6d8794354335503ddd6ce2dd0 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Tue, 19 Mar 2024 19:59:54 +0800 Subject: [PATCH 21/27] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=AB=AF=E5=8F=A3=E4=B8=BA8080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- installer/Dockerfile | 2 +- main.py | 2 +- ui/vite.config.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 78b6fcc0e..7beb3c9d2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ MaxKB 是一款基于 LLM 大语言模型的知识库问答系统。 ## 快速开始 ``` -docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb +docker run -d --name=maxkb -p 8080:8080 ghcr.io/1panel-dev/maxkb ``` 也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 diff --git a/installer/Dockerfile b/installer/Dockerfile index 50dff3c1a..f367d3bfb 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -29,7 +29,7 @@ RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \ rm -rf /var/lib/apt/lists/* # 启动命令 VOLUME /opt/maxkb/conf -EXPOSE 8000 +EXPOSE 8080 COPY installer/run-maxkb.sh /usr/bin/ RUN chmod 755 /usr/bin/run-maxkb.sh ENTRYPOINT ["bash", "-c"] diff --git a/main.py b/main.py index 6f7480807..f925b09f8 100644 --- a/main.py +++ b/main.py @@ -44,7 +44,7 @@ def perform_db_migrate(): def start_services(): management.call_command('migrate') - management.call_command('runserver', "0.0.0.0:8000") + management.call_command('runserver', "0.0.0.0:8080") if __name__ == '__main__': diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 36a2935ab..d7ac2ac19 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -11,7 +11,7 @@ export default defineConfig(({ mode }) => { const ENV = loadEnv(mode, envDir) const proxyConf: Record = {} proxyConf['/api'] = { - target: 'http://127.0.0.1:8000', + target: 'http://127.0.0.1:8080', changeOrigin: true, rewrite: (path) => path.replace(ENV.VITE_BASE_PATH, '/') } From 4307177b0a38a326fe314ffa943667d7a02836f1 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 20:00:08 +0800 Subject: [PATCH 22/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 39e8d8ddd..dc775843e 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -28,7 +28,7 @@ on: jobs: build-and-push-to-fit2cloud-registry: - if: contains(${{ github.event.inputs.registry }}, 'fit2cloud') + if: ${{ contains(github.event.inputs.registry, 'fit2cloud') }} runs-on: ubuntu-latest steps: - name: Check Disk Space @@ -55,7 +55,7 @@ jobs: DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb DOCKER_PLATFORMS=${{ github.event.inputs.architecture }} TAG_NAME=${{ github.event.inputs.dockerImageTag }} - if [[ TAG_NAME == *dev* ]]; then + if [[ ${TAG_NAME} == *dev* ]]; then DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}" else DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" @@ -83,7 +83,7 @@ jobs: docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile build-and-push-to-dockerhub: - if: contains(${{ github.event.inputs.registry }}, 'dockerhub') + if: ${{ contains(github.event.inputs.registry, 'dockerhub') }} runs-on: ubuntu-latest steps: - name: Check Disk Space @@ -110,7 +110,7 @@ jobs: DOCKER_IMAGE=1panel/maxkb DOCKER_PLATFORMS=${{ github.event.inputs.architecture }} TAG_NAME=${{ github.event.inputs.dockerImageTag }} - if [[ TAG_NAME == *dev* ]]; then + if [[ ${TAG_NAME} == *dev* ]]; then DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}" else DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" From 7536b0cf842c19d12c8d93298e622a5d4da5c94e Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Tue, 19 Mar 2024 20:02:39 +0800 Subject: [PATCH 23/27] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8C=81=E4=B9=85=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7beb3c9d2..60d8a397f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,13 @@ MaxKB 是一款基于 LLM 大语言模型的知识库问答系统。 ``` docker run -d --name=maxkb -p 8080:8080 ghcr.io/1panel-dev/maxkb ``` +## 自定义持久化数据 +- 在主机系统上创建一个存储数据的目录,例如:/opt/maxkb/data +- 在主机系统上创建一个存储配置文件的目录,例如:/opt/maxkb/conf +``` +docker run --name=maxkb -p 8080:8000 -v /opt/maxkb/data:/var/lib/postgresql/data -v /opt/maxkb/conf:/opt/maxkb/conf -d ghcr.io/1panel-dev/maxkb +``` 也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 From 8403ee16bd3c08ea090f9bd409e2ec00a1918823 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 20:07:01 +0800 Subject: [PATCH 24/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-push.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index dc775843e..1fa51471e 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -28,7 +28,7 @@ on: jobs: build-and-push-to-fit2cloud-registry: - if: ${{ contains(github.event.inputs.registry, 'fit2cloud') }} + if: ${{ contains(github.event.inputs.registry, 'fit2cloud') }} runs-on: ubuntu-latest steps: - name: Check Disk Space @@ -83,7 +83,7 @@ jobs: docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile build-and-push-to-dockerhub: - if: ${{ contains(github.event.inputs.registry, 'dockerhub') }} + if: ${{ contains(github.event.inputs.registry, 'dockerhub') }} runs-on: ubuntu-latest steps: - name: Check Disk Space diff --git a/README.md b/README.md index 7beb3c9d2..97a67a794 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ MaxKB 是一款基于 LLM 大语言模型的知识库问答系统。 ## 快速开始 ``` -docker run -d --name=maxkb -p 8080:8080 ghcr.io/1panel-dev/maxkb +docker run -d --name=maxkb -p 8080:8080 1panel/maxkb ``` 也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 From 2228675443c1985de109e3dc48f6b187430cd8f6 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 20:08:04 +0800 Subject: [PATCH 25/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8c102cc8..37904c30f 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ docker run -d --name=maxkb -p 8080:8080 1panel/maxkb - 在主机系统上创建一个存储数据的目录,例如:/opt/maxkb/data - 在主机系统上创建一个存储配置文件的目录,例如:/opt/maxkb/conf ``` -docker run --name=maxkb -p 8080:8000 -v /opt/maxkb/data:/var/lib/postgresql/data -v /opt/maxkb/conf:/opt/maxkb/conf -d ghcr.io/1panel-dev/maxkb +docker run --name=maxkb -p 8080:8000 -v /opt/maxkb/data:/var/lib/postgresql/data -v /opt/maxkb/conf:/opt/maxkb/conf -d 1panel/maxkb ``` 也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 From 9262419cf90ae271d9261b4fcc571cb6f82a4080 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 20:31:21 +0800 Subject: [PATCH 26/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/installer/Dockerfile b/installer/Dockerfile index f367d3bfb..f95a4e814 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -4,17 +4,18 @@ FROM node:18-alpine3.18 as web-build COPY ui ui RUN cd ui && \ npm install && \ - npm run build + npm run build && \ + rm -rf ./node_modules FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3 # 创建工作目录 RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf # 拷贝项目 COPY . /opt/maxkb/app -RUN rm -rf /opt/maxkb/app/ui/* +RUN rm -rf /opt/maxkb/app/ui COPY installer/config.yaml /opt/maxkb/conf COPY --from=vector-model model /opt/maxkb/app/model -COPY --from=web-build ui/dist /opt/maxkb/app/ui +COPY --from=web-build ui /opt/maxkb/app/ui ENV POSTGRES_USER root ENV POSTGRES_PASSWORD Password123@postgres WORKDIR /opt/maxkb/app From 948102deef1e2c93ac6c82dfb0f9774d877f1d3f Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 19 Mar 2024 20:38:28 +0800 Subject: [PATCH 27/27] =?UTF-8?q?build:=20=E5=88=86=E5=BC=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 1fa51471e..b1102252e 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -117,6 +117,7 @@ jobs: fi echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ ${DOCKER_IMAGE_TAGS} . + env - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx