Skip to content

Commit 3e277da

Browse files
committed
Merge branch 'release' of github.com:dataelement/bisheng into release
2 parents 0152e5a + cc656c6 commit 3e277da

1,113 files changed

Lines changed: 82247 additions & 64510 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.

.drone.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
4040
- echo $REPO
4141
- REPO2=$(echo $REPO | sed 's/http:\\/\\///g')
4242
- sed '/apt-get/ s|$| '"$PROXY"'|' Dockerfile
43+
- sed -i.bak 's/uv cache clean.*$/ /' Dockerfile
4344
- sed -i '6i\RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
44-
- sed -i '7i\RUN poetry source add --priority=supplemental foo http://'$NEXUS_PUBLIC':'$NEXUS_PUBLIC_PASSWORD'@'$REPO2'simple' Dockerfile
45-
- sed -i '8i\RUN poetry source add --priority=primary qh https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
45+
- sed -i '7i\ENV UV_PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
46+
- sed -i '8i\ENV UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
47+
- sed -i '9i\ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
4648
- cat Dockerfile
4749

4850
- name: build_docker
@@ -56,6 +58,8 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
5658
path: /var/run/docker.sock
5759
- name: pro-cache
5860
path: /root/.local/share/pypoetry
61+
- name: uv-cache
62+
path: /root/.cache/uv
5963
environment:
6064
http_proxy:
6165
from_secret: PROXY
@@ -214,8 +218,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
214218
- REPO2=$(echo $REPO | sed 's/http:\\/\\///g')
215219
- sed '/apt-get/ s|$| '"$PROXY"'|' Dockerfile
216220
- sed -i '6i\RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
217-
- sed -i '7i\RUN poetry source add --priority=supplemental foo http://'$NEXUS_PUBLIC':'$NEXUS_PUBLIC_PASSWORD'@'$REPO2'simple' Dockerfile
218-
- sed -i '8i\RUN poetry source add --priority=primary qh https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
221+
- sed -i '7i\RUN export UV_PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
219222
- cat Dockerfile
220223

221224
- name: build_docker

.github/workflows/base_ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515

1616
jobs:
1717
build_bisheng_arm:
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-22.04-arm
1919
# if: startsWith(github.event.ref, 'refs/tags')
2020
steps:
2121
- name: checkout
@@ -38,13 +38,15 @@ jobs:
3838
# DOCKERHUB_TOKEN: docker hub => Account Setting => Security 创建.
3939
username: ${{ secrets.DOCKERHUB_USERNAME }}
4040
password: ${{ secrets.DOCKERHUB_TOKEN }}
41-
42-
# 构建 backend 并推送到 Docker hub
43-
- name: Set up QEMU
44-
uses: docker/setup-qemu-action@v1
4541

4642
- name: set up Docker Buildx
4743
uses: docker/setup-buildx-action@v3
44+
45+
# because ibm-db driver not support linux arm64
46+
- name: fix ibm-db lib error
47+
run: |
48+
# remove ibm-db lib
49+
sed -i '/ibm-db*/d' ./src/backend/pyproject.toml
4850
4951
- name: Build backend arm64 and push
5052
id: docker_build_backend

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ jobs:
8383
- name: set up Docker Buildx
8484
uses: docker/setup-buildx-action@v3
8585

86+
# because ibm-db driver not support linux arm64
87+
- name: fix ibm-db lib error
88+
run: |
89+
# remove ibm-db lib
90+
sed -i '/ibm-db*/d' ./src/backend/pyproject.toml
91+
8692
- name: Build backend and push
8793
id: docker_build_backend
8894
run: |

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,6 @@ sftp-config.json
264264
# Docker local files
265265
docker/data/*
266266
docker/mysql/data/*
267-
docker/office/bisheng/*.gz
267+
docker/office/bisheng/*.gz
268+
269+
CLAUDE.md

docker/docker-compose-ft.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
services:
22
ft_server:
33
container_name: bisheng-ft-server
4-
image: dataelement/bisheng-ft:v0.2.0
4+
image: dataelement/bisheng-ft:v0.5.0
5+
shm_size: "4g"
56
ports:
67
- "8000:8000"
78
environment:

docker/docker-compose-office.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
services:
2+
office:
3+
container_name: bisheng-office
4+
image: onlyoffice/documentserver:7.1.1
5+
ports:
6+
- "8701:80"
7+
environment:
8+
TZ: Asia/Shanghai
9+
JWT_ENABLED: "false"
10+
volumes:
11+
- ${DOCKER_VOLUME_DIRECTORY:-.}/office/bisheng:/var/www/onlyoffice/documentserver/sdkjs-plugins/bisheng
12+
command: bash -c "supervisorctl restart all"
13+
restart: on-failure
14+

docker/docker-compose.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,9 @@ services:
3838
retries: 3
3939
restart: on-failure
4040

41-
office:
42-
container_name: bisheng-office
43-
image: onlyoffice/documentserver:7.1.1
44-
ports:
45-
- "8701:80"
46-
environment:
47-
TZ: Asia/Shanghai
48-
JWT_ENABLED: "false"
49-
volumes:
50-
- ${DOCKER_VOLUME_DIRECTORY:-.}/office/bisheng:/var/www/onlyoffice/documentserver/sdkjs-plugins/bisheng
51-
command: bash -c "supervisorctl restart all"
52-
restart: on-failure
53-
5441
backend:
5542
container_name: bisheng-backend
56-
image: dataelement/bisheng-backend:v2.0.3
43+
image: dataelement/bisheng-backend:v2.2.0
5744
ports:
5845
- "7860:7860"
5946
environment:
@@ -88,12 +75,10 @@ services:
8875
condition: service_healthy
8976
redis:
9077
condition: service_healthy
91-
office:
92-
condition: service_started
9378

9479
backend_worker:
9580
container_name: bisheng-backend-worker
96-
image: dataelement/bisheng-backend:v2.0.3
81+
image: dataelement/bisheng-backend:v2.2.0
9782
environment:
9883
TZ: Asia/Shanghai
9984
BS_MILVUS_CONNECTION_ARGS: '{"host":"milvus","port":"19530","user":"","password":"","secure":false}'
@@ -120,12 +105,11 @@ services:
120105
condition: service_healthy
121106
redis:
122107
condition: service_healthy
123-
office:
124-
condition: service_started
108+
125109

126110
frontend:
127111
container_name: bisheng-frontend
128-
image: dataelement/bisheng-frontend:v2.0.3
112+
image: dataelement/bisheng-frontend:v2.2.0
129113
ports:
130114
- "3001:3001"
131115
environment:
@@ -139,7 +123,7 @@ services:
139123

140124
elasticsearch:
141125
container_name: bisheng-es
142-
image: docker.io/bitnami/elasticsearch:8.12.0
126+
image: docker.io/bitnamilegacy/elasticsearch:8.12.0
143127
user: root
144128
ports:
145129
- "9200:9200"

docker/nginx/conf.d/default.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,25 @@ server {
2121
location / {
2222
root /usr/share/nginx/html/platform;
2323
index index.html index.htm;
24+
# 禁止浏览器缓存 index.html
25+
location = /index.html {
26+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate" always;
27+
add_header Pragma "no-cache" always;
28+
add_header Expires 0 always;
29+
}
2430
try_files $uri $uri/ /index.html =404;
2531
add_header X-Frame-Options SAMEORIGIN;
2632
}
2733

2834
location /workspace/ {
2935
alias /usr/share/nginx/html/client/;
3036
index index.html index.htm;
37+
# 禁止浏览器缓存 /workspace/index.html
38+
location = /workspace/index.html {
39+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate" always;
40+
add_header Pragma "no-cache" always;
41+
add_header Expires 0 always;
42+
}
3143
try_files $uri $uri/ /workspace/index.html;
3244
}
3345

src/backend/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
FROM dataelement/bisheng-backend:base.v4
1+
FROM dataelement/bisheng-backend:base.v8
22

33
WORKDIR /app
44

55
COPY ./ ./
66

7-
RUN poetry config virtualenvs.create false
8-
RUN poetry update --without dev
7+
# 生成并安装依赖
8+
RUN uv pip compile pyproject.toml --upgrade --output-file requirements.txt && \
9+
uv pip install -r requirements.txt --system --no-cache-dir && \
10+
uv cache clean && \
11+
rm -f requirements.txt
12+
913

1014
# patch langchain-openai lib. remove this when langchain-openai support reasoning_content
1115
RUN patch -p1 < /app/bisheng/patches/langchain_openai.patch /usr/local/lib/python3.10/site-packages/langchain_openai/chat_models/base.py

src/backend/alembic.ini

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# A generic, single database configuration.
2+
3+
[alembic]
4+
# path to migration scripts.
5+
# this is typically a path given in POSIX (e.g. forward slashes)
6+
# format, relative to the token %(here)s which refers to the location of this
7+
# ini file
8+
script_location = ./bisheng/core/database/alembic
9+
10+
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
11+
# Uncomment the line below if you want the files to be prepended with date and time
12+
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
13+
# for all available tokens
14+
file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
15+
16+
# sys.path path, will be prepended to sys.path if present.
17+
# defaults to the current working directory. for multiple paths, the path separator
18+
# is defined by "path_separator" below.
19+
prepend_sys_path = .
20+
21+
22+
# timezone to use when rendering the date within the migration file
23+
# as well as the filename.
24+
# If specified, requires the tzdata library which can be installed by adding
25+
# `alembic[tz]` to the pip requirements.
26+
# string value is passed to ZoneInfo()
27+
# leave blank for localtime
28+
# timezone =
29+
30+
# max length of characters to apply to the "slug" field
31+
# truncate_slug_length = 40
32+
33+
# set to 'true' to run the environment during
34+
# the 'revision' command, regardless of autogenerate
35+
# revision_environment = false
36+
37+
# set to 'true' to allow .pyc and .pyo files without
38+
# a source .py file to be detected as revisions in the
39+
# versions/ directory
40+
# sourceless = false
41+
42+
# version location specification; This defaults
43+
# to <script_location>/versions. When using multiple version
44+
# directories, initial revisions must be specified with --version-path.
45+
# The path separator used here should be the separator specified by "path_separator"
46+
# below.
47+
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
48+
49+
# path_separator; This indicates what character is used to split lists of file
50+
# paths, including version_locations and prepend_sys_path within configparser
51+
# files such as alembic.ini.
52+
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
53+
# to provide os-dependent path splitting.
54+
#
55+
# Note that in order to support legacy alembic.ini files, this default does NOT
56+
# take place if path_separator is not present in alembic.ini. If this
57+
# option is omitted entirely, fallback logic is as follows:
58+
#
59+
# 1. Parsing of the version_locations option falls back to using the legacy
60+
# "version_path_separator" key, which if absent then falls back to the legacy
61+
# behavior of splitting on spaces and/or commas.
62+
# 2. Parsing of the prepend_sys_path option falls back to the legacy
63+
# behavior of splitting on spaces, commas, or colons.
64+
#
65+
# Valid values for path_separator are:
66+
#
67+
# path_separator = :
68+
# path_separator = ;
69+
# path_separator = space
70+
# path_separator = newline
71+
#
72+
# Use os.pathsep. Default configuration used for new projects.
73+
path_separator = os
74+
75+
# set to 'true' to search source files recursively
76+
# in each "version_locations" directory
77+
# new in Alembic version 1.10
78+
# recursive_version_locations = false
79+
80+
# the output encoding used when revision files
81+
# are written from script.py.mako
82+
# output_encoding = utf-8
83+
84+
# database URL. This is consumed by the user-maintained env.py script only.
85+
# other means of configuring database URLs may be customized within the env.py
86+
# file.
87+
# sqlalchemy.url =
88+
89+
90+
[post_write_hooks]
91+
# post_write_hooks defines scripts or Python functions that are run
92+
# on newly generated revision scripts. See the documentation for further
93+
# detail and examples
94+
95+
# format using "black" - use the console_scripts runner, against the "black" entrypoint
96+
# hooks = black
97+
# black.type = console_scripts
98+
# black.entrypoint = black
99+
# black.options = -l 79 REVISION_SCRIPT_FILENAME
100+
101+
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
102+
# hooks = ruff
103+
# ruff.type = module
104+
# ruff.module = ruff
105+
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
106+
107+
# Alternatively, use the exec runner to execute a binary found on your PATH
108+
# hooks = ruff
109+
# ruff.type = exec
110+
# ruff.executable = ruff
111+
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
112+
113+
# Logging configuration. This is also consumed by the user-maintained
114+
# env.py script only.
115+
[loggers]
116+
keys = root,sqlalchemy,alembic
117+
118+
[handlers]
119+
keys = console
120+
121+
[formatters]
122+
keys = generic
123+
124+
[logger_root]
125+
level = WARNING
126+
handlers = console
127+
qualname =
128+
129+
[logger_sqlalchemy]
130+
level = WARNING
131+
handlers =
132+
qualname = sqlalchemy.engine
133+
134+
[logger_alembic]
135+
level = INFO
136+
handlers =
137+
qualname = alembic
138+
139+
[handler_console]
140+
class = StreamHandler
141+
args = (sys.stderr,)
142+
level = NOTSET
143+
formatter = generic
144+
145+
[formatter_generic]
146+
format = %(levelname)-5.5s [%(name)s] %(message)s
147+
datefmt = %H:%M:%S

0 commit comments

Comments
 (0)